aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFRIGN <dev@frign.de>2016-02-14 01:48:48 +0100
committerFRIGN <dev@frign.de>2016-02-14 02:00:14 +0100
commita6dc051e3744ce5b14c54d2d246d3e8258207e76 (patch)
tree86e99a63432cae69d1ae8c1c9782496ee7cd8160
parentbdcbeab0d8ac0963c61ae1d9d1ed57d3effb8ec3 (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.124
-rw-r--r--slock.c16
2 files changed, 9 insertions, 31 deletions
diff --git a/slock.1 b/slock.1
index 1f946d9..467194d 100644
--- a/slock.1
+++ b/slock.1
@@ -1,29 +1,19 @@
1.TH SLOCK 1 slock\-VERSION 1.TH SLOCK 1 slock\-VERSION
2.SH NAME 2.SH NAME
3slock \- simple X display locker 3slock \- 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
11is a screen locker for X. If provided, the 11is an X screen locker. If provided,
12.IR post_lock_command 12.IR cmd
13will be executed when the screen is locked. 13is executed after the screen has been locked.
14.SH OPTIONS
15.TP
16.B \-v
17prints 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
22can be customized by creating a custom config.h and (re)compiling the source 18can be customized by creating a custom config.h and (re)compiling the source
23code. This keeps it fast, secure and simple. 19code. This keeps it fast, secure and simple.
24.SH AUTHORS
25See the LICENSE file for the authors.
26.SH LICENSE
27See the LICENSE file for the terms of redistribution.
28.SH BUGS
29Please report them.
diff --git a/slock.c b/slock.c
index 3188ff7..4531f95 100644
--- a/slock.c
+++ b/slock.c
@@ -272,27 +272,15 @@ lockscreen(Display *dpy, int screen)
272 return NULL; 272 return NULL;
273} 273}
274 274
275static void
276usage(void)
277{
278 fprintf(stderr, "usage: slock [-v|POST_LOCK_CMD]\n");
279 exit(1);
280}
281
282int 275int
283main(int argc, char **argv) { 276main(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