[Pkg-wmaker-commits] [wmcalc] 02/65: Imported Debian patch 0.3-2

Doug Torrance dtorrance-guest at moszumanska.debian.org
Sun Aug 23 13:53:59 UTC 2015


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

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

commit 7bb1644fe750977e1f943a022ef35bd2469a00f5
Author: Gordon Fraser <gordon at debian.org>
Date:   Tue Feb 5 11:44:36 2002 +0100

    Imported Debian patch 0.3-2
---
 Makefile         |  12 ++++++
 debian/changelog |  17 ++++++++
 debian/conffiles |   1 +
 debian/control   |  15 +++++++
 debian/copyright |  12 ++++++
 debian/dirs      |   3 ++
 debian/docs      |   1 +
 debian/manpages  |   1 +
 debian/menu      |   2 +
 debian/rules     |  61 +++++++++++++++++++++++++++++
 debian/wmcalc.1  | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 wmcalc.c         |   5 ++-
 wmcalc.conf      |  35 +++++++++++++++++
 wmcalc_c.h       |   1 +
 wmcalcswitch.c   |  27 ++++++++++---
 15 files changed, 302 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 5008008..ccc305a 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,14 @@ LIBS = -lX11 -lXpm -lXext -lm
 
 TARGET = wmcalc
 OBJECTS = wmcalc.o readln.o wmcalcswitch.o wmcalcfunc.o
+DESTDIR =
+PREFIX = /usr/local
+BINDIR = ${PREFIX}/bin
+MANDIR = ${PREFIX}/share/man
+CONF   = /etc
+INSTALL = /usr/bin/install
+INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755
+INSTALL_FILE    = $(INSTALL) -p -o root -g root -m 644
 
 .c.o:
 	gcc -O2 -c -Wall ${INCLUDES} ${FLAGS} $< -o $*.o
@@ -14,3 +22,7 @@ ${TARGET}: ${OBJECTS}
 clean::
 	for i in ${OBJECTS}; do if [ -e $$i ] ; then rm $$i; fi; done 
 	if [ -e ${TARGET} ] ; then rm ${TARGET}; fi
