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

Diff for /src/usr.bin/tset/Attic/misc.c between version 1.3 and 1.4

version 1.3, 1997/07/25 21:05:45 version 1.4, 1997/07/25 22:13:24
Line 47 
Line 47 
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
   #include <err.h>
 #include "extern.h"  #include "extern.h"
   
 void  void
Line 57 
Line 58 
         char buf[1024];          char buf[1024];
   
         if ((fd = open(file, O_RDONLY, 0)) < 0)          if ((fd = open(file, O_RDONLY, 0)) < 0)
                 err("%s: %s", file, strerror(errno));                  err(1, file);
   
         while ((nr = read(fd, buf, sizeof(buf))) > 0)          while ((nr = read(fd, buf, sizeof(buf))) > 0)
                 if ((nw = write(STDERR_FILENO, buf, nr)) == -1)                  if ((nw = write(STDERR_FILENO, buf, nr)) == -1)
                         err("write to stderr: %s", strerror(errno));                          err(1, "write to stderr");
         if (nr != 0)          if (nr != 0)
                 err("%s: %s", file, strerror(errno));                  err(1, file);
         (void)close(fd);          (void)close(fd);
 }  }
   
Line 72 
Line 73 
         int c;          int c;
 {  {
         (void)putc(c, stderr);          (void)putc(c, stderr);
 }  
   
 #ifdef __STDC__  
 #include <stdarg.h>  
 #else  
 #include <varargs.h>  
 #endif  
   
 void  
 #ifdef __STDC__  
 err(const char *fmt, ...)  
 #else  
 err(fmt, va_alist)  
         char *fmt;  
         va_dcl  
 #endif  
 {  
         va_list ap;  
 #ifdef __STDC__  
         va_start(ap, fmt);  
 #else  
         va_start(ap);  
 #endif  
         (void)fprintf(stderr, "tset: ");  
         (void)vfprintf(stderr, fmt, ap);  
         va_end(ap);  
         (void)fprintf(stderr, "\n");  
         exit(1);  
         /* NOTREACHED */  
 }  }

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