diff options
author | FRIGN <dev@frign.de> | 2016-02-14 01:48:48 +0100 |
---|---|---|
committer | FRIGN <dev@frign.de> | 2016-02-14 02:00:14 +0100 |
commit | a6dc051e3744ce5b14c54d2d246d3e8258207e76 (patch) | |
tree | 86e99a63432cae69d1ae8c1c9782496ee7cd8160 | |
parent | bdcbeab0d8ac0963c61ae1d9d1ed57d3effb8ec3 (diff) |
No need for usage()
There are 2 arguments why -v and -h are broken:
1) if you are running off git, -v will show the last stable
release, effectively making this option useless.
people running stable versions leave open an attack surface
this way in case there are vulnerabilities found.
99% of the people are also using package managers to keep
their software up to date, instead of running $TOOL -v to
check how old it is.
2) -h is a sad excuse for not just looking at the manual page
(man 1 slock). Given we accept a post_lock_command, we can't
be as liberal and just intercept certain flags.
I changed the manpage to reflect this change.
-rw-r--r-- | slock.1 | 24 | ||||
-rw-r--r-- | slock.c | 16 |
2 files changed, 9 insertions, 31 deletions
@@ -1,29 +1,19 @@ | |||
1 | .TH SLOCK 1 slock\-VERSION | 1 | .TH SLOCK 1 slock\-VERSION |
2 | .SH NAME | 2 | .SH NAME |
3 | slock \- simple X display locker | 3 | slock \- simple X screen locker |
4 | .SH SYNOPSIS | 4 | .SH SYNOPSIS |
5 | .B slock | 5 | .B slock |
6 | .RB [ \-v | 6 | .RB [ |
7 | | | 7 | .IR cmd |
8 | .IR post_lock_command ] | 8 | ] |
9 | .SH DESCRIPTION | 9 | .SH DESCRIPTION |
10 | .B slock | 10 | .B slock |
11 | is a screen locker for X. If provided, the | 11 | is an X screen locker. If provided, |
12 | .IR post_lock_command | 12 | .IR cmd |
13 | will be executed when the screen is locked. | 13 | is executed after the screen has been locked. |
14 | .SH OPTIONS | ||
15 | .TP | ||
16 | .B \-v | ||
17 | prints version information to stdout, then exits. | ||
18 | .SH EXAMPLES | 14 | .SH EXAMPLES |
19 | $ slock /usr/sbin/s2ram | 15 | $ slock /usr/sbin/s2ram |
20 | .SH CUSTOMIZATION | 16 | .SH CUSTOMIZATION |
21 | .B slock | 17 | .B slock |
22 | can be customized by creating a custom config.h and (re)compiling the source | 18 | can be customized by creating a custom config.h and (re)compiling the source |
23 | code. This keeps it fast, secure and simple. | 19 | code. This keeps it fast, secure and simple. |
24 | .SH AUTHORS | ||
25 | See the LICENSE file for the authors. | ||
26 | .SH LICENSE | ||
27 | See the LICENSE file for the terms of redistribution. | ||
28 | .SH BUGS | ||
29 | Please report them. | ||
@@ -272,27 +272,15 @@ lockscreen(Display *dpy, int screen) | |||
272 | return NULL; | 272 | return NULL; |
273 | } | 273 | } |
274 | 274 | ||
275 | static void | ||
276 | usage(void) | ||
277 | { | ||
278 | fprintf(stderr, "usage: slock [-v|POST_LOCK_CMD]\n"); | ||
279 | exit(1); | ||
280 | } | ||
281 | |||
282 | int | 275 | int |
283 | main(int argc, char **argv) { | 276 | main(int argc, char **argv) |
277 | { | ||
284 | #ifndef HAVE_BSD_AUTH | 278 | #ifndef HAVE_BSD_AUTH |
285 | const char *pws; | 279 | const char *pws; |
286 | #endif | 280 | #endif |
287 | Display *dpy; | 281 | Display *dpy; |
288 | int screen; | 282 | int screen; |
289 | 283 | ||
290 | if ((argc == 2) && !strcmp("-v", argv[1])) | ||
291 | die("slock-%s, © 2006-2016 slock engineers\n", VERSION); | ||
292 | |||
293 | if ((argc == 2) && !strcmp("-h", argv[1])) | ||
294 | usage(); | ||
295 | |||
296 | #ifdef __linux__ | 284 | #ifdef __linux__ |
297 | dontkillme(); | 285 | dontkillme(); |
298 | #endif | 286 | #endif |