+
+install::
+	${INSTALL_PROGRAM} wmcalc ${DESTDIR}${BINDIR}
+	${INSTALL_FILE} wmcalc.conf ${DESTDIR}${CONF}
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..2546b33
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,17 @@
+wmcalc (0.3-2) unstable; urgency=low
+
+  * Updated manpage
+  * Removed unused files
+  * Removed compiler warnings
+
+ -- Gordon Fraser <gordon at debian.org>  Tue,  5 Feb 2002 11:44:36 +0100
+
+wmcalc (0.3-1) unstable; urgency=low
+
+  * Initial Release - (Closes: #113948)
+
+ -- Gordon Fraser <gordon at freakzone.net>  Wed, 19 Sep 2001 21:33:45 +0200
+
+Local variables:
+mode: debian-changelog
+End:
diff --git a/debian/conffiles b/debian/conffiles
new file mode 100644
index 0000000..7f7ab91
--- /dev/null
+++ b/debian/conffiles
@@ -0,0 +1 @@
+/etc/wmcalc.conf
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..79b9056
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,15 @@
+Source: wmcalc
+Section: x11
+Priority: optional
+Maintainer: Gordon Fraser <gordon at freakzone.net>
+Build-Depends: debhelper (>> 3.0.0), xlibs-dev
+Standards-Version: 3.5.2
+
+Package: wmcalc
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Dockable calculator application
+ Wmcalc is a small calculator meant for the WindowMaker dock or
+ Afterstep Wharf. It is a simple calculator with basic functions and memory
+ slots, and can launch any external application for more complex
+ calculations.
\ No newline at end of file
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..e0ffcd9
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,12 @@
+This package was debianized by Gordon Fraser <gordon at freakzone.net> on
+Wed, 19 Sep 2001 21:33:45 +0200.
+
+It was downloaded from http://members.access1.net/ehflora/
+
+Upstream Author: Edward H. Flora <ehflora at access1.net>
+
+Copyright:
+
+Wmcalc is released under the GNU General Public License, version 2 or
+greater, found on Debian GNU/Linux systems in the file
+/usr/share/common-licenses/GPL
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..6ace571
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1,3 @@
+usr/bin
+usr/share/man/man1
+etc
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..e845566
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+README
diff --git a/debian/manpages b/debian/manpages
new file mode 100644
index 0000000..a7194b5
--- /dev/null
+++ b/debian/manpages
@@ -0,0 +1 @@
+debian/wmcalc.1
diff --git a/debian/menu b/debian/menu
new file mode 100644
index 0000000..7dd9fee
--- /dev/null
+++ b/debian/menu
@@ -0,0 +1,2 @@
+?package(wmcalc):needs=X11 section=Apps/Tools hints="Dockapp,Desktop"\
+  title="wmcalc" command="/usr/bin/wmcalc"
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..b4f0a88
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,61 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+export DH_COMPAT=3
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	touch configure-stamp
+
+build: configure-stamp build-stamp
+build-stamp:
+	dh_testdir
+	$(MAKE)
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	-$(MAKE) clean
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	$(MAKE) install DESTDIR=$(CURDIR)/debian/wmcalc PREFIX=/usr
+
+
+# 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_installdocs
+	dh_installmenu
+	dh_installman
+	dh_installinfo
+	dh_installchangelogs 
+	dh_link
+	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 install configure
diff --git a/debian/wmcalc.1 b/debian/wmcalc.1
new file mode 100644
index 0000000..630a4ad
--- /dev/null
+++ b/debian/wmcalc.1
@@ -0,0 +1,117 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH WMCALC 1 "September 20, 2001"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+wmcalc \- dockable calculator application
+.SH SYNOPSIS
+.B wmcalc
+[-g \fIgeometry\fP] [-d \fIdisplay\fP] [-v] [-f \fIconfigfile\fP] [-h]
+
+.SH DESCRIPTION
+This manual page documents briefly the
+.B wmcalc
+command.
+This manual page was written for the Debian GNU/Linux distribution
+because the original program does not have a manual page.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics, 
+.\" respectively.
+\fBwmcalc\fP is a program designed to act as a simple calculator offering basic operations like addition, subtraction, multiplication, division, square and squareroot.  It is different from other calculator programs, however in that it is designed to take up very little desktop space.  As such, it can be left running on the desktop at all times.  It is intended to placed in the WindowMaker dock, or in Wharf under Afterstep, though it should run as well under any window manager. 
+
+
+Buttons are defined as:
+.nf
+ ____________________  
+|       x00          |  x = 1 for Left Mouse Button
+| 0 1 2 3 4 5 6 7 8 9|  x = 2 for Middle Mouse Button
+|--------------------|  x = 3 for Right Mouse Button 
+|x01 x02 x03 x04 x05 |                
+|x06 x07 x08 x09 x10 |  Note: the numbers 0..9 are the
+|x11 x12 x13 x14 x15 |         indicators for memory cells  
+|x16 x17 x18 x19 x20 |         0..9 respectively
+ -------------------- 
+.fi
+.TP
+Button Functions:
+.TP
+.B 100
+Reinitialize the calculator. (100 = Left Mouse Button on Display)
+.TP
+.B 200
+Clear all the memory registers (0..10)
+.TP
+.B 300
+Clear the current number being entered only
+.TP
+.B x11
+Start a program defined by CalcStart variable in config file
+.TP
+.B 1yy
+Perform function shown on button
+.TP
+.B 2yy
+Recall number from memory location [0-9] to display for calculation if yy = 2,3,4, 7,8,9, 12, 13, 14, 17 otherwise, can run a user-defined function (not implemented)
+.TP
+.B 3yy
+Store Displayed number in memory location [0-9] if yy = 2,3,4, 7,8,9, 12,13,14, 17 otherwise, can run a user-defined function (not implemented)
+.TP
+.B 1xx
+Hopefully the other functions are obvious from their button graphics.
+
+
+.SH OPTIONS
+.TP
+.B \-g <geometry>
+Window Geometry - ie: 64x64+10+10
+.TP
+.B \-d  <display>
+Display -  ie: 127.0.0.1:0.0
+.TP
+.B \-f  <filename>
+Full path to configuration file.
+.TP
+.B \-v
+Verbose Mode. 
+.TP
+.B \-h
+Help.
+.SH FILES
+.TP
+.I /etc/wmbutton.conf
+system wide wmbutton configuration file which will be used for all users who start wmcalc the first time.
+.TP
+.I ~/.wmcalc
+The configuration file (.wmcalc) is written by wmcalc whenever the user requests to store a number to memory. This file is automatically created the first time a user launches wmcalc with /etc/wmcalc.conf as template. As a part of this process, a file is written to /tmp. If /tmp is not accessible, it tries in the user's home directory, as defined by the environment variable HOME. This file is erased as soon as it is written over the main configuration file.
+.SH CONFIGURATION
+.TP
+The configuration file is case sensitive. A # starts a comment, and lines consisting entirely of whitespace are ignored. The syntax is simply:
+.TP
+.B <variable> <content>
+Where <variable> and <content> need to be seperated by a Tab \\t and \fBnot\fP spaces.
+.TP
+\fBmem0 - mem9\fP Calculator Memory Locations. These must all exist, though they may be in any order.
+.TP
+\fBCalcStart\fP The CalcStart variable is intended to allow the user to start a larger calculator for more complicated needs.  Everything after the tab '\\t' character is sent unmodified in a system() call, so anything you can type at the command prompt may be put here.
+.TP
+\fBImagChar\fP The ImagChar variable allows the user to choose between 'i' and 'j' to represent the sqrt(-1).
+
+.SH AUTHOR
+wmcalc was written by Edward H. Flora <ehflora at access1.net>, and is licensed under the terms of the GNU  General Public License.
+.TP
+This manual page was written by Gordon Fraser <gordon at freakzone.net>, for the Debian GNU/Linux system (but may be used by others).
+
diff --git a/wmcalc.c b/wmcalc.c
index 64f51c6..19990a6 100644
--- a/wmcalc.c
+++ b/wmcalc.c
@@ -90,6 +90,7 @@ char *app_name = "wmcalc";     /* Name of app, for window management */
     01/17/01   Updated to use XLookupString to get KeySym
     11/09/00   Added Events for focus and keyboard work.
     11/01/00   File Header Added
+    21/09/01   Added global configfile by Gordon Fraser
  ****************************************************************/
 int main( int argc, char **argv ) {
   XEvent report;
@@ -107,6 +108,7 @@ int main( int argc, char **argv ) {
   int bufsize = 20;
   int chcnt = 0;
   
+
   strcpy(configfile, getenv("HOME"));  // Added to wmbutton by Casey Harkin, 3/6/99
   strcat(configfile, CONFFILENAME);    // Fixed Bug - didn't look in home directory
                                        // but startup directory
@@ -428,7 +430,7 @@ void redraw() {
   flush_expose( iconwin ); 
   XCopyArea(display, visible.pixmap, iconwin, gc, 0, 0,
 	    visible.attributes.width, visible.attributes.height, 0, 0 );
-  if ( Verbose ) printf("In Redraw()\n");	
+  //  if ( Verbose ) printf("In Redraw()\n");	
   displaystr();
 }  /***** End of function redraw() ********************************/
 
@@ -471,7 +473,6 @@ int whichButton( int x, int y ) {
  ****************************************************************/
 int whichKey (KeySym keysym) {
   extern int      Verbose;
-  extern Display  *display;
   int        func   = NO_BUTTON;
 
   if (Verbose) printf("KeySym 0x%x received, decoding...\n", (int) keysym);
diff --git a/wmcalc.conf b/wmcalc.conf
new file mode 100644
index 0000000..d6f110d
--- /dev/null
+++ b/wmcalc.conf
@@ -0,0 +1,35 @@
+# wmcalc Configuration File
+# Last Manual Update: 10/29/00
+
+# General Notes: 
+# * There must be a tab character '\t' between the variable name and
+#   the value, not a series of spaces.
+# * wmcalc is case sensitive when reading these variables.  Examine the 
+#   wmcalc_g.h file for currently defined variables.
+
+#Calculator Memory Locations 
+#Note: These must all exist, though they may be in any order
+Mem0	0.000000
+Mem1	0.000000
+MEM2	2.718282
+MEM3	3.141593
+Mem4	0.000000
+Mem5	0.000000
+Mem6	0.000000
+Mem7	0.000000
+Mem8	0.000000
+Mem9	0.000000
+
+# The CalcStart variable is intended to allow the user to start a larger
+# calculator for more complicated needs.  Everything after the tab '\t' 
+# character is sent unmodified in a system() call, so anything you can type
+# at the command prompt may be put here.
+#CalcStart	xterm -T "Basic Calculator" -e bc &
+#CalcStart	xterm -T "gnuplot" -sb -sl 500 -e gnuplot &
+CalcStart	xcalc &
+
+# The ImagChar variable allows the user to choose between 'i' and 'j' to 
+# represent the sqrt(-1).  (Electrical Engineers (such as myself) use 'j' 
+# rather than 'i.')
+#ImagChar	i
+ImagChar	j
diff --git a/wmcalc_c.h b/wmcalc_c.h
index 675cb1f..6481d14 100644
--- a/wmcalc_c.h
+++ b/wmcalc_c.h
@@ -17,6 +17,7 @@
 #define CALC_CMD_SIZE 128
 #define CONFFILENAME  "/.wmcalc"
 #define CONFTEMPFILE  "/tmp/wmcalc.tmp"
+#define CONFIGGLOBAL  "/etc/wmcalc.conf"
 #define VER           0
 #define REL           3
 
diff --git a/wmcalcswitch.c b/wmcalcswitch.c
index 84cd9d2..f8b9846 100644
--- a/wmcalcswitch.c
+++ b/wmcalcswitch.c
@@ -399,10 +399,16 @@ int write_config(void) {
 
   /* Open current Config file */
   if ((fp = fopen(configfile, "r")) == NULL) {  // Can't find config file
-    printf("%s: Configuration File not found\n", configfile);
+    printf("%s: Cannot create configuration file\n", configfile);
     return(ERR_FILE_NOT_FOUND);
   }
 
+  /* We cannot write to the global config-file... */
+  if(!strcmp(configfile, CONFIGGLOBAL)) {
+    strcpy(configfile, getenv("HOME"));  // Added to wmbutton by Gordon Fraser, 9/21/01
+    strcat(configfile, CONFFILENAME);    
+  }
+
   /* Open Temporary File */
   if ((fptmp = fopen(tempfile, "w")) == NULL) {  // Can't open file in /tmp
     fprintf(stderr, "%s: Temporary File Open Failed\n", tempfile);
@@ -476,12 +482,18 @@ int read_config(void) {
   char *sepstr = NULL;
   char  sep_ch = '\t';
   char *cfg_var_ptr = NULL;
-  
+
+
   sepstr = &sep_ch;
 
-  if ((fp = fopen(configfile, "r")) == NULL) {  // Can't find config file
-    fprintf(stderr, "%s: Configuration File not found\n", configfile);
-    return(ERR_FILE_NOT_FOUND);
+  if ((fp = fopen(configfile, "r")) == NULL) {    // Can't find config file
+    strcpy(configfile, CONFIGGLOBAL);             // ...so try to open global config
+    if ((fp = fopen(configfile, "r")) == NULL) {  // Can't find global config file
+      fprintf(stderr, "%s: Configuration File not found\n", configfile);
+      return(ERR_FILE_NOT_FOUND);
+    } else {
+      write_config();                             // if global config opened, save in homedir
+    }
   }
   else {
     if (Verbose) printf("%s: Found Configuration File\n", configfile);
@@ -498,7 +510,7 @@ int read_config(void) {
 					      understood */
 	i = 0;
 	/* Loop while we haven't found the variable */
-	while (((strncmp(line, CfgVarList[i], strlen(CfgVarList[i]))) != NULL)
+	while (((strncmp(line, CfgVarList[i], strlen(CfgVarList[i]))) != 0)
 	       && (i < MAX_LABEL)) {
 	  i++;
 	}
@@ -586,5 +598,8 @@ int read_config(void) {
   } while (line != NULL);
 
   fclose(fp);
+
+
+
   return(err_code);
 } /***** End of function read_config **************************/

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



More information about the Pkg-wmaker-commits mailing list