Lines 1-18
Link Here
|
1 |
--- src/audio.c.orig Sat Jul 10 21:31:56 2004 |
1 |
--- src/audio.c.orig Wed Apr 5 03:16:50 2006 |
2 |
+++ src/audio.c Sat Jul 10 21:32:05 2004 |
2 |
+++ src/audio.c Mon May 8 14:31:45 2006 |
3 |
@@ -578,6 +578,7 @@ |
3 |
@@ -30,6 +30,8 @@ |
4 |
|
4 |
#include "onechar.h" |
5 |
float testvalue; |
5 |
|
6 |
char key = '\0'; |
6 |
extern char sc_device[]; |
7 |
+int runnit = 1; |
7 |
+char soundlog_dir[FILENAME_MAX]; |
8 |
|
8 |
+char *home; |
9 |
clear(); |
9 |
|
10 |
|
10 |
int afd; |
11 |
@@ -586,7 +587,6 @@ |
11 |
|
12 |
/* ------------initialize sound card --------*/ |
12 |
@@ -668,10 +670,8 @@ |
13 |
init_audio(); |
13 |
mvprintw(15,20, "recording %s", ph_message[0]); |
14 |
|
14 |
mvprintw(16,20, ""); |
15 |
-int runnit = 1; |
15 |
refresh(); |
16 |
|
16 |
- strcpy(commands,"rec -w -r 8000 -d "); |
17 |
while (runnit == 1) { |
17 |
- strcat(commands, sc_device); |
18 |
|
18 |
- strcat(commands, " "); // (W9WI) |
|
|
19 |
- strcat(commands, ph_message[0]); |
20 |
+ snprintf(commands,sizeof(commands), "rec -w -w 8000 -d %s %s", |
21 |
+ sc_device, ph_message[0]); |
22 |
system (commands); |
23 |
runnit = 0; |
24 |
break; |
25 |
@@ -680,21 +680,16 @@ |
26 |
mvprintw(16,20, ""); |
27 |
refresh(); |
28 |
|
29 |
- strcpy(commands,"rec -w -r 8000 -d "); |
30 |
- strcat(commands, sc_device); |
31 |
- strcat(commands, " "); // (W9WI) |
32 |
- strcat(commands, ph_message[1]); |
33 |
- system (commands); |
34 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
35 |
+ sc_device, ph_message[1]); |
36 |
runnit = 0; |
37 |
break; |
38 |
case 131 : |
39 |
mvprintw(15,20, "recording %s", ph_message[2]); |
40 |
mvprintw(16,20, ""); |
41 |
refresh(); |
42 |
- strcpy(commands,"rec -w -r 8000 -d "); |
43 |
- strcat(commands, sc_device); |
44 |
- strcat(commands, " "); // (W9WI) |
45 |
- strcat(commands, ph_message[2]); |
46 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
47 |
+ sc_device, ph_message[2]); |
48 |
system (commands); |
49 |
runnit = 0; |
50 |
break; |
51 |
@@ -702,10 +697,8 @@ |
52 |
mvprintw(15,20, "recording %s", ph_message[3]); |
53 |
mvprintw(16,20, ""); |
54 |
refresh(); |
55 |
- strcpy(commands,"rec -w -r 8000 -d "); |
56 |
- strcat(commands, sc_device); |
57 |
- strcat(commands, " "); // (W9WI) |
58 |
- strcat(commands, ph_message[3]); |
59 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
60 |
+ sc_device, ph_message[3]); |
61 |
system (commands); |
62 |
runnit = 0; |
63 |
break; |
64 |
@@ -713,10 +706,8 @@ |
65 |
mvprintw(15,20, "recording %s", ph_message[4]); |
66 |
mvprintw(16,20, ""); |
67 |
refresh(); |
68 |
- strcpy(commands,"rec -w -r 8000 -d "); |
69 |
- strcat(commands, sc_device); |
70 |
- strcat(commands, " "); // (W9WI) |
71 |
- strcat(commands, ph_message[4]); |
72 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
73 |
+ sc_device, ph_message[4]); |
74 |
system (commands); |
75 |
runnit = 0; |
76 |
break; |
77 |
@@ -724,10 +715,8 @@ |
78 |
mvprintw(15,20, "recording %s", ph_message[5]); |
79 |
mvprintw(16,20, ""); |
80 |
refresh(); |
81 |
- strcpy(commands,"rec -w -r 8000 -d "); |
82 |
- strcat(commands, sc_device); |
83 |
- strcat(commands, " "); // (W9WI) |
84 |
- strcat(commands, ph_message[5]); |
85 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
86 |
+ sc_device, ph_message[5]); |
87 |
system (commands); |
88 |
runnit = 0; |
89 |
break; |
90 |
@@ -735,10 +724,8 @@ |
91 |
mvprintw(15,20, "recording %s", ph_message[6]); |
92 |
mvprintw(16,20, ""); |
93 |
refresh(); |
94 |
- strcpy(commands,"rec -w -r 8000 -d "); |
95 |
- strcat(commands, sc_device); |
96 |
- strcat(commands, " "); // (W9WI) |
97 |
- strcat(commands, ph_message[6]); |
98 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
99 |
+ sc_device, ph_message[6]); |
100 |
system (commands); |
101 |
runnit = 0; |
102 |
break; |
103 |
@@ -746,10 +733,8 @@ |
104 |
mvprintw(15,20, "recording %s", ph_message[7]); |
105 |
mvprintw(16,20, ""); |
106 |
refresh(); |
107 |
- strcpy(commands,"rec -w -r 8000 -d "); |
108 |
- strcat(commands, sc_device); |
109 |
- strcat(commands, " "); // (W9WI) |
110 |
- strcat(commands, ph_message[7]); |
111 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
112 |
+ sc_device, ph_message[7]); |
113 |
system (commands); |
114 |
runnit = 0; |
115 |
break; |
116 |
@@ -757,10 +742,8 @@ |
117 |
mvprintw(15,20, "recording %s", ph_message[8]); |
118 |
mvprintw(16,20, ""); |
119 |
refresh(); |
120 |
- strcpy(commands,"rec -w -r 8000 -d "); |
121 |
- strcat(commands, sc_device); |
122 |
- strcat(commands, " "); // (W9WI) |
123 |
- strcat(commands, ph_message[8]); |
124 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
125 |
+ sc_device, ph_message[8]); |
126 |
system (commands); |
127 |
runnit = 0; |
128 |
break; |
129 |
@@ -768,10 +751,8 @@ |
130 |
mvprintw(15,20, "recording %s", ph_message[9]); |
131 |
mvprintw(16,20, ""); |
132 |
refresh(); |
133 |
- strcpy(commands,"rec -w -r 8000 -d "); |
134 |
- strcat(commands, sc_device); |
135 |
- strcat(commands, " "); // (W9WI) |
136 |
- strcat(commands, ph_message[9]); |
137 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
138 |
+ sc_device, ph_message[9]); |
139 |
system (commands); |
140 |
runnit = 0; |
141 |
break; |
142 |
@@ -779,10 +760,8 @@ |
143 |
mvprintw(15,20, "recording %s", ph_message[10]); |
144 |
mvprintw(16,20, ""); |
145 |
refresh(); |
146 |
- strcpy(commands,"rec -w -r 8000 -d "); |
147 |
- strcat(commands, sc_device); |
148 |
- strcat(commands, " "); // (W9WI) |
149 |
- strcat(commands, ph_message[10]); |
150 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
151 |
+ sc_device, ph_message[10]); |
152 |
system (commands); |
153 |
runnit = 0; |
154 |
break; |
155 |
@@ -790,10 +769,8 @@ |
156 |
mvprintw(15,20, "recording %s", ph_message[11]); |
157 |
mvprintw(16,20, ""); |
158 |
refresh(); |
159 |
- strcpy(commands,"rec -w -r 8000 -d "); |
160 |
- strcat(commands, sc_device); |
161 |
- strcat(commands, " "); // (W9WI) |
162 |
- strcat(commands, ph_message[11]); |
163 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
164 |
+ sc_device, ph_message[11]); |
165 |
system (commands); |
166 |
runnit = 0; |
167 |
break; |
168 |
@@ -802,10 +779,8 @@ |
169 |
mvprintw(15,20, "recording %s", ph_message[12]); |
170 |
mvprintw(16,20, ""); |
171 |
refresh(); |
172 |
- strcpy(commands,"rec -w -r 8000 -d "); |
173 |
- strcat(commands, sc_device); |
174 |
- strcat(commands, " "); // (W9WI) |
175 |
- strcat(commands, ph_message[12]); |
176 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
177 |
+ sc_device, ph_message[12]); |
178 |
system (commands); |
179 |
runnit = 0; |
180 |
break; |
181 |
@@ -814,10 +789,8 @@ |
182 |
mvprintw(15,20, "recording %s", ph_message[13]); |
183 |
mvprintw(16,20, ""); |
184 |
refresh(); |
185 |
- strcpy(commands,"rec -w -r 8000 -d "); |
186 |
- strcat(commands, sc_device); |
187 |
- strcat(commands, " "); // (W9WI) |
188 |
- strcat(commands, ph_message[13]); |
189 |
+ snprintf(commands,sizeof(commands),"rec -w -r 8000 -d %s %s", |
190 |
+ sc_device, ph_message[13]); |
191 |
system (commands); |
192 |
runnit = 0; |
193 |
break; |
194 |
@@ -840,7 +813,13 @@ |
195 |
runnit = 0; |
196 |
break; |
197 |
case '3' : |
198 |
- sounddir = opendir("$HOME/tlf/soundlogs/"); // (W9WI) |
199 |
+ if ((home = getenv("HOME")) != NULL) { |
200 |
+ snprintf(soundlog_dir,sizeof(soundlog_dir), |
201 |
+ "%s/tlf/soundlogs/", home); |
202 |
+ sounddir = opendir(soundlog_dir); |
203 |
+ } else |
204 |
+ sounddir = NULL; |
205 |
+ |
206 |
|
207 |
if (sounddir == NULL) break; |
208 |
|