Browse Source

prsoccessing cli args

phyto 6 months ago
parent
commit
407c980690
3 changed files with 30 additions and 4 deletions
  1. 2
    1
      audio/Makefile
  2. 1
    1
      audio/player.c
  3. 27
    2
      audio/t.c

+ 2
- 1
audio/Makefile View File

@@ -4,8 +4,9 @@
4 4
 
5 5
 
6 6
 CC      = gcc
7
-CCOPT   = -Wall -g -DDEBUG_LEVEL=1
7
+CCOPT   = -Wall -g -DDEBUG_LEVEL=0
8 8
 LIBS	= -lao -lsndfile -lm 
9
+
9 10
 player.o:	player.c Makefile
10 11
 	 $(CC) ${CCOPT} -c $< 
11 12
 

+ 1
- 1
audio/player.c View File

@@ -65,7 +65,7 @@ sndf = sf_open(fname, SFM_READ, &sfinfo);
65 65
 if (NULL==sndf)
66 66
         {
67 67
         perror("sf_open");
68
-        abort();
68
+        return -2;
69 69
         }
70 70
 
71 71
 #if DEBUG_LEVEL

+ 27
- 2
audio/t.c View File

@@ -4,15 +4,40 @@
4 4
  
5 5
 #include  <stdio.h>
6 6
 #include  <stdlib.h>
7
-
7
+#include <unistd.h>
8 8
 #include  "player.h"
9 9
 
10 10
 /* --------------------------------------------------------------------- */
11 11
 
12
+int		verbosity;
13
+
14
+/* --------------------------------------------------------------------- */
15
+void help(int v)
16
+{
17
+
18
+}
19
+/* --------------------------------------------------------------------- */
20
+
12 21
 int main(int argc, char *argv[])
13 22
 {
14 23
 char		*wavname = "1337.wav";
15
-int		foo;
24
+int		foo, opt, K;
25
+
26
+
27
+printf("\n**** %s **** compiled the %s at %s ***\n",
28
+		argv[0], __DATE__, __TIME__);
29
+
30
+
31
+while ((opt = getopt(argc, argv, "hK:vw:")) != -1) {
32
+	switch (opt) {
33
+		case 'h':	help(0);		break;
34
+		case 'K':	K = atoi(optarg);	break;
35
+		case 'v':	verbosity++;		break;
36
+		case 'w':	wavname = optarg;	break;
37
+		default:				break;
38
+		}
39
+	}
40
+
16 41
 
17 42
 
18 43
 foo = blast_this_file(wavname);

Loading…
Cancel
Save