[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.17 and 1.24

version 1.17, 2002/02/16 21:27:44 version 1.24, 2005/08/09 12:32:58
Line 12 
Line 12 
  * 2. Redistributions in binary form must reproduce the above copyright   * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the   *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.   *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software   * 3. Neither the name of the University nor the names of its contributors
  *    must display the following acknowledgement:  
  *      This product includes software developed by the University of  
  *      California, Berkeley and its contributors.  
  * 4. Neither the name of the University nor the names of its contributors  
  *    may be used to endorse or promote products derived from this software   *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.   *    without specific prior written permission.
  *   *
Line 43 
Line 39 
 #if 0  #if 0
 static const char sccsid[] = "@(#)calendar.c  8.3 (Berkeley) 3/25/94";  static const char sccsid[] = "@(#)calendar.c  8.3 (Berkeley) 3/25/94";
 #else  #else
 static char rcsid[] = "$OpenBSD$";  static const char rcsid[] = "$OpenBSD$";
 #endif  #endif
 #endif /* not lint */  #endif /* not lint */
   
Line 77 
Line 73 
   
 int f_dayAfter = 0; /* days after current date */  int f_dayAfter = 0; /* days after current date */
 int f_dayBefore = 0; /* days before current date */  int f_dayBefore = 0; /* days before current date */
   int f_SetdayAfter = 0; /* calendar invoked with -A */
   
 struct specialev spev[NUMEV];  struct specialev spev[NUMEV];
   
 void childsig(int);  void childsig(int);
   
 int  int
 main(argc, argv)  main(int argc, char *argv[])
         int argc;  
         char *argv[];  
 {  {
         int ch;          int ch;
         char *caldir;          char *caldir;
   
         (void)setlocale(LC_ALL, "");          (void)setlocale(LC_ALL, "");
   
         while ((ch = getopt(argc, argv, "-abf:t:A:B:")) != -1)          while ((ch = getopt(argc, argv, "abf:t:A:B:-")) != -1)
                 switch (ch) {                  switch (ch) {
                 case '-':               /* backward contemptible */                  case '-':               /* backward contemptible */
                 case 'a':                  case 'a':
Line 116 
Line 111 
   
                 case 'A': /* days after current date */                  case 'A': /* days after current date */
                         f_dayAfter = atoi(optarg);                          f_dayAfter = atoi(optarg);
                           f_SetdayAfter = 1;
                         break;                          break;
   
                 case 'B': /* days before current date */                  case 'B': /* days before current date */
Line 190 
Line 186 
                                 (void)setlocale(LC_ALL, "");                                  (void)setlocale(LC_ALL, "");
                                 if (setusercontext(NULL, pw, pw->pw_uid,                                  if (setusercontext(NULL, pw, pw->pw_uid,
                                     LOGIN_SETALL ^ LOGIN_SETLOGIN))                                      LOGIN_SETALL ^ LOGIN_SETLOGIN))
                                         err(1, "unable to set user context (uid %d)",                                          err(1, "unable to set user context (uid %u)",
                                             (int)pw->pw_uid);                                              pw->pw_uid);
                                 if (acstat) {                                  if (acstat) {
                                         if (chdir(pw->pw_dir) ||                                          if (chdir(pw->pw_dir) ||
                                             stat(calendarFile, &sbuf) != 0 ||                                              stat(calendarFile, &sbuf) != 0 ||
Line 233 
Line 229 
                                  * if there's only a zombie now.                                   * if there's only a zombie now.
                                  */                                   */
                                 (void)kill(kid, SIGTERM);                                  (void)kill(kid, SIGTERM);
                                 warnx("uid %d did not finish in time", (int)pw->pw_uid);                                  warnx("uid %u did not finish in time", pw->pw_uid);
                         }                          }
                         if (time(NULL) - t >= SECSPERDAY)                          if (time(NULL) - t >= SECSPERDAY)
                                 errx(2, "'calendar -a' took more than a day; stopped at uid %d",                                  errx(2, "'calendar -a' took more than a day; stopped at uid %u",
                                     (int)pw->pw_uid);                                      pw->pw_uid);
                 }                  }
                 for (;;) {                  for (;;) {
                         deadkid = waitpid(-1, &kidstat, WNOHANG);                          deadkid = waitpid(-1, &kidstat, WNOHANG);
Line 260 
Line 256 
   
   
 void  void
 usage()  usage(void)
 {  {
         (void)fprintf(stderr,          (void)fprintf(stderr,
             "usage: calendar [-a] [-A num] [-b] [-B num] [-t [[[cc]yy][mm]]dd] "              "usage: calendar [-ab] [-A num] [-B num] [-f calendarfile] "
             "[-f calendarfile]\n");              "[-t [[[cc]yy][mm]]dd]\n");
         exit(1);          exit(1);
 }  }
   
   
 void  void
 childsig(sig)  childsig(int signo)
         int sig;  
 {  {
 }  }

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.24