[Pkg-wmaker-commits] [wmtime] 24/101: Imported Debian patch 1.0b2-9

Doug Torrance dtorrance-guest at moszumanska.debian.org
Mon Aug 24 23:59:25 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmtime.

commit 8d3513c94a2950f2b2fd24a9d4ed404d1b14a0f1
Author: Simon Law <sfllaw at debian.org>
Date:   Tue Aug 10 21:15:53 2004 -0400

    Imported Debian patch 1.0b2-9
---
 debian/changelog         |  32 +++++++++
 debian/compat            |   1 +
 debian/control           |  27 ++++---
 debian/copyright         |  41 ++++++-----
 debian/examples          |   1 +
 debian/manpages          |   1 +
 debian/menu              |   6 ++
 debian/r                 |  75 ++++++++++++++++++++
 debian/rules             |  62 +++++++++++++----
 debian/wmtime.menu       |   5 --
 debian/wmtimerc          |   3 +
 wmgeneral/wmgeneral.c    |  24 +++++--
 wmtime/Makefile          |  10 ++-
 wmtime/wmtime-master.xpm |  66 +++++++++---------
 wmtime/wmtime.1          | 178 +++++++++++++++++++++++++++++++++++++++++++++++
 wmtime/wmtime.c          | 171 +++++++++++++++++++++++++--------------------
 16 files changed, 532 insertions(+), 171 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a93ae13..342b4d6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,35 @@
