Source obtained from http://sourceforge.net/projects/wmacpi/files/.
---
 wmacpi/README    |  4 ++--
 wmacpi/acpi.c    |  6 +++---
 wmacpi/libacpi.h |  4 ++--
 wmacpi/wmacpi.c  | 23 +++++++++++++++--------
 4 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/wmacpi/README b/wmacpi/README
index 409f8b8..97fcb19 100644
--- a/wmacpi/README
+++ b/wmacpi/README
@@ -19,7 +19,7 @@ under /proc/acpi, reads status information from them, and then
 displays summaries.
 
 Version 1.99 and later provides full support for multiple
-batteries. You can tell it to monitor a particular batter with the -m
+batteries. You can tell it to monitor a particular battery with the -m
 option, which will display the percentage remaining and current status
 message for that battery. The time remaining and AC/battery status are
 global - the time remaining is calculated based on all batteries found
@@ -51,4 +51,4 @@ this could have adverse effects.
 
 Please report bugs to <si...@dreamcraft.com.au>.
 
-Simon Fowler, 2003-11-23.
\ No newline at end of file
+Simon Fowler, 2003-11-23.
diff --git a/wmacpi/acpi.c b/wmacpi/acpi.c
index 2bb0935..23649fb 100644
--- a/wmacpi/acpi.c
+++ b/wmacpi/acpi.c
@@ -71,11 +71,11 @@ int main(int argc, char *argv[])
                        if(optarg != NULL) {
                                samples = atoi(optarg);
                                if(samples > 1000 || samples <= 0) {
-                                       printf("Please specify a reasonable 
number of samples\n");
+                                       fprintf(stderr, "Please specify a 
reasonable number of samples\n");
                                        exit(1);
+                               }
                        }
-                       }
-                       printf("samples: %d\n", samples);
+                       pinfo("samples: %d\n", samples);
                        sleep_time = 1000000/samples;
                        break;
                default:
diff --git a/wmacpi/libacpi.h b/wmacpi/libacpi.h
index 4ed6f5a..2ba7cc8 100644
--- a/wmacpi/libacpi.h
+++ b/wmacpi/libacpi.h
@@ -96,8 +96,6 @@ typedef struct {
  * It's a macro because I'm too lazy to deal with varargs.
  */
 
-static int verbosity = 0;
-
 #define pdebug(fmt, arg...)                            \
     do {                                               \
        if (verbosity > 2)                              \
@@ -124,6 +122,8 @@ static int verbosity = 0;
 battery_t batteries[MAXBATT];
 int batt_count;
 
+int verbosity;
+
 /* check if apm/acpi is enabled, etc */
 int power_init(void);
 /* fill global_t with data */
diff --git a/wmacpi/wmacpi.c b/wmacpi/wmacpi.c
index 158f514..96c6df3 100644
--- a/wmacpi/wmacpi.c
+++ b/wmacpi/wmacpi.c
@@ -63,6 +63,7 @@ typedef struct {
 Dockapp *dockapp;
 global_t *globals;
 int count = 0;                 /* global timer variable */
+/* extern int verbosity; */
 
 /* Time for scroll updates */
 #define DEFAULT_UPDATE 150
@@ -584,13 +585,19 @@ void set_batt_id_area(int bno)
 
 void usage(char *name)
 {
-    printf("%s - help\t\t[time...@japan.co.jp]\n\n"
+    printf("%s - help\t\t[si...@dreamcraft.com.au]\n\n"
           "-d display\t\tdisplay on remote display <display>\n"
           "-b\t\t\tmake noise when battery is critical low (beep)\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"
-          "-v\t\t\tincrease verbosity.\n"
+          "-s <sample rate>\trate at which to sample battery status\n"
+          "\t\t\tdefault 100 (once every three seconds)\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);
 }
@@ -664,11 +671,6 @@ int main(int argc, char **argv)
     globals->crit_level = 10;
     battery_no = 1;
 
-    /* see if whatever we want to use is supported */
-    if (power_init())
-       /* power_init functions handle printing error messages */
-       exit(1);
-
     /* parse command-line options */
     while ((ch = getopt(argc, argv, "d:c:m:s:a:hnwvV")) != EOF) {
        switch (ch) {
@@ -731,7 +733,7 @@ int main(int argc, char **argv)
            if(optarg != NULL) {
                samples = atoi(optarg);
                if(samples > 1000 || samples <= 0) {
-                   printf("Please specify a reasonable number of samples\n");
+                   fprintf(stderr, "Please specify a reasonable number of 
samples\n");
                    exit(1);
                }
            }
@@ -743,6 +745,11 @@ int main(int argc, char **argv)
        
     }
     
+    /* see if whatever we want to use is supported */
+    if (power_init())
+       /* power_init functions handle printing error messages */
+       exit(1);
+
     /* check for cli mode */
     if (cli) {
        cli_wmacpi(samples);
-- 
1.9.1


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to