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

Diff for /src/usr.bin/calendar/io.c between version 1.19 and 1.22

version 1.19, 2001/11/19 19:02:13 version 1.22, 2003/03/13 09:09:29
Line 82 
Line 82 
   
   
 void  void
 cal()  cal(void)
 {  {
         int printing;          int printing;
         char *p;          char *p;
Line 178 
Line 178 
                                         if (m->bodun && prefix) {                                          if (m->bodun && prefix) {
                                                 int l1 = strlen(prefix);                                                  int l1 = strlen(prefix);
                                                 int l2 = strlen(p);                                                  int l2 = strlen(p);
                                                   int len = l1 + l2 + 2;
                                                 if ((cur_evt->ldesc =                                                  if ((cur_evt->ldesc =
                                                     malloc(l1 + l2)) == NULL)                                                      malloc(len)) == NULL)
                                                         err(1, "malloc");                                                          err(1, "malloc");
                                                 sprintf(cur_evt->ldesc,                                                  snprintf(cur_evt->ldesc, len,
                                                     "\t%s %s", prefix, p + 1);                                                      "\t%s %s", prefix, p + 1);
                                         } else if ((cur_evt->ldesc =                                          } else if ((cur_evt->ldesc =
                                             strdup(p)) == NULL)                                              strdup(p)) == NULL)
Line 315 
Line 316 
   
   
 FILE *  FILE *
 opencal()  opencal(void)
 {  {
         int pdes[2];          int pdes[2], fdin;
         int fdin;          struct stat st;
   
         /* open up calendar file as stdin */          /* open up calendar file as stdin */
         if ((fdin = open(calendarFile, O_RDONLY)) == -1) {          if ((fdin = open(calendarFile, O_RDONLY)) == -1 ||
               fstat(fdin, &st) == -1 || !S_ISREG(st.st_mode)) {
                 if (!doall) {                  if (!doall) {
                         char *home = getenv("HOME");                          char *home = getenv("HOME");
                         if (home == NULL || *home == '\0')                          if (home == NULL || *home == '\0')
Line 333 
Line 335 
                                     calendarFile, calendarHome, calendarFile);                                      calendarFile, calendarHome, calendarFile);
                 }                  }
         }          }
   
         if (pipe(pdes) < 0)          if (pipe(pdes) < 0)
                 return (NULL);                  return (NULL);
         switch (vfork()) {          switch (vfork()) {
Line 348 
Line 351 
                         (void)close(pdes[1]);                          (void)close(pdes[1]);
                 }                  }
                 (void)close(pdes[0]);                  (void)close(pdes[0]);
                 /* Set stderr to /dev/null.  Necessary so that cron does not                  /*
                    * Set stderr to /dev/null.  Necessary so that cron does not
                  * wait for cpp to finish if it's running calendar -a.                   * wait for cpp to finish if it's running calendar -a.
                  */                   */
                 if (doall) {                  if (doall) {

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.22