1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
|
diff -u wavplay-1.4/Makefile wavplay-1.4-new/Makefile
--- wavplay-1.4/Makefile 1999-12-04 01:06:42.000000000 +0100
+++ wavplay-1.4-new/Makefile 2003-03-11 11:15:53.000000000 +0100
@@ -38,7 +38,7 @@
#----------------------------------------------------------------------
# If you are running a 386 you should comment this line out.
#
-CPU=-m486
+# CPU=-m486
#----------------------------------------------------------------------
# If you are experiencing troubles (like core dumps!), then uncomment
@@ -47,7 +47,7 @@
# adjust the STRIP option to suit compile mode:
#
#DEBUG=-g
-OPT=-O2
+# OPT=-O2
#----------------------------------------------------------------------
# When using 'DEBUG=-g' above, then comment out the 'strip' line:
@@ -115,7 +115,7 @@
# Environment variable WAVPLAYPATH will override this value at runtime, if
# present.
#
-PLAYPATH= -DWAVPLAYPATH=\"$(INSTDIR)/wavplay\"
+PLAYPATH= -DWAVPLAYPATH=\"/usr/bin/wavplay\"
#----------------------------------------------------------------------
# Minimum DSP sampling rate (default is 4000)
@@ -164,7 +164,7 @@
# installed).
#
#CUSTINCL= -I/usr/X11R6/include/X11 -I/usr/local/lesstif/include/Xm
-
+CUSTINCL= -I /usr/X11R6/include
#----------------------------------------------------------------------
# Normally, you shouldn't need to change anything beyond this point:
#----------------------------------------------------------------------
@@ -173,8 +173,6 @@
CUSTMOPTS=$(STDGETOPTS) $(PLAYPATH) $(DSPMIN) $(DSPMAX) $(DSPPATH) $(DSPLOCKS) $(USERES) $(NOEDITRES) $(SCHED_PRIORITY)
ELF= # -fPIC
INCL= -I. $(CUSTINCL)
-CCFLAGS= -c $(DEBUG)$(OPT) $(CPU) $(ELF) -fhandle-exceptions $(CUSTMOPTS) -Wall -Wstrict-prototypes
-CFLAGS= -c $(DEBUG)$(OPT) $(CPU) $(ELF) -Wall -Wstrict-prototypes $(CUSTMOPTS)
CC= gcc
CP= g++
@@ -184,10 +182,10 @@
WVDMPO= wavdump.o
.cc.o:
- $(CP) $(CCFLAGS) $(INCL) $<
+ $(CP) -c $(CCFLAGS) $(CUSTMOPTS) $(INCL) $<
.c.o:
- $(CC) $(CFLAGS) $(INCL) $<
+ $(CC) -c $(CFLAGS) $(CUSTMOPTS) $(INCL) $<
all: wavplay wavrec xltwavplay
diff -u wavplay-1.4/client.c wavplay-1.4-new/client.c
--- wavplay-1.4/client.c 1999-12-04 01:06:42.000000000 +0100
+++ wavplay-1.4-new/client.c 2003-03-11 10:21:50.000000000 +0100
@@ -135,7 +135,7 @@
* communications.
*/
if ( (svrIPC = MsgCreate()) < 0 ) {
- err("%s: creating message queue",sys_errlist[errno]);
+ err("%s: creating message queue",strerror(errno));
return -1;
}
@@ -153,12 +153,12 @@
else execl(env_WAVPLAYPATH,buf,NULL); /* No debug yet */
/* Returns only if error occurs */
- fprintf(stderr,"%s: exec of %s\n",sys_errlist[errno],env_WAVPLAYPATH);
+ fprintf(stderr,"%s: exec of %s\n",strerror(errno),env_WAVPLAYPATH);
exit(2);
} else if ( svrPID < 0 ) {
e = errno;
- err("%s: forking the server process",sys_errlist[errno]);
+ err("%s: forking the server process",strerror(errno));
MsgClose(svrIPC);
errno = e; /* Restore error code */
return -1;
@@ -216,7 +216,7 @@
if ( (rc = MsgSend(svrIPC,&msg,flags,MSGNO_SRVR)) != 0 && erf != NULL )
err("%s: Sending server message '%s'",
msg_name(cmd),
- sys_errlist[errno]);
+ strerror(errno));
return rc; /* Zero indicates success */
}
@@ -236,7 +236,7 @@
msg.bytes = strlen(msg.u.tosvr_path.path);
if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL )
- err("%s: Sending server message 'path'",sys_errlist[errno]);
+ err("%s: Sending server message 'path'",strerror(errno));
return z;
}
@@ -255,7 +255,7 @@
msg.bytes = sizeof msg.u.tosvr_bits;
if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL )
- err("%s: Sending server message 'bits'",sys_errlist[errno]);
+ err("%s: Sending server message 'bits'",strerror(errno));
return z;
}
@@ -275,7 +275,7 @@
msg.bytes = sizeof msg.u.tosvr_start_sample;
if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL )
- err("%s: Sending server message 'start_sample'",sys_errlist[errno]);
+ err("%s: Sending server message 'start_sample'",strerror(errno));
return z;
}
@@ -294,7 +294,7 @@
msg.bytes = sizeof msg.u.tosvr_sampling_rate;
if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL )
- err("%s: Sending server message 'sampling_rate'",sys_errlist[errno]);
+ err("%s: Sending server message 'sampling_rate'",strerror(errno));
return z;
}
@@ -314,7 +314,7 @@
msg.bytes = sizeof msg.u.tosvr_chan;
if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL )
- err("%s: Sending server message 'tosvr_chan'",sys_errlist[errno]);
+ err("%s: Sending server message 'tosvr_chan'",strerror(errno));
return z;
}
@@ -336,7 +336,7 @@
msg.bytes = sizeof msg.u.tosvr_record;
if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL )
- err("%s: Sending server message 'tosvr_record'",sys_errlist[errno]);
+ err("%s: Sending server message 'tosvr_record'",strerror(errno));
return z;
}
@@ -356,7 +356,7 @@
msg.bytes = sizeof msg.u.tosvr_debug;
if ( (z = MsgToServer(svrIPC,&msg,flags)) != 0 && erf != NULL )
- err("%s: Sending server message 'tosvr_debug'",sys_errlist[errno]);
+ err("%s: Sending server message 'tosvr_debug'",strerror(errno));
return z;
}
diff -u wavplay-1.4/file.c wavplay-1.4-new/file.c
--- wavplay-1.4/file.c 1999-12-04 01:06:42.000000000 +0100
+++ wavplay-1.4-new/file.c 2003-03-11 10:30:30.000000000 +0100
@@ -106,7 +106,7 @@
WAVFILE *wfile = (WAVFILE *) malloc(sizeof (WAVFILE));
if ( wfile == NULL ) {
- err("%s: Allocating WAVFILE structure",sys_errlist[ENOMEM]);
+ err("%s: Allocating WAVFILE structure",strerror(ENOMEM));
return NULL;
}
@@ -114,7 +114,7 @@
if ( (wfile->Pathname = strdup(Pathname)) == NULL ) {
free(wfile);
- err("%s: Allocating storage for WAVFILE.Pathname",sys_errlist[ENOMEM]);
+ err("%s: Allocating storage for WAVFILE.Pathname",strerror(ENOMEM));
return NULL;
}
@@ -166,14 +166,14 @@
*/
if ( (wfile->fd = open(wfile->Pathname,O_RDONLY)) < 0 ) {
err("%s:\nOpening WAV file %s",
- sys_errlist[errno],
+ strerror(errno),
wfile->Pathname);
goto errxit;
}
if ( lseek(wfile->fd,0L,SEEK_SET) != 0L ) {
err("%s:\nRewinding WAV file %s",
- sys_errlist[errno],
+ strerror(errno),
wfile->Pathname);
goto errxit; /* Wav file must be seekable device */
}
@@ -205,12 +205,12 @@
* Seek to byte count and read dbytes:
*/
if ( lseek(wfile->fd,offset,SEEK_SET) != offset ) {
- err("%s:\nSeeking to WAV data in %s",sys_errlist[errno],wfile->Pathname);
+ err("%s:\nSeeking to WAV data in %s",strerror(errno),wfile->Pathname);
goto errxit; /* Seek failure */
}
if ( read(wfile->fd,ubuf,4) != 4 ) {
- err("%s:\nReading dbytes from %s",sys_errlist[errno],wfile->Pathname);
+ err("%s:\nReading dbytes from %s",strerror(errno),wfile->Pathname);
goto errxit;
}
@@ -308,7 +308,7 @@
v_erf = erf; /* Set error reporting function */
if ( wfile == NULL ) {
- err("%s: WAVFILE pointer is NULL!",sys_errlist[EINVAL]);
+ err("%s: WAVFILE pointer is NULL!",strerror(EINVAL));
errno = EINVAL;
return -1;
}
@@ -322,9 +322,9 @@
if ( (e = WaveReadHeader(wfile->fd,&channels,&samplerate,&sample_bits,&samples,&datastart,_v_erf)) != 0 )
err("%s:\nReading WAV header from %s",emsg,wfile->Pathname);
else if ( lseek(wfile->fd,(long)(datastart-4),SEEK_SET) != (long)(datastart-4) )
- err("%s:\nSeeking in WAV header file %s",sys_errlist[errno],wfile->Pathname);
+ err("%s:\nSeeking in WAV header file %s",strerror(errno),wfile->Pathname);
else if ( write(wfile->fd,&wfile->wavinfo.Samples,sizeof wfile->wavinfo.Samples) != sizeof wfile->wavinfo.Samples )
- err("%s:\nWriting in WAV header file %s",sys_errlist[errno],wfile->Pathname);
+ err("%s:\nWriting in WAV header file %s",strerror(errno),wfile->Pathname);
else {
/*
* 'data' chunk was updated OK: Now we have to update the RIFF block
@@ -333,24 +333,24 @@
*/
if ( ftruncate(wfile->fd,(size_t)fpos) )
err("%s:\nTruncating file %s to correct size",
- sys_errlist[errno],
+ strerror(errno),
wfile->Pathname);
else if ( lseek(wfile->fd,4L,SEEK_SET) < 0L )
err("%s:\nSeek 4 for RIFF block update of %s",
- sys_errlist[errno],
+ strerror(errno),
wfile->Pathname);
else {
fpos -= 8; /* Byte count for RIFF block */
if ( write(wfile->fd,&fpos,sizeof fpos) != sizeof fpos )
err("%s:\nUpdate of RIFF block count in %s failed",
- sys_errlist[errno],
+ strerror(errno),
wfile->Pathname);
}
}
}
if ( close(wfile->fd) < 0 ) {
- err("%s:\nClosing WAV file",sys_errlist[errno]);
+ err("%s:\nClosing WAV file",strerror(errno));
e = errno; /* Save errno value to return */
}
@@ -385,7 +385,7 @@
*/
if ( (wfile->fd = open(wfile->Pathname,O_RDWR|O_TRUNC|O_CREAT,0666)) < 0 ) {
err("%s:\nOpening %s for WAV writing",
- sys_errlist[errno],
+ strerror(errno),
wfile->Pathname);
return NULL; /* Open error */
}
@@ -427,7 +427,7 @@
v_erf = erf; /* Set error reporting function */
if ( dfile == NULL ) {
- err("%s: Opening DSP device",sys_errlist[errno=ENOMEM]);
+ err("%s: Opening DSP device",strerror(errno=ENOMEM));
return NULL;
}
@@ -439,7 +439,7 @@
*/
if ( (dfile->fd = open(env_AUDIODEV,omode,0)) < 0 ) {
err("%s:\nOpening audio device %s",
- sys_errlist[errno],
+ strerror(errno),
env_AUDIODEV);
goto errxit;
}
@@ -449,7 +449,7 @@
* setting sampling rate etc.
*/
if ( ioctl(dfile->fd,SNDCTL_DSP_GETBLKSIZE,&dfile->dspblksiz) < 0 ) {
- err("%s: Optaining DSP's block size",sys_errlist[errno]);
+ err("%s: Optaining DSP's block size",strerror(errno));
goto errxit;
}
@@ -460,7 +460,7 @@
/* and 64 for 8130Hz, 8 bit */
if ( dfile->dspblksiz < 32 || dfile->dspblksiz > 65536 ) {
err("%s: Audio block size (%d bytes)",
- sys_errlist[errno=EINVAL],
+ strerror(errno=EINVAL),
(int)dfile->dspblksiz);
goto errxit;
}
@@ -469,7 +469,7 @@
* Allocate a buffer to do the I/O through:
*/
if ( (dfile->dspbuf = (char *) malloc(dfile->dspblksiz)) == NULL ) {
- err("%s: For DSP I/O buffer",sys_errlist[errno]);
+ err("%s: For DSP I/O buffer",strerror(errno));
goto errxit;
}
@@ -478,7 +478,7 @@
*/
t = wfile->wavinfo.DataBits;
if ( ioctl(dfile->fd,SNDCTL_DSP_SAMPLESIZE,&t) < 0 ) {
- err("%s: Setting DSP to %u bits",sys_errlist[errno],(unsigned)t);
+ err("%s: Setting DSP to %u bits",strerror(errno),(unsigned)t);
goto errxit;
}
@@ -488,7 +488,7 @@
t = wfile->wavinfo.Channels == Stereo ? 1 : 0;
if ( ioctl(dfile->fd,SNDCTL_DSP_STEREO,&t) < 0 ) {
err("%s: Unable to set DSP to %s mode",
- sys_errlist[errno],
+ strerror(errno),
t?"Stereo":"Mono");
goto errxit;
}
@@ -498,7 +498,7 @@
*/
ul = wfile->wavinfo.SamplingRate;
if ( ioctl(dfile->fd,SNDCTL_DSP_SPEED,&ul) < 0 ) {
- err("Unable to set audio sampling rate",sys_errlist[errno]);
+ err("Unable to set audio sampling rate",strerror(errno));
goto errxit;
}
@@ -530,7 +530,7 @@
v_erf = erf; /* Set error reporting function */
if ( dfile == NULL ) {
- err("%s: DSPFILE is not open",sys_errlist[errno=EINVAL]);
+ err("%s: DSPFILE is not open",strerror(errno=EINVAL));
return -1;
}
@@ -540,7 +540,7 @@
free(dfile);
if ( close(fd) ) {
- err("%s: Closing DSP fd %d",sys_errlist[errno],fd);
+ err("%s: Closing DSP fd %d",strerror(errno),fd);
return -1;
}
@@ -565,7 +565,7 @@
* Check that the WAVFILE is open for reading:
*/
if ( wfile->rw != 'R' ) {
- err("%s: WAVFILE must be open for reading",sys_errlist[errno=EINVAL]);
+ err("%s: WAVFILE must be open for reading",strerror(errno=EINVAL));
return -1;
}
@@ -581,7 +581,7 @@
break;
default :
err("%s: Cannot process %u bit samples",
- sys_errlist[errno=EINVAL],
+ strerror(errno=EINVAL),
(unsigned)wfile->wavinfo.DataBits);
return -1;
}
@@ -593,7 +593,7 @@
byte_count *= 2; /* Twice as many bytes for stereo */
else if ( wfile->wavinfo.Channels != Mono ) {
err("%s: DSPFILE control block is corrupted (chan_mode)",
- sys_errlist[errno=EINVAL]);
+ strerror(errno=EINVAL));
return -1;
}
@@ -606,7 +606,7 @@
update_bytes = ((wfile->wavinfo.SamplingRate*byte_modulo) / (RECPLAY_UPDATES_PER_SEC*dfile->dspblksiz)) * dfile->dspblksiz;
if ( ioctl(dfile->fd,SNDCTL_DSP_SYNC,0) != 0 )
- err("%s: ioctl(%d,SNDCTL_DSP_SYNC,0)",sys_errlist[errno]);
+ err("%s: ioctl(%d,SNDCTL_DSP_SYNC,0)",strerror(errno));
/* Seek to requested start sample */
lseek(wfile->fd,wfile->StartSample*byte_modulo,SEEK_CUR);
@@ -620,8 +620,8 @@
if ( (n = read(wfile->fd,dfile->dspbuf,bytes)) != bytes ) {
if ( n >= 0 )
- err("Unexpected EOF reading samples from WAV file",sys_errlist[errno=EIO]);
- else err("Reading samples from WAV file",sys_errlist[errno]);
+ err("Unexpected EOF reading samples from WAV file",strerror(errno=EIO));
+ else err("Reading samples from WAV file",strerror(errno));
goto errxit;
}
@@ -635,7 +635,7 @@
}
if ( write(dfile->fd,dfile->dspbuf,n) != n ) {
- err("Writing samples to audio device",sys_errlist[errno]);
+ err("Writing samples to audio device",strerror(errno));
goto errxit;
}
@@ -651,7 +651,7 @@
#if 0 /* I think this is doing a destructive flush: disabled */
if ( ioctl(dfile->fd,SNDCTL_DSP_SYNC,0) != 0 )
- err("%s: ioctl(%d,SNDCTL_DSP_SYNC,0)",sys_errlist[errno]);
+ err("%s: ioctl(%d,SNDCTL_DSP_SYNC,0)",strerror(errno));
#endif
/* Update client time display at end of sucessful play */
if (clntIPC >= 0) {
@@ -688,7 +688,7 @@
* Check that the WAVFILE is open for writing:
*/
if ( wfile->rw != 'W' ) {
- err("WAVFILE must be open for writing",sys_errlist[errno=EINVAL]);
+ err("WAVFILE must be open for writing",strerror(errno=EINVAL));
return -1;
}
@@ -705,7 +705,7 @@
break;
default :
err("Cannot process %u bit samples",
- sys_errlist[errno=EINVAL],
+ strerror(errno=EINVAL),
(unsigned)wfile->wavinfo.DataBits);
return -1;
}
@@ -716,7 +716,7 @@
if ( wfile->wavinfo.Channels == Stereo )
byte_count *= 2; /* Twice as many bytes for stereo */
else if ( wfile->wavinfo.Channels != Mono ) {
- err("DSPFILE control block is corrupted (chan_mode)",sys_errlist[errno=EINVAL]);
+ err("DSPFILE control block is corrupted (chan_mode)",strerror(errno=EINVAL));
return -1;
}
@@ -747,7 +747,7 @@
* Read a block of samples:
*/
if ( (n = read(dfile->fd,dfile->dspbuf,bytes)) < 0 ) {
- err("Reading DSP device",sys_errlist[errno]);
+ err("Reading DSP device",strerror(errno));
goto errxit;
} else if ( n == 0 )
break;
@@ -756,12 +756,12 @@
* Write a block of samples to the file:
*/
if ( (bytes = write(wfile->fd,dfile->dspbuf,n)) < 0 ) {
- err("Writing WAV samples to %s",sys_errlist[errno],wfile->Pathname);
+ err("Writing WAV samples to %s",strerror(errno),wfile->Pathname);
goto errxit;
} else if ( bytes != n ) {
if ( bytes > 0 )
bytes_written += bytes;
- err("Did not write all WAV successfully",sys_errlist[errno=EIO]);
+ err("Did not write all WAV successfully",strerror(errno=EIO));
goto errxit;
}
diff -u wavplay-1.4/locks.c wavplay-1.4-new/locks.c
--- wavplay-1.4/locks.c 1999-12-04 01:06:42.000000000 +0100
+++ wavplay-1.4-new/locks.c 2003-03-11 10:31:04.000000000 +0100
@@ -125,7 +125,7 @@
*/
if ( (ipc = semget(LockIPCKey,2,IPC_CREAT|IPC_EXCL|0666)) < 0 && errno != EEXIST ) {
err("Unable to create a semaphore set for key 0x%lX",
- sys_errlist[errno],
+ strerror(errno),
LockIPCKey);
return -1; /* No system IPC resources? */
}
@@ -157,7 +157,7 @@
*/
e = errno; /* Save error */
semctl(ipc,0,IPC_RMID,NULL); /* Destroy bad sems */
- err("%s: Unable to initialize semaphore set values",sys_errlist[errno=e]);
+ err("%s: Unable to initialize semaphore set values",strerror(errno=e));
return -1; /* Return err ind. */
}
}
@@ -199,7 +199,7 @@
}
if ( s < 0 )
- err("%s: Locking the %s semaphore",sys_errlist[errno],playrecx?"Record":"Play");
+ err("%s: Locking the %s semaphore",strerror(errno),playrecx?"Record":"Play");
/*
* Exit this procedure:
@@ -232,7 +232,7 @@
if ( s < 0 )
err("%s: Unlocking the %s semaphore",
- sys_errlist[errno],
+ strerror(errno),
playrecx?"Record":"Play");
return s;
diff -u wavplay-1.4/main.c wavplay-1.4-new/main.c
--- wavplay-1.4/main.c 1999-12-04 01:06:42.000000000 +0100
+++ wavplay-1.4-new/main.c 2003-03-11 10:23:51.000000000 +0100
@@ -363,7 +363,7 @@
dup2(fd,2);
close(fd);
} else fprintf(stderr,"%s: cannot go quiet due to /dev/null\n",
- sys_errlist[errno]);
+ strerror(errno));
}
/*
@@ -393,7 +393,7 @@
*/
if ( wavopts.IPCKey && (wavopts.ipc = OpenDSPLocks(wavopts.IPCKey,
!(wavopts.PlayLock.optChar | wavopts.RecdLock.optChar),v_erf)) < 0 ) {
- err("%s: Unable to get audio locking semaphores.",sys_errlist[errno]);
+ err("%s: Unable to get audio locking semaphores.",strerror(errno));
exit(1);
}
@@ -405,7 +405,7 @@
* Remove old semaphore set :
*/
if ( semctl(wavopts.ipc,0,IPC_RMID,NULL) < 0 ) {
- err("%s: Unable to remove old locking semaphores.",sys_errlist[errno]);
+ err("%s: Unable to remove old locking semaphores.",strerror(errno));
exit(1);
}
@@ -422,7 +422,7 @@
* Get replacement semaphores :
*/
if ( wavopts.IPCKey && (wavopts.ipc = OpenDSPLocks(wavopts.IPCKey,0,v_erf)) < 0 ) {
- err("%s: Unable to get audio locking semaphores.",sys_errlist[errno]);
+ err("%s: Unable to get audio locking semaphores.",strerror(errno));
exit(1);
}
}
@@ -431,7 +431,7 @@
* -u play unlock request :
*/
if ( wavopts.PlayLock.optChar == OPF_PLAY_UNLOCK && UnlockDSP(wavopts.ipc,0,v_erf) ) {
- err("%s: -%c unlock request failed.",sys_errlist[errno],OPF_PLAY_UNLOCK);
+ err("%s: -%c unlock request failed.",strerror(errno),OPF_PLAY_UNLOCK);
exit(1);
}
@@ -439,7 +439,7 @@
* -U record unlock request :
*/
if ( wavopts.RecdLock.optChar == OPF_RECD_UNLOCK && UnlockDSP(wavopts.ipc,1,v_erf) ) {
- err("%s: -%c unlock request failed.",sys_errlist[errno],OPF_RECD_UNLOCK);
+ err("%s: -%c unlock request failed.",strerror(errno),OPF_RECD_UNLOCK);
exit(1);
}
@@ -447,7 +447,7 @@
* -l play lock request :
*/
if ( wavopts.PlayLock.optChar == OPF_PLAY_LOCK && LockDSP(wavopts.ipc,0,v_erf,0) ) {
- err("%s: -%c lock request failed.",sys_errlist[errno],OPF_PLAY_LOCK);
+ err("%s: -%c lock request failed.",strerror(errno),OPF_PLAY_LOCK);
exit(1);
}
@@ -455,7 +455,7 @@
* -L record lock request :
*/
if ( wavopts.RecdLock.optChar == OPF_RECD_LOCK && LockDSP(wavopts.ipc,1,v_erf,0) ) {
- err("%s: -%c lock request failed.",sys_errlist[errno],OPF_RECD_LOCK);
+ err("%s: -%c lock request failed.",strerror(errno),OPF_RECD_LOCK);
exit(1);
}
diff -u wavplay-1.4/save_as.c wavplay-1.4-new/save_as.c
--- wavplay-1.4/save_as.c 1999-12-04 01:06:42.000000000 +0100
+++ wavplay-1.4-new/save_as.c 2003-03-11 10:23:31.000000000 +0100
@@ -81,7 +81,7 @@
if ( stat(RECORD_PATH,&src_stat) != 0 ) {
if ( errno == ENOENT )
ReportErrorf("No file %s to 'save'.",RECORD_PATH);
- else ReportErrorf("%s: doing stat on recorded.wav",sys_errlist[errno]);
+ else ReportErrorf("%s: doing stat on recorded.wav",strerror(errno));
return;
}
@@ -139,29 +139,29 @@
if ( !bCopy ) {
if ( link(RECORD_PATH,path) == 0 ) { /* mv by linking.. */
if ( unlink(RECORD_PATH) != 0 ) /* And removing the old */
- ReportErrorf("%s: unlink(%s)",sys_errlist[errno]);
+ ReportErrorf("%s: unlink(%s)",strerror(errno));
goto rm; /* Success (or mostly success) */
} else ReportErrorf("%s: link(%s,%s)\nWill try a copy next..",
- sys_errlist[errno],RECORD_PATH,path);
+ strerror(errno),RECORD_PATH,path);
}
/*
* Copy the file, if control passes to here:
*/
if ( (ifd = open(RECORD_PATH,O_RDONLY,0)) < 0 ) {
- ReportErrorf("%s: opening %s for read.",sys_errlist[errno],RECORD_PATH);
+ ReportErrorf("%s: opening %s for read.",strerror(errno),RECORD_PATH);
goto xit;
}
if ( (ofd = open(path,O_WRONLY|O_CREAT|O_TRUNC,0644)) < 0 ) {
- ReportErrorf("%s: opening %s for read.",sys_errlist[errno],path);
+ ReportErrorf("%s: opening %s for read.",strerror(errno),path);
close(ifd);
goto xit;
}
while ( (n = read(ifd,buf,sizeof buf)) > 0 )
if ( write(ofd,buf,n) < 0 ) {
- ReportErrorf("%s: writing file %s for copy.",sys_errlist[errno],path);
+ ReportErrorf("%s: writing file %s for copy.",strerror(errno),path);
close(ifd);
close(ofd);
unlink(path);
@@ -169,7 +169,7 @@
}
if ( n < 0 ) {
- ReportErrorf("%s: reading file %s for copy.",sys_errlist[errno],RECORD_PATH);
+ ReportErrorf("%s: reading file %s for copy.",strerror(errno),RECORD_PATH);
close(ifd);
close(ofd);
unlink(path);
@@ -177,7 +177,7 @@
}
if ( fsync(ofd) != 0 )
- ReportErrorf("%s: fsync(%s)",sys_errlist[errno],path);
+ ReportErrorf("%s: fsync(%s)",strerror(errno),path);
if ( close(ofd) == 0 )
unlink(RECORD_PATH); /* Delete recorded.wav if copy successful */
close(ifd);
diff -u wavplay-1.4/server.c wavplay-1.4-new/server.c
--- wavplay-1.4/server.c 1999-12-04 01:06:42.000000000 +0100
+++ wavplay-1.4-new/server.c 2003-03-11 11:36:00.000000000 +0100
@@ -326,7 +326,11 @@
/*
* Tell client the pathname we're using for the recording:
*/
- strcpy(svr.path,RECORD_PATH); /* Always record to same place */
+ if(strlen(RECORD_PATH) >= sizeof(svr.path)-1) {
+ fprintf(stderr, "Record path %s too long. Truncating.\n", RECORD_PATH);
+ }
+ strncpy(svr.path,RECORD_PATH, sizeof(svr.path)-1); /* Always record to same place */
+ svr.path[sizeof(svr.path)-1]=0;
msg.msg_type = ToClnt_Path;
strcpy(msg.u.toclnt_path.path,svr.path);
@@ -397,7 +401,7 @@
* Remove old semaphore set :
*/
if ( semctl(svr.lockIPCID,0,IPC_RMID,NULL) < 0 ) {
- toclnt_fatal(0,"%s: Unable to remove old locking semaphores.",sys_errlist[errno]);
+ toclnt_fatal(0,"%s: Unable to remove old locking semaphores.",strerror(errno));
exit(13);
}
@@ -406,7 +410,7 @@
*/
if ( (svr.lockIPCID = OpenDSPLocks(svr.IPCKey,1,x_erf)) < 0 ) {
toclnt_fatal(0,"%s:\nAttempting to obtain new locking\nsemaphores.",
- sys_errlist[errno]);
+ strerror(errno));
exit(13);
}
@@ -497,7 +501,7 @@
if ( sched_setscheduler(pid,SCHED_FIFO,&rtp) != 0 ) {
z = errno;
fprintf(stderr,"WARNING; %s: sched_setscheduler(%ld,SCHED_FIFO,) // priority=%d;\n",
- sys_errlist[z],(long)pid,(int)SCHED_PRIORITY);
+ strerror(z),(long)pid,(int)SCHED_PRIORITY);
if ( z == EPERM && rtp.sched_priority > 0 )
fputs("You need setuid root to use sched_setscheduler()\n",stderr);
fflush(stderr);
@@ -531,7 +535,7 @@
msg.bytes = 0;
if ( MsgToClient(clntIPC,&msg,flags) != 0 ) { /* Send to client */
- ClntMsg("%s: toclnt_ready(flags=0%o;ipc=%d)\n",sys_errlist[errno],flags,clntIPC);
+ ClntMsg("%s: toclnt_ready(flags=0%o;ipc=%d)\n",strerror(errno),flags,clntIPC);
exit(13);
}
}
@@ -550,7 +554,7 @@
msg.u.toclnt_bits.DataBits = bits;
if ( MsgToClient(clntIPC,&msg,flags) != 0 ) { /* Send to client */
- ClntMsg("%s: toclnt_ready(flags=0%o;ipc=%d)\n",sys_errlist[errno],flags,clntIPC);
+ ClntMsg("%s: toclnt_ready(flags=0%o;ipc=%d)\n",strerror(errno),flags,clntIPC);
exit(13);
}
}
@@ -602,7 +606,7 @@
msg.bytes = sizeof msg.u.toclnt_settings;
if ( (z = MsgToClient(clntIPC,&msg,flags)) != 0 && flags && errno != EAGAIN ) {
- toclnt_fatal(0,"%s: toclnt_settings(flags=0%o;ipc=%d)\n",sys_errlist[errno],flags,clntIPC);
+ toclnt_fatal(0,"%s: toclnt_settings(flags=0%o;ipc=%d)\n",strerror(errno),flags,clntIPC);
exit(13);
}
@@ -645,7 +649,7 @@
[sizeof msg.u.toclnt_errmsg.msg - 1] = 0;
if ( MsgToClient(clntIPC,&msg,flags) != 0 ) { /* Send to client */
- fprintf(stderr,"%s: toclnt_errmsg(...)\n",sys_errlist[errno]);
+ fprintf(stderr,"%s: toclnt_errmsg(...)\n",strerror(errno));
exit(13);
}
}
diff -u wavplay-1.4/wavfile.c wavplay-1.4-new/wavfile.c
--- wavplay-1.4/wavfile.c 1999-12-04 01:06:42.000000000 +0100
+++ wavplay-1.4-new/wavfile.c 2003-03-11 10:22:41.000000000 +0100
@@ -141,7 +141,7 @@
waveheader.nDataBytes = databytes;
if (write (wavefile, &waveheader, sizeof (WAVE_HEADER)) != sizeof (WAVE_HEADER)) {
- err("%s",sys_errlist[errno]); /* wwg: report the error */
+ err("%s",strerror(errno)); /* wwg: report the error */
return WW_BADWRITEHEADER ;
}
@@ -157,7 +157,7 @@
v_erf = erf; /* wwg: Set error reporting function */
if (lseek (wavefile, 0L, SEEK_SET)) {
- err("%s",sys_errlist[errno]); /* wwg: Report error */
+ err("%s",strerror(errno)); /* wwg: Report error */
return WR_BADSEEK ;
}
|