[Pkg-wmaker-commits] [wmacpi] 48/105: Imported Debian patch 2.1-8

Doug Torrance dtorrance-guest at moszumanska.debian.org
Tue Aug 18 01:13:44 UTC 2015


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

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

commit 577b67c16489da5719972841ce66afb387066023
Author: Sebastian Henschel <shensche at debian.org>
Date:   Fri Apr 20 10:54:39 2007 +1200

    Imported Debian patch 2.1-8
---
 Makefile         |   2 +-
 debian/changelog |  17 ++++++
 debian/control   |   2 +-
 wmacpi.1         |  52 +++++++++++++++++-
 wmacpi.c         | 162 ++++++++++++++++++-------------------------------------
 5 files changed, 122 insertions(+), 113 deletions(-)

diff --git a/Makefile b/Makefile
index 0707ebe..4d53ae1 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ BUILD_CLI = 1
 
 CC	:= gcc
 CFLAGS	:= $(OPT) -Wall -W -g -ansi -I/usr/X11R6/include
-LDFLAGS := $(OPT) -L/usr/X11R6/lib -lX11 -ldockapp
+LDFLAGS := $(OPT) -L/usr/X11R6/lib -lX11 -lXpm -lXext -ldockapp
 
 WMSRC	:= wmacpi.c libacpi.c
 HEADERS := libacpi.h wmacpi.h
diff --git a/debian/changelog b/debian/changelog
index 2cac4b4..8847c54 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,18 @@
+wmacpi (2.1-8) unstable; urgency=low
+
+  * Orphaned package. See you fellas.
+
+ -- Sebastian Henschel <shensche at debian.org>  Fri, 20 Apr 2007 10:54:39 +1200
+
+wmacpi (2.1-7) unstable; urgency=low
+
+  * New upstream release to close several bugs, see below.
+  * debian/control:
+    - Fix display issues with newer versions of libdockapp,
+    closes: #280495, #293546
+
+ -- Sebastian Henschel <shensche at debian.org>  Thu, 22 Feb 2007 17:44:08 +1300
+
 wmacpi (2.1-6) unstable; urgency=low
 
   * wmacpi.c:
@@ -10,6 +25,7 @@ wmacpi (2.1-6) unstable; urgency=low
     - Removed Build-Depends on libxext-dev and libxpm-dev.
 
  -- Sebastian Henschel <shensche at debian.org>  Tue, 26 Sep 2006 13:42:52 +1200
+
 wmacpi (2.1-5) unstable; urgency=low
 
   * wmacpi.c:
@@ -58,6 +74,7 @@ wmacpi (2.1-1) unstable; urgency=low
 
  -- Sebastian Henschel <shensche at debian.org>  Wed,  2 Feb 2005 09:56:55 +0100
 
+
 wmacpi (2.0-1) unstable; urgency=low
 
   * New upstream release which closes: #228047.
diff --git a/debian/control b/debian/control
index b7e4fce..13d609b 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,7 @@
 Source: wmacpi
 Section: x11
 Priority: extra
-Maintainer: Sebastian Henschel <shensche at debian.org>
+Maintainer: Debian QA Group <packages at qa.debian.org>
 Build-Depends: debhelper (>= 4), libx11-dev, x-dev, libdockapp-dev (>=1:0.5.0-1)
 Standards-Version: 3.7.2.0
 
diff --git a/wmacpi.1 b/wmacpi.1
index 1f0c658..47c02c5 100644
--- a/wmacpi.1
+++ b/wmacpi.1
@@ -1,6 +1,8 @@
-.TH WMACPI 1 "February 02 2005"
+.TH WMACPI 1 "August 15 2004"
 .SH NAME
 wmacpi \- Battery status monitor for systems supporting ACPI
+.SH NAME
+acpi \- Query battery status for systems supporting ACPI
 .SH SYNOPSIS
 .B wmacpi
 [
@@ -37,6 +39,25 @@ samples ]
 .RI -h
 ]
 .PP
+.B acpi
+[
+.RI -a
+samples ]
+[
+.RI -v 
+]
+[
+.RI -V
+]
+]
+.RI -b
+]
+[
+.RI -r
+]
+[
+.RI -h
+]
 .SH DESCRIPTION
 This manual page documents briefly the
 .B wmacpi
@@ -55,7 +76,14 @@ and a scrolling message with some hopefully useful information.
 .PP
 Clicking on the window cycles through the batteries that the ACPI
 system knows about.
+.PP
+.B acpi
+queries the battery status from the command line. It prints the power
+status, the percentage remaining for each battery found, and the time
+remaining if the system is on battery, or the time remaining for each
+battery to reach full charge if the batteries are charging.
 .SH OPTIONS
+.B wmacpi
 .TP
 .B \-c percentage
 Set critical low alarm at <value>% (default: 10%).
