X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=driver%2Fxscreensaver.c;h=daacb41051e2361c05b8a9308163c08029bdfd82;hb=ff35d056d723c9a5ffe728dbba5f1c25e141be04;hp=c608b76402a4318867a403e1e0574fdb80536be1;hpb=ec8d2b32b63649e6d32bdfb306eda062769af823;p=xscreensaver diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c index c608b764..daacb410 100644 --- a/driver/xscreensaver.c +++ b/driver/xscreensaver.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1991-2011 Jamie Zawinski +/* xscreensaver, Copyright (c) 1991-2013 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -271,17 +271,24 @@ ERROR! You must not include vroot.h in this file. static void do_help (saver_info *si) { + char *s, year[5]; + s = strchr (screensaver_id, '-'); + s = strrchr (s, '-'); + s++; + strncpy (year, s, 4); + year[4] = 0; + fflush (stdout); fflush (stderr); fprintf (stdout, "\ -xscreensaver %s, copyright (c) 1991-2008 by Jamie Zawinski \n\ +xscreensaver %s, copyright (c) 1991-%s by Jamie Zawinski \n\ \n\ All xscreensaver configuration is via the `~/.xscreensaver' file.\n\ Rather than editing that file by hand, just run `xscreensaver-demo':\n\ that program lets you configure the screen saver graphically,\n\ including timeouts, locking, and display modes.\n\ \n", - si->version); + si->version, year); fprintf (stdout, "\ Just getting started? Try this:\n\ \n\ @@ -299,14 +306,28 @@ xscreensaver %s, copyright (c) 1991-2008 by Jamie Zawinski \n\ } +Bool in_signal_handler_p = 0; /* I hate C so much... */ + char * timestring (void) { - time_t now = time ((time_t *) 0); - char *str = (char *) ctime (&now); - char *nl = (char *) strchr (str, '\n'); - if (nl) *nl = 0; /* take off that dang newline */ - return str; + if (in_signal_handler_p) + { + /* Turns out that ctime() and even localtime_r() call malloc() on Linux! + So we can't call them from inside SIGCHLD. WTF. + */ + static char buf[30]; + strcpy (buf, "... ... .. signal ...."); + return buf; + } + else + { + time_t now = time ((time_t *) 0); + char *str = (char *) ctime (&now); + char *nl = (char *) strchr (str, '\n'); + if (nl) *nl = 0; /* take off that dang newline */ + return str; + } } static Bool blurb_timestamp_p = True; /* kludge */ @@ -726,6 +747,13 @@ print_banner (saver_info *si) { saver_preferences *p = &si->prefs; + char *s, year[5]; + s = strchr (screensaver_id, '-'); + s = strrchr (s, '-'); + s++; + strncpy (year, s, 4); + year[4] = 0; + /* This resource gets set some time before the others, so that we know whether to print the banner (and so that the banner gets printed before any resource-database-related error messages.) @@ -738,9 +766,9 @@ print_banner (saver_info *si) if (p->verbose_p) fprintf (stderr, - "%s %s, copyright (c) 1991-2008 " + "%s %s, copyright (c) 1991-%s " "by Jamie Zawinski .\n", - progname, si->version); + progname, si->version, year); if (p->debug_p) fprintf (stderr, "\n" @@ -756,6 +784,17 @@ print_banner (saver_info *si) "\n", blurb()); + if (p->verbose_p && senescent_p ()) + fprintf (stderr, "\n" + "*************************************" + "**************************************\n" + "%s: Warning: this version of xscreensaver is VERY OLD!\n" + "%s: Please upgrade! http://www.jwz.org/xscreensaver/\n" + "*************************************" + "**************************************\n" + "\n", + blurb(), blurb()); + if (p->verbose_p) { if (!si->uid_message || !*si->uid_message) @@ -1191,6 +1230,10 @@ main_loop (saver_info *si) we would never be able to un-blank it! We would never see any events, and the display would be wedged. + In particular, without that keyboard grab, we will be + unable to ever read keypresses on the unlock dialog. + You can't unlock if you can't type your password. + So, just go around the loop again and wait for the next bout of idleness. (If the user remains idle, we will next try to blank the screen again in no more than