diff --git a/LICENSE b/LICENSE index cb52dba..2e4419b 100644 --- a/LICENSE +++ b/LICENSE @@ -4,7 +4,6 @@ MIT/X Consortium License © 2014 Dimitris Papastamos © 2006-2014 Anselm R Garbe © 2014-2016 Laslo Hunhold -© 2016-2023 Hiltjo Posthuma Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/Makefile b/Makefile index 6d74b21..f4ffbb7 100644 --- a/Makefile +++ b/Makefile @@ -6,41 +6,56 @@ include config.mk SRC = slock.c ${COMPATSRC} OBJ = ${SRC:.c=.o} -all: slock +all: options slock + +options: + @echo slock build options: + @echo "CFLAGS = ${CFLAGS}" + @echo "LDFLAGS = ${LDFLAGS}" + @echo "CC = ${CC}" .c.o: - ${CC} -c ${CFLAGS} $< + @echo CC $< + @${CC} -c ${CFLAGS} $< ${OBJ}: config.h config.mk arg.h util.h config.h: - cp config.def.h $@ + @echo creating $@ from config.def.h + @cp config.def.h $@ slock: ${OBJ} - ${CC} -o $@ ${OBJ} ${LDFLAGS} + @echo CC -o $@ + @${CC} -o $@ ${OBJ} ${LDFLAGS} clean: - rm -f slock ${OBJ} slock-${VERSION}.tar.gz + @echo cleaning + @rm -f slock ${OBJ} slock-${VERSION}.tar.gz dist: clean - mkdir -p slock-${VERSION} - cp -R LICENSE Makefile README slock.1 config.mk \ - ${SRC} config.def.h arg.h util.h slock-${VERSION} - tar -cf slock-${VERSION}.tar slock-${VERSION} - gzip slock-${VERSION}.tar - rm -rf slock-${VERSION} + @echo creating dist tarball + @mkdir -p slock-${VERSION} + @cp -R LICENSE Makefile README slock.1 config.mk \ + ${SRC} explicit_bzero.c config.def.h arg.h util.h slock-${VERSION} + @tar -cf slock-${VERSION}.tar slock-${VERSION} + @gzip slock-${VERSION}.tar + @rm -rf slock-${VERSION} install: all - mkdir -p ${DESTDIR}${PREFIX}/bin - cp -f slock ${DESTDIR}${PREFIX}/bin - chmod 755 ${DESTDIR}${PREFIX}/bin/slock - chmod u+s ${DESTDIR}${PREFIX}/bin/slock - mkdir -p ${DESTDIR}${MANPREFIX}/man1 - sed "s/VERSION/${VERSION}/g" ${DESTDIR}${MANPREFIX}/man1/slock.1 - chmod 644 ${DESTDIR}${MANPREFIX}/man1/slock.1 + @echo installing executable file to ${DESTDIR}${PREFIX}/bin + @mkdir -p ${DESTDIR}${PREFIX}/bin + @cp -f slock ${DESTDIR}${PREFIX}/bin + @chmod 755 ${DESTDIR}${PREFIX}/bin/slock + @chmod u+s ${DESTDIR}${PREFIX}/bin/slock + @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 + @mkdir -p ${DESTDIR}${MANPREFIX}/man1 + @sed "s/VERSION/${VERSION}/g" ${DESTDIR}${MANPREFIX}/man1/slock.1 + @chmod 644 ${DESTDIR}${MANPREFIX}/man1/slock.1 uninstall: - rm -f ${DESTDIR}${PREFIX}/bin/slock - rm -f ${DESTDIR}${MANPREFIX}/man1/slock.1 + @echo removing executable file from ${DESTDIR}${PREFIX}/bin + @rm -f ${DESTDIR}${PREFIX}/bin/slock + @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 + @rm -f ${DESTDIR}${MANPREFIX}/man1/slock.1 -.PHONY: all clean dist install uninstall +.PHONY: all options clean dist install uninstall diff --git a/README b/README index dcacd01..a81290d 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ slock - simple screen locker ============================ -simple screen locker utility for X. +simple screen locker utility for X. Requirements diff --git a/config.mk b/config.mk index 514c236..74429ae 100644 --- a/config.mk +++ b/config.mk @@ -1,5 +1,5 @@ # slock version -VERSION = 1.5 +VERSION = 1.4 # Customize below to fit your system @@ -27,3 +27,6 @@ COMPATSRC = explicit_bzero.c #CPPFLAGS = -DVERSION=\"${VERSION}\" -D_BSD_SOURCE -D_NETBSD_SOURCE # On OpenBSD set COMPATSRC to empty #COMPATSRC = + +# compiler and linker +CC = cc diff --git a/slock.1 b/slock.1 index 40c15e1..82cdcd6 100644 --- a/slock.1 +++ b/slock.1 @@ -1,6 +1,5 @@ -.Dd October 6, 2023 +.Dd 2016-08-23 .Dt SLOCK 1 -.Os .Sh NAME .Nm slock .Nd simple X screen locker @@ -10,36 +9,31 @@ .Op Ar cmd Op Ar arg ... .Sh DESCRIPTION .Nm -is a simple X screen locker. -If provided, -.Ar cmd +is a simple X screen locker. If provided, +.Ar cmd Op Ar arg ... is executed after the screen has been locked. -.Pp -The options are as follows: +.Sh OPTIONS .Bl -tag -width Ds .It Fl v Print version information to stdout and exit. .El -.Sh EXIT STATUS -.Ex -std -.Sh EXAMPLES -$ -.Nm -/usr/sbin/s2ram .Sh SECURITY CONSIDERATIONS To make sure a locked screen can not be bypassed by switching VTs or killing the X server with Ctrl+Alt+Backspace, it is recommended to disable both in .Xr xorg.conf 5 for maximum security: -.Bd -literal +.Bd -literal -offset left Section "ServerFlags" Option "DontVTSwitch" "True" Option "DontZap" "True" EndSection .Ed +.Sh EXAMPLES +$ +.Nm +/usr/sbin/s2ram .Sh CUSTOMIZATION .Nm can be customized by creating a custom config.h from config.def.h and -(re)compiling the source code. -This keeps it fast, secure and simple. +(re)compiling the source code. This keeps it fast, secure and simple. diff --git a/slock.c b/slock.c index b2f14e3..d55eb3d 100644 --- a/slock.c +++ b/slock.c @@ -177,7 +177,7 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens, break; case XK_BackSpace: if (len) - passwd[--len] = '\0'; + passwd[len--] = '\0'; break; default: if (num && !iscntrl((int)buf[0]) && @@ -317,7 +317,7 @@ main(int argc, char **argv) { ARGBEGIN { case 'v': - puts("slock-"VERSION); + fprintf(stderr, "slock-"VERSION"\n"); return 0; default: usage();