@@ -86,7 +114,9 @@ works around certain buggy ACPI BIOSes that fail to report the current
 rate.
 .TP
 .B \-w
-Run wmacpi in command line mode.
+Run wmacpi in command line mode - this operates identically to 
+.B acpi
+..
 .TP
 .B \-a num
 Average the time remaining over num samples. This greatly improves the
@@ -107,6 +137,22 @@ Disable scrolling message.
 .TP
 .B \-h
 Display help.
+.TP
+.B acpi
+.TP
+.B \-a num
+Average the time remaining over num samples. This greatly improves the
+accuracy of the reported time remaining.
+.TP
+.B \-v
+Increase the verbosity of the program, as for
+.B wmacpi
+.TP
+.B \-V
+Print the version information.
+.TP
+.B \-h
+Display help.
 .SH AUTHOR
 .B wmacpi
 was originally written by Tim Copperfield <timecop at japan.co.jp>, then
@@ -115,3 +161,5 @@ completely rewritten after 1.34 by Simon Fowler <simon at dreamcraft.com.au>.
 This manual page was originally written by Simon Richter
 <sjr at debian.org> for the Debian GNU/Linux system, and then updated by
 Simon Fowler. 
+.br
+Last modification by Simon Fowler <simon at dreamcraft.com.au>, 2004-08-15.
diff --git a/wmacpi.c b/wmacpi.c
index 7644556..cf15227 100644
--- a/wmacpi.c
+++ b/wmacpi.c
@@ -24,7 +24,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include <getopt.h>
 #include <unistd.h>
 #include <time.h>
 
@@ -137,10 +136,14 @@ static void redraw_window(void)
 static void new_window(char *display, char *name, int argc, char **argv)
 {
     /* Initialise the dockapp window and appicon */
-    char **fake_argv = malloc (sizeof(char) * 7);
-    fake_argv[0] = "wmacpi";
-    DAParseArguments(1, fake_argv, NULL, 0, "", WMACPI_VER);
-    DAInitialize(display, name, 64, 64, argc, argv);
+    /* we don't want libdocapp to parse the command line, but we have to
+       initialize it with DAParseArguments, so we set argc to 1 */
+    DAParseArguments(1, argv, NULL, 0, 
+       "help option done", "version option done");
+    /* deprecated
+       DAInitialize(display, name, 64, 64, argc, argv); */
+    DAOpenDisplay(display, argc, argv);
+    DACreateIcon(name, 64, 64, argc, argv);
     dockapp->display = DADisplay;
     dockapp->win = DAWindow;
 
@@ -564,32 +567,7 @@ void set_batt_id_area(int bno)
     copy_xpm_area(sx, sy, w, h, dx, dy);
 }
 
