[Pkg-wmaker-commits] [wmacpi] 32/105: Remove trailing whitespace.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Tue Aug 18 01:13:42 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 f3a56250094381fe8048add190b44d3a31d7ebbf
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Sun Oct 5 10:29:59 2014 -0500

    Remove trailing whitespace.
---
 AUTHORS      |   2 +-
 ChangeLog    | 102 ++++++++++++++++++++++++------------------------
 INSTALL      |   2 +-
 Makefile     |   6 +--
 TODO         |   4 +-
 libacpi.c    | 124 +++++++++++++++++++++++++++++------------------------------
 libacpi.h    |  14 +++----
 wmacpi-cli.c |  10 ++---
 wmacpi.1     |  12 +++---
 wmacpi.c     | 104 ++++++++++++++++++++++++-------------------------
 10 files changed, 190 insertions(+), 190 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index df14ee7..6121538 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,5 +1,5 @@
 Simon Fowler <simon at himi.org>
- Complete rewriting of the code from wmacpi-1.34. 
+ Complete rewriting of the code from wmacpi-1.34.
 
  timecop
  timecop at japan.co.jp
diff --git a/ChangeLog b/ChangeLog
index e6be39e..d3793e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -51,8 +51,8 @@
 	Thanks,
 
 	JB.
-	
-	
+
+
 2008 March 18 2.2rc3
 	Some fixes for the sysfs interface support, supplied by
 	jblache at debian.org:
@@ -70,7 +70,7 @@
 
 	JB.
 
-	
+
 2008 March 14 2.2rc2
 	Support for the sysfs interface that became mandatory with kernel
 	2.6.24 (patch supplied by jblache at debian.org).
@@ -78,7 +78,7 @@
 	A number of graphics fixes also from jblache at debian.org.
 
 	Removed support for hardware reported critical battery status.
-	
+
 2007 July 14 2.2rc1
 	Major changes to command line handling and to the way we use
 	libdockapp, courtesy of Patrice Dumas. This should hopefully fix
@@ -89,7 +89,7 @@
 	/proc/acpi/info - thanks to Samuel Ortiz.
 
 	Fixed a longstanding issue with redrawing - thanks to Vito
