commit b335bfcccdf0ca3dce07ab745f002be25a08071b
parent 4ba6c06601f5aad28c671b0c1d5a422504e78526
Author: Cem Keylan <cem@ckyln.com>
Date: Tue, 30 Jun 2020 09:22:37 +0300
sxss: use a die function
Diffstat:
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sxss.c b/sxss.c
@@ -19,21 +19,21 @@ static void spawn(char *const argv[]) {
}
}
+void die(const char *str) {
+ printf("%s\n", str);
+ exit(1);
+}
+
int main(int argc, char *argv[]) {
XScreenSaverInfo *info;
Display *dpy;
int base, errbase;
- if(!(dpy = XOpenDisplay(0))) {
- printf("Cannot open display.\n");
- exit(1);
- }
+ if(!(dpy = XOpenDisplay(0))) die("Cannot open display.");
- if (!XScreenSaverQueryExtension(dpy, &base, &errbase)) {
- printf("Screensaver extension not activated.\n");
- exit(1);
- }
+ if (!XScreenSaverQueryExtension(dpy, &base, &errbase))
+ die("Screensaver extension not activated.");
while(1) {