-void usage(char *name)
-{
-    printf("%s - help\t\t[simon at dreamcraft.com.au]\n\n"
-	   "-d display\t\tdisplay on remote display <display>\n"
-	   "-b\t\t\tenable blinking of various UI elements\n"
-	   "-r\t\t\tdisable scrolling message\n"
-	   "-c value\t\tset critical low alarm at <value> percent\n"
-	   "\t\t\t(default: 10 percent)\n"
-	   "-m <battery number>\tbattery number to monitor\n"
-	   "-s <sample rate>\tnumber of times per minute to sample battery information\n"
-	   "\t\t\tdefault 20 (once every three seconds)\n"
-	   "-f\t\t\tforce the use of capacity mode for calculating time remaining\n"
-	   "-n\t\t\tdo not blink\n"
-	   "-w\t\t\trun in command line mode\n"
-	   "-a <samples>\t\tsamples to average over (cli mode only)\n"
-	   "-v\t\t\tincrease verbosity\n"
-	   "\t\t\tcan be used multiple times to increase verbosity further\n"
-	   "-h\t\t\tdisplay this help\n",
-	   name);
-}
-
-void print_version(void)
-{
-    printf("wmacpi version %s\n", WMACPI_VER);
-    printf(" Using libacpi version %s\n", LIBACPI_VER);
-}
+#define VERSION "wmacpi version " WMACPI_VER "\nUsing libacpi version " LIBACPI_VER
 
 void cli_wmacpi(global_t *globals, int samples)
 {
@@ -643,12 +621,12 @@ void cli_wmacpi(global_t *globals, int samples)
 int main(int argc, char **argv)
 {
     char *display = NULL;
-    int ch;
     int sample_count = 0;
     int batt_reinit, ac_reinit;
     int batt_count = 0;
     int ac_count = 0;
     int cli = 0, samples = 1;
+    int critical = 10;
     int samplerate = 20;
     int sleep_rate = 10;
     int sleep_time = 1000000/sleep_rate;
@@ -658,6 +636,19 @@ int main(int argc, char **argv)
     battery_t *binfo;
     global_t *globals;
 
+    DAProgramOption options[] = {
+     {"-r", "--no-scroll", "disable scrolling message", DONone, False, {NULL}},
+     {"-n", "--no-blink", "disable blinking of various UI elements", DONone, False, {NULL}},
+     {"-x", "--cmdline", "run in command line mode",  DONone, False, {NULL}}, 
+     {"-f", "--force-capacity-mode", "force the use of capacity mode for calculating time remaining", DONone, False, {NULL}},
+     {"-d", "--display", "display or remote display", DOString, False, {&display}},
+     {"-c", "--critical", "set critical low alarm at <number> percent\n                               (default: 10 percent)", DONatural, False, {&critical}},
+     {"-m", "--battery", "battery number to monitor", DONatural, False, {&battery_no}},
+     {"-s", "--sample-rate", "number of times per minute to sample battery information\n                               default 20 (once every three seconds)", DONatural, False, {&samplerate}},
+     {"-v", "--verbosity", "Set verbosity", DONatural, False, {&verbosity}},
+     {"-a", "--samples", "number of samples to average over (cli mode only)",  DONatural, False, {&samples}}, 
+    };
+
     dockapp = calloc(1, sizeof(struct dockapp));
     globals = calloc(1, sizeof(global_t));
 
@@ -678,84 +669,37 @@ int main(int argc, char **argv)
      * are available /before/ we can decide if the battery we want to
      * monitor is available. */
     /* parse command-line options */
-    while ((ch = getopt(argc, argv, "d:c:m:s:a:fhnwbrvV")) != EOF) {
-	switch (ch) {
-	case 'c':
-	    if (optarg) {
-		globals->crit_level = atoi(optarg);
-		if ((globals->crit_level < 0) || (globals->crit_level > 100)) {
-		    fprintf(stderr, "Please use values between 0 and 100%%\n");
-		    globals->crit_level = 10;
-		    fprintf(stderr, "Using default value of 10%%\n");
-		}
-	    }
-	    break;
-	case 'd':
-	    if (optarg)
-		display = strdup(optarg);
-	    break;
-	case 'm':
-	    if (optarg) {
-		battery_no = atoi(optarg);
-		if (battery_no >= MAXBATT) {
-		    fprintf(stderr, "Please specify a battery number below %d\n",
-			    MAXBATT);
-		    return 1;
-		}
-		pinfo("Monitoring battery %d\n", battery_no);
-	    } 
-	    break;
-	case 's':
-	    if (optarg) {
-		samplerate = atoi(optarg);
-		if (samplerate == 0) samplerate = 1;
-		if (samplerate > 600) samplerate = 600;
-	    } else {
-		usage(argv[0]);
-		exit(1);
-	    }
-	    break;
-	case 'f':
-	    rt_mode = RT_CAP;
-	    rt_forced = 1;
-	    break;
-	case 'h':
-	    usage(argv[0]);
-	    return 0;
-	case 'v':
-	    verbosity++;
-	    break;
-	case 'V':
-	    print_version();
-	    return 0;
-	case 'n':
-	    dockapp->blink = 0;
-	    break;
-	case 'w':
-	    cli = 1;
-	    break;
-	case 'a':
-	    if(optarg != NULL) {
-		samples = atoi(optarg);
-		if(samples > 1000 || samples <= 0) {
-		    fprintf(stderr, "Please specify a reasonable number of samples\n");
-		    exit(1);
-		}
-	    }
-	    break;
-	case 'b':
-	    dockapp->blink = 1;
-	    break;
-	case 'r':
-	    dockapp->scroll = 0;
-	    break;
-	default:
-	    usage(argv[0]);
-	    return 1;
-	}
-	
+    DAParseArguments(argc, argv, options, 10, 
+      "A battery monitor dockapp for ACPI based systems", 
+      VERSION);
+		
+    if (options[0].used)
+        dockapp->scroll = 0;
+    if (options[1].used)
+        dockapp->blink = 0;
+    if (options[2].used)
+        cli = 1;
+    if (options[3].used) {
+        rt_mode = RT_CAP;
+        rt_forced = 1;
     }
-    
+        
+    if (samplerate == 0) samplerate = 1;
+    if (samplerate > 600) samplerate = 600;
+
+    if (critical > 100) {
+        fprintf(stderr, "Please use values between 0 and 100%%\n");
+        fprintf(stderr, "Using default value of 10%%\n");
+        critical = 10;
+    }
+    globals->crit_level = critical;
+
+    if (battery_no >= MAXBATT) {
+        fprintf(stderr, "Please specify a battery number below %d\n", MAXBATT);
+        return 1;
+    }
+    pinfo("Monitoring battery %d\n", battery_no);
+
     if (power_init(globals))
 	/* power_init functions handle printing error messages */
 	exit(1);

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



More information about the Pkg-wmaker-commits mailing list