-	Caputo. 
+	Caputo.
 
 	This version changes a number of command line options (little used
 	ones, but they're still incompatible changes) due to the
@@ -98,7 +98,7 @@
 	(thanks to libdockapp grabbing -h, -v and -w for itself). Also,
 	long options are now supported for everything in wmacpi (but not
 	acpi, since it doesn't use libdockapp for command line parsing).
-	
+
 2007 January 10 2.2a1
 	Added a patch from Patrice Dumas to support newer versions of
 	libdockapp.
@@ -107,20 +107,20 @@
 
 2005 February 2 2.1
 	Finalised libdockapp-0.5.0 port - no changes from 2.1rc1.
-	
+
 2005 Jan 5 2.1rc1
 	Typo fix in the manpage.
 
 	Ported to libdockapp-0.5.0 - all this needed was changing the
 	type of the dockapp width and height to unsigned short.
-	
+
 2004 October 24 2.0
 	Upped version number to 2.0.
 
 	Small typo fixes.
 
 	wmacpi 2.0 goes gold . . .
-	
+
 2004 September 28 2.0rc1
 	Added support for switching to capacity mode automatically, on
 	detecting dodgy reports from the battery.
@@ -131,7 +131,7 @@
 	Various cleanups.
 
 	Hopefully last release before the final 2.0.
-	
+
 2004 August 18 1.99r7
 	Implemented the libdockapp port - this seems to close Debian bug
 	#227819, but it hasn't received sufficient testing.
@@ -141,17 +141,17 @@
 	remaining capacity of the battery and notes the time at which it
 	was sampled, and uses a history of samples to estimate the rate of
 	drain on the battery. From there it calculates a value for time
-	remaining. 
+	remaining.
 
-	Also, various cleanups have gone in: 
+	Also, various cleanups have gone in:
 
 	* a reworking of the scrolling code
-	
+
 	* generic battery number support (rather than just
 	using two pixmaps, one for b1 and one for b2)
 
 	* stopped the battery glyph from blinking when running on AC
-	
+
 2004 July 19 1.99r6
 	Fix for Debian bug #250792 - the parser for the acpi files was
 	too stupid to deal with error conditions. I've now added some
@@ -184,7 +184,7 @@
 
 	libdockapp is waiting, but I think that's the only change left
 	without more bug repots . . .
-	
+
 2004 April 15 1.99r4
 	Collected fixes for various small issues.
 
@@ -202,17 +202,17 @@
 	I've left the big changes that are needed (like using libdockapp,
 	in the hope that it'll solve the docking problems) until later, so
 	that I can get these smaller fixes out. Hopefully soon . . .
-	
+
 2004 January 12 1.99r3
 	. . . and a fix for a fix that didn't fix it . . .
-	
+
 2004 January 12 1.99r2
 	Some cleanups and bugfixes found by the wonderful Debian users.
 
 	It's finally in testing!
-	
+
 2003 November 23 1.99
-	Finally claimed the wmacpi name as my own . . . 
+	Finally claimed the wmacpi name as my own . . .
 
 	Renamed wmacpi-ng and acpi-ng, renamed the header files, fixed up
 	the makefile.
@@ -226,7 +226,7 @@
 	This is wmacpi 1.99, so that I can have a release packaged and in
 	Debian before going to 2.0, so that any bugs that are left can be
 	found by all the extra users.
-	
+
 2003 September 26 0.99
 	Fix the last of the old wmacpi code oddities (specifically, the
 	APMInfo struct, which was a completely inappropriate name given we
@@ -237,21 +237,21 @@
 	more feedback and the like, so I'm going to make this version
 	0.99, preliminary to either wmacpi-ng 1.0 or wmacpi 2.0 (depending
 	which direction I go with that).
-	
+
 2003 September 23 0.92
 	Fix a few more bugs, and include an option to allow the user to
 	specify how often to sample the ACPI data - some BIOSes disable
 	all interrupts while reading from the battery, which apparently
 	causes some interactivity issues. I have no idea why reading once
 	every three seconds (which is our default), but there've been some
-	complaints. 
+	complaints.
 
 	Also fixed acpi-ng to properly handle the -a option.
-	
+
 2003 August 6 0.91
 	Fix a problem I'm seeing with docking the app - if the window name
 	is set to "acpi" rather than "apm" it doesn't dock . . .
-	
+
 2003 July 16 0.90
 	Make the time display show '--:--' instead of '00:00' when the
 	time remaining is 0 - I think this is reasonable, since it'll only
@@ -262,7 +262,7 @@
 	don't lose anything. We also get to handle the (sadly, very
 	common) case where the ACPI subsystem doesn't report sane values
 	for the things we depend on.
-	
+
 2003 July 11 0.50a2
 	Make the time display show nothing (as opposed to 00:00) when the
 	time remaining is unknown, as requested by Emma Jane Hogbin.
@@ -283,7 +283,7 @@
 	annoying about.
 
 	Also, added an acpi-ng manpage.
-	
+
 2003 July 11 0.50a1
 	Properly fix the AC adapter issue - it's not much use adding the
 	infrastructure and then forgetting to fix the code that uses it.
@@ -291,14 +291,14 @@
 	Fix the time disiplay so that it doesn't try to display values
 	greater than 99:59, since the display area won't fit anything
 	beyond that.
-	
+
 2003 July 10 0.50a
 	Bugfixes, to handle two problems: the case where something like
 	the present rate or some such is "unknown" (reported initially by
 	Emma Jane Hogbin, and where the AC adapter is called something
 	other than "AC" (reported by Sebastian Henschel). This an 'a'
-	release because I can't test these myself . . . 
-	
+	release because I can't test these myself . . .
+
 2003 July 6 0.50
 	Finally got rid of that annoying button - that space now contains
 	a 'B 1' or 'B 2' (only those two at present, since I'm too lazy to
@@ -307,69 +307,69 @@
 	batteries . . .)
 
 	A few more code cleanups.
-	
+
 2003 July 1 0.19
 	libacpi cleanups and reworking - we now handle the charging
-	battery case properly, it seems. 
+	battery case properly, it seems.
 
 	Also, some attempts to make error printing a bit cleaner; still a
 	long way to go on that, though . . .
-	
+
 2003 June 24 0.15
 	Removed process_plugin_timer(), since it was doing nothing useful
 	at all . . .
-	
+
 2003 June 23 0.14
 	Removed libapm.c - wmacpi-ng is specifically for ACPI, with no APM
-	support. 
-	
+	support.
+
 2003 June 23 0.13
 	Some more code cleanups, designed to move libacpi to more of a
 	library than something built into wmacpi-ng. This is useful with
 	the seperate programs, though at present it's not used much.
-	
+
 2003 June 21 0.12
 	Added a command line tool, acpi-ng to query battery status from
 	the command line.
-	
+
 2003 May 30 0.11
 	Implemented multiple battery support, and averaging of the samples
 	in an attempt to even out the jumpiness of the timer.
-	
+
 2003 May 30 0.10
 	More major code cleanups: in particular the handling of the power
 	panel and the message has been cleaned up so that it's actually
-	sane and clean. 
+	sane and clean.
 
 	Next step from here is to actually implement handling of multiple
 	batteries, so that if there's a fully charge second battery
 	available it reports the correct time remaining (based on the
 	present rate of power consumption and the sum of the two battery's
 	remaining capacities).
-	
+
 2003 May 29 0.3
 	Some major reworking of the internals, to help fix the handling of
-	multiple batteries and such things. 
-	
+	multiple batteries and such things.
+
 2003 May 26 0.2a
 	Code cleanups to fix various problems with corner cases.
-	
+
 2003 May 26 0.2
 	Added support for multiple batteries: I took the simple route of
 	displaying only one battery per instance - to do more I'd need to
 	hack with the display code, and I'm not ready for that yet.
-	
+
 	Added a -m option to specify the battery number to monitor.
-	
+
 2003 May 26 0.1
 	Changed package completely, to support the new ACPI code as of
-	2.4.21-rc2. 
+	2.4.21-rc2.
 
 	Since this code hasn't been touched in more than a year, I figure
 	I might as well have a go at hacking on it . . .
 
 	-- Simon Fowler, <simon at dreamcraft.com.au>
-	
+
 2002 Feb 17 1.34
     Updated ACPI statistics gathering code for the latest ACPI patch from
     Intel. Now uses/checks for subsystem version 20020214+. Redone the version
@@ -439,13 +439,13 @@
 
     	Added support for fucked APM bioses that display stuff wrong. (See
 	README to learn how to enable it. Obviously, it's disabled by default)
-	
+
     	Reorganized apminfo structure and got rid of redundancy.
-	
+
     	Reorganized acquire_apm_info.  All APM data is processed there.
-	
+
     	Fixed display_state to do the Right Thing.
-	
+
     	Fixed red blinking button to actually blink on critical battery, and
     	to stop when it isn't critical anymore.  I don't think it ever worked
 	right in 1.0.
diff --git a/INSTALL b/INSTALL
index df0c51c..674da8f 100644
--- a/INSTALL
+++ b/INSTALL
@@ -4,7 +4,7 @@ You can change the default install prefix (/usr/local) by specifying
 it in the make install command, eg: make install PREFIX=/usr
 
 To build the command line tool, either uncomment the BUILD_CLI=1 line
-in the Makefile, or specify BUILD_CLI=1 on the make command line. ie, 
+in the Makefile, or specify BUILD_CLI=1 on the make command line. ie,
 make BUILD_CLI=1
 make install BUILD_CLI=1
 
diff --git a/Makefile b/Makefile
index cd840a6..8b90efd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # set options.  pick one, acpi or apm.  comment out the other one.  don't
 # uncomment both, bad things will happen :)
 
-OPT	:= -O2 
+OPT	:= -O2
 
 # uncomment this to build the command line acpi tool
 BUILD_CLI = 1
@@ -40,7 +40,7 @@ wmacpi:	$(WMOBJ)
 	$(CC) -o $@ $^ $(LDFLAGS)
 
 # for the Debian package, we want to make building the command line tools
-# optional. So, we hide all the necessary stuff here . . . 
+# optional. So, we hide all the necessary stuff here . . .
 ifdef BUILD_CLI
 CLSRC := wmacpi-cli.c libacpi.c
 CLOBJ := $(patsubst %.c,%.o,$(filter %.c,$(CLSRC)))
@@ -56,7 +56,7 @@ endif
 	gcc -MM $(CFLAGS) $< > $@
 
 clean:
-	rm -f TAGS *.o *~ trace *.out *.bb *.bbg 
+	rm -f TAGS *.o *~ trace *.out *.bb *.bbg
 
 clean-all: clean
 	rm -f *.d $(targets)
diff --git a/TODO b/TODO
index d016ac7..44feb86 100644
--- a/TODO
+++ b/TODO
@@ -7,7 +7,7 @@
 
 2003 November 23 1.99
  * Expand libacpi to handle everything else under
-   /proc/acpi. Basically, make it into a full ACPI reporting library. 
+   /proc/acpi. Basically, make it into a full ACPI reporting library.
 
  * Make the command line tool a complete replacement for Grahame
    Bowland's acpi tool, so that wmacpi won't conflict with it.
@@ -20,7 +20,7 @@
 2003 June 24 0.14
 
  * Still more code cleanups - there's a considerable amount of dumb
-   stuff in there still . . . 
+   stuff in there still . . .
 
  * Display time left for battery charging. But first make sure that
    this will actually work with other systems.
diff --git a/libacpi.c b/libacpi.c
index 2d3a528..fb77015 100644
--- a/libacpi.c
+++ b/libacpi.c
@@ -46,7 +46,7 @@ static int read_sysfs_file(char *node, char *prop, char *buf, size_t buflen)
 	perr("Could not read %s/%s\n", node, prop);
 	return -3;
     }
-  
+
     buf[ret] = '\0';
 
     return 0;
@@ -61,7 +61,7 @@ static int sysfs_init_batteries(global_t *globals)
     char *names[MAXBATT];
     char ps_type[16];
     int i, j;
-    
+
     /* now enumerate batteries */
     globals->battery_count = 0;
     battdir = opendir("/sys/class/power_supply");
@@ -72,12 +72,12 @@ static int sysfs_init_batteries(global_t *globals)
     while ((batt = readdir(battdir))) {
 	/* there's a serious problem with this code when there's
 	 * more than one battery: the readdir won't return the
-	 * entries in sorted order, so battery one won't 
+	 * entries in sorted order, so battery one won't
 	 * necessarily be the first one returned. So, we need
-	 * to sort them ourselves before adding them to the 
+	 * to sort them ourselves before adding them to the
 	 * batteries array. */
 	name = batt->d_name;
-	
+
 	/* skip ., .. and dotfiles */
 	if (name[0] == '.')
 	    continue;
@@ -96,7 +96,7 @@ static int sysfs_init_batteries(global_t *globals)
     /* A nice quick insertion sort, ala CLR. */
     {
 	char *tmp1, *tmp2;
-	
+
 	for (i = 1; i < globals->battery_count; i++) {
 	    tmp1 = names[i];
 	    j = i - 1;
@@ -107,7 +107,7 @@ static int sysfs_init_batteries(global_t *globals)
 	    }
 	}
     }
-    
+
     for (i = 0; i < globals->battery_count; i++) {
 	snprintf(batteries[i].name, MAX_NAME, "%s", names[i]);
 	pdebug("battery detected at /sys/class/power_supply/%s\n", batteries[i].name);
@@ -141,7 +141,7 @@ static int procfs_init_batteries(global_t *globals)
     char *name;
     char *names[MAXBATT];
     int i, j;
-    
+
     /* now enumerate batteries */
     globals->battery_count = 0;
     battdir = opendir("/proc/acpi/battery");
@@ -152,12 +152,12 @@ static int procfs_init_batteries(global_t *globals)
     while ((batt = readdir(battdir))) {
 	/* there's a serious problem with this code when there's
 	 * more than one battery: the readdir won't return the
-	 * entries in sorted order, so battery one won't 
+	 * entries in sorted order, so battery one won't
 	 * necessarily be the first one returned. So, we need
-	 * to sort them ourselves before adding them to the 
+	 * to sort them ourselves before adding them to the
 	 * batteries array. */
 	name = batt->d_name;
-	
+
 	/* skip . and .. */
 	if (!strncmp(".", name, 1) || !strncmp("..", name, 2))
 	    continue;
@@ -170,7 +170,7 @@ static int procfs_init_batteries(global_t *globals)
     /* A nice quick insertion sort, ala CLR. */
     {
 	char *tmp1, *tmp2;
-	
+
 	for (i = 1; i < globals->battery_count; i++) {
 	    tmp1 = names[i];
 	    j = i - 1;
@@ -181,12 +181,12 @@ static int procfs_init_batteries(global_t *globals)
 	    }
 	}
     }
-    
+
     for (i = 0; i < globals->battery_count; i++) {
 	snprintf(batteries[i].name, MAX_NAME, "%s", names[i]);
-	snprintf(batteries[i].info_file, MAX_NAME, 
+	snprintf(batteries[i].info_file, MAX_NAME,
 		 "/proc/acpi/battery/%s/info", names[i]);
-	snprintf(batteries[i].state_file, MAX_NAME, 
+	snprintf(batteries[i].state_file, MAX_NAME,
 		 "/proc/acpi/battery/%s/state", names[i]);
 	pdebug("battery detected at %s\n", batteries[i].info_file);
 	pinfo("found battery %s\n", names[i]);
@@ -196,7 +196,7 @@ static int procfs_init_batteries(global_t *globals)
     pdebug("%d batteries detected\n", globals->battery_count);
     pinfo("libacpi: found %d batter%s\n", globals->battery_count,
 	    (globals->battery_count == 1) ? "y" : "ies");
-    
+
     return 0;
 }
 
@@ -263,7 +263,7 @@ static int sysfs_init_ac_adapters(global_t *globals)
     /* we'll just use the first adapter we find ... */
     ap->name = strdup(name);
     pinfo("libacpi: found ac adapter %s\n", ap->name);
-    
+
     return 0;
 }
 
@@ -298,7 +298,7 @@ static int procfs_init_ac_adapters(global_t *globals)
     snprintf(ap->state_file, MAX_NAME, "/proc/acpi/ac_adapter/%s/state",
 	     ap->name);
     pinfo("libacpi: found ac adapter %s\n", ap->name);
-    
+
     return 0;
 }
 
@@ -374,7 +374,7 @@ int power_reinit(global_t *globals)
 	    return 1;
 	}
     }
-    
+
     if (!(retval = reinit_batteries(globals)))
 	retval = reinit_ac_adapters(globals);
 
@@ -424,7 +424,7 @@ static power_state_t procfs_get_power_status(global_t *globals)
     char buf[1024];
     char *val;
     adapter_t *ap = &globals->adapter;
-    
+
     if ((file = fopen(ap->state_file, "r")) == NULL) {
 	snprintf(buf, 1024, "Could not open state file %s", ap->state_file);
 	perror(buf);
@@ -531,7 +531,7 @@ static int sysfs_get_battery_info(global_t *globals, int batt_no)
 	    info->charge_state = FULL; /* DISCHARGE ? as per old comment ... */
     }
 
-    /* get current rate of burn 
+    /* get current rate of burn
      * note that if it's on AC, this will report 0 */
     if (read_sysfs_file(info->name, "current_now", buf, sizeof(buf)) < 0)
 	info->present_rate = -1;
@@ -590,7 +590,7 @@ static int procfs_get_battery_info(global_t *globals, int batt_no)
 	perror(NULL);
 	return 0;
     }
-    
+
     /* grab the contents of the file */
     buflen = fread(buf, sizeof(buf), 1, file);
     fclose(file);
@@ -612,13 +612,13 @@ static int procfs_get_battery_info(global_t *globals, int batt_no)
 	info->present = 0;
 	return 0;
     }
