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

Diff for /src/usr.bin/dc/dc.c between version 1.7 and 1.8

version 1.7, 2006/01/15 19:11:59 version 1.8, 2006/03/24 21:13:45
Line 20 
Line 20 
 static const char rcsid[] = "$OpenBSD$";  static const char rcsid[] = "$OpenBSD$";
 #endif /* not lint */  #endif /* not lint */
   
   #include <sys/stat.h>
 #include <err.h>  #include <err.h>
   #include <errno.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <unistd.h>  #include <unistd.h>
Line 46 
Line 48 
         FILE            *file;          FILE            *file;
         struct source   src;          struct source   src;
         char            *buf, *p;          char            *buf, *p;
           struct stat     st;
   
   
         if ((buf = strdup("")) == NULL)          if ((buf = strdup("")) == NULL)
                 err(1, NULL);                  err(1, NULL);
         /* accept and ignore a single dash to be 4.4BSD dc(1) compatible */          /* accept and ignore a single dash to be 4.4BSD dc(1) compatible */
Line 85 
Line 89 
                         return (0);                          return (0);
         }          }
         if (argc == 1) {          if (argc == 1) {
                   if (stat(argv[0], &st) == -1)
                           err(1, "%s", argv[0]);
                   if (S_ISDIR(st.st_mode)) {
                           errno = EISDIR;
                           err(1, "%s", argv[0]);
                   }
   
                 file = fopen(argv[0], "r");                  file = fopen(argv[0], "r");
                 if (file == NULL)                  if (file == NULL)
                         err(1, "cannot open file %s", argv[0]);                          err(1, "cannot open file %s", argv[0]);

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8