From fb067c4bf830eef804b65703368eea3b822a3904 Mon Sep 17 00:00:00 2001 From: Don Stewart Date: Sat, 9 Jun 2007 11:01:27 +0200 Subject: missing unsetenv darcs-hash:20070609090127-9c5c1-9d952a732e6e00c4db7a6dee89ecc67ff9343916.gz --- scripts/clock.c | 64 ------------------------------------------------ scripts/xmonad-clock.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 64 deletions(-) delete mode 100644 scripts/clock.c create mode 100644 scripts/xmonad-clock.c (limited to 'scripts') diff --git a/scripts/clock.c b/scripts/clock.c deleted file mode 100644 index 77868d7..0000000 --- a/scripts/clock.c +++ /dev/null @@ -1,64 +0,0 @@ -/* -dwm status bar provider. use as ~/.xinitrc or call it in your xinitrc -or xsession in place of dwm. - -to compile: gcc -Os -s -o dwm-status dwm-status.c - -Copyright (c) 2007, Tom Menari -Copyright (c) 2007, Don Stewart - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include -#include -#include -#include -#include - -/* configuration */ -#define REFRESH_RATE 60 -#define TIME_FORMAT "%H.%M %a %b %d" -#define TIME_FORMAT2 "PDT %H.%M" - -int main(void) { - char b[34]; - char c[34]; - time_t epochtime; - struct tm *realtime; - - time_t pdttime; - struct tm *pdtrealtime; - - double load; - - signal(SIGPIPE, SIG_IGN); - - for(;;) { - getloadavg(&load, 1); - - epochtime = time(NULL); - realtime = localtime(&epochtime); - strftime(b, sizeof(b), TIME_FORMAT, realtime); - - setenv("TZ","America/Los_Angeles", 1); - pdttime = time(NULL); - pdtrealtime = localtime(&pdttime); - strftime(c, sizeof(c), TIME_FORMAT2, pdtrealtime); - - fprintf(stdout, "%s | %s | %.2f | xmonad 0.3 \n", b, c, load); - fflush(stdout); - sleep(REFRESH_RATE); - } - return EXIT_SUCCESS; -} diff --git a/scripts/xmonad-clock.c b/scripts/xmonad-clock.c new file mode 100644 index 0000000..c0bff8c --- /dev/null +++ b/scripts/xmonad-clock.c @@ -0,0 +1,66 @@ +/* + +dwm/xmonad status bar provider. launch from your .xinitrc, and pipe +into dzen2. + +to compile: gcc -Os -s -o xmonad-status xmonad-status.c + +Copyright (c) 2007, Tom Menari +Copyright (c) 2007, Don Stewart + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include +#include +#include +#include +#include + +/* configuration */ +#define REFRESH_RATE 60 +#define TIME_FORMAT "%H.%M %a %b %d" +#define TIME_FORMAT2 "PDT %H.%M" + +int main(void) { + char b[34]; + char c[34]; + time_t epochtime; + struct tm *realtime; + + time_t pdttime; + struct tm *pdtrealtime; + + double load; + + signal(SIGPIPE, SIG_IGN); + + for(;;) { + getloadavg(&load, 1); + + epochtime = time(NULL); + realtime = localtime(&epochtime); + strftime(b, sizeof(b), TIME_FORMAT, realtime); + + setenv("TZ","America/Los_Angeles", 1); + pdttime = time(NULL); + pdtrealtime = localtime(&pdttime); + strftime(c, sizeof(c), TIME_FORMAT2, pdtrealtime); + unsetenv("TZ"); + + fprintf(stdout, "%s | %s | %.2f | xmonad 0.3 \n", b, c, load); + fflush(stdout); + sleep(REFRESH_RATE); + } + return EXIT_SUCCESS; +} -- cgit v1.2.3