-    
+
     /* get design capacity
      * note that all these integer values can also contain the
      * string 'unknown', so we need to check for this. */
     entry = strstr(buf, "design capacity:");
     val = get_value(entry);
-    if (val[0] == 'u') 
+    if (val[0] == 'u')
 	info->design_cap = -1;
     else
 	info->design_cap = strtoul(val, NULL, 10);
@@ -639,13 +639,13 @@ static int procfs_get_battery_info(global_t *globals, int batt_no)
     else
 	info->design_voltage = strtoul(val, NULL, 10);
 
-    
+
     if ((file = fopen(info->state_file, "r")) == NULL) {
 	perr("Could not open %s:", info->state_file );
 	perror(NULL);
 	return 0;
     }
-    
+
     /* grab the file contents */
     memset(buf, 0, sizeof(buf));
     buflen = fread(buf, sizeof(buf), 1, file);
@@ -671,7 +671,7 @@ static int procfs_get_battery_info(global_t *globals, int batt_no)
     /* get charging state */
     entry = strstr(buf, "charging state:");
     val = get_value(entry);
-    if (val[0] == 'u') 
+    if (val[0] == 'u')
 	info->charge_state = CH_ERR;
     else if ((strncmp(val, "discharging", 10)) == 0)
 	info->charge_state = DISCHARGE;
