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

Diff for /src/usr.bin/who/who.c between version 1.8 and 1.9

version 1.8, 2000/03/21 21:54:51 version 1.9, 2000/03/22 17:07:37
Line 52 
Line 52 
   
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/stat.h>  #include <sys/stat.h>
   #include <paths.h>
 #include <pwd.h>  #include <pwd.h>
 #include <utmp.h>  #include <utmp.h>
 #include <stdio.h>  #include <stdio.h>
Line 116 
Line 117 
                 only_current_term = show_term = show_idle = show_labels = 0;                  only_current_term = show_term = show_idle = show_labels = 0;
         }          }
   
         if (show_term || show_idle) {  
                 if (chdir("/dev")) {  
                         err(1, "cannot change directory to /dev");  
                         /* NOTREACHED */  
                 }  
         }  
   
         if (show_labels)          if (show_labels)
                 output_labels();                  output_labels();
   
Line 225 
Line 219 
         struct utmp *up;          struct utmp *up;
 {  {
         struct stat sb;          struct stat sb;
         char line[sizeof (up->ut_line) + 1];          char line[sizeof(_PATH_DEV) + sizeof (up->ut_line)];
         char state = '?';          char state = '?';
         static time_t now = 0;          static time_t now = 0;
         time_t idle = 0;          time_t idle = 0;
Line 234 
Line 228 
                 if (now == 0)                  if (now == 0)
                         time(&now);                          time(&now);
   
                 strncpy(line, up->ut_line, sizeof (up->ut_line));                  strcpy(line, _PATH_DEV);
                 line[sizeof (up->ut_line)] = '\0';                  strncat(line, up->ut_line, sizeof (up->ut_line));
   
                 if (stat(line, &sb) == 0) {                  if (stat(line, &sb) == 0) {
                         state = (sb.st_mode & 020) ? '+' : '-';                          state = (sb.st_mode & 020) ? '+' : '-';

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