Update of /cvsroot/alsa/alsa-tools/sscape_ctl
In directory usw-pr-cvs1:/tmp/cvs-serv26330

Modified Files:
        sscape_ctl.c 
Log Message:
Updated to make utility slightly more user friendly - Chris Rankin <[EMAIL PROTECTED]>

Index: sscape_ctl.c
===================================================================
RCS file: /cvsroot/alsa/alsa-tools/sscape_ctl/sscape_ctl.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sscape_ctl.c        22 Sep 2002 08:58:04 -0000      1.1
+++ sscape_ctl.c        29 Sep 2002 15:26:20 -0000      1.2
@@ -16,6 +16,23 @@
 const char scope[] = "scope.cod";
 
 
+static void
+show_usage(void)
+{
+  printf("sscape_ctl: [--card card number]\n"
+         "            [--directory firmware directory]\n"
+         "sscape_ctl: --help\n"
+         "sscape_ctl: --version\n");
+}
+
+
+static void
+show_version(void)
+{
+  printf("ALSA SoundScape control utility: v" VERSION "\n");
+}
+
+
 void
 safe_close(int fd)
 {
@@ -120,13 +137,16 @@
   return err;
 }
 
+
 static const struct option long_option[] = {
   { "card", 1, NULL, 'c' },
   { "directory", 1, NULL, 'd' },
+  { "help", 0, NULL, 'h' },
+  { "version", 0, NULL, 'v' },
   { NULL, 0, NULL, '\0' }
 };
 
-static const char option[] = "c:d:";
+static const char option[] = "c:d:hv";
 
 int
 main(int argc, char *argv[])
@@ -157,14 +177,21 @@
       directory = optarg;
       break;
 
+    case 'h':
+      show_usage();
+      return EXIT_SUCCESS;
+
+    case 'v':
+      show_version();
+      return EXIT_SUCCESS;
+
     default:
-      fprintf(stderr, "Unknown option \'%c\'\n", c);
-      break;
+      return EXIT_FAILURE;
     } /* switch */
   } /* while */
 
   ret = EXIT_FAILURE;
-  sprintf(devicename, "hw:%i,0", card);
+  snprintf(devicename, sizeof(devicename), "hw:%i,0", card);
   err = snd_hwdep_open(&handle, devicename, O_WRONLY);
   if (err < 0)
   {



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to