@@ -684,7 +684,7 @@ static int procfs_get_battery_info(global_t *globals, int batt_no)
     else
 	info->charge_state = CHARGE;
 
-    /* get current rate of burn 
+    /* get current rate of burn
      * note that if it's on AC, this will report 0 */
     entry = strstr(buf, "present rate:");
     val = get_value(entry);
@@ -728,12 +728,12 @@ int get_battery_info(global_t *globals, int batt_no)
  * 2003-7-1.
  * In order to make this code more convenient for things other than
  * just plain old wmacpi-ng I'm breaking the basic functionality
- * up into several chunks: collecting and collating info for a 
- * single battery, calculating the global info (such as rtime), and 
+ * up into several chunks: collecting and collating info for a
+ * single battery, calculating the global info (such as rtime), and
  * some stuff to provide a similar interface to now.
  */
 
-/* calculate the percentage remaining, using the values of 
+/* calculate the percentage remaining, using the values of
  * remaining capacity and last full capacity, as outlined in
  * the ACPI spec v2.0a, section 3.9.3. */
 static int calc_remaining_percentage(int batt)
@@ -741,7 +741,7 @@ static int calc_remaining_percentage(int batt)
     float rcap, lfcap;
     battery_t *binfo;
     int retval;
-    
+
     binfo = &batteries[batt];
 
     rcap = (float)binfo->remaining_cap;
@@ -796,8 +796,8 @@ static enum rtime_mode check_rt_mode(global_t *globals)
 }
 
 /* calculate remaining time until the battery is charged.
- * when charging, the battery state file reports the 
- * current being used to charge the battery. We can use 
+ * when charging, the battery state file reports the
+ * current being used to charge the battery. We can use
  * this and the remaining capacity to work out how long
  * until it reaches the last full capacity of the battery.
  * XXX: make sure this is actually portable . . . */
@@ -816,7 +816,7 @@ static int calc_charge_time_rate(int batt)
 	} else {
 	    lfcap = (float)binfo->last_full_cap;
 	    rcap = (float)binfo->remaining_cap;
-	    
+
 	    charge_time = (int)(((lfcap - rcap)/binfo->present_rate) * 60.0);
 	}
     } else
@@ -826,7 +826,7 @@ static int calc_charge_time_rate(int batt)
 }
 
 /* we need to calculate the present rate the same way we do in rt_cap
- * mode, and then use that to estimate charge time. This will 
+ * mode, and then use that to estimate charge time. This will
  * necessarily be even less accurate than it is for remaining time, but
  * it's just as neessary . . . */
 static int calc_charge_time_cap(int batt)
