--- dclock-2.1.2.orig/Dclock.c +++ dclock-2.1.2/Dclock.c @@ -4,12 +4,15 @@ * Modifications 2/93 by Tim Edwards */ +#include #include #include #include #include #include -#include +#include +#include +#include #include #include #include @@ -221,7 +224,7 @@ * These stipples give different densities for the * different stages of fading. */ -static unsigned char stpl_1_8th[] = +static char stpl_1_8th[] = { 0x80, 0x80, 0x08, 0x08, 0x80, 0x80, 0x08, 0x08, 0x80, 0x80, 0x08, 0x08, 0x80, 0x80, 0x08, 0x08, @@ -229,7 +232,7 @@ 0x80, 0x80, 0x08, 0x08, 0x80, 0x80, 0x08, 0x08 }; -static unsigned char stpl_1_4th[] = +static char stpl_1_4th[] = { 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22, @@ -237,7 +240,7 @@ 0x88, 0x88, 0x22, 0x22, 0x88, 0x88, 0x22, 0x22 }; -static unsigned char stpl_3_8ths[] = +static char stpl_3_8ths[] = { 0xA2, 0xA2, 0x15, 0x15, 0xA8, 0xA8, 0x45, 0x45, 0x2A, 0x2A, 0x51, 0x51, 0x8A, 0x8A, 0x54, 0x54, @@ -245,7 +248,7 @@ 0x2A, 0x2A, 0x51, 0x51, 0x8A, 0x8A, 0x54, 0x54 }; -static unsigned char stpl_one_half[] = +static char stpl_one_half[] = { 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, 0x55, 0x55, 0xAA, 0xAA, @@ -262,7 +265,6 @@ #define FADE_ITER 8 static Pixmap fade_stip[FADE_ITER]; int fadevector[FADE_ITER]; -int bsave = -1; Boolean use_stipple; #define MAX_PTS 6 /* max # of pts per segment polygon */ @@ -415,7 +417,7 @@ for (n = 1; n != FADE_ITER; ++n) if (!fade_stip[n]) { - fprintf(stderr, "Couldn't create stipple!\n"); + fprintf(stderr, "dclock: Couldn't create stipple!\n"); exit(1); } } @@ -1052,16 +1054,14 @@ static void playbell(DclockWidget w, int alarmtype) { - /* Fork an audio process or else ring the bell */ + /* Try using an audio process. If that fails ring the bell */ + int status = 1; - if ((alarmtype == 0) && (w->dclock.alarmfile == (String)NULL)) { - XBell (XtDisplay (w), 50); - XBell (XtDisplay (w), 50); - } - else if ((alarmtype == 1) && (w->dclock.bellfile == (String)NULL)) { - XBell (XtDisplay (w), 50); - } - else { + if ((((alarmtype == 0) && (w->dclock.alarmfile != (String)NULL && + strcasecmp(w->dclock.alarmfile, "NULL"))) || + ((alarmtype == 1) && (w->dclock.bellfile != (String)NULL && + strcasecmp(w->dclock.bellfile, "NULL")))) && + w->dclock.audioplay) { pid_t cpid, bell_proc; char *locargv[4]; char *proot = strrchr(w->dclock.audioplay, '/'); @@ -1075,27 +1075,36 @@ locargv[2] = NULL; if ((cpid = fork()) < 0) { - fprintf(stderr, "dclock: Fork error. . . reverting to system bell.\n"); + fprintf(stderr, "dclock: Fork error. Reverting to system bell.\n"); w->dclock.audioplay = (String)NULL; } else if (cpid == 0) { - if ((bell_proc = fork()) < 0) { - fprintf(stderr, "dclock: Secondary fork error.\n"); - exit(-1); - } - else if (bell_proc > 0) - exit(0); - execv(w->dclock.audioplay, locargv); + fprintf(stderr, "dclock: Unable to exec \"%s\".\n",w->dclock.audioplay); + exit(-1); } else { - if (waitpid(cpid, NULL, 0) != cpid) { - fprintf(stderr, "dclock: Waidpid error\n"); + if (waitpid(cpid, &status, 0) != cpid) { + fprintf(stderr, "dclock: Waitpid error (%d)\n", errno); exit(-1); } + if (WEXITSTATUS(status) != 0) { + fprintf(stderr, "dclock: \"%s\" returned an error. . . reverting to system bell.\n",w->dclock.audioplay); + w->dclock.audioplay = (String)NULL; + } + } + } + + if (WEXITSTATUS(status) != 0) { + if (alarmtype == 0) { + XBell (XtDisplay (w), 50); + XBell (XtDisplay (w), 50); + } + else if (alarmtype == 1) { + XBell (XtDisplay (w), 50); } } - return; + } /* ARGSUSED */ @@ -1169,6 +1178,7 @@ show_time(w) DclockWidget w; { + static time_t last_alarm; char buf[11]; Boolean alarm_went_off = False; long t = time(0); @@ -1225,9 +1235,14 @@ if (w->dclock.alarm && Alarm.hrs == l_time->tm_hour && Alarm.mins == l_time->tm_min && l_time->tm_sec < 5) { - playbell(w, 0); + if (t - last_alarm > 60) + { + last_alarm=t; + toggle_reverse_video(w); + playbell(w, 0); + alarm_went_off = True; toggle_reverse_video(w); - alarm_went_off = True; + } } else /* if alarm didn't go off, check for hour/half-hour bell */ if (w->dclock.bell && (!w->dclock.seconds || l_time->tm_sec == 0) && @@ -1509,8 +1524,7 @@ /* Try to catch the next second on the second boundary */ gettimeofday(&now, NULL); - next_intr = (1e6 - now.tv_usec) / 1e3; - + next_intr = (1e6 - now.tv_usec) / 1e3 + 1; w->dclock.interval_id = XtAddTimeOut((unsigned long)((alarm_went_off || w->dclock.seconds || w->dclock.blink) ? next_intr : 59000 + next_intr), timeout, @@ -1755,6 +1769,7 @@ toggle_reverse_video(w) DclockWidget w; { + static int bsave = -1; Display *dpy = XtDisplay(w); int i, itemp; --- dclock-2.1.2.orig/Dclock.ad +++ dclock-2.1.2/Dclock.ad @@ -7,7 +7,8 @@ dclock*borderWidth: 2 dclock*widthFactor: 0.143 dclock*spaceFactor: 0.062 -dclock*bellFile: /usr/share/sound/bell.wav -dclock*alarmFile: /usr/share/sound/digital.wav +dclock*bellFile: /usr/share/sounds/bell.wav +dclock*alarmFile: /usr/share/sounds/digital.wav dclock*font: *helvetica-medium-r-normal--14* dclock*audioPlay: /usr/bin/play +dclock.input: true --- dclock-2.1.2.orig/dclock.1 +++ dclock-2.1.2/dclock.1 @@ -62,8 +62,11 @@ .TP 8 .B \-bellFile \fIfilename\fP This specifies a sound file to use to play the dclock hourly chime. If -unspecified, the system beep is used instead. The sound file format -must be understood by the executable specified by option "audioPlay". +unspecified (or a 'NULL' string is used), the system beep is used +instead. +The sound file format must be understood by the executable specified by +option "audioPlay" (the 'NULL' is meant as a means to override a system +level setting to disable external sound playing). .TP 8 .B \-miltime .TP 8 @@ -85,6 +88,13 @@ When the time changes, the digits scroll from the previous digit to the next digit. The -noscroll option turns the behavior off. .TP 8 +.B \-blink +.TP 8 +.B \-noblink +.br +The colon separating hours from minutes blinks on and off once per second. +With the -noblink option it remains on permanently. +.TP 8 .B \-fade .TP 8 .B \-nofade @@ -143,8 +153,11 @@ .TP 8 .B \-alarmFile \fIfilename\fP This specifies a sound file to use to play the dclock alarm. If -unspecified, the system beep is used instead. The sound file format -must be understood by the executable specified by option "audioPlay". +unspecified (or a 'NULL' string is used), the system beep is used +instead. +The sound file format must be understood by the executable specified by +option "audioPlay" (the 'NULL' is meant as a means to override a system +level setting to disable external sound playing). .TP 8 .B \-seconds This option will update the clock every second and display the time @@ -231,7 +244,7 @@ .B font (\fPclass\fB Font) Specifies the font to be used for the date. .TP 8 -.B miltime (\fPclass\fB Boolean) +.B militaryTime (\fPclass\fB Boolean) Specifies whether the military (24hr) time format should be used. .TP 8 .B reverseVideo (\fPclass\fB ReverseVideo) --- dclock-2.1.2.orig/Makefile +++ dclock-2.1.2/Makefile @@ -0,0 +1,43 @@ +# +# This is a Makefile for those people not using xmkmf to compile dclock. +# +# Remember to add the path to your X include files to CFLAGS and to +# add the path to your X libraries to the front of LIBS. +# +prefix= /usr/local +bindir= $(prefix)/bin +mandir= $(prefix)/man/man1 +appdir= ${prefix}/etc/X11/app-defaults + +PROGRAM= dclock +SRCS= Dclock.c dclock.c +OBJS= Dclock.o dclock.o +HFILES= Dclock.h DclockP.h patchlevel.h +ADFILE= DClock + +CC= gcc +CFLAGS= -O +LDFLAGS= +LIBS= -lm -lXt -lX11 + +$(PROGRAM): ${OBJS} + ${CC} ${LDFLAGS} ${OBJS} ${LIBS} -o $(PROGRAM) + +$(ADFILE): Dclock.ad + cp -p $< $@ + +clean: ; rm -f ${OBJS} core $(PROGRAM) $(ADFILE) + +install: $(PROGRAM) $(ADFILE) + install -d $(bindir) $(mandir) + install --mode=0755 $(PROGRAM) $(bindir) + install --mode=0644 $(ADFILE) $(appdir) + install -d ${prefix}/man/man1 + install -d ${prefix}/bin + install -d ${prefix}/etc/X11/app-defaults + + +shar: ; shar README Makefile dclock.man ${HFILES} ${SRCS} > dclock.shar + +tar: ; tar fcv - README Makefile dclock.man ${HFILES} ${SRCS} | \ + compress > dclock.tar.Z --- dclock-2.1.2.orig/debian/menu +++ dclock-2.1.2/debian/menu @@ -0,0 +1,2 @@ +?package(dclock):command="/usr/bin/dclock" needs="X11" \ + section="Apps/Tools" title="dclock" --- dclock-2.1.2.orig/debian/control +++ dclock-2.1.2/debian/control @@ -0,0 +1,18 @@ +Source: dclock +Section: x11 +Priority: optional +Maintainer: Adrian Bridgett +Build-depends: debhelper (>=4), xutils, libxt-dev +Standards-Version: 3.6.2.1 + +Package: dclock +Architecture: any +Depends: ${shlibs:Depends} ${misc:Depends} +Recommends: sox +Description: Digital clock for the X Window System with flexible display + Dclock main feature is its great flexibility in how it can draw. You can + even display the output from "date" in it such as "Wednesday, 3rd Jan". + Dclock also supports setting an alarm. + . + You need the package sox if you want to enable sound for alarm and + hourly bells (rather than beeps) --- dclock-2.1.2.orig/debian/rules +++ dclock-2.1.2/debian/rules @@ -0,0 +1,63 @@ +#!/usr/bin/make -f + +# This script uses debhelper by Joey Hess +export DH_VERBOSE=1 +export DH_COMPAT=4 + +DEB=debian/dclock + +PROGRAM= dclock +SRCS= Dclock.c dclock.c +OBJS= Dclock.o dclock.o +HFILES= Dclock.h DclockP.h patchlevel.h + +CFLAGS= -O +LDFLAGS= +LIBS= -lm -lXt -lX11 + +$(PROGRAM): ${OBJS} + ${CC} ${LDFLAGS} ${OBJS} ${LIBS} -o $(PROGRAM) + +build: build-stamp +build-stamp: $(PROGRAM) + dh_testdir + touch build-stamp + +clean: + dh_testdir + rm -f build-stamp + rm -f $(PROGRAM) ${OBJS} + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + +binary-indep: build install +binary-arch: build install +# dh_testversion 2 + dh_testdir + dh_testroot + dh_installdebconf + dh_installdirs usr/bin usr/share/sounds etc/X11/app-defaults + # move files into debian/tmp + cp $(PROGRAM) $(DEB)/usr/bin + cp sounds/* $(DEB)/usr/share/sounds + cp Dclock.ad $(DEB)/etc/X11/app-defaults/DClock + dh_installdocs TODO + dh_installmenu + dh_installman $(PROGRAM).1 + dh_installchangelogs + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary --- dclock-2.1.2.orig/debian/changelog +++ dclock-2.1.2/debian/changelog @@ -0,0 +1,114 @@ +dclock (2.1.2-8) unstable; urgency=low + + * fix FTBFS (X11's imake build procedure is gone). Thanks to Harri + Dunkel for the patch (closes: #363055) + + -- Adrian Bridgett Sun, 9 Jul 2006 09:50:08 +0100 + +dclock (2.1.2-7) unstable; urgency=low + + * allow overriding of bellFile sound and alarmFile sounds. + Based on a patch by Nadim Shaikli (closes: #289780) + * upgrade DH_COMPAT to v4 + + -- Adrian Bridgett Mon, 29 Aug 2005 14:06:08 +0100 + +dclock (2.1.2-6) unstable; urgency=low + + * ACK of NMU + * disable external sounds if we have problems using them (closes: #266359) + * only ring the alarm bell once, not as many times as we can in 5seconds + + -- Adrian Bridgett Tue, 7 Sep 2004 10:46:11 +0100 + +dclock (2.1.2-5.1) unstable; urgency=low + + * Non-maintainer upload + * Dclock.c, playbell(): print error and exit if audio player can not + be execv'ed (closes: #253704) + * recommend package 'sox' to enable sound and explain it in the package + description (closes: #234258) + * build-depend on debhelper >= 2 (closes: #259729) + + -- Martin Pitt Fri, 16 Jul 2004 14:26:56 +0200 + +dclock (2.1.2-5) unstable; urgency=low + + * manpage didn't mention -noblink option (closes: #227068) + thanks to Sven Rudolph for spotting this and providing a patch. + + -- Adrian Bridgett Sun, 18 Jan 2004 13:44:46 +0000 + +dclock (2.1.2-4) unstable; urgency=low + + * s/miltime/militaryTime/ for X resource in manpage (closes: #198669) + + -- Adrian Bridgett Tue, 24 Jun 2003 21:37:37 +0100 + +dclock (2.1.2-3) unstable; urgency=low + + * lintian fixes + * darn typo in last changelog - let's close it here (closes: #185864) + + -- Adrian Bridgett Sat, 31 May 2003 22:01:50 +0100 + +dclock (2.1.2-2) unstable; urgency=low + + * patch from Robert Macomber to stop dclock missing some updates. + I've actually only added 1 onto next_intr, as I can explain that, but + not 100 (close: #185864) + + -- Adrian Bridgett Mon, 21 Apr 2003 19:02:40 +0100 + +dclock (2.1.2-1) unstable; urgency=low + + * slightly newer code at upstream location (I've named it 2.1.2) + * build-depends were right, mark bug as fixed (closes: #122166) + * app-defaults file was wrongly named. Set dclock.input:true to fix + a WM interaction(closes: #98840) + + -- Adrian Bridgett Sat, 2 Feb 2002 21:26:38 +0000 + +dclock (2.1.1-6) unstable; urgency=low + + * add some build-depends for #122166 + + -- Adrian Bridgett Mon, 3 Dec 2001 18:53:36 +0000 + +dclock (2.1.1-5) unstable; urgency=low + + * refer to the X Window System properly (close: #119841) + + -- Adrian Bridgett Sun, 2 Dec 2001 14:32:00 +0000 + +dclock (2.1.1-4) unstable; urgency=low + + * app-defaults files must be marked conffiles + + -- Adrian Bridgett Sun, 4 Mar 2001 18:55:21 +0000 + +dclock (2.1.1-3) unstable; urgency=low + + * use time.h not sys/time.h (closes: #86957) + + -- Adrian Bridgett Sat, 3 Mar 2001 15:33:23 +0000 + +dclock (2.1.1-2) unstable; urgency=low + + * use new app-defaults location (closes: #86265) + + -- Adrian Bridgett Sun, 18 Feb 2001 20:31:10 +0000 + +dclock (2.1.1-1) unstable; urgency=low + + * new upstream (thanks to Harald Dunkel) + NB: The version number _hadn't_ changed upstream + * use /usr/share/sounds like other programs (closes: #79159) + + -- Adrian Bridgett Tue, 26 Dec 2000 18:50:50 +0000 + +dclock (2.1-1) unstable; urgency=low + + * initial release. + + -- Adrian Bridgett Mon, 3 Jan 2000 14:47:11 +0000 --- dclock-2.1.2.orig/debian/copyright +++ dclock-2.1.2/debian/copyright @@ -0,0 +1,5 @@ +dclock (c) Dan Heller , Tim Edwards +released under the GPL (see /usr/share/common-licenses). + +Packaged by Adrian Bridgett from sources obtained +at http://bach.ece.jhu.edu/~tim/programs/archive/dclock.tar.gz