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

Diff for /src/usr.bin/msgs/Attic/msgs.c between version 1.31 and 1.32

version 1.31, 2007/05/17 10:59:26 version 1.32, 2007/09/09 12:36:38
Line 75 
Line 75 
 #include <sys/stat.h>  #include <sys/stat.h>
 #include <dirent.h>  #include <dirent.h>
 #include <ctype.h>  #include <ctype.h>
   #include <err.h>
 #include <errno.h>  #include <errno.h>
 #include <fcntl.h>  #include <fcntl.h>
 #include <pwd.h>  #include <pwd.h>
Line 371 
Line 372 
                         printf("Message %d:\nFrom %s %sSubject: ",                          printf("Message %d:\nFrom %s %sSubject: ",
                             nextmsg, pw->pw_name, ctime(&t));                              nextmsg, pw->pw_name, ctime(&t));
                         fflush(stdout);                          fflush(stdout);
                         fgets(inbuf, sizeof inbuf, stdin);                          if (fgets(inbuf, sizeof inbuf, stdin) == NULL)
                                   errx(1, "could not read input");
                         putchar('\n');                          putchar('\n');
                         fflush(stdout);                          fflush(stdout);
                         fprintf(newmsg, "From %s %sSubject: %s\n",                          fprintf(newmsg, "From %s %sSubject: %s\n",
Line 380 
Line 382 
                 } else                  } else
                         blankline = seensubj = NO;                          blankline = seensubj = NO;
                 for (;;) {                  for (;;) {
                         fgets(inbuf, sizeof inbuf, stdin);                          if (fgets(inbuf, sizeof inbuf, stdin) == NULL)
                         if (feof(stdin) || ferror(stdin))  
                                 break;                                  break;
                         blankline = (blankline || (inbuf[0] == '\n'));                          blankline = (blankline || (inbuf[0] == '\n'));
                         seensubj = (seensubj ||                          seensubj = (seensubj ||
Line 752 
Line 753 
         printf("%s ", prompt);          printf("%s ", prompt);
         fflush(stdout);          fflush(stdout);
         intrpflg = NO;          intrpflg = NO;
         (void) fgets(inbuf, sizeof inbuf, stdin);          if (fgets(inbuf, sizeof inbuf, stdin) == NULL)
         if ((n = strlen(inbuf)) > 0 && inbuf[n - 1] == '\n')                  errx(1, "could not read input");
                 inbuf[n - 1] = '\0';          inbuf[strcspn(inbuf, "\n")] = '\0';
         if (intrpflg)          if (intrpflg)
                 inbuf[0] = 'x';                  inbuf[0] = 'x';
   

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.32