@@ -841,7 +841,7 @@ static int calc_charge_time_cap(int batt)
     float cdiff;
     float current_rate;
     battery_t *binfo = &batteries[batt];
-    
+
     cap_samples[current] = (float) binfo->remaining_cap;
     time_samples[current] = time(NULL);
 
@@ -863,7 +863,7 @@ static int calc_charge_time_cap(int batt)
 	tdiff = time_samples[current] - time_samples[old];
 	current_rate = cdiff/(float)tdiff;
     }
-    if (current_rate == 0) 
+    if (current_rate == 0)
 	rtime = 0;
     else {
 	float cap_left = (float)(binfo->last_full_cap - binfo->remaining_cap);
@@ -900,11 +900,11 @@ void acquire_batt_info(global_t *globals, int batt)
 {
     battery_t *binfo;
     adapter_t *ap = &globals->adapter;
-    
+
     get_battery_info(globals, batt);
-    
+
     binfo = &batteries[batt];
-    
+
     if (!binfo->present) {
 	binfo->percentage = 0;
 	binfo->valid = 0;
@@ -915,21 +915,21 @@ void acquire_batt_info(global_t *globals, int batt)
 
     binfo->percentage = calc_remaining_percentage(batt);
 
-    /* set the battery's capacity state, based (at present) on some 
+    /* set the battery's capacity state, based (at present) on some
      * guesstimated values: more than 75% == HIGH, 25% to 75% MED, and
      * less than 25% is LOW. Less than globals->crit_level is CRIT. */
     if (binfo->percentage == -1)
 	binfo->state = BS_ERR;
     if (binfo->percentage < globals->crit_level)
 	binfo->state = CRIT;
-    else if (binfo->percentage > 75) 
+    else if (binfo->percentage > 75)
 	binfo->state = HIGH;
     else if (binfo->percentage > 25)
 	binfo->state = MED;
-    else 
+    else
 	binfo->state = LOW;
 
-    /* we need to /know/ that we've got a valid state for the 
+    /* we need to /know/ that we've got a valid state for the
      * globals->power value . . . .*/
     ap->power = get_power_status(globals);
 
@@ -939,11 +939,11 @@ void acquire_batt_info(global_t *globals, int batt)
      * that it's now valid . . .*/
     binfo->valid = 1;
 }
-	
+
 void acquire_all_batt_info(global_t *globals)
 {
     int i;
-    
+
     for(i = 0; i < globals->battery_count; i++)
 	acquire_batt_info(globals, i);
 }
@@ -961,7 +961,7 @@ void acquire_all_batt_info(global_t *globals)
  * So, what we need to do is provide a way to use a different method
  * to calculate the time remaining. What seems most sensible is to
  * split out the code to calculate it into a seperate function, and
- * then provide multiple implementations . . . 
+ * then provide multiple implementations . . .
  */
 
 /*
@@ -980,12 +980,12 @@ int calc_time_remaining_rate(global_t *globals)
     static int j = 0;
     static int n = 0;
 
-    /* calculate the time remaining, using the battery's remaining 
-     * capacity and the reported burn rate (3.9.3). 
-     * For added accuracy, we average the value over the last 
+    /* calculate the time remaining, using the battery's remaining
+     * capacity and the reported burn rate (3.9.3).
+     * For added accuracy, we average the value over the last
      * SAMPLES number of calls, or for anything less than this we
      * simply report the raw number. */
-    /* XXX: this needs to correctly handle the case where 
+    /* XXX: this needs to correctly handle the case where
      * any of the values used is unknown (which we flag using
      * -1). */
     for (i = 0; i < globals->battery_count; i++) {
@@ -999,16 +999,16 @@ int calc_time_remaining_rate(global_t *globals)
     j++, sample_count++;
     if (j >= SAMPLES)
 	j = 0;
-    
+
     /* for the first SAMPLES number of calls we calculate the
      * average based on sample_count, then we use SAMPLES to
      * calculate the rolling average. */
-    
+
     /* when this fails, n should be equal to SAMPLES. */
     if (sample_count < SAMPLES)
 	n++;
     for (i = 0, rate = 0; i < n; i++) {
-	/* if any of our samples are invalid, we drop 
+	/* if any of our samples are invalid, we drop
 	 * straight out, and flag our unknown values. */
 	if (rate_samples[i] < 0) {
 	    rate = -1;
@@ -1018,16 +1018,16 @@ int calc_time_remaining_rate(global_t *globals)
 	rate += rate_samples[i];
     }
     rate = rate/(float)n;
-    
+
     if ((rcap < 1) || (rate < 1)) {
 	rtime = 0;
 	goto out;
     }
-    if (rate <= 0) 
+    if (rate <= 0)
 	rate = 1;
     /* time remaining in minutes */
     rtime = (int)((rcap/rate) * 60.0);
-    if(rtime <= 0) 
+    if(rtime <= 0)
 	rtime = 0;
  out:
     pdebug("discharge time rem: %d\n", rtime);
@@ -1044,11 +1044,11 @@ int calc_time_remaining_rate(global_t *globals)
  * precision instruments - mine only report with about 70mAH
  * resolution, so they don't report any changes until the difference
  * is 70mAH. This means that calculating the current rate from the
- * remaining capacity is very choppy . . . 
+ * remaining capacity is very choppy . . .
  *
  * To fix this, we should calculate an average over some number of
  * samples at the old end of the set - this would smooth out the
- * transitions. 
+ * transitions.
  */
 int calc_time_remaining_cap(global_t *globals)
 {
@@ -1091,7 +1091,7 @@ int calc_time_remaining_cap(global_t *globals)
 	tdiff = time_samples[current] - time_samples[old];
 	current_rate = cdiff/tdiff;
     }
-    if (current_rate == 0) 
+    if (current_rate == 0)
 	rtime = 0;
     else
 	rtime = (int)(cap_samples[current]/(current_rate * 60.0));
@@ -1104,7 +1104,7 @@ int calc_time_remaining_cap(global_t *globals)
 
     pdebug("cap discharge time rem: %d\n", rtime);
     return rtime;
-}    
+}
 
 void acquire_global_info(global_t *globals)
 {
diff --git a/libacpi.h b/libacpi.h
index 07e5b9a..afb38c0 100644
--- a/libacpi.h
+++ b/libacpi.h
@@ -20,7 +20,7 @@ typedef enum {
     BATT,
     PS_ERR,
 } power_state_t;
-    
+
 typedef enum {
     HIGH,
     MED,
@@ -52,7 +52,7 @@ typedef struct {
     char state_file[MAX_NAME];
     /* sysfs capacity mode */
     sysfs_capa_t sysfs_capa_mode;
-    int present; 
+    int present;
     int design_cap;		/* assuming mAh */
     int last_full_cap;
     int design_voltage;		/* in mV */
@@ -68,9 +68,9 @@ typedef struct {
     /* and a flag to indicate that this is valid . . . */
     int valid;
     /* number of times we've gotten bad info on this battery's present rate */
-    int bad_count;		
+    int bad_count;
 } battery_t;
-    
+
 typedef struct {
     char *name;
     char state_file[MAX_NAME];
@@ -96,11 +96,11 @@ typedef struct {
 
 /*
  * Moving percentage to the battery is right, but I think we need a global
- * remaining capacity somewhere, too . . . 
+ * remaining capacity somewhere, too . . .
  */
 
 /*
- * To provide a convenient debugging function . . . 
+ * To provide a convenient debugging function . . .
  *
  * It's a macro because I'm too lazy to deal with varargs.
  */
@@ -125,7 +125,7 @@ typedef struct {
 
 #define pfatal(fmt, arg...)				\
     fprintf(stderr, fmt, ##arg)				\
-	
+
 
 /* Since these /are/ needed here . . . */
 battery_t batteries[MAXBATT];
diff --git a/wmacpi-cli.c b/wmacpi-cli.c
index 274f287..7446856 100644
--- a/wmacpi-cli.c
+++ b/wmacpi-cli.c
@@ -4,7 +4,7 @@
  * Written by Simon Fowler <simon at dreamcraft.com.au>, 2003-06-20.
  * Copyright 2003-06-20 Dreamcraft Pty Ltd.
  *
- * This file is distributed under the GNU General Public License, 
+ * This file is distributed under the GNU General Public License,
  * version 2. Please see the COPYING file for details.
  */
 
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
 		acquire_global_info(globals);
 		usleep(sleep_time);
 	}
-	
+
 	ap = &globals->adapter;
 	if(ap->power == AC) {
 		printf("On AC Power");
@@ -104,8 +104,8 @@ int main(int argc, char *argv[])
 			if(binfo->present && (binfo->charge_state == CHARGE)) {
 				printf("; Battery %s charging", binfo->name);
 				printf(", currently at %2d%%", binfo->percentage);
-				if(binfo->charge_time >= 0) 
-					printf(", %2d:%02d remaining", 
+				if(binfo->charge_time >= 0)
+					printf(", %2d:%02d remaining",
 					       binfo->charge_time/60,
 					       binfo->charge_time%60);
 			}
@@ -120,7 +120,7 @@ int main(int argc, char *argv[])
 				       binfo->percentage);
 		}
 		if(globals->rtime >= 0)
-			printf("; %d:%02d remaining", globals->rtime/60, 
+			printf("; %d:%02d remaining", globals->rtime/60,
 			       globals->rtime%60);
 		printf("\n");
 	}
diff --git a/wmacpi.1 b/wmacpi.1
index 26c18ed..aaeeca8 100644
--- a/wmacpi.1
+++ b/wmacpi.1
@@ -99,7 +99,7 @@ Set the rate at which to sample the ACPI data, in number of times per
 minute. Minimum is 1, ie once a minute, default is 20, maximum is 600.
 .TP
 .B \-n, --no-blink
-Disable blinking power glyph when charging. Note that it still blinks when 
+Disable blinking power glyph when charging. Note that it still blinks when
 the battery reports its capacity state as critical.
 .TP
 .B \-f, --force-capacity-mode
@@ -114,7 +114,7 @@ works around certain buggy ACPI BIOSes that fail to report the current
 rate.
 .TP
 .B \-x, --cmdline
-Run wmacpi in command line mode - this operates identically to 
+Run wmacpi in command line mode - this operates identically to
 .B wmacpi-cli\&.
 .TP
 .B \-a, --samples=samples
@@ -122,8 +122,8 @@ Average the time remaining over num samples. This greatly improves the
 accuracy of the reported time remaining.
 .TP
 .B \-V, --verbosity=num
-Increase the verbosity of the program. Setting this to 1 will print extra 
-error information; 2 will produce informational output; 3 will produce 
+Increase the verbosity of the program. Setting this to 1 will print extra
+error information; 2 will produce informational output; 3 will produce
 copious debugging output.
 .TP
 .B \-v, --version
@@ -143,7 +143,7 @@ accuracy of the reported time remaining.
 .TP
 .B \-V
 Increase the verbosity of the program. If repeated, the result is the
-same as setting 
+same as setting
 .B \--verbosity
 for
 .B wmacpi
@@ -161,6 +161,6 @@ completely rewritten after 1.34 by Simon Fowler <simon at himi.org>.
 .PP
 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. 
+Simon Fowler.
 .br
 Last modification by Simon Fowler <simon at himi.org>, 2007-07-13.
diff --git a/wmacpi.c b/wmacpi.c
index 99002cd..e8833ac 100644
--- a/wmacpi.c
+++ b/wmacpi.c
@@ -80,11 +80,11 @@ struct dockapp *dockapp;
 int scroll_reset = DEFAULT_SCROLL_RESET;
 
 /* copy a chunk of pixmap around the app */
-static void copy_xpm_area(int x, int y, int w, int h, int dx, int dy)					
-{										
-    XCopyArea(DADisplay, dockapp->pixmap, dockapp->pixmap,	
-	      DAGC, x, y, w, h, dx, dy);			
-    dockapp->update = 1;							
+static void copy_xpm_area(int x, int y, int w, int h, int dx, int dy)
+{
+    XCopyArea(DADisplay, dockapp->pixmap, dockapp->pixmap,
+	      DAGC, x, y, w, h, dx, dy);
+    dockapp->update = 1;
 }
 
 /* display AC power symbol */
@@ -156,7 +156,7 @@ static void new_window(char *display, char *name, int argc, char **argv)
                  StructureNotifyMask);
 
     /* create the main pixmap . . . */
-    DAMakePixmapFromData(master_xpm, &dockapp->pixmap, &dockapp->mask, 
+    DAMakePixmapFromData(master_xpm, &dockapp->pixmap, &dockapp->mask,
 			 &dockapp->width, &dockapp->height);
     DASetPixmap(dockapp->pixmap);
     DASetShape(dockapp->mask);
@@ -181,7 +181,7 @@ static void new_window(char *display, char *name, int argc, char **argv)
 	hints->max_height = 64;
 	XSetWMNormalHints(dockapp->display, dockapp->win, hints);
 	XFree(hints);
-    } 
+    }
 
     DAShow();
 }
@@ -208,10 +208,10 @@ static void scroll_text(void)
     int tw = dockapp->tw;	/* width of the rendered text */
     int sx, dx, w;
 
-    if (!dockapp->scroll) 
+    if (!dockapp->scroll)
 	return;
 
-    /* 
+    /*
      * Conceptually this is viewing the text through a scrolling
      * window - the window starts out with the end immediately before
      * the text, and stops when the start of the window is immediately
@@ -224,9 +224,9 @@ static void scroll_text(void)
      * text is being copied, until a full window is being copied.
      *
      * As the end of the window moves out past the end of the text, we
-     * want to keep the destination at the beginning of the text area, 
+     * want to keep the destination at the beginning of the text area,
      * but copy a smaller and smaller chunk of the text. Eventually the
-     * start of the window will scroll past the end of the text, at 
+     * start of the window will scroll past the end of the text, at
      * which point we stop doing any work and wait to be reset.
      */
 
@@ -246,7 +246,7 @@ static void scroll_text(void)
 	w = end;
     else if (end > tw)
 	w = 52 - (end - tw);
-	
+
     dx = x + 52 - w;
     if (end > tw)
 	dx = x;
@@ -368,7 +368,7 @@ static void display_time(int minutes)
     hour = minutes / 60;
     /* our display area only fits %2d:%2d, so we need to make sure
      * what we're displaying will fit in those constraints. I don't
-     * think we're likely to see any batteries that do more than 
+     * think we're likely to see any batteries that do more than
      * 100 hours any time soon, so it's fairly safe. */
     if (hour >= 100) {
 	hour = 99;
@@ -392,7 +392,7 @@ static void display_time(int minutes)
     omin = min;
 }
 
-/* 
+/*
  * The reworked state handling stuff.
  */
 
@@ -407,9 +407,9 @@ static void really_blink_power_glyph(void)
 {
     static int counter = 0;
 
-    if (counter == 10) 
+    if (counter == 10)
 	display_power_glyph();
-    else if (counter == 20) 
+    else if (counter == 20)
 	kill_power_glyph();
     else if (counter > 30)
 	counter = 0;
@@ -435,7 +435,7 @@ static void really_blink_battery_glyph(void)
 	counter = 0;
 
     counter += dockapp->period_length;
-}    
+}
 
 static void blink_battery_glyph(void)
 {
@@ -484,7 +484,7 @@ void reset_scroll_speed(void) {
     scroll_reset = DEFAULT_SCROLL_RESET;
 }
 
-/* 
+/*
  * The message that needs to be displayed needs to be decided
  * according to a heirarchy: a message like not present needs to take
  * precedence over a global thing like the current power status, and
@@ -492,11 +492,11 @@ void reset_scroll_speed(void) {
  * the "on battery" message. Likewise, a battery charging message
  * needs to take precedence over the on ac power message. The other
  * question is how much of a precedence local messages should take
- * over global ones . . . 
+ * over global ones . . .
  *
  * So, there are three possible sets of messages: not present, on-line
  * and off-line messages. We need to decide which of those sets is
- * appropriate right now, and then decide within them. 
+ * appropriate right now, and then decide within them.
  */
 enum messages {
     M_NB,	/* no batteries */
@@ -515,7 +515,7 @@ static void set_message(global_t *globals)
     static enum messages state = M_NULL;
     battery_t *binfo = globals->binfo;
     adapter_t *ap = &globals->adapter;
-    
+
     if (globals->battery_count == 0) {
 	if (state != M_NB) {
 	    state = M_NB;
@@ -525,7 +525,7 @@ static void set_message(global_t *globals)
 
 	return;
     }
-    
+
     /* battery not present case */
     if (!binfo->present) {
 	if (state != M_NP) {
@@ -567,7 +567,7 @@ static void set_message(global_t *globals)
 		render_text("on battery");
 	    }
 	}
-    }    
+    }
 }
 
 void set_time_display(global_t *globals)
@@ -598,7 +598,7 @@ void set_batt_id_area(int bno)
     int dy = 32;		/* y coord of the target area */
     int sx = (bno + 1) * 7;	/* source x coord */
     int sy = 76;		/* source y coord */
-    
+
     copy_xpm_area(sx, sy, w, h, dx, dy);
 }
 
@@ -609,7 +609,7 @@ void cli_wmacpi(global_t *globals, int samples)
     int i, j, sleep_time = 0;
     battery_t *binfo;
     adapter_t *ap;
-    
+
     pdebug("samples: %d\n", samples);
     if(samples > 1)
     	sleep_time = 1000000/samples;
@@ -621,7 +621,7 @@ void cli_wmacpi(global_t *globals, int samples)
 	acquire_global_info(globals);
 	usleep(sleep_time);
     }
-    
+
     ap = &globals->adapter;
     if(ap->power == AC) {
 	printf("On AC Power");
@@ -630,8 +630,8 @@ void cli_wmacpi(global_t *globals, int samples)
 	    if(binfo->present && (binfo->charge_state == CHARGE)) {
 		printf("; Battery %s charging", binfo->name);
 		printf(", currently at %2d%%", binfo->percentage);
-		if(binfo->charge_time >= 0) 
-		    printf(", %2d:%02d remaining", 
+		if(binfo->charge_time >= 0)
+		    printf(", %2d:%02d remaining",
 			   binfo->charge_time/60,
 			   binfo->charge_time%60);
 	    }
@@ -646,7 +646,7 @@ void cli_wmacpi(global_t *globals, int samples)
 		       binfo->percentage);
 	}
 	if(globals->rtime >= 0)
-	    printf("; %d:%02d remaining", globals->rtime/60, 
+	    printf("; %d:%02d remaining", globals->rtime/60,
 		   globals->rtime%60);
 	printf("\n");
     }
@@ -686,14 +686,14 @@ int main(int argc, char **argv)
     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}}, 
+     {"-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}}, 
+     {"-a", "--samples", "number of samples to average over (cli mode only)",  DONatural, False, {&samples}},
     };
 
     dockapp = calloc(1, sizeof(struct dockapp));
@@ -706,8 +706,8 @@ int main(int argc, char **argv)
     globals->crit_level = 10;
     battery_no = 1;
 
-    /* after this many samples, we reinit the battery and AC adapter 
-     * information. 
+    /* after this many samples, we reinit the battery and AC adapter
+     * information.
      * XXX: make these configurable . . . */
     batt_reinit = 100;
     ac_reinit = 1000;
@@ -716,10 +716,10 @@ 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 */
-    DAParseArguments(argc, argv, options, 10, 
-      "A battery monitor dockapp for ACPI based systems", 
+    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)
@@ -730,7 +730,7 @@ int main(int argc, char **argv)
         rt_mode = RT_CAP;
         rt_forced = 1;
     }
