diff -urd autospeedstep-0.2.orig/autospeedstep.c autospeedstep-0.2/autospeedstep.c
--- autospeedstep-0.2.orig/autospeedstep.c	2002-07-12 12:23:12.000000000 +0300
+++ autospeedstep-0.2/autospeedstep.c	2004-04-19 13:27:22.341121704 +0300
@@ -51,67 +51,67 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <time.h>
+#include <getopt.h>
+#include <stdlib.h>
 
+#define CPUFILE		"/proc/acpi/processor/CPU0/performance"
+#define HIGHLOAD	70
+#define LOWLOAD		20
+#define HIGHCPU		0
+#define LOWCPU		1
 
 static int downcounter = 0, state = 3;
 static const char *progname;
 static int daemonize (void);
 static const char *logfile = "/var/log/speedstep";
-int highval=70;
-int lowval=20;
+char *cpufile = CPUFILE;
+int highval = HIGHLOAD;
+int lowval = LOWLOAD;
+int highcpu = HIGHCPU;
+int lowcpu = LOWCPU;
 
 void
-cpuup ()
+cpuspeed(int state, char *mode)
 {
   FILE *fp;
   time_t curtime;
   char *timestr;
 
-  if (state == 0)
-    return;
-  fp = fopen ("/proc/acpi/processor/CPU0/performance", "w");
+  fp = fopen (cpufile, "w");
   if (fp == NULL)
     {
-      perror ("/proc/acpi/processor/CPU0/performance");
+      perror (cpufile);
       exit (2);
     }
-  fprintf (fp, "0");
+  fprintf (fp, "%d", state);
   fclose (fp);
-  downcounter = 0;
   curtime = time (NULL);
   timestr = ctime (&curtime);
   timestr[strlen (timestr) - 1] = '\0';
   fprintf (stderr, timestr);
-  fprintf (stderr, ": max. speed mode\n");
+  fprintf (stderr, ": %s\n", mode);
   state = 0;
 }
 
 void
-cpudown ()
+cpuup ()
 {
-  FILE *fp;
-  time_t curtime;
-  char *timestr;
+  if (state == 0)
+    return;
+  cpuspeed(highcpu, "max. speed mode");
+  downcounter = 0;
+  state = 0;
+}
 
+void
+cpudown ()
+{
   if (state == 1)
     return;
   downcounter++;
   if (downcounter < 5)
     return;
-  fp = fopen ("/proc/acpi/processor/CPU0/performance", "w");
-  if (fp == NULL)
-    {
-      perror ("/proc/acpi/processor/CPU0/performance");
-      exit (2);
-    }
-  fprintf (fp, "1");
-  fclose (fp);
-
-  curtime = time (NULL);
-  timestr = ctime (&curtime);
-  timestr[strlen (timestr) - 1] = '\0';
-  fprintf (stderr, timestr);
-  fprintf (stderr, ": power save mode\n");
+  cpuspeed(lowcpu, "power save mode");
   state = 1;
 }
 
@@ -123,12 +123,53 @@
   unsigned int cuse, cice, load, csys, oldcuse = 0;
   unsigned long cide;
   FILE *fp;
-
+  int c;
 
 
   progname = (const char *) strrchr (argv[0], '/');
   progname = progname ? (progname + 1) : argv[0];
 
+  while (1)
+    {
+      static struct option long_options[] = {
+        {"acpifile", required_argument, NULL, 0},
+        {"highload", required_argument, NULL, 0},
+        {"lowload", required_argument, NULL, 0},
+        {"highstate", required_argument, NULL, 0},
+        {"lowstate", required_argument, NULL, 0},
+        {"help", no_argument, NULL, 0},
+        {NULL, 0, NULL, 0}
+      };
+      if ((c = getopt_long(argc, argv, "f:h:l:H:L:?", long_options, NULL)) == -1)
+        break;
+      switch (c)
+        {
+          case 'f':
+            cpufile = strdup(optarg);
+            break;
+          case 'h':
+            highval = atoi(optarg);
+            break;
+          case 'l':
+            lowval = atoi(optarg);
+            break;
+          case 'H':
+            highcpu = atoi(optarg);
+            break;
+          case 'L':
+            lowcpu = atoi(optarg);
+            break;
+          default:
+            fprintf(stderr, "usage: %s [OPTION]...\n", progname);
+            fprintf(stderr, "  -f, --acpifile     ACPI file to change CPU speed (default: %s)\n", CPUFILE);
+            fprintf(stderr, "  -h, --highload     enter max power mode above this load (default: %d)\n", HIGHLOAD);
+            fprintf(stderr, "  -l, --lowload      enter power savings below this load (default: %d)\n", LOWLOAD);
+            fprintf(stderr, "  -H, --highstate    CPU max power mode (default: %d)\n", HIGHCPU);
+            fprintf(stderr, "  -L, --lowstate     CPU power save mode (default: %d)\n", LOWCPU);
+            exit (1);
+        }
+      }
+
   /* check perms */
   if (geteuid () != 0)
     {
diff -urd autospeedstep-0.2.orig/configure.in autospeedstep-0.2/configure.in
--- autospeedstep-0.2.orig/configure.in	2002-07-12 12:23:54.000000000 +0300
+++ autospeedstep-0.2/configure.in	2004-04-19 13:30:19.733154016 +0300
@@ -23,7 +23,7 @@
 
 dnl Checks for header files.
 AC_STDC_HEADERS
-AC_CHECK_HEADERS(sys/types.h sys/termios.h termio.h termios.h sys/stat.h fcntl.h stdio.h unistd.h)
+AC_CHECK_HEADERS(sys/types.h sys/termios.h termio.h termios.h sys/stat.h fcntl.h stdio.h unistd.h stdlib.h getopt.h)
 dnl Checks for typedefs, structures, and compiler characteristics.
 
 dnl Checks for library functions.
