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

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

version 1.7, 1997/05/30 23:35:51 version 1.8, 1998/07/10 15:45:15
Line 77 
Line 77 
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
 #include <time.h>  #include <time.h>
   #include <err.h>
 #include "finger.h"  #include "finger.h"
 #include "extern.h"  #include "extern.h"
   
Line 90 
Line 91 
         char **argv;          char **argv;
 {  {
         extern int optind;          extern int optind;
           extern char *__progname;
         int ch;          int ch;
         char domain[256];          char domain[256];
   
Line 121 
Line 123 
                 case '?':                  case '?':
                 default:                  default:
                         (void)fprintf(stderr,                          (void)fprintf(stderr,
                             "usage: finger [-lmMpsho] [login ...]\n");                              "usage: %s [-lmMpsho] [login ...]\n", __progname);
                         exit(1);                          exit(1);
                 }                  }
         argc -= optind;          argc -= optind;
Line 171 
Line 173 
         struct utmp user;          struct utmp user;
         char name[UT_NAMESIZE + 1];          char name[UT_NAMESIZE + 1];
   
         if (!freopen(_PATH_UTMP, "r", stdin)) {          if (!freopen(_PATH_UTMP, "r", stdin))
                 (void)fprintf(stderr, "finger: can't read %s.\n", _PATH_UTMP);                  err(2, _PATH_UTMP);
                 exit(2);  
         }  
         name[UT_NAMESIZE] = '\0';          name[UT_NAMESIZE] = '\0';
         while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {          while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {
                 if (!user.ut_name[0])                  if (!user.ut_name[0])
Line 203 
Line 203 
         struct passwd *pw;          struct passwd *pw;
         int dolocal, *used;          int dolocal, *used;
   
         if (!(used = (int *)calloc((u_int)argc, (u_int)sizeof(int)))) {          if (!(used = (int *)calloc((u_int)argc, (u_int)sizeof(int))))
                 (void)fprintf(stderr, "finger: out of space.\n");                  err(2, "malloc");
                 exit(1);  
         }  
   
         /* pull out all network requests */          /* pull out all network requests */
         for (i = 0, dolocal = 0, nettail = &nethead; i < argc; i++) {          for (i = 0, dolocal = 0, nettail = &nethead; i < argc; i++) {
Line 247 
Line 245 
         /* list errors */          /* list errors */
         for (i = 0; i < argc; i++)          for (i = 0; i < argc; i++)
                 if (!used[i])                  if (!used[i])
                         (void)fprintf(stderr,                          warnx("%s: no such user.", argv[i]);
                             "finger: %s: no such user.\n", argv[i]);  
   
         /* handle network requests */          /* handle network requests */
 net:    for (pn = nethead; pn; pn = pn->next) {  net:    for (pn = nethead; pn; pn = pn->next) {
Line 264 
Line 261 
          * Scan thru the list of users currently logged in, saving           * Scan thru the list of users currently logged in, saving
          * appropriate data whenever a match occurs.           * appropriate data whenever a match occurs.
          */           */
         if (!freopen(_PATH_UTMP, "r", stdin)) {          if (!freopen(_PATH_UTMP, "r", stdin))
                 (void)fprintf( stderr, "finger: can't read %s.\n", _PATH_UTMP);                  err(1, _PATH_UTMP);
                 exit(1);  
         }  
         while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {          while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {
                 if (!user.ut_name[0])                  if (!user.ut_name[0])
                         continue;                          continue;

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