slock with DPMS and other tweaks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

FRIGN a6dc051e bdcbeab0

+9 -31
+7 -17
slock.1
··· 1 1 .TH SLOCK 1 slock\-VERSION 2 2 .SH NAME 3 - slock \- simple X display locker 3 + slock \- simple X screen locker 4 4 .SH SYNOPSIS 5 5 .B slock 6 - .RB [ \-v 7 - | 8 - .IR post_lock_command ] 6 + .RB [ 7 + .IR cmd 8 + ] 9 9 .SH DESCRIPTION 10 10 .B slock 11 - is a screen locker for X. If provided, the 12 - .IR post_lock_command 13 - will be executed when the screen is locked. 14 - .SH OPTIONS 15 - .TP 16 - .B \-v 17 - prints version information to stdout, then exits. 11 + is an X screen locker. If provided, 12 + .IR cmd 13 + is executed after the screen has been locked. 18 14 .SH EXAMPLES 19 15 $ slock /usr/sbin/s2ram 20 16 .SH CUSTOMIZATION 21 17 .B slock 22 18 can be customized by creating a custom config.h and (re)compiling the source 23 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.
+2 -14
slock.c
··· 272 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 275 int 283 - main(int argc, char **argv) { 276 + main(int argc, char **argv) 277 + { 284 278 #ifndef HAVE_BSD_AUTH 285 279 const char *pws; 286 280 #endif 287 281 Display *dpy; 288 282 int screen; 289 - 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 283 296 284 #ifdef __linux__ 297 285 dontkillme();