File: patch

package info (click to toggle)
ascd 0.13.2-10
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,720 kB
  • sloc: ansic: 14,316; sh: 183; makefile: 21
file content (2150 lines) | stat: -rw-r--r-- 67,656 bytes parent folder | download | duplicates (2)
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
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
Description: Various
 ascd (0.13.2-8) UNRELEASED; urgency=medium
 .
   * Fixed build gcc-14 (closes: #1074819)
Author: Fredrik Hallenberg <hallon@debian.org>
Bug-Debian: https://bugs.debian.org/1074819

---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>
Last-Update: 2024-11-23

--- /dev/null
+++ ascd-0.13.2/README_CDDB
@@ -0,0 +1,24 @@
+AScd CDDB patch
+N. Rutman 10/2/2001
+nathan@gordian.com
+
+
+AScd 0.13.2
+http://worldserver.oleane.com/rsn/ascd-download.html
+
+The modification to ascd/faktory.c fixes a segfault bug.  The other mods
+finish and enable the CDDB support in libworkman, so libworkman will now
+lookup unknown CD's in CDDB, store them in the local database, and AScd
+will show that info.  (Compiling libworkman with -DDEBUG will print the
+CDDB query and response.)
+
+To use CDDB support, add a ~/.workmanrc file with something like:
+cddbprotocol cddbp
+cddbmailadress nathan@nowhere.com
+cddbserver freedb.freedb.org
+
+Full CDDB options in ~/.workmanrc are:
+cddbprotocol [cddbp|http]
+cddbserver [server(:port)]	default port is 888 for cddbp, 80 for http
+cddbpathtocgi [cgipath] 	default is /~cddb/cddb.cgi
+cddbproxy [proxyserver(:port)]
--- ascd-0.13.2.orig/ascd/README
+++ ascd-0.13.2/ascd/README
@@ -110,7 +110,7 @@ theme files are *not* compatible.
 
   Add a line in your ~/.steprc file:
 
-  *Wharf - - Swallow "ascd" /usr/local/bin/ascd -device /dev/wcd0a &
+  *Wharf - - Swallow "ascd" ascd -device /dev/cdrom &
 
   (customized to your system settings of course!)
   
--- ascd-0.13.2.orig/ascd/ascd.c
+++ ascd-0.13.2/ascd/ascd.c
@@ -690,7 +690,7 @@ int main(int argc, char *argv[])
 
     strcpy(led_text, "");
     strcpy(theme, "default");
-    strcpy(xv, "xv");
+    strcpy(xv, "display");
     
     /* the WorkMan database. It's still not used in ascd, but we need this
        to start the WorkMan code
--- ascd-0.13.2.orig/ascd/config.h
+++ ascd-0.13.2/ascd/config.h
@@ -2,5 +2,5 @@
 #define DEFAULT_COLOR "#2FAFAF"
 #define DEFAULT_BGCOLOR "#000000"
 #define DEFAULTDEVICE "/dev/cdrom"
-#define THDIR "/usr/local/share/AScd"
+#define THDIR "/usr/share/ascd"
 #define VERSION 		"0.13.2"
--- ascd-0.13.2.orig/ascd/dirs.h
+++ ascd-0.13.2/ascd/dirs.h
@@ -1,3 +1,4 @@
-#define CBINDIR /usr/local/bin
-#define CMANDIR /usr/local/man/man1
-#define CTHDIR /usr/local/share/AScd
+#define CBINDIR /usr/bin
+#define CMANDIR /usr/man/man1
+#define CTHDIR /usr/share/ascd
+
--- ascd-0.13.2.orig/ascd/faktory.c
+++ ascd-0.13.2/ascd/faktory.c
@@ -56,13 +56,19 @@ char *tes_xgets(char *chaine, int nb, FI
 int fak_parse_line(char *ligne, char *key, char *arguments)
 {
     unsigned int pos = 0;
+    unsigned int len = strlen(ligne);
 
-    if ((strlen(ligne) > 0) && (ligne[0] != '#')) {
-	while ((ligne[pos] != ' ') && (ligne[pos] != 9)) pos++;
+    if ((len > 0) && (ligne[0] != '#')) {
+	while ((ligne[pos] != ' ') && (ligne[pos] != 9) && (pos < len))
+	    pos++;
 	tes_sncpy(key, ligne, pos);
-	while (((ligne[pos] == ' ') || (ligne[pos] == 9)) && (pos < strlen(ligne))) pos++;
-	if (pos < strlen(ligne)) strcpy(arguments, ligne + pos);
-	else strcpy(arguments, "");
+	while (((ligne[pos] == ' ') || (ligne[pos] == 9))
+	       && (pos < len)) 
+	    pos++;
+	if (pos < len)
+	    strcpy(arguments, ligne + pos);
+	else
+	    strcpy(arguments, "");
 	if (debug > 2) fprintf(stderr,"++ input: [%s]\n   key:   [%s]\n   args:  [%s]\n", ligne, key, arguments);
 	return TRUE;
     } else {
--- ascd-0.13.2.orig/ascd/misc/config.h.default
+++ ascd-0.13.2/ascd/misc/config.h.default
@@ -2,4 +2,4 @@
 #define DEFAULT_COLOR "#2FAFAF"
 #define DEFAULT_BGCOLOR "#000000"
 #define DEFAULTDEVICE "/dev/cdrom"
-#define THDIR "/usr/local/share/AScd"
+#define THDIR "/usr/share/ascd"
--- ascd-0.13.2.orig/ascd/misc/dirs.h.default
+++ ascd-0.13.2/ascd/misc/dirs.h.default
@@ -1,3 +1,4 @@
-#define CBINDIR /usr/local/bin
-#define CMANDIR /usr/local/man/man1
-#define CTHDIR /usr/local/share/AScd
+#define CBINDIR /usr/bin
+#define CMANDIR /usr/man/man1
+#define CTHDIR /usr/share/ascd
+
--- ascd-0.13.2.orig/ascd/workman/wm_config.h
+++ ascd-0.13.2/ascd/workman/wm_config.h
@@ -186,7 +186,7 @@
  * probably want this, but it will cause WorkMan to not work on IDE
  * drives.
  */
-#define LINUX_SCSI_PASSTHROUGH 1
+/*#define LINUX_SCSI_PASSTHROUGH 1*/
 
 /*
  * Which device should be opened by WorkMan at default?
--- /dev/null
+++ ascd-0.13.2/config.h
@@ -0,0 +1 @@
+#define VERSION 		"0.13.2"
--- ascd-0.13.2.orig/default
+++ ascd-0.13.2/default
@@ -6,4 +6,4 @@ ln -s ../libworkman/include workman
 ./misc/default
 cd ..
 xmkmf -a
-
+perl -pi -e 's/ar clq/ar cq/' libworkman/Makefile
--- ascd-0.13.2.orig/libworkman/Config
+++ ascd-0.13.2/libworkman/Config
@@ -33,7 +33,7 @@ XCOMM
 XCOMM -------------------------------------------------------------------
 XCOMM                        Directory Prefix
 XCOMM -------------------------------------------------------------------
-DESTDIR=/usr/local/
+DESTDIR=/usr/
 
 XCOMM -------------------------------------------------------------------
 XCOMM          LibWorkMan include file target relative to DSTDIR
@@ -43,6 +43,6 @@ WMINCDIR=include/workman
 
 
 XCOMM -------------------------------------------------------------------
-#define SHARED_LIBWORKMAN
+#undef SHARED_LIBWORKMAN
 LIBDIR=lib
 
--- ascd-0.13.2.orig/libworkman/cddb.c
+++ ascd-0.13.2/libworkman/cddb.c
@@ -33,7 +33,7 @@ static char cddb_id[] = "$Id: cddb.c,v 1
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <strings.h>
+#include <string.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -49,6 +49,12 @@ static char cddb_id[] = "$Id: cddb.c,v 1
 #include "include/wm_cdinfo.h"
 #include "include/wm_helpers.h"
 
+#ifdef DEBUG
+#define Trace(x)  fprintf x
+#else
+#define Trace(x)
+#endif
+
 /*
  * This is for identifying WorkMan at CDDB servers
  */
@@ -57,41 +63,9 @@ static char cddb_id[] = "$Id: cddb.c,v 1
 
 struct wm_cddb cddb;
 
-int cur_cddb_protocol;
-char *cur_cddb_server;
-char *cur_cddb_mail_adress;
-char *cur_cddb_path_to_cgi;
-char *cur_cddb_proxy_server;
-
 int Socket;
 FILE *Connection;
 
-/*
- *
- */
-void
-cddb_cur2struct(void)
-{
-	cddb.protocol = cur_cddb_protocol;
-	strcpy(cddb.cddb_server,  cur_cddb_server);
-	strcpy(cddb.mail_adress,  cur_cddb_mail_adress);
-	strcpy(cddb.path_to_cgi,  cur_cddb_path_to_cgi);
-	strcpy(cddb.proxy_server, cur_cddb_proxy_server);
-} /* cddb_cur2struct() */
-
-/*
- *
- */
-void
-cddb_struct2cur(void)
-{
-	cur_cddb_protocol = cddb.protocol;
-	cur_cddb_server =       (cddb.cddb_server);
-	cur_cddb_mail_adress =  (cddb.mail_adress);
-	cur_cddb_path_to_cgi =  (cddb.path_to_cgi);
-	cur_cddb_proxy_server = (cddb.proxy_server);
-} /* cddb_struct2cur() */
-
 
 /*
  * Subroutine from cddb_discid
@@ -146,23 +120,17 @@ cddb_discid(void)
 	return ((n % 0xff) << 24 | t << 8 | thiscd.ntracks);
 } /* cddb_discid() */
 
-/*
- * Split a string into two components according to the first occurance of
- * the delimiter.
- */
-char *
-string_split(char *line, char delim)
+
+/* Split string at delim */
+char *string_split(char *line, char delim)
 {
 	char *p1;
 
-	for (p1=line;*p1;p1++)
-	{
-		if(*p1 == delim)
-		{
+	p1 = strchr(line, (int)delim);
+	if (p1) {
 			*p1 = 0;
 			return ++p1;
 		}
-	}
 	return (NULL);
 } /* string_split() */
 
@@ -176,8 +144,18 @@ string_makehello(char *line,char delim)
 	char mail[84],*host;
 	
 	strcpy(mail,cddb.mail_adress);
-	host=string_split(mail,'@');
-	
+	host = string_split(mail,'@');
+	if (!host) {
+	    int len;
+	    if (getlogin())
+		strncpy(mail, getlogin(), 83);
+	    else
+		strcpy(mail, "nobody");
+	    len = strlen(mail);
+	    host = mail + len + 1;
+	    gethostname(host, 83-len);
+	    Trace((stderr, "default email %s@%s\n", mail, host)); 
+	}
 	sprintf(line,"%shello%c%s%c%s%c%s%c%s",
 		delim == ' ' ? "cddb " : "&",
 		delim == ' ' ? ' ' : '=',
@@ -193,26 +171,40 @@ string_makehello(char *line,char delim)
 int
 connect_open(void)
 {
-	char *host;
+	char host[200], *prt;
 	struct hostent *hp;
 	struct sockaddr_in soc_in;
-	int port;
+	int port = 0;
+
+	Trace((stderr, "opening connection to cddb server\n"));
+
+	/* in case of failure */
+	Connection = NULL;
 	
 	if(cddb.protocol == 3) /* http proxy */
-	  host = strdup(cddb.proxy_server);
+	    strcpy(host, cddb.proxy_server);
 	else
-	  host = strdup(cddb.cddb_server);
-	/*	
-	 * t=string_split(host,':'); 
-	 */
-	port=atoi(string_split(host,':'));
+	    strcpy(host, cddb.cddb_server);
+
+	Trace((stderr, "host %s\n", host));
+
+	prt = string_split(host,':'); 
+	if (prt)
+	    port = atoi(prt);
+	
+	/* Defaults */
 	if(!port)
-	  port=8880;
+	    if (cddb.protocol == 1)
+		port = 888;
+	    else
+		port = 80;
+	if (cddb.path_to_cgi[0] == 0)
+	    sprintf(cddb.path_to_cgi, "/~cddb/cddb.cgi");
 
-	printf("%s:%d\n",host,port);
-	hp  =gethostbyname(host);
+	Trace((stderr, "%s : %d\n",host,port));
   
-	if (hp == NULL)
+	hp = gethostbyname(host);
+	if (!hp)
 	{
 		static struct hostent def;
 		static struct in_addr defaddr;
@@ -220,10 +212,12 @@ connect_open(void)
 		static char namebuf[128];
 		int inet_addr();
 		
+		Trace((stderr, "gethostbyname failed: %s\n", host));
+		
 		defaddr.s_addr = inet_addr(host);
 		if (defaddr.s_addr == -1) 
 		{
-			printf("unknown host: %s\n", host);
+			Trace((stderr, "unknown host: %s\n", host));
 			return (-1);
 		}
 		strcpy(namebuf, host);
@@ -234,6 +228,7 @@ connect_open(void)
 		def.h_aliases = 0;
 		hp = &def;
 	}
+	
 	soc_in.sin_family = hp->h_addrtype;
 	bcopy(hp->h_addr, (char *)&soc_in.sin_addr, hp->h_length);
 	soc_in.sin_port = htons(port);
@@ -274,6 +269,8 @@ connect_getline(char *line)
 {
 	char c;
     
+	/* FIXME timeout, return empty string (not null) */
+    
 	while ((c = getc(Connection)) != '\n')
 	{
 		*line = c;
@@ -298,15 +295,15 @@ connect_read_entry(void)
 	{
 		connect_getline(tempbuf);
 		
-		t=string_split(tempbuf,'=');
-		if(t != NULL)
+		t = string_split(tempbuf,'=');
+		if (t != NULL)
 		{
 			type=tempbuf[0];
 			
 			if(strncmp("TITLE",tempbuf+1,5))
 			  continue;
 			
-			if('D' == type)
+			if(type == 'D')
 			{
 				/*
 				 * Annahme: "Interpret / Titel" ist falsch.
@@ -326,18 +323,11 @@ connect_read_entry(void)
 				}
 				strcpy(cd->artist,t);
 			}
-			
-			if('T' == type)
+			else if(type == 'T')
 			{
 				trknr=atoi(tempbuf+6);
-				/*
-				 * printf("Track %d:%s\n",trknr,t);
-				 */
 				wm_strmcpy(&cd->trk[trknr].songname,t);
 			}
-			/*
-			 * fprintf(stderr, "%s %s\n",tempbuf,t);
-			 */
 		}
 	}
 } /* connect_read_entry() */
@@ -372,22 +362,22 @@ http_send(char* line)
 	char tempbuf[2000];
 	
 	write(Socket, "GET ", 4);
-	printf("GET ");
+	Trace((stderr, "GET "));
 	if(cddb.protocol == 3)
 	{
 		write(Socket, "http://", 7);
 		write(Socket, cddb.cddb_server, strlen(cddb.cddb_server));
-		printf("http://%s",cddb.cddb_server);
+		Trace((stderr, "http://%s",cddb.cddb_server));
 	}
 	write(Socket, cddb.path_to_cgi, strlen(cddb.path_to_cgi));
 	write(Socket, "?cmd=" ,5);
 	write(Socket, line, strlen(line));
-	printf("%s?cmd=%s",cddb.path_to_cgi,line);
+	Trace((stderr, "%s?cmd=%s",cddb.path_to_cgi,line));
 	string_makehello(tempbuf,'+');
 	write(Socket, tempbuf, strlen(tempbuf));
-	printf("%s",tempbuf);
+	Trace((stderr, "%s",tempbuf));
 	write(Socket, "&proto=1 HTTP/1.0\n\n", 19);
-	printf("&proto=1 HTTP/1.0\n");
+	Trace((stderr, "&proto=1 HTTP/1.0\n"));
 	do
 	  connect_getline(tempbuf);
 	while(strcmp(tempbuf,""));
@@ -406,120 +396,111 @@ http_read(char *category, unsigned int i
 
 /*
  * The main routine called from the ui
+ * returns 0 on success, -1 on err
  */
-void
+int 
 cddb_request(void)
 {
 	int i;
 	char tempbuf[2000];
 	extern int cur_ntracks;
-	
-	int status;
+	int status, rv = 0;
 	char category[20];
 	unsigned int id;
 	
-	strcpy(cddb.cddb_server,"localhost:888");
-	strcpy(cddb.mail_adress,"svolli@bigfoot.com");
-	/*
-	 * cddb.protocol = 1;
-	 */
 	wipe_cdinfo();
 	
 	switch(cddb.protocol)
 	{
 	 case 1: /* cddbp */
-		printf("USING CDDBP\n");
-		printf("open\n");
-		connect_open();
+		Trace((stderr, "USING CDDBP\n"));
+		Trace((stderr, "open\n"));
+		if (connect_open()) { 
+		    Trace((stderr, "connect failed.\n"));
+		    return -1;
+		}
 		connect_getline(tempbuf);
-		printf("[%s]\n",tempbuf);
-		/*
-		 * if(atoi(tempbuf) == 201) return;
-		 */
-
-		/*
-		 * strcpy(tempbuf,"cddb hello svolli bigfoot.com Eierkratzer eins");
-		 */
+		Trace((stderr, "[%s]\n",tempbuf));
+
 		string_makehello(tempbuf,' ');
-		fprintf(stderr, "%s\n", tempbuf);
+		Trace((stderr, "%s\n", tempbuf));
 		cddbp_send(tempbuf);
 		connect_getline(tempbuf);
-		printf("[%s]\n",tempbuf);
+		Trace((stderr, "[%s]\n",tempbuf));
 		
-		printf("query\n");
+		Trace((stderr, "query\n"));
 		sprintf(tempbuf, "cddb query %08x %d",thiscd.cddbid,thiscd.ntracks);
 		for (i = 0; i < cur_ntracks; i++)
 		  if (thiscd.trk[i].section < 2)
 		    sprintf(tempbuf + strlen(tempbuf), " %d",
 			    thiscd.trk[i].start);
 		sprintf(tempbuf + strlen(tempbuf), " %d\n", thiscd.length);
-		printf(">%s<\n",tempbuf);
+		Trace((stderr, ">%s<\n",tempbuf));
 		cddbp_send(tempbuf);
 		connect_getline(tempbuf);
-		printf("[%s]\n",tempbuf);
+		Trace((stderr, "[%s]\n",tempbuf));
 		
 		status=atoi(tempbuf);
-		/*
-		 * fprintf(stderr, "status:%d\n",status);
-		 * fprintf(stderr,"category:%s\n",category);
-		 * fprintf(stderr,"id:%s\n",id);
-		 */
+		Trace((stderr, "status:%d\n",status));
+	
 		if(status == 200) /* Exact match */
 		{
 			sscanf(tempbuf,"%d %s %08x",&status,category,&id);
 			cddbp_read(category,id);
 			connect_read_entry();
 		}
-		
-		if(status == 211) /* Unexact match, multiple possible
+		else if(status == 211) /* Unexact match, multiple possible
 				   * Hack: always use first. */
 		{
 			connect_getline(tempbuf);
+			Trace((stderr, "[%s]\n",tempbuf));
 			sscanf(tempbuf,"%s %08x",category,&id);
-			while(strcmp(tempbuf,"."))
+			while(strcmp(tempbuf,".")) {
 			  connect_getline(tempbuf);
+			  Trace((stderr, "ignoring [%s]\n",tempbuf));
+			}
 			cddbp_read(category,id);
 			connect_read_entry();
 		}
-		
+		else 
+		    rv = -1;
 		cddbp_send("quit");
 		connect_close();
-		printf("close\n");
-		break;
+		Trace((stderr, "close\n"));
+		return rv;
 	 case 2: /* http */
 	 case 3: /* http proxy */
-		printf("USING HTTP%s\n",
-		       (cddb.protocol == 3) ? " WITH PROXY" : "");
-		printf("query\n");
+		Trace((stderr, "USING HTTP%s\n",
+		       (cddb.protocol == 3) ? " WITH PROXY" : ""));
+		Trace((stderr, "query\n"));
 		sprintf(tempbuf, "cddb+query+%08x+%d",thiscd.cddbid,thiscd.ntracks);
 		for (i = 0; i < cur_ntracks; i++)
 		  if (thiscd.trk[i].section < 2)
 		    sprintf(tempbuf + strlen(tempbuf), "+%d",
 			    thiscd.trk[i].start);
 		sprintf(tempbuf + strlen(tempbuf), "+%d", thiscd.length);
-		printf(">%s<\n",tempbuf);
-		connect_open();
+		Trace((stderr, ">%s<\n",tempbuf));
+		if (connect_open()) { 
+		    Trace((stderr, "connect failed.\n"));
+		    return -1;
+		}
 		http_send(tempbuf);
 		connect_getline(tempbuf);
-		printf("[%s]\n",tempbuf);
+		Trace((stderr, "[%s]\n",tempbuf));
 		
 		status=atoi(tempbuf);
-		/*
-		 * fprintf(stderr, "status:%d\n",status);
-		 * fprintf(stderr, "category:%s\n",category);
-		 * fprintf(stderr, "id:%s\n",id);
-		 */
-
 		if(status == 200) /* Exact match */
 		{
 			connect_close();
-			connect_open();
+			if (connect_open()) { 
+			    Trace((stderr, "connect failed.\n"));
+			    return -1;
+			}	
 			sscanf(tempbuf,"%d %s %08x",&status,category,&id);
 			http_read(category,id);
 			connect_read_entry();
 		}
-		
-		if(status == 211) /* Unexact match, multiple possible
+		else if(status == 211) /* Unexact match, multiple possible
 				   * Hack: always use first. */
 		{
 			connect_getline(tempbuf);
@@ -527,15 +508,24 @@ cddb_request(void)
 			while(strcmp(tempbuf,"."))
 			  connect_getline(tempbuf);
 			connect_close();
-			connect_open();
+			if (connect_open()) { 
+			    Trace((stderr, "connect failed.\n"));
+			    return -1;
+			}	
 			http_read(category,id);
 			connect_read_entry();
 		}
+		else 
+		    rv = -1;
 		/* moved close above break */
 		connect_close();
-		break;
+		return rv;
 	 default: /* off */
 		break;
 	}
+	return -1;
 } /* cddb_request() */
 
+
+
+
--- ascd-0.13.2.orig/libworkman/database.c
+++ ascd-0.13.2/libworkman/database.c
@@ -33,6 +33,8 @@ static char database_id[] = "$Id: databa
 #define DBFILE "/.workmandb"
 #define FUZZFRAMES 75
 
+#define ASYNC_CDDB 1
+
 #include <errno.h>
 #include <stdio.h>
 #include <fcntl.h>
@@ -44,6 +46,10 @@ static char database_id[] = "$Id: databa
 #include <sys/param.h>
 #include <sys/time.h>
 #include <sys/stat.h>
+#ifdef ASYNC_CDDB
+#include <signal.h>
+#include <sys/wait.h>
+#endif
 #include "include/wm_config.h"
 #include "include/wm_helpers.h"
 #include "include/wm_struct.h"
@@ -80,6 +86,12 @@ extern int cur_ntracks, cur_nsections;
 int mark_a = 0;
 int mark_b = 0;
 
+static int _save(int saverc);
+static int check_in_cddb();
+static int wakeup_from_cddb();
+static int cddb_lock = 0;
+
+extern void set_abtimer(int a, int b);
 
 /*
  *
@@ -1011,9 +1023,7 @@ plnomem:
         if (searching > 1) /* A near match has been found. Good enough. */
             searching = 0;
 
-        cddb_struct2cur();
 	return (! searching);
-
 } /* search_db() */
 
 /*
@@ -1164,6 +1174,29 @@ load( void )
 
 	free(trklist);
 
+	/* If we didn't find it, try CDDB */
+#ifndef ASYNC_CDDB
+	/* Syncronous - wait for query to return */
+	if (cddb.protocol && !found_in_rc && !found_in_db)
+	    check_in_cddb();
+#else
+	/* Asyncronous */
+	if (cddb.protocol && !found_in_rc && !found_in_db && !cddb_lock) {
+	    /* Make sure we only have one request out to CDDB at a time.
+	       In case server is down or something, we don't want to keep
+	       forking children. */
+	    cddb_lock = 1;
+	    signal(SIGCHLD, (sig_t)wakeup_from_cddb);
+	    if (!fork()) {
+		/* Child */
+		int rv;
+		cddb_lock = 1; /* extra safety, can't hurt */
+		rv = check_in_cddb();
+   		exit(rv);
+	    }
+	}
+#endif
+
 	if (cur_playnew == -1)
 		cur_playnew = 0;
 
@@ -1177,6 +1210,41 @@ load( void )
 #endif
 } /* load() */
 
+
+/* Lookup cddb data and save it to workman database */
+static int check_in_cddb()
+{
+    if (!cddb_request()) {
+	/* Found it, let's save it so we don't have to look it
+	   up again. */
+#ifdef DEBUG
+	fprintf(stderr, "\nFound in CDDB:");
+	fprintf(stderr, "%s",  print_cdinfo(cd, 0));
+#endif
+	/* Save in db only, not rc, because we haven't put any
+	   customizations in, and I don't want to clutter the
+	   rc needlessly. */
+	_save(0);
+	return 0;
+    }
+    return -1;
+}
+
+/* Called when the fork above finishes. */
+static int wakeup_from_cddb()
+{
+    int status;
+    cddb_lock = 0;
+    /* Child had new data loaded, but we don't share memory, so we have to
+       reload here for updated data */
+    /* Only reload if child was successful, otherwise we keep trying */
+    wait(&status);
+    if (WIFEXITED(status) && (!WEXITSTATUS(status))) {
+	load();
+    }
+}
+
+
 /*
  * Load program settings from the rcfile.
  */
@@ -1221,6 +1289,8 @@ save_globals(FILE *fp)
 	long	curpos;
 	int	globesize, hit_cdent = 0, c = 0;
 
+	printf("saving globals\n");
+
 	if (otherrc)
 		wm_strmcpy(&globes, otherrc);
 
@@ -1252,6 +1322,7 @@ save_globals(FILE *fp)
 
 		if(cddb.cddb_server[0])
 	 	{
+		    printf("writing cddb server data\n");
 			sprintf(temp,"cddbserver %s\n",
 				cddb.cddb_server);
 			wm_strmcat(&globes, temp);
@@ -1260,14 +1331,14 @@ save_globals(FILE *fp)
 		if(cddb.path_to_cgi[0])
 	 	{
 			sprintf(temp,"cddbpathtocgi %s\n",
-				cddb.mail_adress);
+				cddb.path_to_cgi);
 			wm_strmcat(&globes, temp);
 		}
 
 		if(cddb.proxy_server[0])
 	 	{
 			sprintf(temp,"cddbproxy %s\n",
-				cddb.mail_adress);
+				cddb.proxy_server);
 			wm_strmcat(&globes, temp);
 		}
 	}
@@ -1409,6 +1480,8 @@ save_entry(char *filename, int pref)
 		locked = 1;
 
 	buf = print_cdinfo(cd, pref);
+	if (!buf)
+	    fprintf(stderr, "save_entry: print_cdinfo failed\n");
 	len = strlen(buf);	/* doesn't return if there's an error */
 
 	rcpos = -1;
@@ -1500,13 +1573,17 @@ save_entry(char *filename, int pref)
  * list, unless the entry came from another database file) and to the
  * personal prefs file.
  */
-int
-save( void )
+int save(void)
+{
+    return _save(1);
+}
+
+static int _save(int saverc)
 {
 
 	if( wm_db_save_disabled == FALSE )
 	{
-		if (save_entry(rcfile, 1))
+	        if (saverc && save_entry(rcfile, 1))
 			return (0);
 
 		if (cd->whichdb == NULL || access(cd->whichdb, W_OK))
@@ -1519,4 +1596,4 @@ save( void )
 	} else {
 		return( WM_DB_SAVE_DISABLED );
 	}
-} /* save() */
+} /* _save() */
--- ascd-0.13.2.orig/libworkman/include/wm_cdda.h
+++ ascd-0.13.2/libworkman/include/wm_cdda.h
@@ -91,7 +91,6 @@ struct cdda_block {
  * if there is no support.
  */
 #ifdef linux
-# include <bytesex.h>
 # include <endian.h>
 /*
  * XXX could this be a problem? The results are only 0 and 1 because
--- ascd-0.13.2.orig/libworkman/include/wm_cddb.h
+++ ascd-0.13.2/libworkman/include/wm_cddb.h
@@ -37,6 +37,6 @@ void cddb_cur2struct();
 void cddb_select();
 void connect_cddb();
 void update_cddbserver();
-void cddb_request();
+int cddb_request();
 
 #endif /* WM_CDDB_H */
--- ascd-0.13.2.orig/libworkman/include/wm_config.h
+++ ascd-0.13.2/libworkman/include/wm_config.h
@@ -186,7 +186,7 @@
  * probably want this, but it will cause WorkMan to not work on IDE
  * drives.
  */
-#define LINUX_SCSI_PASSTHROUGH 1
+/*#define LINUX_SCSI_PASSTHROUGH 1*/
 
 /*
  * Which device should be opened by WorkMan at default?
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/wm_cdda.h
@@ -0,0 +1,116 @@
+#ifndef WM_CDDA_H
+#define WM_CDDA_H
+/*
+ * $Id: wm_cdda.h,v 1.2 1999/02/14 09:50:46 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+/*
+ * Information about a particular block of CDDA data.
+ */
+struct cdda_block {
+	unsigned char	status;		/* see below */
+	unsigned char	track;
+	unsigned char	index;
+	unsigned char	minute;
+	unsigned char	second;
+	unsigned char	frame;
+
+	/* Average volume levels, for level meters */
+	unsigned char	lev_chan0;
+	unsigned char	lev_chan1;
+
+	/* Current volume setting (0-255) */
+	unsigned char	volume;
+
+	/* Current balance setting (0-255, 128 = balanced) */
+	unsigned char	balance;
+};
+
+/*
+ * cdda_block status codes.
+ */
+#define WMCDDA_ERROR	0	/* Couldn't read CDDA from disc */
+#define WMCDDA_OK	1	/* Read this block successfully (raw data) */
+#define WMCDDA_PLAYED	2	/* Just played the block in question */
+#define WMCDDA_STOPPED	3	/* Block data invalid; we've just stopped */
+#define WMCDDA_ACK	4	/* Acknowledgement of command from parent */
+#define WMCDDA_DONE	5	/* Chunk of data is done playing */
+#define WMCDDA_EJECTED	6	/* Disc ejected or offline */
+
+/*
+ * Enable or disable CDDA building depending on platform capabilities, and
+ * determine endianness based on architecture.  (Gross!)
+ *
+ * For header-comfort, the macros LITTLE_ENDIAN and BIG_ENDIAN had to be
+ * renamed. At least Linux does have bytesex.h and endian.h for easy
+ * byte-order examination.
+ */
+
+#ifdef sun
+# ifdef SYSV
+#  include <sys/types.h>
+#  include <sys/cdio.h>
+#  ifndef CDROMCDDA
+#   undef BUILD_CDDA
+#  endif
+#  ifdef i386
+#   define WM_LITTLE_ENDIAN 1
+#   define WM_BIG_ENDIAN 0
+#  else
+#   define WM_BIG_ENDIAN 1
+#   define WM_LITTLE_ENDIAN 0
+#  endif
+# else
+#  undef BUILD_CDDA
+# endif
+#endif
+
+/* Linux only allows definition of endianness, because there's no
+ * standard interface for CDROM CDDA functions that aren't available
+ * if there is no support.
+ */
+#ifdef linux
+# include <endian.h>
+/*
+ * XXX could this be a problem? The results are only 0 and 1 because
+ * of the ! operator. How about other linux compilers than gcc ?
+ */
+# define WM_LITTLE_ENDIAN !(__BYTE_ORDER - __LITTLE_ENDIAN)
+# define WM_BIG_ENDIAN !(__BYTE_ORDER - __BIG_ENDIAN)
+#endif
+
+/*
+ * The following code shouldn't take effect now. 
+ * In 1998, the WorkMan platforms don't support __PDP_ENDIAN
+ * architectures.
+ *
+ */
+
+#if !WM_LITTLE_ENDIAN
+#  if !WM_BIG_ENDIAN
+#    error yet unsupported architecture
+	foo bar this is to stop the compiler. 
+#  endif
+#endif
+#endif /* WM_CDDA_H */
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/wm_cddb.h
@@ -0,0 +1,42 @@
+#ifndef WM_CDDB_H
+#define WM_CDDB_H
+/*
+ * $Id: wm_cddb.h,v 1.2 1999/02/14 09:50:46 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+
+extern struct wm_cddb cddb;
+extern int cur_cddb_protocol;
+extern char *cur_cddb_server, *cur_cddb_mail_adress,
+	*cur_cddb_path_to_cgi, *cur_cddb_proxy_server;
+
+unsigned int cddb_discid();
+void cddb_struct2cur();
+void cddb_cur2struct();
+void cddb_select();
+void connect_cddb();
+void update_cddbserver();
+void cddb_request();
+
+#endif /* WM_CDDB_H */
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/wm_cdinfo.h
@@ -0,0 +1,78 @@
+#ifndef WM_CDINFO_H
+#define WM_CDINFO_H
+/*
+ * $Id: wm_cdinfo.h,v 1.5 1999/05/28 03:35:58 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Prototypes from cdinfo.c
+ * 
+ * This is just one more step to a more modular and understandable code.
+ */
+
+extern char *cur_trackname;		/* Take a guess */
+extern int cur_index;			/* Current index mark */
+extern int cur_frame;			/* Current frame number */
+extern struct wm_play *playlist;		/* = NULL */
+extern struct wm_cdinfo thiscd;
+extern struct wm_cdinfo *cd;
+extern int cur_track;			/* Current track number, starting at 1 */
+extern char *cur_artist;		/* Name of current CD's artist */
+extern char cur_avoid;			/* Avoid flag */
+extern char cur_contd;			/* Continued flag */
+extern char *cur_cdname;		/* Album name */
+extern int cur_nsections;		/* Number of sections currently defined */
+extern int exit_on_eject;
+extern int cur_track;
+extern int cur_pos_abs;
+extern int cur_pos_rel;
+extern int cur_tracklen;
+extern int cur_cdlen;
+extern enum wm_cd_modes cur_cdmode;
+extern int cur_ntracks;
+extern int cur_lasttrack;
+extern int cur_firsttrack;
+extern int cur_listno;
+extern int cur_stopmode;
+
+void	wipe_cdinfo( void );
+void	play_next_entry( int forward );
+void	make_playlist( int playmode, int starttrack );
+int	get_autoplay( void );
+int	get_playmode( void );
+void	pl_find_track( int track );
+void	play_prev_track( int forward );
+void	play_next_track( int forward );
+int	tracklen( int num );
+int	get_default_volume( int track );
+int	split_trackinfo( int pos );
+int	remove_trackinfo( int num );
+void	freeup( char **x );
+int	get_runtime( void );
+char   *trackname( int num );
+void	stash_cdinfo( char *artist, char *cdname, int autoplay, int playmode );
+void	stash_trkinfo( int track, char *songname, int contd, int avoid );
+int	get_avoid( int num );
+int	get_contd( int num );
+void	default_volume( int track, int vol );
+char   *listentry( int num );
+
+#endif /* WM_CDINFO_H */
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/wm_cdrom.h
@@ -0,0 +1,64 @@
+#ifndef WM_CDROM_H
+#define WM_CDROM_H
+/*
+ * $Id: wm_cdrom.h,v 1.6 1999/05/05 16:09:55 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Prototypes from cdrom.c
+ * 
+ * This is just one more step to a more modular and understandable code.
+ */
+
+#define WM_CDS_NO_DISC		0
+#define WM_CDS_DISC_READY	1
+#define WM_CDS_JUST_INSERTED	2
+
+#define WM_STR_GENVENDOR	"Generic"
+#define WM_STR_GENMODEL		"drive"
+#define WM_STR_GENREV		"type"
+
+extern int wm_cd_cur_balance;
+
+
+char *	wm_drive_vendor( void );
+char *	wm_drive_model( void );
+char *	wm_drive_revision( void );
+void 	wm_drive_settype( char *vendor, char *model, char *revision );
+
+int	wm_cd_status( void );
+
+void	wm_cd_play( int start, int pos, int end );
+void	wm_cd_play_chunk( int start, int end, int realstart );
+void	wm_cd_play_from_pos( int pos );
+void	wm_cd_pause( void );
+void	wm_cd_stop( void );
+int	wm_cd_eject( void );
+int     wm_cd_closetray( void );
+int	wm_cd_read_initial_volume( int max );
+
+/*
+ * Following are the missing to rename.
+ */
+int	find_trkind( int track, int index, int start );
+void	cd_volume( int vol, int bal, int max );
+
+#endif /* WM_CDROM_H */
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/wm_config.h
@@ -0,0 +1,357 @@
+#ifndef WM_CONFIG_H
+#define WM_CONFIG_H
+/*
+ * $Id: wm_config.h,v 1.5 1999/05/05 16:34:22 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ **********************************************************************
+ *
+ * This file consists of several parts. First, there's a generic,
+ * platform independent part. Set needed options there.
+ * The following parts are platform dependent. You may search for the
+ * names listed below and then set your OS specific options there.
+ * Don't be surprised, if there are no options for your OS. They aren't
+ * needed in any case.
+ * 
+ * The default values should produce a functional WorkMan on every
+ * platform.
+ *
+ *********************
+ * Current platforms:
+ *********************
+ * BSD386
+ * FreeBSD
+ * HP-UX
+ * Irix (SGI)
+ * Linux
+ * News  (Sony NewsOS)
+ * OpenBSD
+ * OSF1
+ * Sun (SunOS/Solaris, Sparc or x86)
+ * SVR4
+ * Ultrix
+ * AIX
+ *
+ * The above order corresponds with the order of the platform specific
+ * options below.
+ */
+
+/******************************************************************
+ * generic options
+ ******************************************************************
+ **   **  ***  ****    **  ****   **    *    **   **    **   *   **
+ *  *  *  ***  ****  *  *  ***  *  **  **  ***  *  *  *  *  * *  **
+ *     *  ***  ****    **  ***     **  **   **  *  *    **  * *  **
+ *  *  *  ***  ****  ****  ***  *  **  **  ***  *  *  *  *  ***  **
+ *  *  *    *    **  ****    *  *  **  **  ****   **  *  *  ***  **
+ ******************************************************************/
+
+/*
+ * This option is obvious. But please do not forget the original
+ * WorkMan version string if you need support.
+ */
+
+#define WORKMAN_NAME "LibWorkMan"
+#define WORKMAN_VERSION "1.4.0"
+ 
+/*
+ * If your CD-ROM drive closes its tray if the device is opened, then
+ * the next define can make WorkMans "Eject" button an "open/close"
+ * button. If it disturbs you, just comment it out.
+ *
+ * ### this is preliminary. It may have no effect for you ###
+ */
+#define CAN_CLOSE 1
+
+/*
+ * Define the following if you want the balance slider to
+ * decrease one channel's volume while increasing the other's
+ */
+/* #define SYMETRIC_BALANCE 1 */
+
+
+/*
+ * Define this if you want CDDA support. Supported systems are:
+ *
+ * - Solaris (2.4 or newer)
+ * --> Linux is on the way. Don't define it now. It would lead to errors only.
+ */
+/*#define BUILD_CDDA 1*/
+
+/*
+ *
+ * This is for experimental cddb support.
+ * This activates the UI component.
+ */
+
+#define CDDB_IN_UI 1
+
+
+/******************************************************************
+ * BSD386
+ ******************************************************************
+ ***     ****    ***    *******  **    ****    ****    ************
+ ***  **  **  ******  *  *****  ******  **  **  **  ***************
+ ***    ******  ****  **  ***  *****  *****    ***     ************
+ ***  **  ******  **  *  ***  ********  **  **  **  **  ***********
+ ***     ****    ***    ***  ******    ****    ****    ************
+ ******************************************************************/
+#ifdef __bsdi__
+
+/*
+ * This lets you use the SoundBlaster Mixer on BSD/386
+ */
+#define SOUNDBLASTER 1
+
+#endif /* __bsdi__ (BSD/386) */
+
+/******************************************************************
+ * FreeBSD
+ ******************************************************************
+ ***      **     ***      **      **     ****    ***    ***********
+ ***  ******  **  **  ******  ******  **  **  ******  *  **********
+ ***    ****     ***    ****    ****    ******  ****  **  *********
+ ***  ******  **  **  ******  ******  **  ******  **  *  **********
+ ***  ******  **  **      **      **     ****    ***    ***********
+ ******************************************************************/
+#if defined(__FreeBSD__) || defined(__NetBSD__)
+
+#define DEFAULT_CD_DEVICE	"/dev/rmatcd0c"
+
+#endif /* freebsd */
+
+/******************************************************************
+ * HP-UX
+ ******************************************************************
+ ***  **  **     *********  **  **  **  ***************************
+ ***  **  **  **  ********  **  ***    ****************************
+ ***      **     ***    **  **  ****  *****************************
+ ***  **  **  ************  **  ***    ****************************
+ ***  **  **  *************    ***  **  ***************************
+ ******************************************************************/
+#if defined(hpux) || defined (__hpux)
+
+#define	DEFAULT_CD_DEVICE	"/dev/rscsi"
+
+#endif /* hpux */
+
+/******************************************************************
+ * Irix
+ ******************************************************************
+ ***      **     ***      **  **  *********************************
+ *****  ****  **  ****  *****    **********************************
+ *****  ****     *****  ******  ***********************************
+ *****  ****  **  ****  *****    **********************************
+ ***      **  **  **      **  **  *********************************
+ ******************************************************************/
+#if defined(sgi)
+
+#define DEFAULT_CD_DEVICE	"/dev/scsi/sc0d6l0"
+
+#endif /* sgi IRIX */
+
+/******************************************************************
+ * Linux
+ ******************************************************************
+ ***  ******      **   ***  **  **  **  **  ***********************
+ ***  ********  ****    **  **  **  ***    ************************
+ ***  ********  ****  *  *  **  **  ****  *************************
+ ***  ********  ****  **    **  **  ***    ************************
+ ***      **      **  ***   ***    ***  **  ***********************
+ ******************************************************************/
+#ifdef linux
+
+/*
+ * Uncomment the following line to have WorkMan send SCSI commands
+ *  directly to the CD-ROM drive.  If you have a SCSI drive you 
+ * probably want this, but it will cause WorkMan to not work on IDE
+ * drives.
+ */
+/*#define LINUX_SCSI_PASSTHROUGH 1*/
+
+/*
+ * Which device should be opened by WorkMan at default?
+ */
+#define DEFAULT_CD_DEVICE	"/dev/sbpcd"
+
+/*
+ * Uncomment the following if you use the sbpcd or mcdx device driver.
+ * It shouldn't hurt if you use it on other devices. It'll be nice to
+ * hear from non-sbpcd (or mcdx) users if this is right.
+ */
+/*#define SBPCD_HACK 1*/
+
+/*
+ * Linux Soundcard support
+ */
+#define OSS_SUPPORT 1
+
+/*
+ * This has nothing to do with the above.
+ */
+
+/* #define CURVED_VOLUME */
+ 
+/*
+ * Uncomment the following if you want to try out a better responding
+ * WorkMan, especially with IDE drives. This may work with non-IDE
+ * drives as well. But it may be possible, that it doesn't work at all.
+ * If your drive/driver combination cannot handle the faster access,
+ * the driver will usually hang and you have to reboot your machine.
+ */
+/* #define FAST_IDE 1 */
+
+/*
+ * There are two alternative ways of checking a device containing a
+ * mounted filesystem. Define BSD_MOUNTTEST for the test using
+ * getmntent(). Undefine it for using the SVR4 ustat().
+ * I built in the choice, because it's not clear which method should
+ * be used in Linux. The ustat manpage tells us since 1995, that
+ * fstat() should be used, but I'm too dumb to do so.
+ */
+
+#define BSD_MOUNTTEST 
+
+#endif /* linux */
+
+/******************************************************************
+ * Sony NewsOS
+ ******************************************************************
+ ***   ***  **      **  *****  ***    *****************************
+ ***    **  **  ******  *****  **  ********************************
+ ***  *  *  **    ****  ** **  ****  ******************************
+ ***  **    **  ******  *   *  ******  ****************************
+ ***  ***   **      **    *    ***    *****************************
+ ******************************************************************/
+#if defined(__sony_news) || defined(sony_news)
+
+#define	DEFAULT_CD_DEVICE	"/dev/rsd/b0i6u0p2\0"
+
+#endif
+
+/******************************************************************
+ * OpenBSD
+ ******************************************************************
+ ****    ***     ***      **   ***  **     ****    ***    *********
+ ***  **  **  **  **  ******    **  **  **  **  ******  *  ********
+ ***  **  **     ***    ****  *  *  **    ******  ****  **  *******
+ ***  **  **  ******  ******  **    **  **  ******  **  *  ********
+ ****    ***  ******      **  ***   **     ****    ***    *********
+ ******************************************************************/
+#ifdef __OpenBSD__
+
+#define	DEFAULT_CD_DEVICE	"/dev/rcdrom"
+
+#endif
+
+/******************************************************************
+ * OSF1
+ ******************************************************************
+ ****    ****    ***      ***  ***  *******************************
+ ***  **  **  ******  ******  **    *******************************
+ ***  **  ****  ****    ***  *****  *******************************
+ ***  **  ******  **  ****  ******  *******************************
+ ****    ****    ***  ***  *****      *****************************
+ ******************************************************************/
+#if defined(__osf__)
+
+#define	DEFAULT_CD_DEVICE	"/dev/rcdrom/cd0"
+
+#endif
+
+/******************************************************************
+ * SunOS/Solaris
+ ******************************************************************
+ ****    ***  **  **   ***  ***************************************
+ ***  ******  **  **    **  ***************************************
+ *****  ****  **  **  *  *  ***************************************
+ *******  **  **  **  **    ***************************************
+ ****    ****    ***  ***   ***************************************
+ ******************************************************************/
+#if defined(sun) || defined(__sun__)
+
+/*
+ * Define the following for Solaris 2.x
+ * If you don't want WorkMan to try to activate the SPARCstation 5
+ * internal audio input so you get sound from the workstation, comment
+ * out the CODEC define.
+ */
+
+#define SYSV 1
+#define CODEC 1
+
+/*
+ * set the following to "SUNW,CS4231" for Sun and to "SUNW,sb16"
+ * for PC (with SoundBlaster 16) running Solaris x86
+ * (only important if you define CODEC above)
+ */
+/*#define SUN_AUD_DEV "SUNW,CS4231"*/
+#define SUN_AUD_DEV "SUNW,sbpro"
+
+
+#endif
+
+/******************************************************************
+ * SVR4
+ ******************************************************************
+ ****    ***  ****  **     ***  *  ********************************
+ ***  ******  ****  **  **  **  *  ********************************
+ *****  *****  **  ***     ***      *******************************
+ *******  ***  **  ***  **  *****  ********************************
+ ****    *****    ****  **  *****  ********************************
+ ******************************************************************/
+#if defined(SVR4) && !defined(sun) && !defined(__sun__)
+
+#define DEFAULT_CD_DEVICE       "/dev/rcdrom/cd0"
+
+#endif
+
+/******************************************************************
+ * Ultrix
+ ******************************************************************
+ ***  **  **  *****      **     ***      **  **  ******************
+ ***  **  **  *******  ****  **  ****  *****    *******************
+ ***  **  **  *******  ****     *****  ******  ********************
+ ***  **  **  *******  ****  **  ****  *****    *******************
+ ****    ***      ***  ****  **  **      **  **  ******************
+ ******************************************************************/
+#if defined(ultrix) || defined(__ultrix)
+
+#endif
+
+/******************************************************************
+ * IBM AIX
+ ******************************************************************
+ ****    ***      **  **  *****************************************
+ ***  **  ****  *****    ******************************************
+ ***      ****  ******  *******************************************
+ ***  **  ****  *****    ******************************************
+ ***  **  **      **  **  *****************************************
+ ******************************************************************/
+#if defined(AIXV3)
+
+#define DEFAULT_CD_DEVICE	"/dev/cd0"
+
+#endif /* IBM AIX */
+
+/******************************************************************/ 
+#endif /* WM_CONFIG_H */
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/wm_database.h
@@ -0,0 +1,44 @@
+#ifndef WM_DATABASE_H
+#define WM_DATABASE_H
+/*
+ * $Id: wm_database.h,v 1.3 1999/02/14 09:50:47 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Prototypes for WorkMan database
+ * 
+ * This is just one more step to a more modular and understandable code.
+ */
+
+
+#define WM_DB_SAVE_ERROR	1
+#define WM_DB_SAVE_DISABLED	2
+ 
+int wm_db_get_playnew( void );
+void	split_workmandb( void );
+int	save( void );
+void	load( void );
+void	load_settings( void );
+
+extern int wm_db_save_disabled;
+extern int cur_playnew;
+
+#endif /* WM_DATABASE_H */
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/wm_helpers.h
@@ -0,0 +1,105 @@
+#ifndef WM_HELPERS_H
+#define WM_HELPERS_H
+/*
+ * $Id: wm_helpers.h,v 1.6 1999/03/07 08:36:44 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Here to be found: Prototypes. Including variable names to be easier
+ * to read.
+ * This is just one more step to a more modular and understandable code.
+ *
+ */
+
+/*
+ * LibWorkMan message levels. I'm not sure how to call them all and which
+ * use they should fulfill. This is not very urgent now, because there
+ * aren't many messages in LibWorkMan now. 
+ */
+#define WM_MSG_LEVEL_NONE	0
+#define WM_MSG_LEVEL_ERROR	1
+#define WM_MSG_LEVEL_TWO	2
+#define WM_MSG_LEVEL_THREE	3
+#define WM_MSG_LEVEL_FOUR	4
+#define WM_MSG_LEVEL_INFO	5
+#define WM_MSG_LEVEL_SIX	6
+#define WM_MSG_LEVEL_SEVEN	7
+#define WM_MSG_LEVEL_EIGHT	8
+#define WM_MSG_LEVEL_DEBUG	9
+
+/*
+ * Message classes. This is somehow a definition of
+ * the message's source.
+ */
+ 
+#define WM_MSG_CLASS_PLATFORM	0x010
+#define WM_MSG_CLASS_SCSI	0x020
+#define WM_MSG_CLASS_CDROM      0x040
+#define WM_MSG_CLASS_DB		0x080
+#define WM_MSG_CLASS_MISC	0x100
+
+#define WM_MSG_CLASS_ALL	0xff0
+
+extern int wm_lib_verbosity;
+
+/*
+ * I did not know any better place...
+ */
+#ifdef DEBUG
+#define CHECKPOINT(t) fprintf(stderr, "%s (%d): %s\n", __FILE__, __LINE__, t );
+#else
+#define CHECKPOINT(t) 
+#endif
+
+#ifndef TRUE
+#define TRUE	1
+#endif
+
+#ifndef FALSE
+#define FALSE	0
+#endif
+
+#ifdef linux
+#include <signal.h>
+/* Linux doesn't have a SIGEMT */
+#if !defined( SIGEMT )
+#  define SIGEMT SIGUNUSED
+#endif
+#endif /* linux */
+
+void		freeup( char **x );
+void	 	wm_strmcat( char **t, char *s);
+void	 	wm_strmcpy( char **t, char *s );
+char *		wm_strdup( char *s );
+/* Somebody's version query unsatisfied? */
+int		wm_libver_major( void );	/* return major internal version number */
+int		wm_libver_minor( void );	/* return minor internal version number */
+int		wm_libver_pl( void );		/* return internal patchlevel number */
+char *		wm_libver_name( void );		/* return internal name (LibWorkMan) */
+char *		wm_libver_number( void );	/* returns string: "<major>.<minor>.<pl>" */
+char *		wm_libver_string( void ); 	/* returns string: "<name> <number>" */
+char *		wm_libver_date( void );		/* returns string: date of compilation */
+void 		wm_lib_set_verbosity( int level ); /* set verbosity level */
+int 		wm_lib_get_verbosity( void );      /* get verbosity level */
+void 		wm_lib_message( unsigned int level, char *format, ... ); /* put out a message on stderr */
+int		wm_susleep( int usec );
+
+#endif /* WM_HELPERS_H */
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/wm_index.h
@@ -0,0 +1,36 @@
+#ifndef WM_INDEX_H
+#define WM_INDEX_H
+/*
+ * $Id: wm_index.h,v 1.2 1999/02/14 09:50:47 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Prototypes for wm_index.c
+ * 
+ * This is just one more step to a more modular and understandable code.
+ */
+
+int	idx_find_entry( char *file, int ntracks, int *tracks,
+		 	int len, int fuzz, unsigned long *pos );
+int	idx_delete_entry(char *file, int track, int fuzz, unsigned long pos );
+int	idx_write_entry( char *file, int track, unsigned long pos );
+
+#endif /* WM_INDEX_H */
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/wm_platform.h
@@ -0,0 +1,51 @@
+#ifndef WM_PLATFORM_H
+#define WM_PLATFORM_H
+/*
+ * $Id: wm_platform.h,v 1.3 1999/02/14 09:50:47 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * The platform interface
+ * 
+ * This is just one more step to a more modular and understandable code.
+ */
+
+#include "wm_struct.h"
+
+int wmcd_open( struct wm_drive *d );
+int wmcd_reopen( struct wm_drive *d );
+
+/*
+ * void	keep_cd_open( void );
+ */
+int	wm_scsi( struct wm_drive *d, unsigned char *cdb, int cdblen,
+         	 void *retbuf, int retbuflen, int getreply );
+
+/****************************************
+ *
+ * The drive prototypes.
+ *
+ */
+extern struct wm_drive generic_proto;
+extern struct wm_drive sony_proto;
+extern struct wm_drive toshiba_proto;
+
+#endif /* WM_PLATFORM_H */
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/wm_scsi.h
@@ -0,0 +1,48 @@
+#ifndef WM_SCSI_H
+#define WM_SCSI_H
+/*
+ * $Id: wm_scsi.h,v 1.3 1999/02/14 09:50:47 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * SCSI prototypes (scsi.c)
+ * 
+ * This is just one more step to a more modular and understandable code.
+ */
+
+#include "wm_struct.h" 
+
+#define	WM_ERR_SCSI_INQUIRY_FAILED -1
+
+int	wm_scsi_mode_sense( struct wm_drive *d, unsigned char page,
+			    unsigned char *buf );
+int	sendscsi( struct wm_drive *d, void *buf,
+		  unsigned int len, int dir,
+		  unsigned char a0, unsigned char a1,
+		  unsigned char a2, unsigned char a3,
+		  unsigned char a4, unsigned char a5,
+		  unsigned char a6, unsigned char a7,
+		  unsigned char a8, unsigned char a9,
+		  unsigned char a10, unsigned char a11 );
+ int	wm_scsi_get_drive_type( struct wm_drive *d, char *vendor,
+				char *model, char *rev );
+
+#endif /* WM_SCSI_H */
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/wm_struct.h
@@ -0,0 +1,181 @@
+#ifndef WM_STRUCT_H
+#define WM_STRUCT_H
+/*
+ * $Id: wm_struct.h,v 1.7 1999/05/28 03:35:58 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+
+
+/*
+ * Structure for a single track.  This is pretty much self-explanatory --
+ * one of these exists for each track on the current CD.
+ */
+struct wm_trackinfo 
+{
+  char	*songname;	/* Name of song, dynamically allocated */
+  char	*otherdb;	/* Unrecognized info for this track */
+  char	*otherrc;
+  int	length;		/* Length of track in seconds or Kbytes */
+  int	start;		/* Starting position (f+s*75+m*60*75) */
+  int	volume;		/* Per-track volume (1-32, 0 to disable) */
+  int	track;		/* Physical track number */
+  int	section;	/* Section number (0 if track not split) */
+  int	contd;		/* Flag: continuation of previous track */
+  int	avoid;		/* Flag: don't play this track. */
+  int	data;		/* Flag: data track */
+};
+
+/*
+ * Structure for internal playlist management.  The internal playlist is
+ * simply the list of track ranges that are being played currently.  This
+ * is built whenever the CD starts playing; it's used in normal and shuffle
+ * modes as well as playlist mode.
+ *
+ * The "starttime" element represents how much time has elapsed by the time
+ * we get to this entry.  For instance, if the list begins with a 5-minute
+ * track and a 3-minute track, the third entry would have a starttime of 8
+ * minutes.  This is used so that the elapsed play time can be displayed
+ * even in shuffle or playlist modes.
+ *
+ * The last member of the list has a start track of 0, and its starttime is
+ * the total playing time of the playlist (which will usually be overestimated,
+ * since we don't play leadouts in some cases.)
+ */
+struct wm_play 
+{
+  int	start;		/* Start track, or 0 if end of list */
+  int	end;		/* last track plus 1 */
+  int	starttime;	/* Number of seconds elapsed previously */
+};
+
+/*
+ * Structure for playlists (as seen by the user.)  This is simply a name
+ * followed by a zero-terminated list of track numbers to play.  The list
+ * is terminated by a NULL name.
+ */
+struct wm_playlist 
+{
+  char	*name;		/* Name of this playlist */
+  int	*list;		/* List of tracks */
+};
+
+struct wm_cdinfo
+{
+  char	artist[84];	/* Artist's name */
+  char	cdname[84];	/* Disc's name */
+  int	ntracks;	/* Number of tracks on the disc */
+  int	length;		/* Total running time in seconds */
+  int	autoplay;	/* Start playing CD immediately */
+  int	playmode;	/* How to play the CD */
+  int	volume;		/* Default volume (1-32, 0 for none) */
+  struct wm_trackinfo *trk;	/* struct wm_trackinfo[ntracks] */
+  struct wm_playlist *lists;	/* User-specified playlists */
+  char	*whichdb;	/* Which database is this entry from? */
+  char	*otherdb;	/* Unrecognized lines from this entry */
+  char	*otherrc;
+  char	*user;		/* Name of originating user */
+  unsigned int cddbid;  /* CDDB-ID of the current disc */
+  struct cdinfo *next;	/* For browsers, etc. */
+};
+
+/* The global variable "cd" points to the struct for the CD that's playing. */
+extern struct wm_cdinfo *cd;
+
+struct wm_playlist *new_list();
+
+enum wm_cd_modes	
+{
+  WM_CDM_UNKNOWN = -1,
+  WM_CDM_BACK = 0, WM_CDM_TRACK_DONE = 0,
+  WM_CDM_PLAYING = 1,
+  WM_CDM_FORWARD = 2,
+  WM_CDM_PAUSED = 3,
+  WM_CDM_STOPPED = 4,
+  WM_CDM_EJECTED = 5
+};
+
+/*
+ * Drive descriptor structure.  Used for access to low-level routines.
+ */
+struct wm_drive 
+{
+  int	fd;		/* File descriptor, if used by platform */
+  char	vendor[32];	/* Vendor name */
+  char	model[32];	/* Drive model */
+  char  revision[32];   /* Revision of the drive */
+  void	*aux;		/* Pointer to optional platform-specific info */
+  void	*daux;		/* Pointer to optional drive-specific info */
+  
+  int	(*init)();
+  int	(*get_trackcount)();
+  int	(*get_cdlen)();
+  int	(*get_trackinfo)();
+  int	(*get_drive_status)();
+  int	(*get_volume)();
+  int	(*set_volume)();
+  int	(*pause)();
+  int	(*resume)();
+  int	(*stop)();
+  int	(*play)();
+  int	(*eject)();
+  int   (*closetray)();
+};
+
+/*
+ * Structure for information of the usage of cddb.
+ */
+struct wm_cddb {
+        int     protocol;               /* 0-off, 1-cddbp, 2-http, 3-htproxy */
+        char    cddb_server[84];        /* host.domain.name:port */
+        char    mail_adress[84];        /* user@domain.name */
+        char    path_to_cgi[84];        /* (/)path/to/cddb.cgi */
+        char    proxy_server[84];       /* host.domain.name:port */
+};
+extern struct wm_cddb cddb;
+
+
+/*
+ * Each platform has to define generic functions, so may as well declare
+ * them all here to save space.
+ * These functions should never be seen outside libworkman. So I don't care
+ * about the wm_ naming convention here.
+ */
+int     gen_init(),
+        gen_get_trackcount(),
+        gen_get_cdlen(),
+        gen_get_trackinfo(),
+	gen_get_drive_status(),
+	gen_get_volume(),
+	gen_set_volume(),
+	gen_pause(),
+	gen_resume(),
+	gen_stop(),
+	gen_play(),
+	gen_eject(),
+	gen_closetray();
+
+struct wm_drive *find_drive_struct();
+
+
+#endif /* WM_STRUCT_H */
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/wm_version.h
@@ -0,0 +1,35 @@
+#ifndef WM_VERSION_H
+#define WM_VERSION_H
+/*
+ * $Id: wm_version.h,v 1.2 1999/05/28 03:35:58 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Version information
+ *
+ */
+
+#define WM_LIBVER_MAJOR	1
+#define WM_LIBVER_MINOR 4
+#define WM_LIBVER_PL	2
+#define WM_LIBVER_NAME  "LibWorkMan"
+
+#endif /* WM_VERSION_H */
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/workman.h
@@ -0,0 +1,51 @@
+#ifndef WORKMAN_H
+#define WORKMAN_H
+/*
+ * $Id: workman.h,v 1.5 1999/05/05 16:34:22 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player library
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * all-in-one libworkman include file.
+ *
+ */
+
+
+/*
+ * wm_config should always be included first
+ */
+#include "wm_config.h" 
+
+#include "workman_defs.h"
+#ifdef BUILD_CDDA
+#include "wm_cdda.h"
+#endif 
+#include "wm_cddb.h"
+#include "wm_cdinfo.h" 
+#include "wm_cdrom.h" 
+#include "wm_database.h" 
+#include "wm_helpers.h" 
+#include "wm_index.h" 
+#include "wm_platform.h" 
+#include "wm_scsi.h" 
+#include "wm_struct.h" 
+
+#endif /* WORKMAN_H */
+
--- /dev/null
+++ ascd-0.13.2/libworkman/include/workman/workman_defs.h
@@ -0,0 +1,30 @@
+#ifndef WORKMAN_DEFS_H
+#define WORKMAN_DEFS_H
+/*
+ * $Id: workman_defs.h,v 1.4 1999/02/14 09:50:47 dirk Exp $
+ *
+ * This file is part of WorkMan, the civilized CD player program
+ * (c) 1991-1997 by Steven Grimm (original author)
+ * (c) by Dirk Frsterling (current 'author' = maintainer)
+ * The maintainer can be contacted by his e-mail address:
+ * milliByte@DeathsDoor.com 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * #defined CONSTANTS
+ * 
+ * Too bad this file seems to be so empty...
+ *
+ */
+
+#include "wm_version.h"
+
+#endif /* WORKMAN_DEFS_H */
--- ascd-0.13.2.orig/libworkman/wm_helpers.c
+++ ascd-0.13.2/libworkman/wm_helpers.c
@@ -29,6 +29,7 @@
 static char wm_helpers_id[] = "$Id: wm_helpers.c,v 1.7 1999/03/07 08:36:41 dirk Exp $";
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <malloc.h>
 #include <errno.h>
--- /dev/null
+++ ascd-0.13.2/patchlevel.h
@@ -0,0 +1,7 @@
+/* 
+   AScd/libworkman CDDB patch
+   Nathan Rutman 
+   10/2/2001
+*/
+
+#define CDDB_PATCHLEVEL 0.13.2_1