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

Diff for /src/usr.bin/lock/lock.c between version 1.9 and 1.10

version 1.9, 1997/07/27 21:29:59 version 1.10, 1997/07/27 21:47:07
Line 78 
Line 78 
   
 #define TIMEOUT 15  #define TIMEOUT 15
   
 int skey_auth __P((char *));  void bye        __P((int));
 void quit __P((int));  void hi         __P((int));
 void bye __P((int));  void quit       __P((int));
 void hi __P((int));  int skey_auth   __P((char *));
   
 struct timeval  timeout;  struct timeval  timeout;
 struct timeval  zerotime;  struct timeval  zerotime;
Line 127 
Line 127 
                         break;                          break;
                 case '?':                  case '?':
                 default:                  default:
                         fprintf(stderr, "usage: lock [-n] [-p] [-t timeout]\n");                          (void)fprintf(stderr,
                               "usage: lock [-n] [-p] [-t timeout]\n");
                         exit(1);                          exit(1);
         }          }
         timeout.tv_sec = sectimeout * 60;          timeout.tv_sec = sectimeout * 60;
Line 154 
Line 155 
   
         if (!mypw) {          if (!mypw) {
                 /* get key and check again */                  /* get key and check again */
                 printf("Key: ");                  (void)fputs("Key: ", stdout);
                 if (!fgets(s, sizeof(s), stdin) || *s == '\n')                  if (!fgets(s, sizeof(s), stdin) || *s == '\n')
                         quit(0);                          quit(0);
                 printf("\nAgain: ");                  (void)fputs("\nAgain: ", stdout);
                 /*                  /*
                  * Don't need EOF test here, if we get EOF, then s1 != s                   * Don't need EOF test here, if we get EOF, then s1 != s
                  * and the right things will happen.                   * and the right things will happen.
Line 186 
Line 187 
   
         /* header info */          /* header info */
         if (no_timeout) {          if (no_timeout) {
                 printf("lock: %s on %s. no timeout\ntime now is %.20s%s%s",                  (void)printf("lock: %s on %s. no timeout\ntime now is %.20s%s%s",
                     ttynam, hostname, ap, tzn, ap + 19);                      ttynam, hostname, ap, tzn, ap + 19);
         } else {          } else {
                 printf("lock: %s on %s. timeout in %d minutes\ntime now is %.20s%s%s",                  (void)printf("lock: %s on %s. timeout in %d minutes\ntime now is %.20s%s%s",
                     ttynam, hostname, sectimeout, ap, tzn, ap + 19);                      ttynam, hostname, sectimeout, ap, tzn, ap + 19);
         }          }
   
         for (;;) {          for (;;) {
                 printf("Key: ");                  (void)fputs("Key: ", stdout);
                 if (!fgets(s, sizeof(s), stdin)) {                  if (!fgets(s, sizeof(s), stdin)) {
                         clearerr(stdin);                          clearerr(stdin);
                         hi(0);                          hi(0);
Line 217 
Line 218 
                 }                  }
                 else if (!strcmp(s, s1))                  else if (!strcmp(s, s1))
                         break;                          break;
                 printf("\a\n");                  (void)puts("\a");
                 if (tcsetattr(0, TCSADRAIN, &ntty) < 0)                  if (tcsetattr(0, TCSADRAIN, &ntty) < 0)
                         exit(1);                          exit(1);
         }          }
Line 240 
Line 241 
         int ret = 0;          int ret = 0;
   
         if (!skey_haskey(user) && (ask = skey_keyinfo(user))) {          if (!skey_haskey(user) && (ask = skey_keyinfo(user))) {
                 printf("\n%s\nResponse: ", ask);                  (void)printf("\n%s\nResponse: ", ask);
                 if (!fgets(s, sizeof(s), stdin) || *s == '\n')                  if (!fgets(s, sizeof(s), stdin) || *s == '\n')
                         clearerr(stdin);                          clearerr(stdin);
                 else {                  else {
                         s[strlen(s) - 1] = '\0';                          rip(s);
                         if (skey_passcheck(user, s) != -1)                          if (skey_passcheck(user, s) != -1)
                                 ret = 1;                                  ret = 1;
                 }                  }
         } else          } else
                 printf("Sorry, you have no s/key.\n");                  (void)printf("Sorry, you have no s/key.\n");
         return ret;          return(ret);
 }  }
 #endif  #endif
   
Line 265 
Line 266 
                 if (no_timeout) {                  if (no_timeout) {
                         putchar('\n');                          putchar('\n');
                 } else {                  } else {
                         printf("timeout in %ld:%ld minutes\n",                          (void)printf("timeout in %ld:%ld minutes\n",
                             (nexttime - timval.tv_sec) / 60,                              (nexttime - timval.tv_sec) / 60,
                             (nexttime - timval.tv_sec) % 60);                              (nexttime - timval.tv_sec) % 60);
                 }                  }
Line 287 
Line 288 
 {  {
         if (!no_timeout) {          if (!no_timeout) {
                 (void)tcsetattr(0, TCSADRAIN, &tty);                  (void)tcsetattr(0, TCSADRAIN, &tty);
                 printf("lock: timeout\n");                  (void)puts("lock: timeout");
                 exit(1);                  exit(1);
         }          }
 }  }

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