-        
+
     if (samplerate == 0) samplerate = 1;
     if (samplerate > 600) samplerate = 600;
 
@@ -801,7 +801,7 @@ int main(int argc, char **argv)
     battery_no--;
 
     /* make new dockapp window */
-    /* Don't even /think/ of asking me why, but if I set the window name to 
+    /* Don't even /think/ of asking me why, but if I set the window name to
      * "acpi", the app refuses to dock properly - it's just plain /weird/.
      * So, wmacpi it is . . . */
     new_window(display, "wmacpi", argc, argv);
@@ -854,9 +854,9 @@ int main(int argc, char **argv)
 		/* what /is/ this crap?
 		 * Turns out that libdockapp adds the WM_DELETE_WINDOW atom to
 		 * the WM_PROTOCOLS property for the window, which means that
-		 * rather than get a simple DestroyNotify message, we get a 
+		 * rather than get a simple DestroyNotify message, we get a
 		 * nice little message from the WM saying "hey, can you delete
-		 * yourself, pretty please?". So, when running as a window 
+		 * yourself, pretty please?". So, when running as a window
 		 * rather than an icon, we're impossible to kill in a friendly
 		 * manner, because we're expecting to die from a DestroyNotify
 		 * and thus blithely ignoring the WM knocking on our window
@@ -877,10 +877,10 @@ int main(int argc, char **argv)
 
 	/* XXX: some laptops have problems with sampling the battery
 	 * regularly - apparently, the BIOS disables interrupts while
-	 * reading from the battery, which is generally on a slow bus 
+	 * reading from the battery, which is generally on a slow bus
 	 * and is a slow device, so you get significant periods without
-	 * interrupts. This causes interactivity to suffer . . . 
-	 * 
+	 * interrupts. This causes interactivity to suffer . . .
+	 *
 	 * So, the workaround/fix for this is to sample at a much
 	 * lower rate than we may update/refresh/expose/whatever. The
 	 * user specifies how many times they want us to sample per
@@ -913,7 +913,7 @@ int main(int argc, char **argv)
 		if (globals->battery_count > 0) {
 		    if (battery_no > globals->battery_count)
 		        battery_no = 0;
-		    
+
 		    binfo = switch_battery(globals, battery_no);
 		}
 	    }
@@ -924,13 +924,13 @@ int main(int argc, char **argv)
 	     * they change - you can hotplug batteries on most laptops these days
 	     * and who knows what kind of shit will be happening soon . . . */
 	    if (batt_count++ >= batt_reinit) {
-		if(reinit_batteries(globals)) 
+		if(reinit_batteries(globals))
 		    pfatal("Oh my god, the batteries are gone!\n");
 		batt_count = 0;
 	    }
 
 	    if (ac_count++ >= ac_reinit) {
-		if(reinit_ac_adapters(globals)) 
+		if(reinit_ac_adapters(globals))
 		    pfatal("What happened to our AC adapters?!?\n");
 		ac_count = 0;
 	    }
