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

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

version 1.3, 1997/01/15 23:42:29 version 1.4, 1998/07/10 15:51:20
Line 54 
Line 54 
 #include <stdlib.h>  #include <stdlib.h>
 #include <unistd.h>  #include <unistd.h>
 #include <paths.h>  #include <paths.h>
   #include <err.h>
   
 main(argc, argv)  main(argc, argv)
         int argc;          int argc;
Line 99 
Line 100 
         if (!file) {          if (!file) {
                 if (!(file = *argv)) {                  if (!(file = *argv)) {
                         if (!(file = getenv("MAIL"))) {                          if (!(file = getenv("MAIL"))) {
                                 if (!(pwd = getpwuid(getuid()))) {                                  if (!(pwd = getpwuid(getuid())))
                                         (void)fprintf(stderr,                                          errx(1, "no password file entry for you");
                                 "from: no password file entry for you.\n");  
                                         exit(1);  
                                 }  
                                 if (file = getenv("USER")) {                                  if (file = getenv("USER")) {
                                         (void)sprintf(buf, "%s/%s",                                          (void)sprintf(buf, "%s/%s",
                                             _PATH_MAILDIR, file);                                              _PATH_MAILDIR, file);
Line 117 
Line 115 
                         file = buf;                          file = buf;
                 }                  }
         }          }
         if (!freopen(file, "r", stdin)) {          if (!freopen(file, "r", stdin))
                 (void)fprintf(stderr, "from: can't read %s.\n", file);                  errx(1, file);
                 exit(1);  
         }  
         for (newline = 1; fgets(buf, sizeof(buf), stdin);) {          for (newline = 1; fgets(buf, sizeof(buf), stdin);) {
                 if (*buf == '\n') {                  if (*buf == '\n') {
                         newline = 1;                          newline = 1;

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