+wmtime (1.0b2-9) unstable; urgency=medium
+
+  * Fixed build dependencies so we no longer depend on libxpm4-dev.
+  * Quoted all strings in /usr/lib/menu/wmtime.
+
+ -- Simon Law <sfllaw at debian.org>  Tue, 10 Aug 2004 21:15:53 -0400
+
+wmtime (1.0b2-8) unstable; urgency=low
+
+  * Fixed more problems in wmtime.1
+  * Add a Debian menu entry for WMTime.
+
+ -- Simon Law <sfllaw at debian.org>  Wed, 26 Nov 2003 23:16:11 -0500
+
+wmtime (1.0b2-7) unstable; urgency=low
+
+  * Corrected some usage information.
+  * Fixed some problems in wmtime.1
+
+ -- Simon Law <sfllaw at debian.org>  Thu, 13 Nov 2003 01:29:24 -0500
+
+wmtime (1.0b2-6) unstable; urgency=low
+
+  * New maintainer.
+  * Added a manual page for wmtime.  It was inspired by Adriaan Peeters'
+    work.  (Closes: Bug#181684)
+  * Added the -geometry option.  (Closes: Bug#182278, Bug#212426)
+  * Added the -noseconds option.  (Closes: Bug#25438)
+  * Fixed some buffer overflow problems.
+
+ -- Simon Law <sfllaw at debian.org>  Thu, 09 Oct 2003 17:52:34 -0400
+
 wmtime (1.0b2-5) unstable; urgency=low
 
   * Forgot to update menu entry with new path (closes: #142461)
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..b8626c4
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+4
diff --git a/debian/control b/debian/control
index fed4081..08109d9 100644
--- a/debian/control
+++ b/debian/control
@@ -1,24 +1,21 @@
 Source: wmtime
 Section: x11
 Priority: optional
-Maintainer: Fredrik Hallenberg <hallon at debian.org>
-Standards-Version: 3.5.6
-Build-Depends: debhelper, libxpm4-dev
+Maintainer: Simon Law <sfllaw at debian.org>
+Standards-Version: 3.6.1
+Build-Depends: debhelper (>> 4.0.0), libx11-dev, libxpm-dev, libxext-dev
 
 Package: wmtime
 Architecture: any
-Depends: ${shlibs:Depends}
-Description: Displays time and date
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Window Maker dockapp that displays the time and date
  WMTime displays the time and date and gives you some nice additional 
- features too. It is intended for docking in WindowMaker.
+ features too.  It is intended for docking in Window Maker.
  .
- WMTime currently provides:
+ It currently provides:
  .
-   * Time and date;
-   * Realtime morphing UI (analog <> digital mode);
-   * Autoscaling and anti aliased hands;
-   * Locale, can display DAY and DATE in various languages;
-   * Can launch 3 user definable commands through ~/.wmtimerc;
-   * Can be run multiple times;
-   * Commandline options for help (-h), version (-v), digital
-     clock mode (-digital) and and display (-d)
+   * the time and date;
+   * a realtime morphing interface (analog <> digital mode);
+   * auto-scaled and anti-aliased hands;
+   * localization: displaying the day and date in various languages;
+   * three user-defined commands to launch.
diff --git a/debian/copyright b/debian/copyright
index 3c80bb3..03dc4b2 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -3,27 +3,26 @@ Wed, 15 Jul 1998 18:18:07 +0200.
 
 It was downloaded from http://www.xs4all.nl/~warp/files/wmtime-1.0b2.tar.gz
 
-Copyright:
-
-WMTime.app is copyright (c) 1997, 1998 by Martijn Pieterse and
-Antoine Nulle and licensed through the GNU General Public License. 
-
-This program is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
-later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Upstream Authors: Martijn Pieterse <pieterse at xs4all.nl>
+                  Antoine Nulle <warp at xs4all.nl>
+
+Upstream Copyright:
+
+    Copyright (c) 1997, 1998 by Martijn Pieterse and Antoine Nulle
+    
+    This program is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2, or (at your option) any
+    later version.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+    
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 On Debian GNU/Linux systems, the complete text of the GNU General
 Public License can be found in `/usr/share/common-licenses/GPL'.
-
-
diff --git a/debian/examples b/debian/examples
new file mode 100644
index 0000000..3d67ade
--- /dev/null
+++ b/debian/examples
@@ -0,0 +1 @@
+debian/wmtimerc
diff --git a/debian/manpages b/debian/manpages
new file mode 100644
index 0000000..b9617db
--- /dev/null
+++ b/debian/manpages
@@ -0,0 +1 @@
+wmtime/wmtime.1
diff --git a/debian/menu b/debian/menu
new file mode 100644
index 0000000..99b8cef
--- /dev/null
+++ b/debian/menu
@@ -0,0 +1,6 @@
+?package(wmtime):\
+	needs="X11"\
+	section="Apps/Tools"\
+	title="WMTime"\
+	command="/usr/bin/wmtime"\
+	hints="Clocks,Dockapp"
diff --git a/debian/r b/debian/r
new file mode 100644
index 0000000..fa2ee13
--- /dev/null
+++ b/debian/r
@@ -0,0 +1,75 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# This file is public domain software, originally written by Joey Hess. 
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+
+	# Add here commands to compile the package.
+	cd wmtime; $(MAKE)
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp
+
+	# Add here commands to clean up after the build process.
+	-cd wmtime; $(MAKE) clean
+	#-$(MAKE) distclean
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	# Add here commands to install the package into debian/<packagename>
+	install -m 755 wmtime/wmtime `pwd`/debian/wmtime/usr/bin
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs
+	dh_installdocs
+	dh_installexamples
+#	dh_install
+	dh_installmenu
+#	dh_installdebconf	
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installcatalogs
+#	dh_installpam
+#	dh_installmime
+#	dh_installinit
+#	dh_installcron
+#	dh_installinfo
+#	dh_undocumented
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_perl
+#	dh_python
+#	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/debian/rules b/debian/rules
index 0b66957..7903d30 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,12 +1,41 @@
 #!/usr/bin/make -f
+#
+# debian/rules file for wmtime.
+# Copyright (C) 2003  Software in the Public Interest.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# 
+# Based on the sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -g
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+	INSTALL_PROGRAM += -s
+endif
+
 build: build-stamp
+
 build-stamp:
 	dh_testdir
 
+	# Add here commands to compile the package.
 	cd wmtime; $(MAKE)
 
 	touch build-stamp
@@ -14,22 +43,21 @@ build-stamp:
 clean:
 	dh_testdir
 	dh_testroot
-	rm -f build-stamp install-stamp
+	rm -f build-stamp 
 
+	# Add here commands to clean up after the build process.
 	-cd wmtime; $(MAKE) clean
 
 	dh_clean
 
-install: install-stamp
-install-stamp: build-stamp
+install: build
 	dh_testdir
 	dh_testroot
 	dh_clean -k
 	dh_installdirs
 
-	install -m 755 wmtime/wmtime `pwd`/debian/tmp/usr/bin
-
-	touch install-stamp
+	# Add here commands to install the package into debian/wmtime.
+	install -m 755 wmtime/wmtime $(CURDIR)/debian/wmtime/usr/bin
 
 # Build architecture-independent files here.
 binary-indep: build install
@@ -37,24 +65,32 @@ binary-indep: build install
 
 # Build architecture-dependent files here.
 binary-arch: build install
-#	dh_testversion
 	dh_testdir
 	dh_testroot
+	dh_installdebconf
+	dh_installdocs
+	dh_installexamples
 	dh_installmenu
-	dh_installdocs BUGS HINTS README TODO
-	dh_undocumented wmtime.1
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_installinit
+#	dh_installcron
+	dh_installman
+#	dh_installinfo
 	dh_installchangelogs CHANGES
+	dh_link
 	dh_strip
 	dh_compress
 	dh_fixperms
+#	dh_makeshlibs
 	dh_installdeb
+#	dh_perl
 	dh_shlibdeps
 	dh_gencontrol
 	dh_md5sums
 	dh_builddeb
 
-source diff:                                                                  
-	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary
+.PHONY: build clean binary-indep binary-arch binary install 
diff --git a/debian/wmtime.menu b/debian/wmtime.menu
deleted file mode 100644
index e112468..0000000
--- a/debian/wmtime.menu
+++ /dev/null
@@ -1,5 +0,0 @@
-?package(wmtime):\
-  needs=X11\
-  section=Apps/Tools hints="Clocks"\
-  title="wmtime"\
-  command="/usr/bin/wmtime"
diff --git a/debian/wmtimerc b/debian/wmtimerc
new file mode 100644
index 0000000..b4578b2
--- /dev/null
+++ b/debian/wmtimerc
@@ -0,0 +1,3 @@
+left: xterm
+middle: xload
+right: xcalc
diff --git a/wmgeneral/wmgeneral.c b/wmgeneral/wmgeneral.c
index a4f13c1..bd8f8a0 100644
--- a/wmgeneral/wmgeneral.c
+++ b/wmgeneral/wmgeneral.c
@@ -12,6 +12,8 @@
 	---
 	CHANGES:
 	---
+	10/10/2003 (Simon Law, sfllaw at debian.org)
+		* changed the parse_rcfile function to use getline instead of fgets.
 	02/05/1998 (Martijn Pieterse, pieterse at xs4all.nl)
 		* changed the read_rc_file to parse_rcfile, as suggester by Marcelo E. Magallon
 		* debugged the parse_rc file.
@@ -21,6 +23,7 @@
 
 */
 
+#define _GNU_SOURCE
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -83,17 +86,18 @@ int CheckMouseRegion(int, int);
 void parse_rcfile(const char *filename, rckeys *keys) {
 
 	char	*p;
-	char	temp[128];
+	char	*line = NULL;
+	size_t  line_size = 0;
 	char	*tokens = " :\t\n";
 	FILE	*fp;
 	int		i,key;
 
 	fp = fopen(filename, "r");
 	if (fp) {
-		while (fgets(temp, 128, fp)) {
+		while (getline(&line, &line_size, fp) >= 0) {
 			key = 0;
 			while (key >= 0 && keys[key].label) {
-				if ((p = strstr(temp, keys[key].label))) {
+				if ((p = strstr(line, keys[key].label))) {
 					p += strlen(keys[key].label);
 					p += strspn(p, tokens);
 					if ((i = strcspn(p, "#\n"))) p[i] = 0;
@@ -270,6 +274,7 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
 	unsigned int	borderwidth = 1;
 	XClassHint		classHint;
 	char			*display_name = NULL;
+	char			*geometry = NULL;
 	char			*wname = argv[0];
 	XTextProperty	name;
 
@@ -282,7 +287,9 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
 
 	for (i=1; argv[i]; i++) {
 		if (!strcmp(argv[i], "-display")) 
-			display_name = argv[i+1];
+			display_name = argv[++i];
+		else if (!strcmp(argv[i], "-geometry"))
+			geometry = argv[++i];
 	}
 
 	if (!(display = XOpenDisplay(display_name))) {
@@ -307,7 +314,11 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
 	fore_pix = GetColor("black");
 
 	XWMGeometry(display, screen, Geometry, NULL, borderwidth, &mysizehints,
-				&mysizehints.x, &mysizehints.y,&mysizehints.width,&mysizehints.height, &dummy);
+	            &mysizehints.x, &mysizehints.y,
+	            &mysizehints.width, &mysizehints.height, &dummy);
+	if (geometry)
+		XParseGeometry(geometry, &mysizehints.x, &mysizehints.y,
+		               &mysizehints.width, &mysizehints.height);
 
 	mysizehints.width = 64;
 	mysizehints.height = 64;
@@ -364,3 +375,6 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit
 	XMapWindow(display, win);
 
 }
+
+/* vim: ts=4 columns=82
+ */
diff --git a/wmtime/Makefile b/wmtime/Makefile
index 5227739..26b8571 100755
--- a/wmtime/Makefile
+++ b/wmtime/Makefile
@@ -4,12 +4,16 @@ OBJS =	wmtime.o \
 		../wmgeneral/wmgeneral.o \
 		../wmgeneral/misc.o \
 		../wmgeneral/list.o
+XPMS = wmtime-master.xpm wmtime-mask.xbm
+
+CC = gcc
+CFLAGS = -O2
 
 .c.o:
-	cc -c -O2 -Wall $< -o $*.o
+	$(CC) $(CFLAGS) -c -Wall $< -o $*.o
 
-wmtime: $(OBJS)
-	cc -o wmtime $^ $(LIBDIR) $(LIBS)
+wmtime: $(OBJS) $(XPMS)
+	$(CC) $(CFLAGS) -o wmtime $(OBJS) $(LIBDIR) $(LIBS)
 
 clean::
 	for i in $(OBJS) ; do \
diff --git a/wmtime/wmtime-master.xpm b/wmtime/wmtime-master.xpm
index 2d6bc1b..d6571a5 100644
--- a/wmtime/wmtime-master.xpm
+++ b/wmtime/wmtime-master.xpm
@@ -29,44 +29,44 @@ static char * wmtime_master_xpm[] = {
 "    X......................................................o        X......................................................o    ................................",
 "    X.........................OOO..........................o        X......................................................o    ................................",
 "    X.........................OOO+.........................o        X......................................................o    ................................",
-"    X..............@@.........OOO+........@@...............o        X...++++...++++.......++++...++++.......++++...++++....o    ................................",
-"    X..............@@+.........+++........@@+..............o        X..+....+.+....+..+..+....+.+....+..+..+....+.+....+...o    ................................",
-"    X...............++.....................++..............o        X..+....+.+....+..+..+....+.+....+..+..+....+.+....+...o    ................................",
-"    X......................................................o        X..+....+.+....+.....+....+.+....+.....+....+.+....+...o    ................................",
+"    X..............@@.........OOO+........@@...............o        X......................................................o    ................................",
+"    X..............@@+.........+++........@@+..............o        X......................................................o    ................................",
+"    X...............++.....................++..............o        X......................................................o    ................................",
+"    X......................................................o        X......................................................o    ................................",
+"    X......................................................o        X......................................................o    ................................",
+"    X......................................................o        X......................................................o    ................................",
+"    X......@@......................................@@......o        X......................................................o    ................................",
+"    X......@@+.....................................@@+.....o        X......................................................o    ................................",
+"    X.......++......................................++.....o        X......................................................o    ................................",
+"    X......................................................o        X......................................................o    ................................",
+"    X......................................................o        X......................................................o    ................................",
+"    X......................................................o        X......................................................o    ................................",
 "    X......................................................o        X...++++...++++.......++++...++++.......++++...++++....o    ................................",
-"    X......................................................o        X..+....+.+....+.....+....+.+....+.....+....+.+....+...o    ................................",
-"    X......@@......................................@@......o        X..+....+.+....+..+..+....+.+....+..+..+....+.+....+...o    ................................",
-"    X......@@+.....................................@@+.....o        X..+....+.+....+..+..+....+.+....+..+..+....+.+....+...o    ................................",
-"    X.......++......................................++.....o        X...++++...++++.......++++...++++.......++++...++++....o    ................................",
+"    X......................................................o        X..+....+.+....+..+..+....+.+....+..+..+....+.+....+...o    ................................",
+"    X......................................................o        X..+....+.+....+..+..+....+.+....+..+..+....+.+....+...o    ................................",
+"    X..OOO...........................................OOO...o        X..+....+.+....+.....+....+.+....+.....+....+.+....+...o    ................................",
+"    X..OOO+..........................................OOO+..o        X...++++...++++.......++++...++++.......++++...++++....o    ................................",
+"    X..OOO+..........................................OOO+..o        X..+....+.+....+.....+....+.+....+.....+....+.+....+...o    ................................",
+"    X...+++...........................................+++..o        X..+....+.+....+..+..+....+.+....+..+..+....+.+....+...o    ................................",
+"    X......................................................o        X..+....+.+....+..+..+....+.+....+..+..+....+.+....+...o    ................................",
+"    X......................................................o        X...++++...++++.......++++...++++.......++++...++++....o    ................................",
+"    X......................................................o        X......................................................o    ................................",
+"    X......................................................o        X......................................................o    ................................",
 "    X......................................................o        X......................................................o    ................................",
 "    X......................................................o        X......................................................o    ................................",
+"    X......@@......................................@@......o        X......................................................o    ................................",
+"    X......@@+.....................................@@+.....o        X......................................................o    ................................",
+"    X.......++......................................++.....o        X......................................................o    ................................",
 "    X......................................................o        X......................................................o    ................................",
 "    X......................................................o        X......................................................o    ................................",
-"    X......................................................o        oooooooooooooooooooooooooooooooooooooooooooooooooooooooo    ................................",
-"    X......................................................o                                                                    ................................",
-"    X..OOO...........................................OOO...o                                                                    ................................",
-"    X..OOO+..........................................OOO+..o                                                                    ................................",
-"    X..OOO+..........................................OOO+..o                                                                    ................................",
-"    X...+++...........................................+++..o                                                                    ................................",
-"    X......................................................o                                                                    ................................",
-"    X......................................................o                                                                    ................................",
-"    X......................................................o                                                                    ................................",
-"    X......................................................o                                                                    ................................",
-"    X......................................................o                                                                    ................................",
-"    X......................................................o                                                                    ................................",
-"    X......@@......................................@@......o                                                                    ................................",
-"    X......@@+.....................................@@+.....o                                                                    ................................",
-"    X.......++......................................++.....o                                                                    ................................",
-"    X......................................................o                                                                    ................................",
-"    X......................................................o                                                                    ................................",
-"    X......................................................o                                                                    ................................",
-"    X..............@@.....................@@...............o                                                                    ................................",
-"    X..............@@+........OOO.........@@+..............o                                                                    ................................",
-"    X...............++........OOO+.........++..............o                                                                    ................................",
-"    X.........................OOO+.........................o                                                                    ................................",
-"    X..........................+++.........................o                                                                    ................................",
-"    X......................................................o                                                                    ................................",
-"    oooooooooooooooooooooooooooooooooooooooooooooooooooooooo                                                                    ................................",
+"    X......................................................o        X......................................................o    ................................",
+"    X..............@@.....................@@...............o        X......................................................o    ................................",
+"    X..............@@+........OOO.........@@+..............o        X......................................................o    ................................",
+"    X...............++........OOO+.........++..............o        X......................................................o    ................................",
+"    X.........................OOO+.........................o        X......................................................o    ................................",
+"    X..........................+++.........................o        X......................................................o    ................................",
+"    X......................................................o        X......................................................o    ................................",
+"    oooooooooooooooooooooooooooooooooooooooooooooooooooooooo        oooooooooooooooooooooooooooooooooooooooooooooooooooooooo    ................................",
 "                                                                                                                                ................................",
 "                                                                                                                                ................................",
 "    XXXXXXXXXXXXXXXX  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX        XXXXXXXXXXXXXXXX  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX    ................................",
diff --git a/wmtime/wmtime.1 b/wmtime/wmtime.1
new file mode 100644
index 0000000..f17156c
--- /dev/null
+++ b/wmtime/wmtime.1
@@ -0,0 +1,178 @@
+'\" t
+.\" Man page for wmtime
+.\" Copyright (c) 2003  Software in the Public Interest, Inc.
+.\"
+.\" This program is free software; you can redistribute it and/or modify
+.\" it under the terms of the GNU General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or (at
+.\" your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful, but
+.\" WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+.\" General Public License for more details.
+.\"
+.\" You should have received a copy of the GNU General Public License
+.\" along with this program; if not, write to the Free Software
+.\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+.\"
+.TH WMTIME 1 "May 1998" "WMTIME 1.0b2"
+
+.SH NAME
+wmtime \- Window Maker dockapp that displays the time and date
+
+.SH SYNOPSIS
+
+.B wmtime
+[
+.I OPTION
+]
+
+.SH DESCRIPTION
+
+.B WMTime
+displays the time and date and gives you some nice additional
+features too. It is intended for docking in Window Maker.
+
+It currently provides:
+
+.IP \(bu 4
+the time and date;
+
+.IP \(bu
+a realtime morphing interface (analog <> digital mode);
+.IP \(bu
+auto\-scaled and anti\-aliased hands;
+.IP \(bu
+localization, displaying the day and date in various languages;
+.IP \(bu
+three user\-defined commands to launch.
+
+.SH OPTIONS
+
+.TP
+.BR \-d , \ \-digital
+Display the digital clock on startup, instead of the analog clock.
+
+.TP
+.BI \-display \ display
+This option specifies the X server to contact; see
+.IR X(7x) .
+
+.TP
+.BI \-geometry \ geometry
+This option specifies the preferred position of clock; see
+.IR X(7x) .
+
+.TP
+.BR \-n , \ \-noseconds
+Disables the second hand.
+
+.TP
+.B \-h
+Show help information.
+
+.TP
+.B \-v
+Print the version number.
+
+.SH USAGE
+The
+.B WMTime
+window is separated into top and bottom sections.  The top section
+contains a clock and the bottom section contains the date.
+
+The clock can be toggled between analog and digital modes.  To do this,
+click in the bottom section of the window.
+
+WMTime can also be used to launch programs.  You may click either left,
+middle, or right mouse buttons in the top section of the window.  The
+pre\-configured program will be launched according to the mouse button
+clicked.  (see
+.B CONFIGURATION FILE
+below.)
+
+In order to move
+.BR WMTime ,
+drag on the outer edges.  These are not sensitive to mouse clicks.
+
+.SH "DOCKING IN WINDOW MANAGERS"
+
+.TP
+Window Maker
+
+Window Maker users should drag and drop the
+.B WMTime
+window on the Dock.  Then, right\-click on the border of the window and
+select \*(lqSettings...\*(rq.  Check \*(lqStart when Window Maker
+is started\*(rq.
+
+.TP
+AfterStep
+
+AfterStep users should put the following in their
+.I $HOME/.steprc
+
+.RS 16
+Wharf wmtime \- MaxSwallow "wmtime" wmtime &
+.RE
+
+.TP
+Other window managers
+
+.B WMTime
+runs nicely as a 64x64 shaped icon on your desktop.
+
+.SH "CONFIGURATION FILE"
+
+.B WMTime
+can launch three user\-defined commands, triggered by left, middle and
+right mouse button clicks.  You can define the commands to launch in
+.I $HOME/.wmtimerc
+
+.RS
+.PD 0
+left: xterm
+.PP
+middle: xload
+.PP
+right: xcalc
+.PP
+.PD 
+.RE
+
+If
+.B WMTime
+detects a
+.I $HOME/.wmtimerc
+file, it will launch the appropriate command when you click on the clock.
+
+The system administrator can define default commands in
+.IR /etc/wmtimerc .
+The administrator may also choose to \*(lqfix\*(rq particular commands,
+making it impossible for users to change.  These commands can be defined in
+.IR /etc/wmtimerc.fixed ,
+although this isn't a nice thing to do.
+
+.SH FILES
+
+.I /etc/wmtimerc
+.br
+.I $HOME/.wmtimerc
+.br
+.I /etc/wmtimerc.fixed
+
+.SH AUTHORS
+
+.B WMTime
+was written by Martijn Pieterse and Antoine Nulle.
+
+This manual page was written by Simon Law <sfllaw at debian.org> for the
+.B Debian
+system (but may be used by others). It is based on the documentation provided
+by the original program.
+
+This manual is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
diff --git a/wmtime/wmtime.c b/wmtime/wmtime.c
index b6353a1..803b8f5 100644
--- a/wmtime/wmtime.c
+++ b/wmtime/wmtime.c
@@ -26,6 +26,11 @@
 	----
 	Changes:
 	----
+	09/10/2003 (Simon Law, sfllaw at debian.org)
+		* Add -geometry support
+		* Add -noseconds support
+		* Make the digital clock fill the space provided
+		* Eliminated exploitable static buffers
 	17/05/1998 (Antoine Nulle, warp at xs4all.nl)
 		* Updated version number and some other minor stuff
 	16/05/1998 (Antoine Nulle, warp at xs4all.nl)
@@ -50,6 +55,7 @@
 		* Copied the source from wmmon.
 */
 
+#define _GNU_SOURCE
 #include <stdlib.h>
 #include <stdio.h>
 #include <time.h>
@@ -86,55 +92,63 @@
  /* Global Variables */
 /********************/
 
-char	*ProgName;
 int		digital = 0;
+int		noseconds = 0;
 char	day_of_week[7][3] = { "SU", "MO", "TU", "WE", "TH", "FR", "SA" };
 char	mon_of_year[12][4] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
 
 /* functions */
-void usage(void);
+void usage(char *);
 void printversion(void);
 
 void wmtime_routine(int, char **);
 void get_lang();
 
-void main(int argc, char *argv[]) {
+int main(int argc, char *argv[]) {
 
 	int		i;
-	
-
-	/* Parse Command Line */
+	char    *name = argv[0];
 
-	ProgName = argv[0];
-	if (strlen(ProgName) >= 6)
-		ProgName += (strlen(ProgName) - 6);
-	
 	for (i=1; i<argc; i++) {
 		char *arg = argv[i];
 
 		if (*arg=='-') {
 			switch (arg[1]) {
 			case 'd' :
-				if (strcmp(arg+1, "display") && strcmp(arg+1, "digital")) {
-					usage();
-					exit(1);
+				if (strcmp(arg+1, "display")
+				    && strcmp(arg+1, "digital") && strcmp(arg+1, "d")) {
+					usage(name);
+					return 1;
 				}
-				if (!strcmp(arg+1, "digital"))
+				if (!strcmp(arg+1, "digital") || !(strcmp(arg+1, "d")))
 					digital = 1;
 				break;
+			case 'g' :
+				if (strcmp(arg+1, "geometry")) {
+					usage(name);
+					return 1;
+				}
+				break;
+			case 'n' :
+				if (strcmp(arg+1, "noseconds") && strcmp(arg+1, "n")) {
+					usage(name);
+					return 1;
+				} else {
+					noseconds = 1;
+				}
+				break;
 			case 'v' :
 				printversion();
-				exit(0);
-				break;
+				return 0;
 			default:
-				usage();
-				exit(0);
-				break;
+				usage(name);
+				return 1;
 			}
 		}
 	}
 	get_lang();
 	wmtime_routine(argc, argv);
+	return 0;
 }
 
 /************/
@@ -143,19 +157,22 @@ void main(int argc, char *argv[]) {
 void get_lang(){
    FILE *fp;
    int i;
-   char temp[5];
+   const int line_size = 5;
+   char line[line_size];
    
    fp=fopen("language","r");
    if (fp) {
+	   /* Grab the days of the week */
        for (i=0;i<7;i++){
-	   fgets(temp,4,fp);
-	   strncpy(day_of_week[i],temp,2);
+		   fgets(line, line_size, fp);
+		   strncpy(day_of_week[i], line, 2);
        };
+	   /* Grab the names of the months */
        for (i=0;i<12;i++){
-	   fgets(temp,5,fp);
-	   strncpy(mon_of_year[i],temp,3);
+		   fgets(line, line_size, fp);
+		   strncpy(mon_of_year[i], line, 3);
        };
-   	fclose(fp);
+	   fclose(fp);
     };
 }
 
@@ -191,42 +208,38 @@ void wmtime_routine(int argc, char **argv) {
 	long		curtime;
 	long		nexttime;
 
-	char		temp[128];
-	char		*p;
+	char		*conffile = NULL;
 
 	/* Scan through ~/.wmtimerc for the mouse button actions. */
 	if (LEFT_ACTION) left_action = strdup(LEFT_ACTION);
 	if (MIDDLE_ACTION) middle_action = strdup(MIDDLE_ACTION);
 	if (RIGHT_ACTION) right_action = strdup(RIGHT_ACTION);
 
-	/* Scan throught  the .rc files */
-	strcpy(temp, "/etc/wmtimerc");
-	parse_rcfile(temp, wmtime_keys);
-
-	p = getenv("HOME");
-	strcpy(temp, p);
-	strcat(temp, "/.wmtimerc");
-	parse_rcfile(temp, wmtime_keys);
+	/* Scan through the .rc files */
+	if (asprintf(&conffile, "/etc/wmtimerc") >= 0) {
+		parse_rcfile(conffile, wmtime_keys);
+		free(conffile);
+	}
 
-	strcpy(temp, "/etc/wmtimerc.fixed");
-	parse_rcfile(temp, wmtime_keys);
+	if (asprintf(&conffile, "%s/.wmtimerc", getenv("HOME")) >= 0) {
+		parse_rcfile(conffile, wmtime_keys);
+		free(conffile);
+	}
 
+	if (asprintf(&conffile, "/etc/wmtimerc.fixed") >= 0) {
+		parse_rcfile(conffile, wmtime_keys);
+		free(conffile);
+	}
 
 	openXwindow(argc, argv, wmtime_master_xpm, wmtime_mask_bits, 128, 64);
 
-	copyXPMArea(0, 0, 128, 64, 0, 98);
-
-        copyXPMArea(0, 0, 64, 64, 64, 0);
+	/* Mask out the right parts of the clock */
+	copyXPMArea(0, 0, 128, 64, 0, 98);   /* Draw the borders */
+	copyXPMArea(0, 0, 64, 64, 64, 0);    /* Draw the clock face */
+	copyXPMArea(64, 98, 64, 64, 0, 0);   /* Draw the LCD background */
 	setMaskXY(0, 0);
-        if (digital) {
-		copyXPMArea(64, 0, 64, 64, 0, 0);
-		setMaskXY(-64, 0);
-	} else {
-		copyXPMArea(0, 0, 64, 64, 64, 0);
-		setMaskXY(0, 0);
-	}
 
-        /* add mouse region */
+    /* add mouse region */
 	AddMouseRegion(0, 5, 48, 58, 60);
 	AddMouseRegion(1, 5, 5, 58, 46);
 
@@ -285,12 +298,10 @@ void wmtime_routine(int argc, char **argv) {
 
 						if (digital) {
 							copyXPMArea(64, 98, 64, 64, 0, 0);
-							setMaskXY(-64, 0);
 							DrawTime(time_struct->tm_hour, time_struct->tm_min, time_struct->tm_sec);
 							DrawDate(time_struct->tm_wday, time_struct->tm_mday, time_struct->tm_mon);
 						} else {
 							copyXPMArea(0, 98, 64, 64, 0, 0);	
-						        setMaskXY(0, 0);
 							DrawWijzer(time_struct->tm_hour, time_struct->tm_min, time_struct->tm_sec);
 							DrawDate(time_struct->tm_wday, time_struct->tm_mday, time_struct->tm_mon);
 						}
@@ -327,24 +338,28 @@ void wmtime_routine(int argc, char **argv) {
 \*******************************************************************************/
 
 void DrawTime(int hr, int min, int sec) {
-
-	
-	char	temp[16];
-	char	*p = temp;
+	const int time_size = 16;
+	char	time[time_size];
+	char	*p = time;
 	int		i,j,k=6;
 
 	/* 7x13 */
 
-	sprintf(temp, "%02d:%02d:%02d ", hr, min, sec);
+	if (noseconds) {
+		snprintf(time, time_size, "%02d:%02d ", hr, min);
+	}
+	else {
+		snprintf(time, time_size, "%02d:%02d:%02d ", hr, min, sec);
+	}
 
-	for (i=0; i<3; i++) {
+	for (i=0; i < 3; i++) {
 		for (j=0; j<2; j++) {
-			copyXPMArea((*p-'0')*7 + 1, 84, 8, 13, k, 6);
+			copyXPMArea((*p-'0')*7 + 1, 84, 8, 13, k, 18);
 			k += 7;
 			p++;
 		}
 		if (*p == ':') {
-			copyXPMArea(71, 84, 5, 13, k, 6);
+			copyXPMArea(71, 84, 5, 13, k, 18);
 			k += 4;
 			p++;
 		}
@@ -356,15 +371,15 @@ void DrawTime(int hr, int min, int sec) {
 \*******************************************************************************/
 
 void DrawDate(int wkday, int dom, int month) {
-
-	
-	char	temp[16];
-	char	*p = temp;
+	const int date_size = 16;
+	char	date[date_size];
+	char	*p = date;
 	int		i,k;
 
 	/* 7x13 */
 
-	sprintf(temp, "%.2s%02d%.3s  ", day_of_week[wkday], dom, mon_of_year[month]);
+	snprintf(date, date_size,
+			"%.2s%02d%.3s  ", day_of_week[wkday], dom, mon_of_year[month]);
 
 	k = 5;
 	for (i=0; i<2; i++) {
@@ -544,6 +559,9 @@ void DrawWijzer(int hr, int min, int sec) {
 		}
 	}
 	/**********************************************************************/
+	if (noseconds)
+		return;    /* Skip drawing the seconds. */
+
 	psi = sec * (M_PI / 30.0);
 
 	dx = floor(sin(psi) * 22 * 0.9 + 0.5);
@@ -615,15 +633,16 @@ void DrawWijzer(int hr, int min, int sec) {
 |* usage																	   *|
 \*******************************************************************************/
 
-void usage(void) {
-
-	fprintf(stderr, "\nwmtime - programming: tijno, (de)bugging & design: warp, web hosting: bobby\n\n");
-	fprintf(stderr, "usage:\n");
-	fprintf(stderr, "\t-digital\tdigital clock\n");
-	fprintf(stderr, "\t-display <display name>\n");
-	fprintf(stderr, "\t-h\tthis screen\n");
-	fprintf(stderr, "\t-v\tprint the version number\n");
-	fprintf(stderr, "\n");
+void usage(char *name) {
+	printf("Usage: %s [OPTION]...\n", name);
+	printf("WindowMaker dockapp that displays the time and date.\n");
+	printf("\n");
+	printf("  -d, -digital         display the digital clock\n");
+	printf("  -display DISPLAY     contact the DISPLAY X server\n");
+	printf("  -geometry GEOMETRY   position the clock at GEOMETRY\n");
+	printf("  -n, -noseconds       disables the second hand\n");
+	printf("  -h                   display this help and exit\n");
+	printf("  -v                   output version information and exit\n");
 }
 
 /*******************************************************************************\
@@ -631,8 +650,8 @@ void usage(void) {
 \*******************************************************************************/
 
 void printversion(void) {
-
-	if (!strcmp(ProgName, "wmtime")) {
-		fprintf(stderr, "%s\n", WMMON_VERSION);
-	}
+	printf("WMTime version %s\n", WMMON_VERSION);
 }
+
+/* vim: sw=4 ts=4 columns=82
+ */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmtime.git



More information about the Pkg-wmaker-commits mailing list