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
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
|
$! vmstest.com -- DCL script to perform test/Makefile actions for VMS
$!
$! Usage:
$! $ set default [-.test]
$! $ @[-.vms]vmstest.com bigtest
$! This assumes that newly built gawk.exe is in the next directory up.
$
$! 3.1.7: changed to share code among many common tests, and
$! to put results for test foo into _foo.tmp instead of tmp.
$!
$! 4.0.71: New tests:
$! functab1,functab2,functab3,id,incdupe,incdupe2, incdupe3,include2
$! symtab1,symtab2,symtab3,symtab4,symtab5,symtab6
$!
$! 4.0.75: New tests
$! basic: rri1,getline5,incdupe4,incdupe5,incdupe6,incdupe7
$! ext: colonwarn,reginttrad,symtab7,symtab8,symtab9
$!
$! 4.1.1: New tests implemented in 4.1.3a
$!
$! basic: badassign1,dfamb1,exit2,nfloop
$! ext: profile4,profile5
$! locale: backbigs1,backsmalls1,backsmalls2,mbprintf4
$! backgigs1 requires a locale not supplied with VMS.
$!
$! 4.1.2: New tests implemented in 4.1.3a
$! basic: badbuild,callparam,exitval3,inpref,paramasfunc1,
$! paramasfunc2,regexpbrack,sortglos
$! ext: crlf,dbugeval,fpat4,genpot,indirectbuiltin,
$! printfbad4,printhuge,profile0,profile6,profile7,
$! regnul1,regnul2,rsgetline,rsglstdin
$! charset_all: charset_msg_start,charset_tests,charset_msg_end
$!
$! 4.1.3: New tests - implemented in 4.1.3a
$! basic: rebrackloc
$!
$! 4.1.3a: New tests
$! vms_debug: Not a test, switches to a debug gawk for following tests
$! basic: aryprm9,exitval2,nulinsrc,rstest4,rstest5
$! ext: mbstr2,profile8,watchpoint1
$! shlib: inplace2,testext,lc_num1,mbprintf1
$! mbprintf2,mbfprintf3,mbfprintf4,mbfw1
$
$
$ echo = "write sys$output"
$ cmp = "diff/Output=_NL:/Maximum=1"
$ delsym = "delete/symbol/local/nolog"
$ igncascmp = "''cmp'/Ignore=Case"
$ sumslp = "edit/Sum"
$ rm = "delete/noConfirm/noLog"
$ mv = "rename/New_Vers"
$ sort = "sort"
$ gawk = "$sys$disk:[-]gawk"
$ AWKPATH_srcdir = "define/User AWKPATH sys$disk:[]"
$ AWKLIBPATH_dir = "define/User AWKLIBPATH sys$disk:[-]"
$ arch_name = f$edit(f$getsyi("arch_name"),"upcase,trim")
$
$! Make sure that the default directory exists on a search list.
$ def_dir = f$environment("default")
$ create/dir 'def_dir'
$ listdepth = 0
$ pipeok = 0
$ floatmode = -1 ! 0: D_float, 1: G_float, 2: IEEE T_float
$
$ list = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7+" "+p8
$ list = f$edit(list,"TRIM,LOWERCASE")
$ if list.eqs."" then list = "all" ! bigtest
$ gosub list_of_tests
$ echo "done."
$ exit
$
$vms_debug: echo "Switching to gawk_debug.exe"
$ gawk = "$sys$disk:[-]gawk_debug.exe"
$ return
$!
$all:
$
$bigtest: echo "bigtest..."
$ ! omits "printlang" and "extra"
$ list = "basic unix_tests gawk_ext vms_tests charset_tests" -
+ " machine_tests"
$ gosub list_of_tests
$ return
$
$basic: echo "basic..."
$ list = "msg addcomma anchgsub argarray arrayparm arrayref" -
+ " arrymem1 arrayprm2 arrayprm3 arryref2 arryref3" -
+ " arryref4 arryref5 arynasty arynocls aryprm1 aryprm2" -
+ " aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 aryprm8" -
+ " aryprm9 arysubnm asgext awkpath" -
+ " back89 backgsub badassign1 badbuild"
$ gosub list_of_tests
$ list = "callparam childin clobber closebad clsflnam" -
+ " compare compare2 concat1 concat2 concat3 concat4" -
+ " convfmt " -
+ " datanonl defref delargv delarprm delarpm2 delfunc" -
+ " dfamb1 dfastress dynlj" -
+ " eofsplit exit2 exitval1 exitval2 exitval3"
$ gosub list_of_tests
$ list = "fcall_exit fcall_exit2 fldchg fldchgnf" -
+ " fnamedat fnarray fnarray2 fnaryscl fnasgnm fnmisc" -
+ " fordel forref forsimp fsbs fsspcoln fsrs fstabplus" -
+ " funsemnl funsmnam funstack"
$ gosub list_of_tests
$ list = "getline getline2 getline3 getline4 getline5 " -
+ " getlnbuf getnr2tb getnr2tm gsubasgn gsubtest" -
+ " gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6" -
+ " gsubtst7 gsubtst8" -
+ " hex hsprint" -
+ " inpref inputred intest intprec iobug1" -
+ " leaddig leadnl litoct longsub longwrds"-
+ " manglprm math membug1 messages minusstr mmap8k" -
+ " mtchi18n"
$ gosub list_of_tests
$ list = "nasty nasty2 negexp negrange nested nfldstr" -
+ " nfloop nfneg nfset nlfldsep nlinstr nlstrina" -
+ " noeffect nofile nofmtch noloop1 noloop2 nonl" -
+ " noparms nors nulinsrc nulrsend numindex numsubstr" -
+ " octsub ofmt ofmtbig ofmtfidl" -
+ " ofmta ofmts ofs1 onlynl opasnidx opasnslf
$ gosub list_of_tests
$ list = "paramasfunc1 paramasfunc2 paramdup" -
+ " paramres paramtyp paramuninitglobal" -
+ " parse1 parsefld parseme pcntplus posix2008sub" -
+ " prdupval prec printf0 printf1 prmarscl prmreuse" -
+ " prt1eval prtoeval"
$ gosub list_of_tests
$ list = "rand range1 rebrackloc rebt8b1 redfilnm regeq" -
+ " regexpbrack regexprange regrange reindops reparse" -
+ " resplit rri1 rs rsnul1nl rsnulbig rsnulbig2 rstest1" -
+ " rstest2 rstest3 rstest4 rstest5 rswhite"
$ gosub list_of_tests
$ list = "scalar sclforin sclifin sortempty sortglos" -
+ " splitargv splitarr splitdef splitvar splitwht" -
+ " strcat1 strtod strnum1 subamp subi18n subsepnm" -
+ " subslash substr swaplns synerr1 synerr2"
$ gosub list_of_tests
$ list = "tradanch tweakfld" -
+ " uninit2 uninit3 uninit4 uninit5 uninitialized" -
+ " unterm uparrfs" -
+ " wideidx wideidx2 widesub widesub2 widesub3 widesub4" -
+ " wjposer1" -
+ " zeroe0 zeroflag zero2"
$ gosub list_of_tests
$ return
$!
$unix:
$unix_tests: echo "unix_tests..."
$ list = "fflush getlnhd localenl pid pipeio1 pipeio2" -
+ " poundbang rtlen rtlen01 space strftlng"
$ gosub list_of_tests
$ return
$
$gnu:
$gawk_ext: echo "gawk_ext... (gawk.extensions)"
$ list = "aadelete1 aadelete2 aarray1 aasort aasorti" -
+ " argtest arraysort" -
+ " backw badargs beginfile1 binmode1" -
+ " colonwarn clos1way charasbytes crlf" -
+ " dbugeval delsub devfd devfd1 devfd2 dumpvars" -
+ " exit" -
+ " fieldwdth fpat1 fpat2 fpat3 fpatnull funlen functab1" -
+ " functab2 functab3 fsfwfs fwtest fwtest2 fwtest3"
$ gosub list_of_tests
$ list = "genpot gensub gensub2 getlndir gnuops2 gnuops3" -
+ " gnureops" -
+ " icasefs id icasers igncdym igncfs ignrcase ignrcas2" -
+ " incdupe incdupe2 incdupe3 incdupe4 incdupe5" -
+ " incdupe6 incdupe7 include2 indirectbuiltin indirectcall"
$ gosub list_of_tests
$ list = "lint lintold lintwarn" -
+ " match1 match2 match3 manyfiles mbprintf3 mbstr1 mbstr2" -
+ " nastyparm next nondec nondec2" -
+ " patsplit posix printfbad1 printfbad2 printfbad3" -
+ " printfbad4 printhuge procinfs profile0 profile1" -
+ " profile2 profile3 profile4 profile5 profile6" -
+ " profile7 profile8 pty1"
$ gosub list_of_tests
$ list = "regx8bit rebuf reginttrad regnul1 regnul2" -
+ " reint reint2 rsgetline rsglstdin rsstart1 rsstart2" -
+ " rsstart3 rstest6" -
+ " shadow sortfor sortu split_after_fpat splitarg4" -
+ " strtonum strftime switch2 symtab1 symtab2 symtab3" -
+ " symtab4 symtab5 symtab6 symtab7 symtab8 symtab9" -
+ " watchpoint1"
$ gosub list_of_tests
$ return
$
$vms:
$vms_tests: echo "vms_tests..."
$ list = "vms_cmd vms_io1 vms_io2"
$ gosub list_of_tests
$ return
$
$locale_tests:
$charset_tests: echo "charset_tests..."
$ ! without i18n kit, VMS only supports the C locale
$ ! and several of these fail
$ list = "asort asorti" -
+ " backbigs1 backsmalls1 backsmalls2" -
+ " fmttest fnarydel fnparydl" -
+ " lc_num1 mbfw1" -
+ " mbprintf1 mbprintf2 mbprintf4" -
+ " rebt8b2 rtlenmb" -
+ " sort1 sprintfc"
$ gosub list_of_tests
$ return
$!
$charset_all: echo "All charset tests..."
$ list = "charset_msg_start charset_tests charset_msg_end"
$ gosub list_of_tests
$ return
$
$hardware:
$machine_tests: echo "machine_tests..."
$ ! these depend upon the floating point format in use
$ list = "double1 double2 fmtspcl intformat"
$ gosub list_of_tests
$ return
$
$extra: echo "extra..."
$ list = "regtest inftest inet"
$ gosub list_of_tests
$ return
$
$inet: echo "inet..."
$ type sys$input:
The inet tests only work if gawk has been built with TCP/IP socket
support and your system supports the services "discard" at port 9
and "daytimed" at port 13.
$ list = "inetechu inetecht inetdayu inetdayt"
$ gosub list_of_tests
$ return
$!
$shlib:
$extension: echo "extension...."
$ list = "fnmatch filefuncs fork fork2 fts functab4" -
+ " inplace1 inplace2" -
+ " ordchr ordchr2" -
+ " readdir readfile readfile2 revout revtwoway rwarray" -
+ " testext time"
$ gosub list_of_tests
$ return
$!
$mpfr: echo "mpfr... - Not yet implmented on VMS"
$ ! mpfr has not yet been ported to VMS.
$ return
$!
$! list_of_tests: process 'list', a space-separated list of tests.
$! Some tests assign their own 'list' and call us recursively,
$! so we have to emulate a local stack to prevent the current list
$! from being clobbered by nested execution. We do this by making
$! and operating on list1, list2, &c depending upon call depth.
$! Lower level tests access higher numbered entries; the lower
$! entries in use by caller or caller's caller are kept intact.
$list_of_tests:
$ listdepth = listdepth + 1 ! increment calling depth
$ list'listdepth' = f$edit(list,"COMPRESS,TRIM")
$next_test:
$ test = f$element(0," ",list'listdepth')
$ list'listdepth' = list'listdepth' - test - " "
$ gosub 'test'
$ if list'listdepth'.nes."" then goto next_test
$ listdepth = listdepth - 1 ! reset
$ return
$
$
$! common tests, not needing special set up: gawk -f 'test'.awk 'test'.in
$addcomma:
$anchgsub:
$arrayprm2:
$arryref2:
$aryprm8:
$aryprm9:
$asgext:
$backgsub:
$backsmalls2:
$backw:
$concat1:
$concat2:
$concat3:
$crlf:
$datanonl:
$delarpm2:
$dfamb1:
$exit2:
$fldchg:
$fldchgnf:
$fmttest:
$fordel:
$fpat1:
$fpat3:
$fpat4:
$fpatnull:
$fsfwfs:
$fsrs:
$funlen:
$funstack:
$fwtest:
$fwtest2:
$fwtest3:
$gensub:
$getline3:
$getline4:
$getnr2tb:
$getnr2tm:
$gsubtest:
$gsubtst2:
$gsubtst4:
$gsubtst5:
$gsubtst7:
$gsubtst8:
$hex:
$icasers:
$igncfs:
$igncdym:
$indirectcall:
$inpref:
$inputred:
$lc_num1:
$leadnl:
$manglprm:
$match3:
$membug1:
$nested:
$nfloop:
$nfset:
$nlfldsep:
$nlinstr:
$noloop1:
$noloop2:
$nulrsend:
$ofmt:
$ofmtfidl:
$ofmts:
$ofs1:
$onlynl:
$parse1:
$parsefld:
$prdupval:
$prec:
$prtoeval:
$range1:
$rebrackloc:
$rebuf:
$regeq:
$regexpbrack:
$regnul1:
$regnul2:
$reindops:
$reparse:
$rsgetline:
$rsnul1nl:
$rsstart1:
$rstest1:
$rstest2:
$rstest3:
$rstest6:
$rswhite:
$sortempty:
$sortfor:
$sortglos:
$split_after_fpat:
$splitarg4:
$splitargv:
$splitarr:
$splitvar:
$sprintfc:
$strcat1:
$strtod:
$subsepnm:
$swaplns:
$uparrfs:
$wjposer1:
$zeroe0:
$! common with 'test'.in
$ echo "''test'"
$ gawk -f 'test'.awk 'test'.in >_'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$!
$indirectbuiltin: ! 4.1.2
$ echo "''test'"
$ ! No shell simulation in gawk
$ temp_file = "sys$disk:[]_'test'.tmp"
$ if f$search(temp_file) .nes. "" then delete 'temp_file';*
$ old_rm = rm
$ rm = "continue ! "
$ gawk -f 'test'.awk 'test'.in >_'test'.tmp
$ rm = old_rm
$ ! gawk subprocesses creating new generation of stdout
$ ! instead of appending to open one.
$ cmp 'test'.ok sys$disk:[]_'test'.tmp;1
$ if $status then rm _'test'.tmp;*,x1.out;,x2.out;
$ return
$
$! more common tests, without a data file: gawk -f 'test'.awk
$ofmta:
$ if arch_name .eqs. "VAX"
$ then
$ echo "''test' skipped on VAX."
$ return
$ endif
$aarray1:
$aasort:
$aasorti:
$arrayref:
$arraysort:
$arrymem1:
$arynasty:
$arysubnm:
$asort:
$asorti:
$badassign1:
$badbuild:
$callparam:
$closebad:
$compare2:
$convfmt:
$delargv:
$delarprm:
$delsub:
$dynlj:
$fnarydel:
$fnparydl:
$fpat2:
$forref:
$forsimp:
$funsemnl:
$gensub2:
$gnuops2:
$gnuops3:
$gnureops:
$hsprint:
$icasefs:
$intest:
$match1:
$math:
$minusstr:
$negrange:
$nulinsrc:
$nlstrina:
$nondec:
$octsub:
$paramtyp:
$paramuninitglobal:
$patsplit:
$pcntplus:
$printf1:
$procinfs:
$prt1eval:
$rebt8b1:
$rebt8b2:
$regexprange:
$regrange:
$regx8bit:
$sort1:
$sortu:
$splitdef:
$splitwht:
$strnum1:
$strtonum:
$substr:
$switch2:
$zero2:
$zeroflag:
$! common without 'test'.in
$ echo "''test'"
$ set noOn
$ gawk -f 'test'.awk 2>&1 >_'test'.tmp
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$colonwarn: echo "''test'"
$ gawk -f 'test'.awk 1 < 'test'.in > _'test'.tmp
$ gawk -f 'test'.awk 2 < 'test'.in > _'test'_2.tmp
$ gawk -f 'test'.awk 3 < 'test'.in > _'test'_3.tmp
$ append _'test'_2.tmp,_'test'_3.tmp _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp;1
$ if $status then rm _'test'*.tmp;*
$ return
$
$dbugeval:
$ echo "''test'"
$ if f$getdvi("SYS$COMMAND", "TRM")
$ then
$ set noOn
$ gawk --debug -f /dev/null < 'test'.in 2>&1 > _'test.tmp'
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp;1
$ if $status then rm _'test'*.tmp;*
$ return
$ else
$ echo "Skipping because not a terminal."
$ endif
$!
$rsglstdin:
$ echo "''test'"
$ set noOn
$ define/user sys$input rsgetline.in
$ gawk -f rsgetline.awk 2>&1 > _'test'.tmp
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$!
$genpot:
$ echo "''test'"
$ set noOn
$ gawk -f 'test'.awk --gen-pot 2>&1 >_'test'.tmp
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$!
$paramasfunc1:
$paramasfunc2:
$ echo "''test'"
$ set noOn
$ gawk -f 'test'.awk --posix 2>&1 >_'test'.tmp
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$!
$watchpoint1:
$ echo "''test'"
$ set noOn
$ gawk "-D" -f 'test'.awk 'test'.in < 'test'.script 2>&1 >_'test'.tmp
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$!
$!
$!
$fork: ! 4.0.2
$fork2: ! 4.0.2
$ echo "''test' not implemented on VMS skipped"
$ return
$!
$testext:
$ set process/parse=extended ! ODS-5 only
$ echo "''test'"
$ gawk "/^(@load|BEGIN)/,/^}/" [-.extension]'test'.c > _'test'.awk
$ set noOn
$ AWKLIBPATH_dir
$ gawk -f _'test'.awk >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ gawk "{gsub(""no children"",""No child processes"")}1" -
_'test'.tmp >_'test'.tmp1
$ rm sys$disk:[]_'test'.tmp;*
$ mv sys$disk:[]_'test'.tmp1 sys$disk:[]_'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ set On
$ return
$!
$double1:
$double2:
$ echo "''test' skipped"
$ return
$
$getline5: echo "''test'"
$ ! Use of echo and rm inside the awk script makes it necessary
$ ! for some temporary redefinitions. The VMS gawk.exe also creates
$ ! multiple output files. Only the first contains the data.
$ old_echo = echo
$ old_rm = rm
$ echo = "pipe write sys$output"
$ rm = "!"
$ gawk -f 'test'.awk > _'test'.tmp
$ echo = old_echo
$ rm = old_rm
$ delsym old_echo
$ delsym old_rm
$ cmp 'test'.ok sys$disk:[]_'test'.tmp;1
$ if $status then rm _'test'.tmp;*,f.;*
$ return
$
$msg:
$ ! first show gawk's version (without copyright notice)
$ gawk --version >_msg.tmp
$ gawk "FNR == 1 {print; exit}" _msg.tmp
$ rm _msg.tmp;
$ echo "Any output from ""DIF"" is bad news, although some differences"
$ echo "in floating point values are probably benign -- in particular,"
$ echo "some systems may omit a leading zero and the floating point"
$ echo "precision may lead to slightly different output in a few cases."
$ echo ""
$ return
$!
$charset_msg_start:
$ echo "======== Starting tests that can vary based on character set ========"
$ echo "======== or locale support ========"
$ echo "*********************************************************************"
$ echo "* Some or all of these tests may fail if you have inadequate or *"
$ echo "* missing locale support. At least en_US.UTF-8, ru_RU.UTF-8 and *"
$ echo "* ja_JP.UTF-8 are needed. However, if you see this message, then *"
$ echo "* this test script thinks you have what you need ... *"
$ echo "*********************************************************************"
$ echo ""
$ return
$!
$charset_msg_end:
$ echo "======== Done with tests that can vary based on character set ========"
$ echo "======== or locale support ========"
$ echo ""
$ return
$!
$printlang:
$! the default locale is C, with LC_LANG and LC_ALL left empty;
$! showing that at the very beginning may cause some confusion about
$! whether gawk requires those, so we don't run this as the first test
$ gawk -f printlang.awk
$ return
$
$poundbang:
$pty1:
$ echo "''test': not supported"
$ return
$
$
$messages: echo "''test'"
$ set noOn
$ gawk -f 'test'.awk > _out2 >& _out3
$ cmp out1.ok sys$disk:[]_out1.
$ if $status then rm _out1.;
$ cmp out2.ok sys$disk:[]_out2.
$ if $status then rm _out2.;
$ cmp out3.ok sys$disk:[]_out3.
$ if $status then rm _out3.;
$ set On
$ return
$
$argarray: echo "argarray"
$ define/User TEST "test" !this is useless...
$ gawk -f argarray.awk ./argarray.in - >_argarray.tmp
just a test
$ cmp argarray.ok sys$disk:[]_argarray.tmp
$ if $status then rm _argarray.tmp;
$ return
$
$fstabplus: echo "fstabplus"
$ gawk -f fstabplus.awk >_fstabplus.tmp
1 2
$ cmp fstabplus.ok sys$disk:[]_fstabplus.tmp
$ if $status then rm _fstabplus.tmp;
$ return
$
$longwrds: echo "longwrds"
$ gawk -v "SORT=sort sys$input: _longwrds.tmp" -f longwrds.awk longwrds.in >_NL:
$ cmp longwrds.ok sys$disk:[]_longwrds.tmp
$ if $status then rm _longwrds.tmp;
$ return
$
$fieldwdth: echo "fieldwdth"
$ gawk -v "FIELDWIDTHS=2 3 4" "{ print $2}" >_fieldwdth.tmp
123456789
$ cmp fieldwdth.ok sys$disk:[]_fieldwdth.tmp
$ if $status then rm _fieldwdth.tmp;
$ return
$
$ignrcase: echo "ignrcase"
$ gawk -v "IGNORECASE=1" "{ sub(/y/, """"); print}" >_ignrcase.tmp
xYz
$ cmp ignrcase.ok sys$disk:[]_ignrcase.tmp
$ if $status then rm _ignrcase.tmp;
$ return
$
$regtest:
$ if f$search("regtest.com").eqs.""
$ then echo "regtest: not available"
$ else echo "regtest"
$ echo "Some of the output from regtest is very system specific, do not"
$ echo "be distressed if your output differs from that distributed."
$ echo "Manual inspection is called for."
$ @regtest.com
$ endif
$ return
$
$posix: echo "posix"
$ gawk -f posix.awk >_posix.tmp
1:2,3 4
$ cmp posix.ok sys$disk:[]_posix.tmp
$ if $status then rm _posix.tmp;
$ return
$
$manyfiles: echo "manyfiles"
$!! this used to use a hard-coded value of 300 simultaneously open
$!! files, but if our open file quota is generous enough then that
$!! wouldn't exercise the ability to handle more than the maximum
$!! number allowed at once
$ f_cnt = 300
$ chnlc = f$getsyi("CHANNELCNT")
$ fillm = f$getjpi("","FILLM")
$ if fillm.ge.chnlc then fillm = chnlc - 1
$ if fillm.ge.f_cnt then f_cnt = fillm + 10
$ if f$search("[.junk]*.*").nes."" then rm [.junk]*.*;*
$ if f$parse("[.junk]").eqs."" then create/Dir/Prot=(O:rwed) [.junk]
$ gawk -- "BEGIN {for (i = 1; i <= ''f_cnt'; i++) print i, i}" >_manyfiles.dat
$ echo "(processing ''f_cnt' files; this may take quite a while)"
$ set noOn ! continue even if gawk fails
$ gawk -f manyfiles.awk _manyfiles.dat _manyfiles.dat
$ set On
$ define/User sys$error _NL:
$ define/User sys$output _manyfiles.tmp
$ search/Match=Nor/Output=_NL:/Log [.junk]*.* ""
$!/Log output: "%SEARCH-S-NOMATCH, <filename> - <#> records" plus 1 line summary
$ gawk -v "F_CNT=''f_cnt'" -f - _manyfiles.tmp
$deck !some input begins with "$"
$4 != 2 {++count}
END {if (NR != F_CNT+1 || count != 1) {print "\nFailed!"}}
$eod
$ rm _manyfiles.tmp;,_manyfiles.dat;,[.junk]*.*;*,[]junk.dir;
$ return
$
$compare: echo "compare"
$ gawk -f compare.awk 0 1 compare.in >_compare.tmp
$ cmp compare.ok sys$disk:[]_compare.tmp
$ if $status then rm _compare.tmp;
$ return
$
$rs: echo "rs"
$ gawk -v "RS=" "{ print $1, $2}" rs.in >_rs.tmp
$ cmp rs.ok sys$disk:[]_rs.tmp
$ if $status then rm _rs.tmp;
$ return
$
$fsbs: echo "fsbs"
$ gawk -v "FS=\" "{ print $1, $2 }" fsbs.in >_fsbs.tmp
$ cmp fsbs.ok sys$disk:[]_fsbs.tmp
$ if $status then rm _fsbs.tmp;
$ return
$
$inftest: echo "inftest"
$ !! echo "This test is very machine specific..."
$ set noOn
$ gawk -f inftest.awk >_inftest.tmp
$ !! cmp inftest.ok sys$disk:[]_inftest.tmp !just care that gawk doesn't crash...
$ if $status then rm _inftest.tmp;
$ set On
$ return
$
$getline2: echo "getline2"
$ gawk -f getline2.awk getline2.awk getline2.awk >_getline2.tmp
$ cmp getline2.ok sys$disk:[]_getline2.tmp
$ if $status then rm _getline2.tmp;
$ return
$
$rand: echo "rand"
$ echo "The following line should just be 19 random numbers between 1 and 100"
$ echo ""
$ gawk -f rand.awk
$ return
$
$negexp: echo "negexp"
$ gawk "BEGIN { a = -2; print 10^a }" >_negexp.tmp
$ cmp negexp.ok sys$disk:[]_negexp.tmp
$ if $status then rm _negexp.tmp;
$ return
$
$awkpath: echo "awkpath"
$ define/User AWK_LIBRARY [],[.lib]
$ gawk -f awkpath.awk >_awkpath.tmp
$ cmp awkpath.ok sys$disk:[]_awkpath.tmp
$ if $status then rm _awkpath.tmp;
$ return
$
$argtest: echo "argtest"
$ gawk -f argtest.awk -x -y abc >_argtest.tmp
$ cmp argtest.ok sys$disk:[]_argtest.tmp
$ if $status then rm _argtest.tmp;
$ return
$
$badargs: echo "badargs"
$ on error then continue
$ gawk -f 2>&1 >_badargs.too
$! search/Match=Nor _badargs.too "patchlevel" /Output=_badargs.tmp
$ gawk "/patchlevel/{next}; {gsub(""\"""",""'""); print}" <_badargs.too >_badargs.tmp
$ cmp badargs.ok sys$disk:[]_badargs.tmp
$ if $status then rm _badargs.tmp;,_badargs.too;
$ return
$
$nonl: echo "nonl"
$ ! This one might fail, depending on the tool used to unpack the
$ ! distribution. Some will add a final newline if the file lacks one.
$ AWKPATH_srcdir
$ gawk --lint -f nonl.awk _NL: >_nonl.tmp 2>&1
$ cmp nonl.ok sys$disk:[]_nonl.tmp
$ if $status then rm _nonl.tmp;
$ return
$
$defref: echo "defref"
$ set noOn
$ AWKPATH_srcdir
$ gawk --lint -f defref.awk >_defref.tmp 2>&1
$ if .not. $status then call exit_code '$status' _defref.tmp
$ set On
$ cmp defref.ok sys$disk:[]_defref.tmp
$ if $status then rm _defref.tmp;
$ return
$
$nofmtch: echo "nofmtch"
$ AWKPATH_srcdir
$ gawk --lint -f nofmtch.awk >_nofmtch.tmp 2>&1
$ cmp nofmtch.ok sys$disk:[]_nofmtch.tmp
$ if $status then rm _nofmtch.tmp;
$ return
$
$strftime: echo "strftime"
$ ! this test could fail on slow machines or on a second boundary,
$ ! so if it does, double check the actual results
$ ! This test needs SYS$TIMEZONE_NAME and SYS$TIMEZONE_RULE
$ ! to be properly defined.
$ ! This test now needs GNV Corutils to work
$ date_bin = "gnv$gnu:[bin]gnv$date.exe"
$ if f$search(date_bin) .eqs. ""
$ then
$ echo "''test' skipped"
$ return
$ endif
$ date := $'date_bin'
$!! date | gawk -v "OUTPUT"=_strftime.tmp -f strftime.awk
$ now = f$time()
$ wkd = f$extract(0,3,f$cvtime(now,,"WEEKDAY"))
$ mon = f$cvtime(now,"ABSOLUTE","MONTH")
$ mon = f$extract(0,1,mon) + f$edit(f$extract(1,2,mon),"LOWERCASE")
$ day = f$cvtime(now,,"DAY")
$ tim = f$extract(0,8,f$cvtime(now,,"TIME"))
$! Can not use tz as it shows up in the C environment.
$ timezone = f$trnlnm("SYS$TIMEZONE_NAME")
$ yr = f$cvtime(now,,"YEAR")
$ if f$trnlnm("FTMP").nes."" then close/noLog ftmp
$ open/Write ftmp strftime.in
$ write ftmp wkd," ",mon," ",day," ",tim," ",timezone," ",yr
$ close ftmp
$ gawk -v "OUTPUT"=_strftime.tmp -f strftime.awk strftime.in
$ set noOn
$ cmp strftime.ok sys$disk:[]_strftime.tmp
$ if $status then rm _strftime.tmp;,strftime.ok;*,strftime.in;*
$ set On
$ return
$
$litoct: echo "litoct"
$ gawk --traditional -f litoct.awk >_litoct.tmp
ab
$ cmp litoct.ok sys$disk:[]_litoct.tmp
$ if $status then rm _litoct.tmp;
$ return
$
$resplit: echo "resplit"
$ gawk -- "{ FS = "":""; $0 = $0; print $2 }" >_resplit.tmp
a:b:c d:e:f
$ cmp resplit.ok sys$disk:[]_resplit.tmp
$ if $status then rm _resplit.tmp;
$ return
$
$intprec: echo "intprec"
$ gawk -f intprec.awk >_intprec.tmp 2>&1
$ cmp intprec.ok sys$disk:[]_intprec.tmp
$ if $status then rm _intprec.tmp;
$ return
$
$incdupe: echo "''test'"
$ set noOn
$ gawk --lint -i inclib -i inclib.awk "BEGIN {print sandwich(""a"", ""b"", ""c"")}" > _'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*
$ set On
$ return
$
$incdupe2: echo "''test'"
$ set noOn
$ gawk --lint -f inclib -f inclib.awk >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*
$ set On
$ return
$
$incdupe3: echo "''test'"
$ gawk --lint -f hello -f hello.awk >_'test'.tmp 2>&1
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*
$ return
$
$incdupe4: echo "''test'"
$ set NoOn
$ gawk --lint -f hello -i hello.awk >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*
$ set On
$ return
$
$incdupe5: echo "''test'"
$ set NoOn
$ gawk --lint -i hello -f hello.awk >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*
$ set On
$ return
$
$incdupe6: echo "''test'"
$ set NoOn
$ gawk --lint -i inchello -f hello.awk >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*
$ set On
$ return
$
$incdupe7: echo "''test'"
$ set NoOn
$ gawk --lint -f hello -i inchello >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*
$ set On
$ return
$
$include2: echo "''test'"
$ gawk -i inclib "BEGIN {print sandwich(""a"", ""b"", ""c"")}" >_'test'.tmp 2>&1
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*
$ return
$
$id:
$symtab1:
$symtab2:
$symtab3: echo "''test'"
$ set noOn
$ old_sort = sort
$ sort = "@sys$disk:[-.vms]vms_sort.com"
$ gawk -f 'test'.awk >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ sort = old_sort
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*
$ set On
$ return
$
$symtab4:
$symtab5:
$symtab7: echo "''test'"
$ set noOn
$ gawk -f 'test'.awk <'test'.in >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*
$ set On
$ return
$
$symtab6: echo "''test'"
$ set noOn
$ gawk -d__'test'.tmp -f 'test'.awk
$ pipe search __'test'.tmp "ENVIRON","PROCINFO" /match=nor > _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*,__'test'.tmp;*
$ set On
$ return
$
$symtab8: echo "''test'"
$ set noOn
$ gawk -d__'test'.tmp -f 'test'.awk 'test'.in > _'test'.tmp
$ pipe search __'test'.tmp "ENVIRON","PROCINFO","FILENAME" /match=nor > ___'test'.tmp
$ convert/append ___'test'.tmp _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*,__'test'.tmp;*,___'test'.tmp;*
$ set On
$ return
$
$!-----------------------------------------------------------------------------------
$! This awk script performs some cleanup by doing "system (rm testit.txt)". This is
$! good for Unix but a pain for VMS as we must specify version number when deleting
$! a file. The workaround is to define "rm" as a VMS comment and deleting the file
$! outside of the awk script.
$! Additionally each awk "system" call results in a new version of the output file.
$! so we need to compensate for that as well.
$!-----------------------------------------------------------------------------------
$symtab9: echo "''test'"
$ old_rm = rm ! Remember old definition of rm
$ rm = "!" ! Redefine rm to something harmless
$ gawk -f 'test'.awk >_'test'.tmp
$ rm = old_rm ! Restore old value
$ delsym old_rm
$ cmp 'test'.ok sys$disk:[]_'test'.tmp;-0 ! -0 is the lowest version
$ if $status then rm _'test'.tmp;*,testit.txt;*
$ return
$
$childin: echo "''test'"
$ cat = "type sys$input"
$ gawk -f 'test'.awk < 'test'.in > _'test'.tmp
$ delsym cat
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$noeffect: echo "noeffect"
$ AWKPATH_srcdir
$ gawk --lint -f noeffect.awk >_noeffect.tmp 2>&1
$ cmp noeffect.ok sys$disk:[]_noeffect.tmp
$ if $status then rm _noeffect.tmp;
$ return
$
$numsubstr: echo "numsubstr"
$ AWKPATH_srcdir
$ gawk -f numsubstr.awk numsubstr.in >_numsubstr.tmp
$ cmp numsubstr.ok sys$disk:[]_numsubstr.tmp
$ if $status then rm _numsubstr.tmp;
$ return
$
$prmreuse: echo "prmreuse"
$ if f$search("prmreuse.ok").eqs."" then create prmreuse.ok
$ gawk -f prmreuse.awk >_prmreuse.tmp
$ cmp prmreuse.ok sys$disk:[]_prmreuse.tmp
$ if $status then rm _prmreuse.tmp;
$ return
$
$fflush:
$ echo "fflush: not supported"
$ return
$!!fflush: echo "fflush"
$ ! hopelessly Unix-specific
$!! @fflush.sh >_fflush.tmp
$ cmp fflush.ok sys$disk:[]_fflush.tmp
$ if $status then rm _fflush.tmp;
$ return
$
$getlnhd:
$ echo "getlnhd skipped"
$ !Expects a Unix shell
$ return
$!!getlnhd: echo "getlnhd"
$ gawk -f getlnhd.awk >_getlnhd.tmp
$ cmp getlnhd.ok sys$disk:[]_getlnhd.tmp
$ if $status then rm _getlnhd.tmp;
$ return
$
$tweakfld: echo "tweakfld"
$ gawk -f tweakfld.awk tweakfld.in >_tweakfld.tmp
$ if f$search("errors.cleanup").nes."" then rm errors.cleanup;*
$ cmp tweakfld.ok sys$disk:[]_tweakfld.tmp
$ if $status then rm _tweakfld.tmp;
$ return
$
$clsflnam: echo "clsflnam"
$ if f$search("clsflnam.ok").eqs."" then create clsflnam.ok
$ gawk -f clsflnam.awk clsflnam.in >_clsflnam.tmp 2>&1
$ cmp clsflnam.ok sys$disk:[]_clsflnam.tmp
$ if $status then rm _clsflnam.tmp;
$ return
$
$mmap8k: echo "mmap8k"
$ gawk "{ print }" mmap8k.in >_mmap8k.tmp
$ cmp mmap8k.in sys$disk:[]_mmap8k.tmp
$ if $status then rm _mmap8k.tmp;
$ return
$
$eofsplit: echo "eofsplit"
$ if f$search("eofsplit.ok").eqs."" then create eofsplit.ok
$ gawk -f eofsplit.awk >_eofsplit.tmp
$ cmp eofsplit.ok sys$disk:[]_eofsplit.tmp
$ if $status then rm _eofsplit.tmp;
$ return
$
$back89: echo "back89"
$ gawk "/a\8b/" back89.in >_back89.tmp
$ cmp back89.ok sys$disk:[]_back89.tmp
$ if $status then rm _back89.tmp;
$ return
$
$tradanch: echo "tradanch"
$ if f$search("tradanch.ok").eqs."" then create tradanch.ok
$ gawk --traditional -f tradanch.awk tradanch.in >_tradanch.tmp
$ cmp tradanch.ok sys$disk:[]_tradanch.tmp
$ if $status then rm _tradanch.tmp;
$ return
$
$reginttrad: echo "''test'"
$ gawk --traditional -r -f 'test'.awk >_'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$pid: echo "pid"
$ pid = f$integer("%x" + f$getjpi("","PID"))
$ ppid = f$integer("%x" + f$getjpi("","OWNER"))
$ gawk -v "ok_pid=''pid'" -v "ok_ppid=''ppid'" -f pid.awk >_pid.tmp >& _NL:
$ cmp pid.ok sys$disk:[]_pid.tmp
$ if $status then rm _pid.tmp;
$ return
$
$strftlng: echo "strftlng"
$ define/User TZ "UTC" !useless
$ gawk -f strftlng.awk >_strftlng.tmp
$ cmp strftlng.ok sys$disk:[]_strftlng.tmp
$ if $status then rm _strftlng.tmp;
$ return
$
$nfldstr: echo "nfldstr"
$ if f$search("nfldstr.ok").eqs."" then create nfldstr.ok
$ gawk "$1 == 0 { print ""bug"" }" >_nfldstr.tmp
$ cmp nfldstr.ok sys$disk:[]_nfldstr.tmp
$ if $status then rm _nfldstr.tmp;
$ return
$
$nors: echo "nors"
$!! there's no straightforward way to supply non-terminated input on the fly
$!! @echo A B C D E | tr -d '\12' | $(AWK) '{ print $$NF }' - $(srcdir)/nors.in > _$@
$!! so just read a line from sys$input instead
$ gawk "{ print $NF }" - nors.in >_nors.tmp
A B C D E
$ cmp nors.ok sys$disk:[]_nors.tmp
$ if $status then rm _nors.tmp;
$ return
$
$reint: echo "reint"
$ gawk --re-interval -f reint.awk reint.in >_reint.tmp
$ cmp reint.ok sys$disk:[]_reint.tmp
$ if $status then rm _reint.tmp;
$ return
$
$noparms: echo "noparms"
$ set noOn
$ AWKPATH_srcdir
$ gawk -f noparms.awk >_noparms.tmp 2>&1
$ if .not. $status then call exit_code '$status' _noparms.tmp
$ set On
$ cmp noparms.ok sys$disk:[]_noparms.tmp
$ if $status then rm _noparms.tmp;
$ return
$
$pipeio1: echo "pipeio1"
$ cat = "TYPE" !close enough, as long as we avoid .LIS default suffix
$ define/User test1 []test1.
$ define/User test2 []test2.
$ gawk -f pipeio1.awk >_pipeio1.tmp
$ rm test1.;,test2.;
$ cmp pipeio1.ok sys$disk:[]_pipeio1.tmp
$ if $status then rm _pipeio1.tmp;
$ return
$
$pipeio2:
$ echo "pipeio2 skipped"
$ ! Expects the sed utility and Posix shell
$ return
$!!pipeio2: echo "pipeio2"
$ cat = "gawk -- {print}"
$ tr = "??" !unfortunately, no trivial substitution available...
$ gawk -v "SRCDIR=." -f pipeio2.awk >_pipeio2.tmp
$ cmp pipeio2.ok sys$disk:[]_pipeio2.tmp
$ if $status then rm _pipeio2.tmp;
$ return
$
$clobber: echo "clobber"
$ gawk -f clobber.awk >_clobber.tmp
$ cmp clobber.ok sys$disk:[]seq.
$ if $status then rm seq.;*
$ cmp clobber.ok sys$disk:[]_clobber.tmp
$ if $status then rm _clobber.tmp;
$ return
$
$nasty: echo "nasty"
$ set noOn
$ gawk -f nasty.awk >_nasty.tmp
$ call fixup_LRL nasty.ok
$ call fixup_LRL _nasty.tmp "purge"
$ cmp nasty.ok sys$disk:[]_nasty.tmp
$ if $status
$ then
$ rm _nasty.tmp;
$ file = "lcl_root:[]nasty.ok"
$ if f$search(file) .nes. "" then rm 'file';*
$ endif
$ set On
$ return
$
$nasty2: echo "nasty2"
$ set noOn
$ gawk -f nasty2.awk >_nasty2.tmp
$ call fixup_LRL nasty2.ok
$ call fixup_LRL _nasty2.tmp "purge"
$ cmp nasty2.ok sys$disk:[]_nasty2.tmp
$ if $status
$ then
$ rm _nasty2.tmp;
$ file = "lcl_root:[]nasty2.ok"
$ if f$search(file) .nes. "" then rm 'file';*
$ endif
$ set On
$ return
$
$aadelete1:
$aadelete2:
$arrayparm:
$fnaryscl:
$functab1:
$functab2:
$functab3:
$nastyparm:
$opasnslf:
$opasnidx:
$printfbad1:
$prmarscl:
$subslash:
$ echo "''test'"
$ set noOn
$ gawk -f 'test'.awk >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$arynocls: echo "arynocls"
$ gawk -v "INPUT"=arynocls.in -f arynocls.awk >_arynocls.tmp
$ cmp arynocls.ok sys$disk:[]_arynocls.tmp
$ if $status then rm _arynocls.tmp;
$ return
$
$getlnbuf: echo "getlnbuf"
$ gawk -f getlnbuf.awk getlnbuf.in >_getlnbuf.tmp
$ gawk -f gtlnbufv.awk getlnbuf.in >_getlnbuf.too
$ cmp getlnbuf.ok sys$disk:[]_getlnbuf.tmp
$ if $status then rm _getlnbuf.tmp;
$ cmp getlnbuf.ok sys$disk:[]_getlnbuf.too
$ if $status then rm _getlnbuf.too;
$ return
$
$lint: echo "lint"
$ AWKPATH_srcdir
$ gawk -f lint.awk >_lint.tmp 2>&1
$ cmp lint.ok sys$disk:[]_lint.tmp
$ if $status then rm _lint.tmp;
$ return
$
$lintold: echo "lintold"
$ AWKPATH_srcdir
$ gawk -f lintold.awk --lint-old <lintold.in >_lintold.tmp 2>&1
$ cmp lintold.ok sys$disk:[]_lintold.tmp
$ if $status then rm _lintold.tmp;
$ return
$
$ofmtbig: echo "ofmtbig"
$ set noOn
$ gawk -f ofmtbig.awk ofmtbig.in >_ofmtbig.tmp 2>&1
$ set On
$ cmp ofmtbig.ok sys$disk:[]_ofmtbig.tmp
$ if $status then rm _ofmtbig.tmp;
$ return
$
$inetechu: echo "inetechu"
$ echo "this test is for establishing UDP connections"
$ set noOn
$ gawk -- "BEGIN {print """" |& ""/inet/udp/0/127.0.0.1/9""}"
$ set On
$ return
$
$inetecht: echo "inetecht"
$ echo "this test is for establishing TCP connections"
$ set noOn
$ gawk -- "BEGIN {print """" |& ""/inet/tcp/0/127.0.0.1/9""}"
$ set On
$ return
$
$inetdayu: echo "inetdayu"
$ echo "this test is for bidirectional UDP transmission"
$ set noOn
$ gawk -f - _NL:
BEGIN { print "" |& "/inet/udp/0/127.0.0.1/13";
"/inet/udp/0/127.0.0.1/13" |& getline; print $0}
$ set On
$ return
$
$inetdayt: echo "inetdayt"
$ echo "this test is for bidirectional TCP transmission"
$ set noOn
$ gawk -f - _NL:
BEGIN { print "" |& "/inet/tcp/0/127.0.0.1/13";
"/inet/tcp/0/127.0.0.1/13" |& getline; print $0}
$ set On
$ return
$
$redfilnm: echo "redfilnm"
$ gawk -f redfilnm.awk srcdir="." redfilnm.in >_redfilnm.tmp
$ cmp redfilnm.ok sys$disk:[]_redfilnm.tmp
$ if $status then rm _redfilnm.tmp;
$ return
$
$leaddig: echo "leaddig"
$ gawk -v "x=2E" -f leaddig.awk >_leaddig.tmp
$ cmp leaddig.ok sys$disk:[]_leaddig.tmp
$ if $status then rm _leaddig.tmp;
$ return
$
$clos1way:
$ echo "clos1way: not supported"
$ return
$!!clos1way: echo "clos1way"
$ gawk -f clos1way.awk >_clos1way.tmp
$ cmp clos1way.ok sys$disk:[]_clos1way.tmp
$ if $status then rm _clos1way.tmp;
$ return
$
$shadow: echo "shadow"
$ set noOn
$ AWKPATH_srcdir
$ gawk --lint -f shadow.awk >_shadow.tmp 2>&1
$ set On
$ cmp shadow.ok sys$disk:[]_shadow.tmp
$ if $status then rm _shadow.tmp;
$ return
$
$lintwarn: echo "lintwarn"
$ set noOn
$ AWKPATH_srcdir
$ gawk --lint -f lintwarn.awk >_lintwarn.tmp 2>&1
$ if .not. $status then call exit_code '$status' _lintwarn.tmp
$ set On
$ cmp lintwarn.ok sys$disk:[]_lintwarn.tmp
$ if $status then rm _lintwarn.tmp;
$ return
$
$longsub: echo "longsub"
$ set noOn
$ gawk -f longsub.awk longsub.in >_longsub.tmp
$!! the records here are too long for DIFF to handle
$!! so assume success as long as gawk doesn't crash
$!! call fixup_LRL longsub.ok
$!! call fixup_LRL _longsub.tmp "purge"
$!! cmp longsub.ok sys$disk:[]_longsub.tmp
$ if $status then rm _longsub.tmp;
$ set On
$ return
$
$arrayprm3: echo "arrayprm3"
$ gawk -f arrayprm3.awk arrayprm3.in >_arrayprm3.tmp
$ cmp arrayprm3.ok sys$disk:[]_arrayprm3.tmp
$ if $status then rm _arrayprm3.tmp;
$ return
$
$arryref3:
$arryref4:
$arryref5:
$aryprm1:
$aryprm2:
$aryprm3:
$aryprm4:
$aryprm5:
$aryprm6:
$aryprm7:
$dfastress:
$nfneg:
$numindex:
$scalar:
$sclforin:
$sclifin:
$ echo "''test'"
$ set noOn
$ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$ !
$ ! For tests requiring exit code 2
$ !
$ echo "''test'"
$ set noOn
$ gawk -f 'test'.awk <'test'.in >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$exitval2:
$ echo "''test'"
$ cmdfile = "sys$disk:[]_''test'.com"
$ if f$search(cmdfile) .nes. "" then delete 'cmdfile';*
$ open/write xxx 'cmdfile'
$ write xxx "$!'f$verify(0,0)'
$ write xxx "$read := read"
$ write xxx "$define/user sys$input sys$command"
$ write xxx "$pipe read sys$input x ; write sys$output x ; exit %x003A151"
$ close xxx
$ ! Unix exit 42 is VMS %x003A151
$ read := "@''cmdfile' !"
$ set noOn
$ gawk -f 'test'.awk >_'test'.tmp
$ if $status .ne. 1 then call exit_code '$status' _'test'.tmp
$ delete/symbol/local read
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status
$ then
$ rm _'test'.tmp;*
$ if f$search(cmdfile) .nes. "" then rm 'cmdfile';*
$ endif
$ return
$!
$exitval3:
$ echo "''test'"
$ set noOn
$ gawk -f 'test'.awk >_'test'.tmp
$ ! Unix exit 42 is VMS %x003A151
$ if $status .ne. 1 then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$!
$!
$delfunc:
$fcall_exit2:
$fnamedat:
$fnarray2:
$fnasgnm:
$fnmisc:
$gsubasgn:
$unterm:
$ echo "''test'"
$ set noOn
$ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$getline: echo "getline skipped"
$ !Expects a Unix shell
$ return
$!!getline: echo "getline"
$ gawk -f getline.awk getline.in >_getline.tmp
$ cmp getline.ok sys$disk:[]_getline.tmp
$ if $status then rm _getline.tmp;
$ return
$
$gsubtst3: echo "gsubtst3"
$ gawk --re-interval -f gsubtst3.awk gsubtst3.in >_gsubtst3.tmp
$ cmp gsubtst3.ok sys$disk:[]_gsubtst3.tmp
$ if $status then rm _gsubtst3.tmp;
$ return
$
$! FIXME: gawk generates an extra, empty output file while running this test...
$iobug1: echo "iobug1"
$ cat = "TYPE sys$input:"
$ true = "exit 1" !success
$ oldout = f$search("_iobug1.tmp;")
$ gawk -f iobug1.awk iobug1.in >_iobug1.tmp
$ badout = f$search("_iobug1.tmp;-1")
$ if badout.nes."" .and. badout.nes.oldout then rm 'badout'
$ cmp iobug1.ok sys$disk:[]_iobug1.tmp
$ if $status then rm _iobug1.tmp;
$ return
$
$rstest4:
$ echo "rstest4"
$ old_echo = echo
$ echo = "write sys$output """
$ gawk -f rstest4.awk >_rstest4.tmp1
$ echo = old_echo
$ gawk "{gsub(""< A>"",""<a>"")}1" _'test'.tmp1 >_'test'.tmp
$ rm sys$disk:[]_'test'.tmp1;*
$ cmp rstest4.ok sys$disk:[]_rstest4.tmp
$ if $status then rm _rstest4.tmp;
$ return
$
$rstest5:
$ echo "rstest5"
$ old_echo = echo
$ echo = "write sys$output """
$ gawk -f rstest5.awk >_rstest5.tmp1
$ echo = old_echo
$ gawk "{gsub("" '"","""");gsub(""'"","""")}1" _'test'.tmp1 >_'test'.tmp
$ rm sys$disk:[]_'test'.tmp1;*
$ cmp rstest5.ok sys$disk:[]_rstest5.tmp
$ if $status then rm _rstest5.tmp;
$ return
$
$fcall_exit:
$fnarray:
$funsmnam:
$match2:
$paramdup:
$paramres:
$parseme:
$synerr1:
$synerr2:
$ echo "''test'"
$ set noOn
$ gawk -f 'test'.awk >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$!
$uninit2:
$uninit3:
$uninit4:
$uninit5:
$uninitialized:
$ echo "''test'"
$ gawk --lint -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$space: echo "space"
$ set noOn
$ gawk -f " " space.awk >_space.tmp 2>&1
$ if .not. $status then call exit_code '$status' _space.tmp
$ set On
$! we get a different error from what space.ok expects
$ gawk "{gsub(""file specification syntax error"", ""no such file or directory""); print}" -
_space.tmp >_space.too
$ rm _space.tmp;
$ mv _space.too _space.tmp
$ igncascmp space.ok sys$disk:[]_space.tmp
$ if $status then rm _space.tmp;
$ return
$
$posix2008sub:
$printf0:
$ echo "''test'"
$ gawk --posix -f 'test'.awk >_'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$rsnulbig: echo "rsnulbig"
$ if .not.pipeok
$ then echo "Without the PIPE command, ''test' can't be run."
$ On warning then return
$ pipe echo "With PIPE, this will probably take quite a while..."
$ On warning then $
$ pipeok = 1
$ else echo "This will probably take quite a while too..."
$ endif
$ set noOn
$ pipe -
gawk -- "BEGIN {for (i = 1; i <= 128*64+1; i++) print ""abcdefgh123456\n""}" | -
gawk -- "BEGIN {RS = """"; ORS = ""\n\n""}; {print}" | -
gawk -- "/^[^a]/; END {print NR}" >_rsnulbig.tmp
$ set On
$ cmp rsnulbig.ok sys$disk:[]_rsnulbig.tmp
$ if $status then rm _rsnulbig.tmp;
$ return
$
$rsnulbig2: echo "rsnulbig2"
$ if .not.pipeok
$ then echo "Without the PIPE command, ''test' can't be run."
$ On warning then return
$ pipe echo "With PIPE, this will probably take quite a while..."
$ On warning then $
$ pipeok = 1
$ else echo "This will probably take quite a while too..."
$ endif
$ set noOn
$ pipe -
gawk -- "BEGIN {ORS=""""; n=""\n""; for (i=1; i<=10; i++) n=(n n); for (i=1; i<=128; i++) print n; print ""abc\n""}" | -
gawk -- "BEGIN {RS=""""; ORS=""\n\n"" }; {print}" | -
gawk -- "/^[^a]/; END {print NR}" >_rsnulbig2.tmp
$ set On
$ cmp rsnulbig2.ok sys$disk:[]_rsnulbig2.tmp
$ if $status then rm _rsnulbig2.tmp;
$ return
$
$backbigs1: ! 4.1.1
$ echo "''test' skipped'
$ ! needs a locale not on VMS currently
$ return
$!
$backsmalls1:
$ gosub define_gawklocale
$ if f$trnlnm("LC_ALL") .nes. "utf8-50"
$ then
$ echo "''test' skipping"
$ return
$ else
$ echo "''test'"
$ endif
$ gawk -f 'test'.awk 'test'.in >_'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$!
$subamp:
$wideidx:
$widesub2:
$widesub3:
$ echo "''test'"
$ gosub define_gawklocale
$ gawk -f 'test'.awk 'test'.in >_'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$ignrcas2:
$wideidx2:
$widesub:
$widesub4:
$ echo "''test'"
$ gosub define_gawklocale
$ gawk -f 'test'.awk >_'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$! This test is somewhat suspect for vms due to exit code manipulation
$exitval1: echo "exitval1"
$ gawk -f exitval1.awk >_exitval1.tmp 2>&1
$ if $status then call exit_code '$status' _exitval1.tmp
$ cmp exitval1.ok sys$disk:[]_exitval1.tmp
$ if $status then rm _exitval1.tmp;
$ return
$
$fsspcoln: echo "fsspcoln"
$ gawk -f fsspcoln.awk "FS=[ :]+" fsspcoln.in >_forspcoln.tmp
$ cmp fsspcoln.ok sys$disk:[]_forspcoln.tmp
$ if $status then rm _forspcoln.tmp;
$ return
$
$getlndir: echo "getlndir"
$ ! assume we're running in the test subdirectory; we don't want to
$ ! perform a messy conversion of [] into its file specification
$ gawk -v "SRCDIR=[-]test.dir" -f getlndir.awk >_getlndir.tmp
$! getlndir.ok expects "Is a directory", we see "is a directory"
$ igncascmp getlndir.ok sys$disk:[]_getlndir.tmp
$ if $status then rm _getlndir.tmp;
$ return
$
$rsstart2: echo "rsstart2"
$ gawk -f rsstart2.awk rsstart1.in >_rsstart2.tmp
$ cmp rsstart2.ok sys$disk:[]_rsstart2.tmp
$ if $status then rm _rsstart2.tmp;
$ return
$
$rsstart3:
$ echo "rsstart3"
$! rsstart3 with pipe fails,
$! presumeably due to PIPE's use of print file format
$! if .not.pipeok
$! then echo "Without the PIPE command, ''test' can't be run."
$! On warning then return
$! pipe echo "With PIPE, ''test' will finish quickly."
$! On warning then $
$! pipeok = 1
$! endif
$ ! head rsstart1.in | gawk -f rsstart2.awk >_rsstart3.tmp
$ ! splitting this into two steps would make it the same as rsstart2
$ set noOn
$!$ pipe -
$! gawk -- "FNR <= 10" rsstart1.in | -
$! gawk -f rsstart2.awk >_rsstart3.tmp
$!
$ ! DCL redirection to files is similar to pipes
$ ! But not quite the same.
$ ! DCL pipes are mailboxes, not the same as CRTL pipes,
$ ! So eventually someone should look into why CRTL pipes and
$ ! gawk are not always playing well together.
$ gawk -- "FNR <= 10" rsstart1.in > _'test'.tmp1
$ define/user sys$input _'test'.tmp1
$ gawk -f rsstart2.awk >_rsstart3.tmp
$ set On
$ cmp rsstart3.ok sys$disk:[]_rsstart3.tmp
$ if $status then rm _rsstart3.tmp;, _rsstart3.tmp1;
$ return
$
$rtlen:
$rtlen01:
$rtlenmb:
$ echo "''test'"
$ if .not.pipeok
$ then echo "Without the PIPE command, ''test' can't be run."
$ On warning then return
$ pipe echo "With PIPE, ''test' will finish quickly."
$ On warning then $
$ pipeok = 1
$ endif
$ f = "''test'.ok"
$ if test.eqs."rtlen" .or. test.eqs."rtlenmb"
$ then
$ if test.eqs."rtlenmb" then GAWKLOCALE = "en_US.UTF-8"
$ pipe -
gawk -- "BEGIN {printf ""0\n\n\n1\n\n\n\n\n2\n\n""; exit}" | -
gawk -- "BEGIN {RS=""""}; {print length(RT)}" >_'test'.tmp
$ if test.eqs."rtlenmb" then delet_/Symbol/Local GAWKLOCALE
$ if test.eqs."rtlenmb" then f = "rtlen.ok"
$ else
$ call/Output=_rtlen01.tmp do__rtlen01
$ ! first test yields 1 instead of 0 due to forced newline
$ gawk -- "FNR==1 {sub(""1"",""0"")}; {print}" _rtlen01.tmp >_rtlen01.too
$ rm _rtlen01.tmp;
$ mv _rtlen01.too _rtlen01.tmp
$ endif
$ cmp 'f' sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$do__rtlen01: subroutine
$ gawk = gawk !PIPE won't propagate local symbols from outer procedure
$ pipe -
gawk -- "BEGIN {printf ""0""; exit}" | -
gawk -- "BEGIN {RS=""""}; {print length(RT)}"
$ pipe -
gawk -- "BEGIN {printf ""0\n""; exit}" | -
gawk -- "BEGIN {RS=""""}; {print length(RT)}"
$ pipe -
gawk -- "BEGIN {printf ""0\n\n""; exit}" | -
gawk -- "BEGIN {RS=""""}; {print length(RT)}"
$ endsubroutine !do__rtlen01
$
$nondec2: echo "nondec2"
$ gawk --non-decimal-data -v "a=0x1" -f nondec2.awk >_nondec2.tmp
$ cmp nondec2.ok sys$disk:[]_nondec2.tmp
$ if $status then rm _nondec2.tmp;
$ return
$
$nofile: echo "nofile"
$! gawk "{}" no/such/file >_nofile.tmp 2>&1
$! nofile.ok expects no/such/file, but using that name in the test would
$! yield "file specification syntax error" instead of "no such file..."
$ set noOn
$ gawk "{}" no-such-file >_nofile.tmp 2>&1
$ if .not. $status then call exit_code '$status' _nofile.tmp
$ set On
$! restore altered file name
$ gawk "{gsub(""no-such-file"", ""no/such/file""); print}" _nofile.tmp >_nofile.too
$ rm _nofile.tmp;
$ mv _nofile.too _nofile.tmp
$! nofile.ok expects "No such file ...", we see "no such file ..."
$ igncascmp nofile.ok sys$disk:[]_nofile.tmp
$ if $status then rm _nofile.tmp;
$ return
$
$binmode1: echo "binmode1"
$ gawk -v "BINMODE=3" "BEGIN { print BINMODE }" >_binmode1.tmp
$ cmp binmode1.ok sys$disk:[]_binmode1.tmp
$ if $status then rm _binmode1.tmp;
$ return
$
$subi18n: echo "''test'"
$ define/User GAWKLOCALE "en_US.UTF-8"
$ gawk -f 'test'.awk > _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$rri1:
$concat4: echo "''test'"
$ define/User GAWKLOCALE "en_US.UTF-8"
$ gawk -f 'test'.awk 'test'.in > _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$devfd: echo "devfd: not supported"
$ return
$!!devfd: echo "devfd"
$ gawk 1 /dev/fd/4 /dev/fd/5 4< /devfd.in4 5< devfd.in5 >_devfd.tmp
$ cmp devfd.ok sys$disk:[]_devfd.tmp
$ if $status then rm _devfd.tmp;
$ return
$
$devfd1: echo "devfd1: not supported"
$ return
$!!devfd1: echo "devfd1"
$ gawk -f devfd1.awk 4< devfd.in1 5< devfd.in2 >_devfd1.tmp
$ cmp devfd1.ok sys$disk:[]_devfd1.tmp
$ if $status then rm _devfd1.tmp;
$ return
$
$devfd2: echo "devfd2: not supported"
$ return
$!!devfd2: echo "devfd2"
$! The program text is the '1' which will print each record. How compact can you get?
$ gawk 1 /dev/fd/4 /dev/fd/5 4< /devfd.in1 5< devfd.in2 >_devfd2.tmp
$ cmp devfd2.ok sys$disk:[]_devfd2.tmp
$ if $status then rm _devfd2.tmp;
$ return
$
$charasbytes:
$! This test used "od" on Unix to verify the result. As this is not available
$! we must try as best as possible using DUMP and SEARCH, instead of comparing
$! to charasbytes.ok
$!
$ echo "''test'"
$ gawk -b -f 'test'.awk 'test'.in >_'test'.tmp
$ pipe dump/byte/block=count:1 _charasbytes.tmp | -
search sys$pipe /noout " 00 00 00 00 00 00 00 00 00 00 00 00 0A 5A 5A 5A"
$ if $severity .eq. 1 then rm _'test'.tmp;*
$ return
$
$mixed1: echo "mixed1"
$ set noOn
$ gawk -f /dev/null --source "BEGIN {return junk}" >_mixed1.tmp 2>&1
$ if .not. $status then call exit_code '$status' _mixed1.tmp
$ set On
$ cmp mixed1.ok sys$disk:[]_mixed1.tmp
$ if $status then rm _mixed1.tmp;
$ return
$
$mtchi18n: echo "mtchi18n"
$ define/User GAWKLOCALE "ru_RU.UTF-8"
$ gawk -f mtchi18n.awk mtchi18n.in >_mtchi18n.tmp
$ cmp mtchi18n.ok sys$disk:[]_mtchi18n.tmp
$ if $status then rm _mtchi18n.tmp;
$ return
$
$reint2: echo "reint2"
$ gosub define_gawklocale
$ gawk --re-interval -f reint2.awk reint2.in >_reint2.tmp
$ cmp reint2.ok sys$disk:[]_reint2.tmp
$ if $status then rm _reint2.tmp;
$ return
$
$localenl: echo "localenl skipped"
$ return
$!!localenl: echo "localenl"
$ ! localenl.com does not exist.
$ @localenl.com /Output=_localenl.tmp ! sh ./localenl.sh >tmp.
$ cmp localenl.ok sys$disk:[]_localenl.tmp
$ if $status then rm _localenl.tmp;
$ return
$
$mbprintf1: echo "''test'"
$! Makefile test exports this, but we don't want to impact user's environment
$! @GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE ; \
$! Only always have "utf8-20"
$ gosub define_gawklocale
$ gawk -f mbprintf1.awk mbprintf1.in >_mbprintf1.tmp
$ cmp mbprintf1.ok sys$disk:[]_mbprintf1.tmp
$ if $status then rm _mbprintf1.tmp;
$ return
$
$mbprintf2:
echo "''test'"
$! Makefile test exports this, ...
$! @GAWKLOCALE=ja_JP.UTF-8 ; export GAWKLOCALE ; \
$! Only always have "utf8-20"
$! ja_jp_utf-8 is optional
$ gosub define_gawklocale_ja_jp
$ gawk -f 'test'.awk >_'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$!
$mbprintf3:
$mbprintf4:
echo "''test'"
$! Makefile test exports this
$! @GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE ; \
$! Only always have "utf8-20"
$ gosub define_gawklocale
$ gawk -f 'test'.awk 'test'.in 2>&1 >_'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$!
$!
$mbfw1: echo "mbfw1"
$! Makefile test exports this, ...
$ !define/User GAWKLOCALE "en_US.UTF-8"
$ gosub define_gawklocale
$ gawk -f mbfw1.awk mbfw1.in >_mbfw1.tmp
$ cmp mbfw1.ok sys$disk:[]_mbfw1.tmp
$ if $status then rm _mbfw1.tmp;
$ return
$
$gsubtst6: echo "gsubtst6"
$ define/User GAWKLOCALE "C"
$ gawk -f gsubtst6.awk >_gsubtst6.tmp
$ cmp gsubtst6.ok sys$disk:[]_gsubtst6.tmp
$ if $status then rm _gsubtst6.tmp;
$ return
$
$mbstr1:
$ echo "''test'"
$ gosub define_gawklocale
$ AWKPATH_srcdir
$ gawk -f 'test'.awk 2>&1 >_'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$!
$mbstr2:
$ echo "''test'"
$ gosub define_gawklocale
$ AWKPATH_srcdir
$ gawk -f 'test'.awk < 'test'.in 2>&1 >_'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$!
$printhuge:
$ echo "''test'"
$ gosub define_gawklocale
$ AWKPATH_srcdir
$ gawk -f 'test'.awk 2>&1 >_'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$!
$printfbad2:
$printfbad3:
$printfbad4:
$ echo "''test'"
$ set noOn
$ gawk --lint -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ return
$
$fmtspcl: echo "fmtspcl: not supported"
$ return
$!!fmtspcl:
$! fmtspcl ought to work if gawk was compiled to use IEEE floating point
$ if floatmode.lt.0 then gosub calc_floatmode
$ if floatmode.lt.2
$ then echo "fmtspcl: not supported"
$ else echo "fmtspcl"
$ gawk -f fmtspcl.awk >_fmtspcl.tmp 2>&1
$ cmp fmtspcl.ok sys$disk:[]_fmtspcl.tmp
$ if $status then rm _fmtspcl.tmp;
$ endif
$ return
$
$intformat: echo "intformat"
$! note: we use the Alpha value for D_float; VAX value is slightly higher
$! due to not losing precision by being processed via G_float
$ huge_0 = "1.70141183460469213e+38" ! D_float
$ huge_1 = "8.98846567431157854e+307" ! G_float
$ huge_2 = "1.79769313486231570e+308" ! IEEE T_float
$ if floatmode.lt.0 then gosub calc_floatmode
$ hugeval = huge_'floatmode'
$ set noOn
$ gawk -v "HUGEVAL=''hugeval'" -f intformat.awk >_intformat.tmp 2>&1
$ set On
$ cmp intformat.ok sys$disk:[]_intformat.tmp
$ if $status then rm _intformat.tmp;
$ return
$
$! ugh... BEGINFILE functionality works fine, but test is heavily Unix-centric
$beginfile1: echo "beginfile1"
$ ! complications: "." is a filename, not the current directory
$ ! (even "[]" is actually "[].", that same filename, but we can
$ ! handle hacking it more easily);
$ ! "no/such/file" yields syntax error rather than no such file
$ ! when subdirectories no/ and no/such/ don't exist;
$ ! vms test suite doesn't generate Makefile;
$ ! "is a directory" and "no such file" aren't capitalized
$ ! gawk -f beginfile1.awk beginfile1.awk . -
$ ! ./no/such/file "Makefile" >_beginfile1.tmp 2>&1
$ ! And NFS on ODS2 encodes the case in the filename with
$ ! the $ character switching case.
$ makefile_in = "Makefile.in"
$ makefile_in_nfs_ods2 = "$M$akefile.in"
$ if f$search(makefile_in_nfs_ods2) .nes. ""
$ then
$ makefile_in = makefile_in_nfs_ods2
$ endif
$ gawk -f beginfile1.awk beginfile1.awk [] -
./no-such-file "''makefile_in'" >_beginfile1.tmp 2>&1
$ gawk -f - _beginfile1.tmp >_beginfile1.too
{ if (gsub("\\[\\]",".")) gsub("no such file or directory","is a directory")
gsub("no-such-file","file"); gsub("Makefile.in","Makefile");
gsub("\\$M\\$akefile.in","Makefile"); print }
$ rm _beginfile1.tmp;
$ mv _beginfile1.too _beginfile1.tmp
$ igncascmp beginfile1.ok sys$disk:[]_beginfile1.tmp
$ if $status then rm _beginfile1.tmp;
$ return
$
$dumpvars: echo "dumpvars"
$ gawk --dump-variables 1 <dumpvars.in >_NL: 2>&1
$ mv awkvars.out _dumpvars.tmp
$ gawk "!/ENVIRON|PROCINFO/" _dumpvars.tmp >_dumpvars.tmp1
$ rm sys$disk:[]_dumpvars.tmp;*
$ mv sys$disk:[]_dumpvars.tmp1 sys$disk:[]_dumpvars.tmp
$ cmp dumpvars.ok sys$disk:[]_dumpvars.tmp
$ if $status then rm _dumpvars.tmp;
$ return
$
$!
$profile0:
$ gawk --profile=_ap-'test'.out -f 'test'.awk 'test'.in > _NL:
$ ! sed <awkprof.out 1,2d >_profile3.tmp
$ gawk "NR>2" _ap-'test'.out > sys$disk:[]_awkprof.out
$ convert/fdl=nla0: _awkprof.out sys$disk:[]_'test'.tmp
$ convert/fdl=nla0: 'test'.ok _'test'.ok
$ cmp _'test'.ok sys$disk:[]_'test'.tmp
$ if $status
$ then
$ rm _'test'.tmp;*,_'test'.ok;*,_ap-'test'.out;,_awkprof.out;
$ endif
$ return
$!
$profile1: echo "''test'"
$ ! FIXME: for both gawk invocations which pipe output to SORT,
$ ! two output files get created; the top version has real output
$ ! but there's also an empty lower version.
$ oldout = f$search("_''test'.tmp1")
$ gawk --pretty-print -v "sortcmd=SORT sys$intput: sys$output:" -
-f xref.awk dtdgport.awk > _'test'.tmp1
$ badout = f$search("_''test'.tmp1;-1")
$ if badout.nes."" .and. badout.nes.oldout then rm 'badout'
$ oldout = f$search("_''test'.tmp2")
$ gawk -v "sortcmd=SORT sys$intput: sys$output:" -
-f awkprof.out dtdgport.awk > _'test'.tmp2
$ badout = f$search("_''test'.tmp2;-1")
$ if badout.nes."" .and. badout.nes.oldout then rm 'badout'
$ cmp _'test'.tmp1 sys$disk:[]_'test'.tmp2
$ if $status then rm _'test'.tmp%;,awkprof.out;
$ return
$
$profile2: echo "''test'"
$ gawk --profile -v "sortcmd=SORT sys$input: sys$output:" -
-f xref.awk dtdgport.awk > _NL:
$ ! sed <awkprof.out 1,2d >_profile2.tmp
$ sumslp awkprof.out /update=sys$input: /output=_'test'.tmp
-1,2
/
$ rm awkprof.out;
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;*
$ return
$
$profile4:
$profile5:
$ define/user GAWK_NO_PP_RUN 1
$ gawk --profile -f 'test'.awk > _NL:
$ ! sed <awkprof.out 1,2d >_profile4.tmp
$ gawk "NR>2" awkprof.out > sys$disk:[]_awkprof.out
$ convert/fdl=nla0: _awkprof.out sys$disk:[]_'test'.tmp
$ convert/fdl=nla0: 'test'.ok _'test'.ok
$ cmp _'test'.ok sys$disk:[]_'test'.tmp
$ if $status
$ then
$ rm _'test'.tmp;*,_'test'.ok;*,awkprof.out;,_awkprof.out;
$ endif
$ return
$!
$profile6:
$profile7:
$profile8:
$profile3: echo "''test'"
$ gawk --profile -f 'test'.awk > _NL:
$ ! sed <awkprof.out 1,2d >_profile3.tmp
$ gawk "NR>2" awkprof.out > sys$disk:[]_awkprof.out
$ convert/fdl=nla0: _awkprof.out sys$disk:[]_'test'.tmp
$ convert/fdl=nla0: 'test'.ok _'test'.ok
$ cmp _'test'.ok sys$disk:[]_'test'.tmp
$ if $status
$ then
$ rm _'test'.tmp;*,_'test'.ok;*,awkprof.out;,_awkprof.out;
$ endif
$ return
$
$next: echo "next"
$ set noOn
$ gawk "{next}" _NL: > _next.tmp 2>&1
$ gawk "function f() {next}; {f()}" _NL: >>_next.tmp 2>&1
$ gawk "function f() {next}; BEGIN{f()}" _NL: >>_next.tmp 2>&1
$ gawk "function f() {next}; {f()}; END{f()}" _NL: >>_next.tmp 2>&1
$ gawk "function f() {next}; BEGINFILE{f()}" _NL: >>_next.tmp 2>&1
$ gawk "function f() {next}; {f()}; ENDFILE{f()}" _NL: >>_next.tmp 2>&1
$ set On
$ cmp next.ok sys$disk:[]_next.tmp
$ if $status then rm _next.tmp;
$ return
$
$exit: echo "exit"
$ if .not.pipeok
$ then echo "Without the PIPE command, ''test' can't be run."
$ On warning then return
$ pipe echo "PIPE command is available; running exit test"
$ On warning then $
$ pipeok = 1
$ else echo "PIPE command is available; running exit test"
$ endif
$ set noOn
$ call/Output=_exit.tmp do__exit
$ set On
$ cmp exit.ok sys$disk:[]_exit.tmp
$ if $status then rm _exit.tmp;
$ return
$
$do__exit: subroutine
$ gawk = gawk !PIPE won't propagate local symbols from outer procedure
$ x = "BEGIN{print 1; exit; print 2}; NR>1{print}; END{print 3; exit; print 4}"
$ pipe gawk -- "BEGIN { print ""a\nb"" }" | gawk -- "''x'"
$ echo "-- 1"
$ x = "function f(){exit}; END{print NR;f();print NR}"
$ pipe gawk -- "BEGIN { print ""a\nb"" }" | gawk -- "''x'"
$ echo "-- 2"
$ x = "function f(){exit}; NR>1 {f()}; END{print NR; f();print NR}"
$ pipe gawk -- "BEGIN { print ""a\nb"" }" | gawk -- "''x'"
$ echo "-- 3"
$ x = "function f(){exit}; NR>1 {f()}; END{print NR;print NR}"
$ pipe gawk -- "BEGIN { print ""a\nb"" }" | gawk -- "''x'"
$ echo "-- 4"
$ x = "function f(){exit}; BEGINFILE {f()}; NR>1 {f()}; END{print NR}"
$ pipe gawk -- "BEGIN { print ""a\nb"" }" | gawk -- "''x'"
$ echo "-- 5"
$! Ugh; extra quotes are needed here to end up with """" after "''y'"
$! expansion and finally "" when gawk actually sees its command line.
$ y = "function strip(f) { sub(/.*\//, """""""", f); return f };"
$ x = "BEGINFILE{if(++i==1) exit;}; END{print i, strip(FILENAME)}"
$ gawk "''y'''x'" /dev/null exit.sh
$ echo "-- 6"
$ x = "BEGINFILE{if(++i==1) exit;}; ENDFILE{print i++}; END{print i, strip(FILENAME)}"
$ gawk "''y'''x'" /dev/null exit.sh
$ echo "-- 7"
$ x = "function f(){exit}; BEGINFILE{i++ && f()}; END{print NR,strip(FILENAME)}"
$ gawk "''y'''x'" /dev/null exit.sh
$ echo "-- 8"
$ x = "function f(){exit}; BEGINFILE{i++ && f()}; ENDFILE{print i}; END{print NR,strip(FILENAME)}"
$ gawk "''y'''x'" /dev/null exit.sh
$ echo "-- 9"
$ x = "function f(){exit}; BEGINFILE{i++}; ENDFILE{f(); print i}; END{print NR,strip(FILENAME)}"
$ gawk "''y'''x'" /dev/null exit.sh
$ echo "-- 10"
$ x = "function f(){exit}; BEGINFILE{i++}; ENDFILE{i>1 && f(); print i, strip(FILENAME)}"
$ gawk "''y'''x'" /dev/null exit.sh
$ echo "-- 11"
$ endsubroutine !do__exit
$
$vms_cmd: echo "vms_cmd"
$ if f$search("vms_cmd.ok").eqs.""
$ then create vms_cmd.ok
World!
$ endif
$ gawk /Commands="BEGIN { print ""World!"" }" _NL: /Output=_vms_cmd.tmp
$ cmp vms_cmd.ok sys$disk:[]_vms_cmd.tmp
$ if $status then rm _vms_cmd.tmp;,vms_cmd.ok;*
$ return
$
$vms_io1: echo "vms_io1"
$ if f$search("vms_io1.ok").eqs.""
$ then create vms_io1.ok
Hello
$ endif
$ ! define/User dbg$input sys$command:
$ gawk -f - >_vms_io1.tmp
# prior to 3.0.4, gawk crashed doing any redirection after closing stdin
BEGIN { print "Hello" >"/dev/stdout" }
$ cmp vms_io1.ok sys$disk:[]_vms_io1.tmp
$ if $status then rm _vms_io1.tmp;,vms_io1.ok;*
$ return
$
$vms_io2: echo "vms_io2"
$ if f$search("vms_io2.ok").eqs.""
$ then create vms_io2.ok
xyzzy
$ endif
$ ! VAXCRTL created all files in stream_LF format unless explicitly
$ ! overridden by the program; with DECC$SHR, a new version of an
$ ! existing file inherits the previous version's record format;
$ ! for gawk versions older than 3.1.7, that resulted in
$ ! "can't redirect to `File' (invalid record attributes)"
$ ! when an awk program used >"File" (internally, not on command line)
$ ! and File already existed as a batch log file or PIPE output file
$ create /FDL=sys$input: _vms_io2.vfc
file
organization sequential
record
format VFC ! variable with fixed control area (default size 2 bytes)
carriage_control print
$ set noOn
$ ! define/User dbg$input sys$command:
$ gawk -- "BEGIN { print ""xyzzy"" >""_vms_io2.vfc"" }" >_vms_io2.tmp 2>&1
$ set On
$ cmp _NL: sys$disk:[]_vms_io2.tmp
$ if $status then rm _vms_io2.tmp;
$ cmp vms_io2.ok sys$disk:[]_vms_io2.vfc
$ if $status then rm _vms_io2.vfc;*,vms_io2.ok;*
$ return
$!
$!
$inplace1:
$inplace2:
$ set process/parse=extended ! ODS-5 only
$ echo "''test'"
$ filefunc_file = "[-]gawkapi.o"
$ open/write awkfile _'test'.awk
$ write awkfile "@load ""inplace"""
$! write awkfile "BEGIN {print ""before""}"
$ write awkfile " {gsub(/foo/, ""bar""); print}"
$! write awkfile "END {print ""after""}"
$ close awkfile
$ copy inplace^.1.in _'test'.1
$ copy inplace^.2.in _'test'.2
$ set noOn
$ AWKLIBPATH_dir
$ gawk -f _'test'.awk _'test'.1 <inplace.in >_'test'.1.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.1.tmp
$ AWKLIBPATH_dir
$ gawk -f _'test'.awk _'test'.2 <inplace.in >_'test'.2.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.2.tmp
$ set On
$ cmp 'test'.1.ok sys$disk:[]_'test'.1.tmp
$ if $status then rm _'test'.1.tmp;,_'test'.1;
$ cmp 'test'.2.ok sys$disk:[]_'test'.2.tmp
$ if $status then rm _'test'.2.tmp;,_'test'.2;,_'test'.awk;
$ return
$!
$filefuncs:
$fnmatch:
$functab4:
$ordchr:
$ordchr2:
$revout:
$revtwoway:
$time:
$ echo "''test'"
$ filefunc_file = "[-]gawkapi.o"
$ open/write gapi 'filefunc_file'
$ close gapi
$ set noOn
$ AWKLIBPATH_dir
$ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ if f$search(filefunc_file) .nes. "" then rm 'filefunc_file';*
$ return
$!
$rwarray:
$ echo "''test'"
$ set noOn
$ AWKLIBPATH_dir
$ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ set On
$ cmp orig.out new.out
$ if $status
$ then
$ open/append tout _'test'.tmp
$ write tout "old and new are equal - GOOD"
$ close tout
$ endif
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;,orig.bin;,orig.out;,new.out;
$ return
$!
$readdir:
$fts:
$ echo "''test'"
$ set noOn
$ AWKLIBPATH_dir
$ gawk -f 'test'.awk >_'test'.tmp 2>&1
$ if .not. $status
$ then
$ call exit_code '$status' _'test'.tmp
$ write sys$output _'test'.tmp
$ else
$ if f$search("_''test'.tmp") .nes. "" then rm _'test'.tmp;*
$ if f$search("_''test'.") .nes. "" then rm _'test'.;*
$ endif
$ set On
$ return
$!
$readfile:
$ echo "''test'"
$ if f$search("sys$disk:[-]readfile.exe") .eqs. ""
$ then
$ echo "Readfile extension not currently building on VMS."
$ return
$ else
$ echo "Surprise! Found the readfile extension so attempting test."
$ endif
$ set noOn
$ AWKLIBPATH_dir
$ gawk -l readfile -
"BEGIN {printf-f ""%s"", readfile("Makefile.in")}" >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ cmp Makefile.in sys$disk:[]_'test'.tmp
$ if $status
$ then
$ rm _'test'.tmp;
$ else
$ copy Makefile.in 'test'.ok
$ endif
$ set On
$ return
$!
$readfile2:
$ echo "''test'"
$ if f$search("sys$disk:[-]readfile.exe") .eqs. ""
$ then
$ echo "Readfile extension not currently building on VMS."
$ return
$ else
$ echo "Surprise! Found the readfile extension so attempting test."
$ endif
$ set noOn
$ AWKLIBPATH_dir
$ gawk -f 'test'.awk 'test'.awk >_'test'.tmp 2>&1
$ if .not. $status then call exit_code '$status' _'test'.tmp
$ cmp 'test'.ok sys$disk:[]_'test'.tmp
$ if $status then rm _'test'.tmp;
$ set On
$ return
$
$clean:
$ if f$search("_*.tmp") .nes."" then rm _*.tmp;*
$ if f$search("_*.out") .nes."" then rm _*.out;*
$ if f$search("_*.ok") .nes."" then rm _*.ok;*
$ if f$search("_*.1") .nes."" then rm _*.1;*
$ if f$search("_*.2") .nes."" then rm _*.2;*
$ if f$search("_*.awk") .nes."" then rm _*.awk;*
$ if f$search("_*.too") .nes."" then rm _*.too;*
$ if f$search("awkprofile.out") .nes."" then rm awkprofile.out;*
$ if f$search("out%.") .nes."" then rm out%.;*
$ if f$search("strftime.in").nes."" then rm strftime.in;*
$ if f$search("strftime.ok").nes."" then rm strftime.ok;*
$ if f$search("test%.") .nes."" then rm test%.;*
$ if f$search("seq.") .nes."" then rm seq.;*
$ if f$search("_pid.in") .nes."" then rm _pid.in;*
$ if f$search("[.junk]*.*").nes."" then rm [.junk]*.*;*
$ if f$parse("[.junk]") .nes."" then rm []junk.dir;1
$ if f$search("_vms_io2.vfc") .nes."" then rm _vms_io2.vfc;*
$ return
$
$! try to determine what type of double precision floating point gawk uses
$calc_floatmode:
$ ! this is fragile; it might break if gawk changes overflow handling
$ Set noOn
$ gawk -- "BEGIN {print 10^308}" >_NL: 2>&1
$ if $status
$ then floatmode = 2 ! IEEE T_float
$ else gawk -- "BEGIN {print 10^307}" >_NL: 2>&1
$ if $status
$ then floatmode = 1 ! Alpha/VAX G_float
$ else floatmode = 0 ! VAX D_float
$ endif
$ endif
$ Set On
$ return
$
$! assign temporary value to logical name GAWKLOCALE unless it already has one
$! [ -z "$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8
$define_gawklocale:
$ if f$search("sys$i18n_locale:utf8-50.locale") .nes. ""
$ then
$ define/user LC_ALL "utf8-50"
$ else
$ define/user LC_ALL "utf8-20"
$ endif
$ return
$!
$define_gawklocale_ja_jp:
$! @GAWKLOCALE=ja_JP.UTF-8 ; export GAWKLOCALE ; \
$ if f$search("sys$i18n_locale:ja_jp_utf-8.locale") .nes. ""
$ then
$ define/user LC_ALL "ja_JP_utf-8"
$ else
$ write sys$output "Substituting UTF8-20 for ja_JP.UTF-8"
$ define/user LC_ALL "utf8-20"
$ endif
$ return
$
$! make sure that the specified file's longest-record-length field is set;
$! otherwise DIFF will choke if any record is longer than 512 bytes
$fixup_LRL: subroutine
$ lrl = 0 !VMS V5.5-2 didn't support the LRL argument yet
$ define/user sys$error _NL:
$ define/user sys$output _NL:
$ lrl = f$file_attribute(p1,"LRL")
$ if lrl.eq.0 then lrl = f$file_attribute(p1,"MRS")
$ if lrl.eq.0
$ then convert/fdl=sys$input: 'p1' *.*
file
organization sequential
record
format stream_lf
size 32767
$ if $status .and. p2.eqs."purge" then rm 'p1';-1
$ else cmp _NL: _NL: !deassign/user sys${error,output}
$ endif
$ endsubroutine !fixup_LRL
$
$! add a fake "EXIT CODE" record to the end of the temporary output file
$! to simulate the ``|| echo EXIT CODE $$? >>_$@'' shell script usage
$! Unix code = vms_code & (255 * 2^3) >> 3
$exit_code: subroutine
$ unix_status = (p1 .and. %x7f8) / 8
$ if f$trnlnm("FTMP").nes."" then close/noLog ftmp
$ open/Append ftmp 'p2'
$ write ftmp "EXIT CODE: ",'unix_status'
$ close ftmp
$ endsubroutine !exit_code
$
$!NOTREACHED
$ exit
|