version 1.41, 2017/09/06 21:02:31 |
version 1.42, 2019/07/05 14:11:26 |
|
|
|
|
void bye(int); |
void bye(int); |
void hi(int); |
void hi(int); |
|
void usage(void); |
|
|
|
int custom_timeout; |
int no_timeout; /* lock terminal forever */ |
int no_timeout; /* lock terminal forever */ |
|
|
int |
int |
|
|
sectimeout = TIMEOUT; |
sectimeout = TIMEOUT; |
style = NULL; |
style = NULL; |
usemine = 0; |
usemine = 0; |
no_timeout = 0; |
custom_timeout = no_timeout = 0; |
memset(&timeout, 0, sizeof(timeout)); |
memset(&timeout, 0, sizeof(timeout)); |
|
|
if (pledge("stdio rpath wpath getpw tty proc exec", NULL) == -1) |
if (pledge("stdio rpath wpath getpw tty proc exec", NULL) == -1) |
|
|
usemine = 1; |
usemine = 1; |
break; |
break; |
case 't': |
case 't': |
|
if (no_timeout) |
|
usage(); |
sectimeout = strtonum(optarg, 1, INT_MAX, &errstr); |
sectimeout = strtonum(optarg, 1, INT_MAX, &errstr); |
if (errstr) |
if (errstr) |
errx(1, "timeout %s: %s", errstr, optarg); |
errx(1, "timeout %s: %s", errstr, optarg); |
|
custom_timeout = 1; |
break; |
break; |
case 'p': |
case 'p': |
usemine = 1; |
usemine = 1; |
break; |
break; |
case 'n': |
case 'n': |
|
if (custom_timeout) |
|
usage(); |
no_timeout = 1; |
no_timeout = 1; |
break; |
break; |
default: |
default: |
fprintf(stderr, |
usage(); |
"usage: %s [-np] [-a style] [-t timeout]\n", |
|
getprogname()); |
|
exit(1); |
|
} |
} |
} |
} |
timeout.tv_sec = sectimeout * 60; |
timeout.tv_sec = sectimeout * 60; |
|
|
if (!no_timeout) |
if (!no_timeout) |
warnx("timeout"); |
warnx("timeout"); |
_exit(1); |
_exit(1); |
|
} |
|
|
|
void |
|
usage(void) |
|
{ |
|
fprintf(stderr, "usage: %s [-np] [-a style] [-t timeout]\n", |
|
getprogname()); |
|
exit(1); |
} |
} |