@@ -942,15 +942,15 @@ int main(int argc, char **argv)
 	    scroll_count = 0;
 	}
 
-	/* The old code had some kind of weird crap with timers and the like. 
+	/* The old code had some kind of weird crap with timers and the like.
 	 * As far as I can tell, it's meaningless - the time we want to display
-	 * is the time calculated from the remaining capacity, as per the 
+	 * is the time calculated from the remaining capacity, as per the
 	 * ACPI spec. The only thing I'd change is the handling of a charging
-	 * state: my best guess, based on the behaviour I'm seeing with my 
+	 * state: my best guess, based on the behaviour I'm seeing with my
 	 * Lifebook, is that the present rate value when charging is the rate
 	 * at which the batteries are being charged, which would mean I'd just
-	 * need to reverse the rtime calculation to be able to work out how 
-	 * much time remained until the batteries were fully charged . . . 
+	 * need to reverse the rtime calculation to be able to work out how
+	 * much time remained until the batteries were fully charged . . .
 	 * That would be rather useful, though given it would vary rather a lot
 	 * it seems likely that it'd be little more than a rough guesstimate. */
 	set_time_display(globals);
@@ -960,7 +960,7 @@ int main(int argc, char **argv)
 	if (globals->battery_count == 0) {
 	    clear_percentage();
 	    clear_batt_id_area();
-	} else 
+	} else
 	    display_percentage(binfo->percentage);
 
 	scroll_text();

-- 
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