=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/lock/lock.c,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** src/usr.bin/lock/lock.c 1997/07/27 21:29:59 1.9 --- src/usr.bin/lock/lock.c 1997/07/27 21:47:07 1.10 *************** *** 1,4 **** ! /* $OpenBSD: lock.c,v 1.9 1997/07/27 21:29:59 millert Exp $ */ /* $NetBSD: lock.c,v 1.8 1996/05/07 18:32:31 jtc Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: lock.c,v 1.10 1997/07/27 21:47:07 millert Exp $ */ /* $NetBSD: lock.c,v 1.8 1996/05/07 18:32:31 jtc Exp $ */ /* *************** *** 47,53 **** #if 0 static char sccsid[] = "@(#)lock.c 8.1 (Berkeley) 6/6/93"; #endif ! static char rcsid[] = "$OpenBSD: lock.c,v 1.9 1997/07/27 21:29:59 millert Exp $"; #endif /* not lint */ /* --- 47,53 ---- #if 0 static char sccsid[] = "@(#)lock.c 8.1 (Berkeley) 6/6/93"; #endif ! static char rcsid[] = "$OpenBSD: lock.c,v 1.10 1997/07/27 21:47:07 millert Exp $"; #endif /* not lint */ /* *************** *** 78,87 **** #define TIMEOUT 15 ! int skey_auth __P((char *)); ! void quit __P((int)); ! void bye __P((int)); ! void hi __P((int)); struct timeval timeout; struct timeval zerotime; --- 78,87 ---- #define TIMEOUT 15 ! void bye __P((int)); ! void hi __P((int)); ! void quit __P((int)); ! int skey_auth __P((char *)); struct timeval timeout; struct timeval zerotime; *************** *** 127,133 **** break; case '?': default: ! fprintf(stderr, "usage: lock [-n] [-p] [-t timeout]\n"); exit(1); } timeout.tv_sec = sectimeout * 60; --- 127,134 ---- break; case '?': default: ! (void)fprintf(stderr, ! "usage: lock [-n] [-p] [-t timeout]\n"); exit(1); } timeout.tv_sec = sectimeout * 60; *************** *** 154,163 **** if (!mypw) { /* get key and check again */ ! printf("Key: "); if (!fgets(s, sizeof(s), stdin) || *s == '\n') quit(0); ! printf("\nAgain: "); /* * Don't need EOF test here, if we get EOF, then s1 != s * and the right things will happen. --- 155,164 ---- if (!mypw) { /* get key and check again */ ! (void)fputs("Key: ", stdout); if (!fgets(s, sizeof(s), stdin) || *s == '\n') quit(0); ! (void)fputs("\nAgain: ", stdout); /* * Don't need EOF test here, if we get EOF, then s1 != s * and the right things will happen. *************** *** 186,200 **** /* header info */ if (no_timeout) { ! printf("lock: %s on %s. no timeout\ntime now is %.20s%s%s", ttynam, hostname, ap, tzn, ap + 19); } else { ! printf("lock: %s on %s. timeout in %d minutes\ntime now is %.20s%s%s", ttynam, hostname, sectimeout, ap, tzn, ap + 19); } for (;;) { ! printf("Key: "); if (!fgets(s, sizeof(s), stdin)) { clearerr(stdin); hi(0); --- 187,201 ---- /* header info */ if (no_timeout) { ! (void)printf("lock: %s on %s. no timeout\ntime now is %.20s%s%s", ttynam, hostname, ap, tzn, ap + 19); } else { ! (void)printf("lock: %s on %s. timeout in %d minutes\ntime now is %.20s%s%s", ttynam, hostname, sectimeout, ap, tzn, ap + 19); } for (;;) { ! (void)fputs("Key: ", stdout); if (!fgets(s, sizeof(s), stdin)) { clearerr(stdin); hi(0); *************** *** 217,223 **** } else if (!strcmp(s, s1)) break; ! printf("\a\n"); if (tcsetattr(0, TCSADRAIN, &ntty) < 0) exit(1); } --- 218,224 ---- } else if (!strcmp(s, s1)) break; ! (void)puts("\a"); if (tcsetattr(0, TCSADRAIN, &ntty) < 0) exit(1); } *************** *** 240,256 **** int ret = 0; if (!skey_haskey(user) && (ask = skey_keyinfo(user))) { ! printf("\n%s\nResponse: ", ask); if (!fgets(s, sizeof(s), stdin) || *s == '\n') clearerr(stdin); else { ! s[strlen(s) - 1] = '\0'; if (skey_passcheck(user, s) != -1) ret = 1; } } else ! printf("Sorry, you have no s/key.\n"); ! return ret; } #endif --- 241,257 ---- int ret = 0; if (!skey_haskey(user) && (ask = skey_keyinfo(user))) { ! (void)printf("\n%s\nResponse: ", ask); if (!fgets(s, sizeof(s), stdin) || *s == '\n') clearerr(stdin); else { ! rip(s); if (skey_passcheck(user, s) != -1) ret = 1; } } else ! (void)printf("Sorry, you have no s/key.\n"); ! return(ret); } #endif *************** *** 265,271 **** if (no_timeout) { putchar('\n'); } else { ! printf("timeout in %ld:%ld minutes\n", (nexttime - timval.tv_sec) / 60, (nexttime - timval.tv_sec) % 60); } --- 266,272 ---- if (no_timeout) { putchar('\n'); } else { ! (void)printf("timeout in %ld:%ld minutes\n", (nexttime - timval.tv_sec) / 60, (nexttime - timval.tv_sec) % 60); } *************** *** 287,293 **** { if (!no_timeout) { (void)tcsetattr(0, TCSADRAIN, &tty); ! printf("lock: timeout\n"); exit(1); } } --- 288,294 ---- { if (!no_timeout) { (void)tcsetattr(0, TCSADRAIN, &tty); ! (void)puts("lock: timeout"); exit(1); } }