[BACK]Return to calendar.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / calendar

Diff for /src/usr.bin/calendar/calendar.c between version 1.3 and 1.4

version 1.3, 1996/09/16 16:36:04 version 1.4, 1996/12/04 09:06:00
Line 112 
Line 112 
         if (doall)          if (doall)
                 while ((pw = getpwent()) != NULL) {                  while ((pw = getpwent()) != NULL) {
                         (void)setegid(pw->pw_gid);                          (void)setegid(pw->pw_gid);
                           (void)initgroups(pw->pw_name, pw->pw_gid);
                         (void)seteuid(pw->pw_uid);                          (void)seteuid(pw->pw_uid);
                         if (!chdir(pw->pw_dir))                          if (!chdir(pw->pw_dir))
                                 cal();                                  cal();
Line 140 
Line 141 
                 if ((p = strchr(buf, '\n')) != NULL)                  if ((p = strchr(buf, '\n')) != NULL)
                         *p = '\0';                          *p = '\0';
                 else                  else
                         while ((ch = getchar()) != '\n' && ch != EOF);                          while ((ch = getchar()) != '\n' && ch != EOF)
                                   ;
                 if (buf[0] == '\0')                  if (buf[0] == '\0')
                         continue;                          continue;
                 if (buf[0] != '\t')                  if (buf[0] != '\t')
Line 254 
Line 256 
         int val;          int val;
         char *start, savech;          char *start, savech;
   
         for (; !isdigit(*p) && !isalpha(*p) && *p != '*'; ++p);          for (; !isdigit(*p) && !isalpha(*p) && *p != '*'; ++p)
                   ;
         if (*p == '*') {                        /* `*' is current month */          if (*p == '*') {                        /* `*' is current month */
                 *flags |= F_ISMONTH;                  *flags |= F_ISMONTH;
                 *endp = p+1;                  *endp = p+1;
Line 262 
Line 265 
         }          }
         if (isdigit(*p)) {          if (isdigit(*p)) {
                 val = strtol(p, &p, 10);        /* if 0, it's failure */                  val = strtol(p, &p, 10);        /* if 0, it's failure */
                 for (; !isdigit(*p) && !isalpha(*p) && *p != '*'; ++p);                  for (; !isdigit(*p) && !isalpha(*p) && *p != '*'; ++p)
                           ;
                 *endp = p;                  *endp = p;
                 return (val);                  return (val);
         }          }
         for (start = p; isalpha(*++p););          for (start = p; isalpha(*++p);)
                   ;
         savech = *p;          savech = *p;
         *p = '\0';          *p = '\0';
         if ((val = getmonth(start)) != 0)          if ((val = getmonth(start)) != 0)
Line 277 
Line 282 
                 *p = savech;                  *p = savech;
                 return (0);                  return (0);
         }          }
         for (*p = savech; !isdigit(*p) && !isalpha(*p) && *p != '*'; ++p);          for (*p = savech; !isdigit(*p) && !isalpha(*p) && *p != '*'; ++p)
                   ;
         *endp = p;          *endp = p;
         return (val);          return (val);
 }  }
   
 char path[MAXPATHLEN + 1];  char path[MAXPATHLEN];
   
 FILE *  FILE *
 opencal()  opencal()
Line 309 
Line 315 
                         (void)close(pdes[1]);                          (void)close(pdes[1]);
                 }                  }
                 (void)close(pdes[0]);                  (void)close(pdes[0]);
                   (void)setuid(geteuid());
                   (void)setgid(getegid());
                 execl(_PATH_CPP, "cpp", "-P", "-I.", _PATH_INCLUDE, NULL);                  execl(_PATH_CPP, "cpp", "-P", "-I.", _PATH_INCLUDE, NULL);
                 warn("execl: %s", _PATH_CPP);                  warn("execl: %s", _PATH_CPP);
                 _exit(1);                  _exit(1);
Line 357 
Line 365 
                         (void)close(pdes[0]);                          (void)close(pdes[0]);
                 }                  }
                 (void)close(pdes[1]);                  (void)close(pdes[1]);
                   (void)setuid(geteuid());
                   (void)setgid(getegid());
                 execl(_PATH_SENDMAIL, "sendmail", "-i", "-t", "-F",                  execl(_PATH_SENDMAIL, "sendmail", "-i", "-t", "-F",
                     "\"Reminder Service\"", "-f", "root", NULL);                      "\"Reminder Service\"", "-f", "root", NULL);
                 warn("execl: %s", _PATH_SENDMAIL);                  warn("execl: %s", _PATH_SENDMAIL);
Line 373 
Line 383 
         (void)close(pdes[1]);          (void)close(pdes[1]);
 done:   (void)fclose(fp);  done:   (void)fclose(fp);
         (void)unlink(path);          (void)unlink(path);
         while (wait(&status) >= 0);          while (wait(&status) >= 0)
                   ;
 }  }
   
 static char *months[] = {  static char *months[] = {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4