hc
2024-03-22 a0752693d998599af469473b8dc239ef973a012f
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
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
This is libc.info, produced by makeinfo version 5.1 from libc.texinfo.
 
This is ‘The GNU C Library Reference Manual’, for version 2.33 (GNU).
 
   Copyright © 1993–2021 Free Software Foundation, Inc.
 
   Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being “Free Software Needs Free Documentation” and
“GNU Lesser General Public License”, the Front-Cover texts being “A GNU
Manual”, and with the Back-Cover Texts as in (a) below.  A copy of the
license is included in the section entitled "GNU Free Documentation
License".
 
   (a) The FSF’s Back-Cover Text is: “You have the freedom to copy and
modify this GNU manual.  Buying copies from the FSF supports it in
developing GNU and promoting software freedom.”
INFO-DIR-SECTION Software libraries
START-INFO-DIR-ENTRY
* Libc: (libc).                 C library.
END-INFO-DIR-ENTRY
 
INFO-DIR-SECTION GNU C library functions and macros
START-INFO-DIR-ENTRY
* ALTWERASE: (libc)Local Modes.
* ARGP_ERR_UNKNOWN: (libc)Argp Parser Functions.
* ARG_MAX: (libc)General Limits.
* BC_BASE_MAX: (libc)Utility Limits.
* BC_DIM_MAX: (libc)Utility Limits.
* BC_SCALE_MAX: (libc)Utility Limits.
* BC_STRING_MAX: (libc)Utility Limits.
* BRKINT: (libc)Input Modes.
* BUFSIZ: (libc)Controlling Buffering.
* CCTS_OFLOW: (libc)Control Modes.
* CHAR_BIT: (libc)Width of Type.
* CHILD_MAX: (libc)General Limits.
* CIGNORE: (libc)Control Modes.
* CLK_TCK: (libc)Processor Time.
* CLOCAL: (libc)Control Modes.
* CLOCKS_PER_SEC: (libc)CPU Time.
* CLOCK_MONOTONIC: (libc)Getting the Time.
* CLOCK_REALTIME: (libc)Getting the Time.
* COLL_WEIGHTS_MAX: (libc)Utility Limits.
* CPU_CLR: (libc)CPU Affinity.
* CPU_FEATURE_USABLE: (libc)X86.
* CPU_ISSET: (libc)CPU Affinity.
* CPU_SET: (libc)CPU Affinity.
* CPU_SETSIZE: (libc)CPU Affinity.
* CPU_ZERO: (libc)CPU Affinity.
* CREAD: (libc)Control Modes.
* CRTS_IFLOW: (libc)Control Modes.
* CS5: (libc)Control Modes.
* CS6: (libc)Control Modes.
* CS7: (libc)Control Modes.
* CS8: (libc)Control Modes.
* CSIZE: (libc)Control Modes.
* CSTOPB: (libc)Control Modes.
* DTTOIF: (libc)Directory Entries.
* E2BIG: (libc)Error Codes.
* EACCES: (libc)Error Codes.
* EADDRINUSE: (libc)Error Codes.
* EADDRNOTAVAIL: (libc)Error Codes.
* EADV: (libc)Error Codes.
* EAFNOSUPPORT: (libc)Error Codes.
* EAGAIN: (libc)Error Codes.
* EALREADY: (libc)Error Codes.
* EAUTH: (libc)Error Codes.
* EBACKGROUND: (libc)Error Codes.
* EBADE: (libc)Error Codes.
* EBADF: (libc)Error Codes.
* EBADFD: (libc)Error Codes.
* EBADMSG: (libc)Error Codes.
* EBADR: (libc)Error Codes.
* EBADRPC: (libc)Error Codes.
* EBADRQC: (libc)Error Codes.
* EBADSLT: (libc)Error Codes.
* EBFONT: (libc)Error Codes.
* EBUSY: (libc)Error Codes.
* ECANCELED: (libc)Error Codes.
* ECHILD: (libc)Error Codes.
* ECHO: (libc)Local Modes.
* ECHOCTL: (libc)Local Modes.
* ECHOE: (libc)Local Modes.
* ECHOK: (libc)Local Modes.
* ECHOKE: (libc)Local Modes.
* ECHONL: (libc)Local Modes.
* ECHOPRT: (libc)Local Modes.
* ECHRNG: (libc)Error Codes.
* ECOMM: (libc)Error Codes.
* ECONNABORTED: (libc)Error Codes.
* ECONNREFUSED: (libc)Error Codes.
* ECONNRESET: (libc)Error Codes.
* ED: (libc)Error Codes.
* EDEADLK: (libc)Error Codes.
* EDEADLOCK: (libc)Error Codes.
* EDESTADDRREQ: (libc)Error Codes.
* EDIED: (libc)Error Codes.
* EDOM: (libc)Error Codes.
* EDOTDOT: (libc)Error Codes.
* EDQUOT: (libc)Error Codes.
* EEXIST: (libc)Error Codes.
* EFAULT: (libc)Error Codes.
* EFBIG: (libc)Error Codes.
* EFTYPE: (libc)Error Codes.
* EGRATUITOUS: (libc)Error Codes.
* EGREGIOUS: (libc)Error Codes.
* EHOSTDOWN: (libc)Error Codes.
* EHOSTUNREACH: (libc)Error Codes.
* EHWPOISON: (libc)Error Codes.
* EIDRM: (libc)Error Codes.
* EIEIO: (libc)Error Codes.
* EILSEQ: (libc)Error Codes.
* EINPROGRESS: (libc)Error Codes.
* EINTR: (libc)Error Codes.
* EINVAL: (libc)Error Codes.
* EIO: (libc)Error Codes.
* EISCONN: (libc)Error Codes.
* EISDIR: (libc)Error Codes.
* EISNAM: (libc)Error Codes.
* EKEYEXPIRED: (libc)Error Codes.
* EKEYREJECTED: (libc)Error Codes.
* EKEYREVOKED: (libc)Error Codes.
* EL2HLT: (libc)Error Codes.
* EL2NSYNC: (libc)Error Codes.
* EL3HLT: (libc)Error Codes.
* EL3RST: (libc)Error Codes.
* ELIBACC: (libc)Error Codes.
* ELIBBAD: (libc)Error Codes.
* ELIBEXEC: (libc)Error Codes.
* ELIBMAX: (libc)Error Codes.
* ELIBSCN: (libc)Error Codes.
* ELNRNG: (libc)Error Codes.
* ELOOP: (libc)Error Codes.
* EMEDIUMTYPE: (libc)Error Codes.
* EMFILE: (libc)Error Codes.
* EMLINK: (libc)Error Codes.
* EMSGSIZE: (libc)Error Codes.
* EMULTIHOP: (libc)Error Codes.
* ENAMETOOLONG: (libc)Error Codes.
* ENAVAIL: (libc)Error Codes.
* ENEEDAUTH: (libc)Error Codes.
* ENETDOWN: (libc)Error Codes.
* ENETRESET: (libc)Error Codes.
* ENETUNREACH: (libc)Error Codes.
* ENFILE: (libc)Error Codes.
* ENOANO: (libc)Error Codes.
* ENOBUFS: (libc)Error Codes.
* ENOCSI: (libc)Error Codes.
* ENODATA: (libc)Error Codes.
* ENODEV: (libc)Error Codes.
* ENOENT: (libc)Error Codes.
* ENOEXEC: (libc)Error Codes.
* ENOKEY: (libc)Error Codes.
* ENOLCK: (libc)Error Codes.
* ENOLINK: (libc)Error Codes.
* ENOMEDIUM: (libc)Error Codes.
* ENOMEM: (libc)Error Codes.
* ENOMSG: (libc)Error Codes.
* ENONET: (libc)Error Codes.
* ENOPKG: (libc)Error Codes.
* ENOPROTOOPT: (libc)Error Codes.
* ENOSPC: (libc)Error Codes.
* ENOSR: (libc)Error Codes.
* ENOSTR: (libc)Error Codes.
* ENOSYS: (libc)Error Codes.
* ENOTBLK: (libc)Error Codes.
* ENOTCONN: (libc)Error Codes.
* ENOTDIR: (libc)Error Codes.
* ENOTEMPTY: (libc)Error Codes.
* ENOTNAM: (libc)Error Codes.
* ENOTRECOVERABLE: (libc)Error Codes.
* ENOTSOCK: (libc)Error Codes.
* ENOTSUP: (libc)Error Codes.
* ENOTTY: (libc)Error Codes.
* ENOTUNIQ: (libc)Error Codes.
* ENXIO: (libc)Error Codes.
* EOF: (libc)EOF and Errors.
* EOPNOTSUPP: (libc)Error Codes.
* EOVERFLOW: (libc)Error Codes.
* EOWNERDEAD: (libc)Error Codes.
* EPERM: (libc)Error Codes.
* EPFNOSUPPORT: (libc)Error Codes.
* EPIPE: (libc)Error Codes.
* EPROCLIM: (libc)Error Codes.
* EPROCUNAVAIL: (libc)Error Codes.
* EPROGMISMATCH: (libc)Error Codes.
* EPROGUNAVAIL: (libc)Error Codes.
* EPROTO: (libc)Error Codes.
* EPROTONOSUPPORT: (libc)Error Codes.
* EPROTOTYPE: (libc)Error Codes.
* EQUIV_CLASS_MAX: (libc)Utility Limits.
* ERANGE: (libc)Error Codes.
* EREMCHG: (libc)Error Codes.
* EREMOTE: (libc)Error Codes.
* EREMOTEIO: (libc)Error Codes.
* ERESTART: (libc)Error Codes.
* ERFKILL: (libc)Error Codes.
* EROFS: (libc)Error Codes.
* ERPCMISMATCH: (libc)Error Codes.
* ESHUTDOWN: (libc)Error Codes.
* ESOCKTNOSUPPORT: (libc)Error Codes.
* ESPIPE: (libc)Error Codes.
* ESRCH: (libc)Error Codes.
* ESRMNT: (libc)Error Codes.
* ESTALE: (libc)Error Codes.
* ESTRPIPE: (libc)Error Codes.
* ETIME: (libc)Error Codes.
* ETIMEDOUT: (libc)Error Codes.
* ETOOMANYREFS: (libc)Error Codes.
* ETXTBSY: (libc)Error Codes.
* EUCLEAN: (libc)Error Codes.
* EUNATCH: (libc)Error Codes.
* EUSERS: (libc)Error Codes.
* EWOULDBLOCK: (libc)Error Codes.
* EXDEV: (libc)Error Codes.
* EXFULL: (libc)Error Codes.
* EXIT_FAILURE: (libc)Exit Status.
* EXIT_SUCCESS: (libc)Exit Status.
* EXPR_NEST_MAX: (libc)Utility Limits.
* FD_CLOEXEC: (libc)Descriptor Flags.
* FD_CLR: (libc)Waiting for I/O.
* FD_ISSET: (libc)Waiting for I/O.
* FD_SET: (libc)Waiting for I/O.
* FD_SETSIZE: (libc)Waiting for I/O.
* FD_ZERO: (libc)Waiting for I/O.
* FE_SNANS_ALWAYS_SIGNAL: (libc)Infinity and NaN.
* FILENAME_MAX: (libc)Limits for Files.
* FLUSHO: (libc)Local Modes.
* FOPEN_MAX: (libc)Opening Streams.
* FP_ILOGB0: (libc)Exponents and Logarithms.
* FP_ILOGBNAN: (libc)Exponents and Logarithms.
* FP_LLOGB0: (libc)Exponents and Logarithms.
* FP_LLOGBNAN: (libc)Exponents and Logarithms.
* F_DUPFD: (libc)Duplicating Descriptors.
* F_GETFD: (libc)Descriptor Flags.
* F_GETFL: (libc)Getting File Status Flags.
* F_GETLK: (libc)File Locks.
* F_GETOWN: (libc)Interrupt Input.
* F_OFD_GETLK: (libc)Open File Description Locks.
* F_OFD_SETLK: (libc)Open File Description Locks.
* F_OFD_SETLKW: (libc)Open File Description Locks.
* F_OK: (libc)Testing File Access.
* F_SETFD: (libc)Descriptor Flags.
* F_SETFL: (libc)Getting File Status Flags.
* F_SETLK: (libc)File Locks.
* F_SETLKW: (libc)File Locks.
* F_SETOWN: (libc)Interrupt Input.
* HAS_CPU_FEATURE: (libc)X86.
* HUGE_VAL: (libc)Math Error Reporting.
* HUGE_VALF: (libc)Math Error Reporting.
* HUGE_VALL: (libc)Math Error Reporting.
* HUGE_VAL_FN: (libc)Math Error Reporting.
* HUGE_VAL_FNx: (libc)Math Error Reporting.
* HUPCL: (libc)Control Modes.
* I: (libc)Complex Numbers.
* ICANON: (libc)Local Modes.
* ICRNL: (libc)Input Modes.
* IEXTEN: (libc)Local Modes.
* IFNAMSIZ: (libc)Interface Naming.
* IFTODT: (libc)Directory Entries.
* IGNBRK: (libc)Input Modes.
* IGNCR: (libc)Input Modes.
* IGNPAR: (libc)Input Modes.
* IMAXBEL: (libc)Input Modes.
* INADDR_ANY: (libc)Host Address Data Type.
* INADDR_BROADCAST: (libc)Host Address Data Type.
* INADDR_LOOPBACK: (libc)Host Address Data Type.
* INADDR_NONE: (libc)Host Address Data Type.
* INFINITY: (libc)Infinity and NaN.
* INLCR: (libc)Input Modes.
* INPCK: (libc)Input Modes.
* IPPORT_RESERVED: (libc)Ports.
* IPPORT_USERRESERVED: (libc)Ports.
* ISIG: (libc)Local Modes.
* ISTRIP: (libc)Input Modes.
* IXANY: (libc)Input Modes.
* IXOFF: (libc)Input Modes.
* IXON: (libc)Input Modes.
* LINE_MAX: (libc)Utility Limits.
* LINK_MAX: (libc)Limits for Files.
* L_ctermid: (libc)Identifying the Terminal.
* L_cuserid: (libc)Who Logged In.
* L_tmpnam: (libc)Temporary Files.
* MAXNAMLEN: (libc)Limits for Files.
* MAXSYMLINKS: (libc)Symbolic Links.
* MAX_CANON: (libc)Limits for Files.
* MAX_INPUT: (libc)Limits for Files.
* MB_CUR_MAX: (libc)Selecting the Conversion.
* MB_LEN_MAX: (libc)Selecting the Conversion.
* MDMBUF: (libc)Control Modes.
* MSG_DONTROUTE: (libc)Socket Data Options.
* MSG_OOB: (libc)Socket Data Options.
* MSG_PEEK: (libc)Socket Data Options.
* NAME_MAX: (libc)Limits for Files.
* NAN: (libc)Infinity and NaN.
* NCCS: (libc)Mode Data Types.
* NGROUPS_MAX: (libc)General Limits.
* NOFLSH: (libc)Local Modes.
* NOKERNINFO: (libc)Local Modes.
* NSIG: (libc)Standard Signals.
* NULL: (libc)Null Pointer Constant.
* ONLCR: (libc)Output Modes.
* ONOEOT: (libc)Output Modes.
* OPEN_MAX: (libc)General Limits.
* OPOST: (libc)Output Modes.
* OXTABS: (libc)Output Modes.
* O_ACCMODE: (libc)Access Modes.
* O_APPEND: (libc)Operating Modes.
* O_ASYNC: (libc)Operating Modes.
* O_CREAT: (libc)Open-time Flags.
* O_DIRECTORY: (libc)Open-time Flags.
* O_EXCL: (libc)Open-time Flags.
* O_EXEC: (libc)Access Modes.
* O_EXLOCK: (libc)Open-time Flags.
* O_FSYNC: (libc)Operating Modes.
* O_IGNORE_CTTY: (libc)Open-time Flags.
* O_NDELAY: (libc)Operating Modes.
* O_NOATIME: (libc)Operating Modes.
* O_NOCTTY: (libc)Open-time Flags.
* O_NOFOLLOW: (libc)Open-time Flags.
* O_NOLINK: (libc)Open-time Flags.
* O_NONBLOCK: (libc)Open-time Flags.
* O_NONBLOCK: (libc)Operating Modes.
* O_NOTRANS: (libc)Open-time Flags.
* O_PATH: (libc)Access Modes.
* O_RDONLY: (libc)Access Modes.
* O_RDWR: (libc)Access Modes.
* O_READ: (libc)Access Modes.
* O_SHLOCK: (libc)Open-time Flags.
* O_SYNC: (libc)Operating Modes.
* O_TMPFILE: (libc)Open-time Flags.
* O_TRUNC: (libc)Open-time Flags.
* O_WRITE: (libc)Access Modes.
* O_WRONLY: (libc)Access Modes.
* PARENB: (libc)Control Modes.
* PARMRK: (libc)Input Modes.
* PARODD: (libc)Control Modes.
* PATH_MAX: (libc)Limits for Files.
* PA_FLAG_MASK: (libc)Parsing a Template String.
* PENDIN: (libc)Local Modes.
* PF_FILE: (libc)Local Namespace Details.
* PF_INET6: (libc)Internet Namespace.
* PF_INET: (libc)Internet Namespace.
* PF_LOCAL: (libc)Local Namespace Details.
* PF_UNIX: (libc)Local Namespace Details.
* PIPE_BUF: (libc)Limits for Files.
* PTHREAD_ATTR_NO_SIGMASK_NP: (libc)Initial Thread Signal Mask.
* P_tmpdir: (libc)Temporary Files.
* RAND_MAX: (libc)ISO Random.
* RE_DUP_MAX: (libc)General Limits.
* RLIM_INFINITY: (libc)Limits on Resources.
* R_OK: (libc)Testing File Access.
* SA_NOCLDSTOP: (libc)Flags for Sigaction.
* SA_ONSTACK: (libc)Flags for Sigaction.
* SA_RESTART: (libc)Flags for Sigaction.
* SEEK_CUR: (libc)File Positioning.
* SEEK_END: (libc)File Positioning.
* SEEK_SET: (libc)File Positioning.
* SIGABRT: (libc)Program Error Signals.
* SIGALRM: (libc)Alarm Signals.
* SIGBUS: (libc)Program Error Signals.
* SIGCHLD: (libc)Job Control Signals.
* SIGCLD: (libc)Job Control Signals.
* SIGCONT: (libc)Job Control Signals.
* SIGEMT: (libc)Program Error Signals.
* SIGFPE: (libc)Program Error Signals.
* SIGHUP: (libc)Termination Signals.
* SIGILL: (libc)Program Error Signals.
* SIGINFO: (libc)Miscellaneous Signals.
* SIGINT: (libc)Termination Signals.
* SIGIO: (libc)Asynchronous I/O Signals.
* SIGIOT: (libc)Program Error Signals.
* SIGKILL: (libc)Termination Signals.
* SIGLOST: (libc)Operation Error Signals.
* SIGPIPE: (libc)Operation Error Signals.
* SIGPOLL: (libc)Asynchronous I/O Signals.
* SIGPROF: (libc)Alarm Signals.
* SIGQUIT: (libc)Termination Signals.
* SIGSEGV: (libc)Program Error Signals.
* SIGSTOP: (libc)Job Control Signals.
* SIGSYS: (libc)Program Error Signals.
* SIGTERM: (libc)Termination Signals.
* SIGTRAP: (libc)Program Error Signals.
* SIGTSTP: (libc)Job Control Signals.
* SIGTTIN: (libc)Job Control Signals.
* SIGTTOU: (libc)Job Control Signals.
* SIGURG: (libc)Asynchronous I/O Signals.
* SIGUSR1: (libc)Miscellaneous Signals.
* SIGUSR2: (libc)Miscellaneous Signals.
* SIGVTALRM: (libc)Alarm Signals.
* SIGWINCH: (libc)Miscellaneous Signals.
* SIGXCPU: (libc)Operation Error Signals.
* SIGXFSZ: (libc)Operation Error Signals.
* SIG_ERR: (libc)Basic Signal Handling.
* SNAN: (libc)Infinity and NaN.
* SNANF: (libc)Infinity and NaN.
* SNANFN: (libc)Infinity and NaN.
* SNANFNx: (libc)Infinity and NaN.
* SNANL: (libc)Infinity and NaN.
* SOCK_DGRAM: (libc)Communication Styles.
* SOCK_RAW: (libc)Communication Styles.
* SOCK_RDM: (libc)Communication Styles.
* SOCK_SEQPACKET: (libc)Communication Styles.
* SOCK_STREAM: (libc)Communication Styles.
* SOL_SOCKET: (libc)Socket-Level Options.
* SSIZE_MAX: (libc)General Limits.
* STREAM_MAX: (libc)General Limits.
* SUN_LEN: (libc)Local Namespace Details.
* S_IFMT: (libc)Testing File Type.
* S_ISBLK: (libc)Testing File Type.
* S_ISCHR: (libc)Testing File Type.
* S_ISDIR: (libc)Testing File Type.
* S_ISFIFO: (libc)Testing File Type.
* S_ISLNK: (libc)Testing File Type.
* S_ISREG: (libc)Testing File Type.
* S_ISSOCK: (libc)Testing File Type.
* S_TYPEISMQ: (libc)Testing File Type.
* S_TYPEISSEM: (libc)Testing File Type.
* S_TYPEISSHM: (libc)Testing File Type.
* TMP_MAX: (libc)Temporary Files.
* TOSTOP: (libc)Local Modes.
* TZNAME_MAX: (libc)General Limits.
* VDISCARD: (libc)Other Special.
* VDSUSP: (libc)Signal Characters.
* VEOF: (libc)Editing Characters.
* VEOL2: (libc)Editing Characters.
* VEOL: (libc)Editing Characters.
* VERASE: (libc)Editing Characters.
* VINTR: (libc)Signal Characters.
* VKILL: (libc)Editing Characters.
* VLNEXT: (libc)Other Special.
* VMIN: (libc)Noncanonical Input.
* VQUIT: (libc)Signal Characters.
* VREPRINT: (libc)Editing Characters.
* VSTART: (libc)Start/Stop Characters.
* VSTATUS: (libc)Other Special.
* VSTOP: (libc)Start/Stop Characters.
* VSUSP: (libc)Signal Characters.
* VTIME: (libc)Noncanonical Input.
* VWERASE: (libc)Editing Characters.
* WCHAR_MAX: (libc)Extended Char Intro.
* WCHAR_MIN: (libc)Extended Char Intro.
* WCOREDUMP: (libc)Process Completion Status.
* WEOF: (libc)EOF and Errors.
* WEOF: (libc)Extended Char Intro.
* WEXITSTATUS: (libc)Process Completion Status.
* WIFEXITED: (libc)Process Completion Status.
* WIFSIGNALED: (libc)Process Completion Status.
* WIFSTOPPED: (libc)Process Completion Status.
* WSTOPSIG: (libc)Process Completion Status.
* WTERMSIG: (libc)Process Completion Status.
* W_OK: (libc)Testing File Access.
* X_OK: (libc)Testing File Access.
* _Complex_I: (libc)Complex Numbers.
* _Exit: (libc)Termination Internals.
* _IOFBF: (libc)Controlling Buffering.
* _IOLBF: (libc)Controlling Buffering.
* _IONBF: (libc)Controlling Buffering.
* _Imaginary_I: (libc)Complex Numbers.
* _PATH_UTMP: (libc)Manipulating the Database.
* _PATH_WTMP: (libc)Manipulating the Database.
* _POSIX2_C_DEV: (libc)System Options.
* _POSIX2_C_VERSION: (libc)Version Supported.
* _POSIX2_FORT_DEV: (libc)System Options.
* _POSIX2_FORT_RUN: (libc)System Options.
* _POSIX2_LOCALEDEF: (libc)System Options.
* _POSIX2_SW_DEV: (libc)System Options.
* _POSIX_CHOWN_RESTRICTED: (libc)Options for Files.
* _POSIX_JOB_CONTROL: (libc)System Options.
* _POSIX_NO_TRUNC: (libc)Options for Files.
* _POSIX_SAVED_IDS: (libc)System Options.
* _POSIX_VDISABLE: (libc)Options for Files.
* _POSIX_VERSION: (libc)Version Supported.
* __fbufsize: (libc)Controlling Buffering.
* __flbf: (libc)Controlling Buffering.
* __fpending: (libc)Controlling Buffering.
* __fpurge: (libc)Flushing Buffers.
* __freadable: (libc)Opening Streams.
* __freading: (libc)Opening Streams.
* __fsetlocking: (libc)Streams and Threads.
* __fwritable: (libc)Opening Streams.
* __fwriting: (libc)Opening Streams.
* __gconv_end_fct: (libc)glibc iconv Implementation.
* __gconv_fct: (libc)glibc iconv Implementation.
* __gconv_init_fct: (libc)glibc iconv Implementation.
* __ppc_get_timebase: (libc)PowerPC.
* __ppc_get_timebase_freq: (libc)PowerPC.
* __ppc_mdoio: (libc)PowerPC.
* __ppc_mdoom: (libc)PowerPC.
* __ppc_set_ppr_low: (libc)PowerPC.
* __ppc_set_ppr_med: (libc)PowerPC.
* __ppc_set_ppr_med_high: (libc)PowerPC.
* __ppc_set_ppr_med_low: (libc)PowerPC.
* __ppc_set_ppr_very_low: (libc)PowerPC.
* __ppc_yield: (libc)PowerPC.
* __riscv_flush_icache: (libc)RISC-V.
* __va_copy: (libc)Argument Macros.
* __x86_get_cpuid_feature_leaf: (libc)X86.
* _exit: (libc)Termination Internals.
* _flushlbf: (libc)Flushing Buffers.
* _tolower: (libc)Case Conversion.
* _toupper: (libc)Case Conversion.
* a64l: (libc)Encode Binary Data.
* abort: (libc)Aborting a Program.
* abs: (libc)Absolute Value.
* accept: (libc)Accepting Connections.
* access: (libc)Testing File Access.
* acos: (libc)Inverse Trig Functions.
* acosf: (libc)Inverse Trig Functions.
* acosfN: (libc)Inverse Trig Functions.
* acosfNx: (libc)Inverse Trig Functions.
* acosh: (libc)Hyperbolic Functions.
* acoshf: (libc)Hyperbolic Functions.
* acoshfN: (libc)Hyperbolic Functions.
* acoshfNx: (libc)Hyperbolic Functions.
* acoshl: (libc)Hyperbolic Functions.
* acosl: (libc)Inverse Trig Functions.
* addmntent: (libc)mtab.
* addseverity: (libc)Adding Severity Classes.
* adjtime: (libc)Setting and Adjusting the Time.
* adjtimex: (libc)Setting and Adjusting the Time.
* aio_cancel64: (libc)Cancel AIO Operations.
* aio_cancel: (libc)Cancel AIO Operations.
* aio_error64: (libc)Status of AIO Operations.
* aio_error: (libc)Status of AIO Operations.
* aio_fsync64: (libc)Synchronizing AIO Operations.
* aio_fsync: (libc)Synchronizing AIO Operations.
* aio_init: (libc)Configuration of AIO.
* aio_read64: (libc)Asynchronous Reads/Writes.
* aio_read: (libc)Asynchronous Reads/Writes.
* aio_return64: (libc)Status of AIO Operations.
* aio_return: (libc)Status of AIO Operations.
* aio_suspend64: (libc)Synchronizing AIO Operations.
* aio_suspend: (libc)Synchronizing AIO Operations.
* aio_write64: (libc)Asynchronous Reads/Writes.
* aio_write: (libc)Asynchronous Reads/Writes.
* alarm: (libc)Setting an Alarm.
* aligned_alloc: (libc)Aligned Memory Blocks.
* alloca: (libc)Variable Size Automatic.
* alphasort64: (libc)Scanning Directory Content.
* alphasort: (libc)Scanning Directory Content.
* argp_error: (libc)Argp Helper Functions.
* argp_failure: (libc)Argp Helper Functions.
* argp_help: (libc)Argp Help.
* argp_parse: (libc)Argp.
* argp_state_help: (libc)Argp Helper Functions.
* argp_usage: (libc)Argp Helper Functions.
* argz_add: (libc)Argz Functions.
* argz_add_sep: (libc)Argz Functions.
* argz_append: (libc)Argz Functions.
* argz_count: (libc)Argz Functions.
* argz_create: (libc)Argz Functions.
* argz_create_sep: (libc)Argz Functions.
* argz_delete: (libc)Argz Functions.
* argz_extract: (libc)Argz Functions.
* argz_insert: (libc)Argz Functions.
* argz_next: (libc)Argz Functions.
* argz_replace: (libc)Argz Functions.
* argz_stringify: (libc)Argz Functions.
* asctime: (libc)Formatting Calendar Time.
* asctime_r: (libc)Formatting Calendar Time.
* asin: (libc)Inverse Trig Functions.
* asinf: (libc)Inverse Trig Functions.
* asinfN: (libc)Inverse Trig Functions.
* asinfNx: (libc)Inverse Trig Functions.
* asinh: (libc)Hyperbolic Functions.
* asinhf: (libc)Hyperbolic Functions.
* asinhfN: (libc)Hyperbolic Functions.
* asinhfNx: (libc)Hyperbolic Functions.
* asinhl: (libc)Hyperbolic Functions.
* asinl: (libc)Inverse Trig Functions.
* asprintf: (libc)Dynamic Output.
* assert: (libc)Consistency Checking.
* assert_perror: (libc)Consistency Checking.
* atan2: (libc)Inverse Trig Functions.
* atan2f: (libc)Inverse Trig Functions.
* atan2fN: (libc)Inverse Trig Functions.
* atan2fNx: (libc)Inverse Trig Functions.
* atan2l: (libc)Inverse Trig Functions.
* atan: (libc)Inverse Trig Functions.
* atanf: (libc)Inverse Trig Functions.
* atanfN: (libc)Inverse Trig Functions.
* atanfNx: (libc)Inverse Trig Functions.
* atanh: (libc)Hyperbolic Functions.
* atanhf: (libc)Hyperbolic Functions.
* atanhfN: (libc)Hyperbolic Functions.
* atanhfNx: (libc)Hyperbolic Functions.
* atanhl: (libc)Hyperbolic Functions.
* atanl: (libc)Inverse Trig Functions.
* atexit: (libc)Cleanups on Exit.
* atof: (libc)Parsing of Floats.
* atoi: (libc)Parsing of Integers.
* atol: (libc)Parsing of Integers.
* atoll: (libc)Parsing of Integers.
* backtrace: (libc)Backtraces.
* backtrace_symbols: (libc)Backtraces.
* backtrace_symbols_fd: (libc)Backtraces.
* basename: (libc)Finding Tokens in a String.
* basename: (libc)Finding Tokens in a String.
* bcmp: (libc)String/Array Comparison.
* bcopy: (libc)Copying Strings and Arrays.
* bind: (libc)Setting Address.
* bind_textdomain_codeset: (libc)Charset conversion in gettext.
* bindtextdomain: (libc)Locating gettext catalog.
* brk: (libc)Resizing the Data Segment.
* bsearch: (libc)Array Search Function.
* btowc: (libc)Converting a Character.
* bzero: (libc)Copying Strings and Arrays.
* cabs: (libc)Absolute Value.
* cabsf: (libc)Absolute Value.
* cabsfN: (libc)Absolute Value.
* cabsfNx: (libc)Absolute Value.
* cabsl: (libc)Absolute Value.
* cacos: (libc)Inverse Trig Functions.
* cacosf: (libc)Inverse Trig Functions.
* cacosfN: (libc)Inverse Trig Functions.
* cacosfNx: (libc)Inverse Trig Functions.
* cacosh: (libc)Hyperbolic Functions.
* cacoshf: (libc)Hyperbolic Functions.
* cacoshfN: (libc)Hyperbolic Functions.
* cacoshfNx: (libc)Hyperbolic Functions.
* cacoshl: (libc)Hyperbolic Functions.
* cacosl: (libc)Inverse Trig Functions.
* call_once: (libc)Call Once.
* calloc: (libc)Allocating Cleared Space.
* canonicalize: (libc)FP Bit Twiddling.
* canonicalize_file_name: (libc)Symbolic Links.
* canonicalizef: (libc)FP Bit Twiddling.
* canonicalizefN: (libc)FP Bit Twiddling.
* canonicalizefNx: (libc)FP Bit Twiddling.
* canonicalizel: (libc)FP Bit Twiddling.
* carg: (libc)Operations on Complex.
* cargf: (libc)Operations on Complex.
* cargfN: (libc)Operations on Complex.
* cargfNx: (libc)Operations on Complex.
* cargl: (libc)Operations on Complex.
* casin: (libc)Inverse Trig Functions.
* casinf: (libc)Inverse Trig Functions.
* casinfN: (libc)Inverse Trig Functions.
* casinfNx: (libc)Inverse Trig Functions.
* casinh: (libc)Hyperbolic Functions.
* casinhf: (libc)Hyperbolic Functions.
* casinhfN: (libc)Hyperbolic Functions.
* casinhfNx: (libc)Hyperbolic Functions.
* casinhl: (libc)Hyperbolic Functions.
* casinl: (libc)Inverse Trig Functions.
* catan: (libc)Inverse Trig Functions.
* catanf: (libc)Inverse Trig Functions.
* catanfN: (libc)Inverse Trig Functions.
* catanfNx: (libc)Inverse Trig Functions.
* catanh: (libc)Hyperbolic Functions.
* catanhf: (libc)Hyperbolic Functions.
* catanhfN: (libc)Hyperbolic Functions.
* catanhfNx: (libc)Hyperbolic Functions.
* catanhl: (libc)Hyperbolic Functions.
* catanl: (libc)Inverse Trig Functions.
* catclose: (libc)The catgets Functions.
* catgets: (libc)The catgets Functions.
* catopen: (libc)The catgets Functions.
* cbrt: (libc)Exponents and Logarithms.
* cbrtf: (libc)Exponents and Logarithms.
* cbrtfN: (libc)Exponents and Logarithms.
* cbrtfNx: (libc)Exponents and Logarithms.
* cbrtl: (libc)Exponents and Logarithms.
* ccos: (libc)Trig Functions.
* ccosf: (libc)Trig Functions.
* ccosfN: (libc)Trig Functions.
* ccosfNx: (libc)Trig Functions.
* ccosh: (libc)Hyperbolic Functions.
* ccoshf: (libc)Hyperbolic Functions.
* ccoshfN: (libc)Hyperbolic Functions.
* ccoshfNx: (libc)Hyperbolic Functions.
* ccoshl: (libc)Hyperbolic Functions.
* ccosl: (libc)Trig Functions.
* ceil: (libc)Rounding Functions.
* ceilf: (libc)Rounding Functions.
* ceilfN: (libc)Rounding Functions.
* ceilfNx: (libc)Rounding Functions.
* ceill: (libc)Rounding Functions.
* cexp: (libc)Exponents and Logarithms.
* cexpf: (libc)Exponents and Logarithms.
* cexpfN: (libc)Exponents and Logarithms.
* cexpfNx: (libc)Exponents and Logarithms.
* cexpl: (libc)Exponents and Logarithms.
* cfgetispeed: (libc)Line Speed.
* cfgetospeed: (libc)Line Speed.
* cfmakeraw: (libc)Noncanonical Input.
* cfsetispeed: (libc)Line Speed.
* cfsetospeed: (libc)Line Speed.
* cfsetspeed: (libc)Line Speed.
* chdir: (libc)Working Directory.
* chmod: (libc)Setting Permissions.
* chown: (libc)File Owner.
* cimag: (libc)Operations on Complex.
* cimagf: (libc)Operations on Complex.
* cimagfN: (libc)Operations on Complex.
* cimagfNx: (libc)Operations on Complex.
* cimagl: (libc)Operations on Complex.
* clearenv: (libc)Environment Access.
* clearerr: (libc)Error Recovery.
* clearerr_unlocked: (libc)Error Recovery.
* clock: (libc)CPU Time.
* clock_getres: (libc)Getting the Time.
* clock_gettime: (libc)Getting the Time.
* clock_settime: (libc)Setting and Adjusting the Time.
* clog10: (libc)Exponents and Logarithms.
* clog10f: (libc)Exponents and Logarithms.
* clog10fN: (libc)Exponents and Logarithms.
* clog10fNx: (libc)Exponents and Logarithms.
* clog10l: (libc)Exponents and Logarithms.
* clog: (libc)Exponents and Logarithms.
* clogf: (libc)Exponents and Logarithms.
* clogfN: (libc)Exponents and Logarithms.
* clogfNx: (libc)Exponents and Logarithms.
* clogl: (libc)Exponents and Logarithms.
* close: (libc)Opening and Closing Files.
* closedir: (libc)Reading/Closing Directory.
* closelog: (libc)closelog.
* cnd_broadcast: (libc)ISO C Condition Variables.
* cnd_destroy: (libc)ISO C Condition Variables.
* cnd_init: (libc)ISO C Condition Variables.
* cnd_signal: (libc)ISO C Condition Variables.
* cnd_timedwait: (libc)ISO C Condition Variables.
* cnd_wait: (libc)ISO C Condition Variables.
* confstr: (libc)String Parameters.
* conj: (libc)Operations on Complex.
* conjf: (libc)Operations on Complex.
* conjfN: (libc)Operations on Complex.
* conjfNx: (libc)Operations on Complex.
* conjl: (libc)Operations on Complex.
* connect: (libc)Connecting.
* copy_file_range: (libc)Copying File Data.
* copysign: (libc)FP Bit Twiddling.
* copysignf: (libc)FP Bit Twiddling.
* copysignfN: (libc)FP Bit Twiddling.
* copysignfNx: (libc)FP Bit Twiddling.
* copysignl: (libc)FP Bit Twiddling.
* cos: (libc)Trig Functions.
* cosf: (libc)Trig Functions.
* cosfN: (libc)Trig Functions.
* cosfNx: (libc)Trig Functions.
* cosh: (libc)Hyperbolic Functions.
* coshf: (libc)Hyperbolic Functions.
* coshfN: (libc)Hyperbolic Functions.
* coshfNx: (libc)Hyperbolic Functions.
* coshl: (libc)Hyperbolic Functions.
* cosl: (libc)Trig Functions.
* cpow: (libc)Exponents and Logarithms.
* cpowf: (libc)Exponents and Logarithms.
* cpowfN: (libc)Exponents and Logarithms.
* cpowfNx: (libc)Exponents and Logarithms.
* cpowl: (libc)Exponents and Logarithms.
* cproj: (libc)Operations on Complex.
* cprojf: (libc)Operations on Complex.
* cprojfN: (libc)Operations on Complex.
* cprojfNx: (libc)Operations on Complex.
* cprojl: (libc)Operations on Complex.
* creal: (libc)Operations on Complex.
* crealf: (libc)Operations on Complex.
* crealfN: (libc)Operations on Complex.
* crealfNx: (libc)Operations on Complex.
* creall: (libc)Operations on Complex.
* creat64: (libc)Opening and Closing Files.
* creat: (libc)Opening and Closing Files.
* crypt: (libc)Passphrase Storage.
* crypt_r: (libc)Passphrase Storage.
* csin: (libc)Trig Functions.
* csinf: (libc)Trig Functions.
* csinfN: (libc)Trig Functions.
* csinfNx: (libc)Trig Functions.
* csinh: (libc)Hyperbolic Functions.
* csinhf: (libc)Hyperbolic Functions.
* csinhfN: (libc)Hyperbolic Functions.
* csinhfNx: (libc)Hyperbolic Functions.
* csinhl: (libc)Hyperbolic Functions.
* csinl: (libc)Trig Functions.
* csqrt: (libc)Exponents and Logarithms.
* csqrtf: (libc)Exponents and Logarithms.
* csqrtfN: (libc)Exponents and Logarithms.
* csqrtfNx: (libc)Exponents and Logarithms.
* csqrtl: (libc)Exponents and Logarithms.
* ctan: (libc)Trig Functions.
* ctanf: (libc)Trig Functions.
* ctanfN: (libc)Trig Functions.
* ctanfNx: (libc)Trig Functions.
* ctanh: (libc)Hyperbolic Functions.
* ctanhf: (libc)Hyperbolic Functions.
* ctanhfN: (libc)Hyperbolic Functions.
* ctanhfNx: (libc)Hyperbolic Functions.
* ctanhl: (libc)Hyperbolic Functions.
* ctanl: (libc)Trig Functions.
* ctermid: (libc)Identifying the Terminal.
* ctime: (libc)Formatting Calendar Time.
* ctime_r: (libc)Formatting Calendar Time.
* cuserid: (libc)Who Logged In.
* daddl: (libc)Misc FP Arithmetic.
* dcgettext: (libc)Translation with gettext.
* dcngettext: (libc)Advanced gettext functions.
* ddivl: (libc)Misc FP Arithmetic.
* dgettext: (libc)Translation with gettext.
* difftime: (libc)Calculating Elapsed Time.
* dirfd: (libc)Opening a Directory.
* dirname: (libc)Finding Tokens in a String.
* div: (libc)Integer Division.
* dmull: (libc)Misc FP Arithmetic.
* dngettext: (libc)Advanced gettext functions.
* drand48: (libc)SVID Random.
* drand48_r: (libc)SVID Random.
* drem: (libc)Remainder Functions.
* dremf: (libc)Remainder Functions.
* dreml: (libc)Remainder Functions.
* dsubl: (libc)Misc FP Arithmetic.
* dup2: (libc)Duplicating Descriptors.
* dup: (libc)Duplicating Descriptors.
* ecvt: (libc)System V Number Conversion.
* ecvt_r: (libc)System V Number Conversion.
* endfsent: (libc)fstab.
* endgrent: (libc)Scanning All Groups.
* endhostent: (libc)Host Names.
* endmntent: (libc)mtab.
* endnetent: (libc)Networks Database.
* endnetgrent: (libc)Lookup Netgroup.
* endprotoent: (libc)Protocols Database.
* endpwent: (libc)Scanning All Users.
* endservent: (libc)Services Database.
* endutent: (libc)Manipulating the Database.
* endutxent: (libc)XPG Functions.
* envz_add: (libc)Envz Functions.
* envz_entry: (libc)Envz Functions.
* envz_get: (libc)Envz Functions.
* envz_merge: (libc)Envz Functions.
* envz_remove: (libc)Envz Functions.
* envz_strip: (libc)Envz Functions.
* erand48: (libc)SVID Random.
* erand48_r: (libc)SVID Random.
* erf: (libc)Special Functions.
* erfc: (libc)Special Functions.
* erfcf: (libc)Special Functions.
* erfcfN: (libc)Special Functions.
* erfcfNx: (libc)Special Functions.
* erfcl: (libc)Special Functions.
* erff: (libc)Special Functions.
* erffN: (libc)Special Functions.
* erffNx: (libc)Special Functions.
* erfl: (libc)Special Functions.
* err: (libc)Error Messages.
* errno: (libc)Checking for Errors.
* error: (libc)Error Messages.
* error_at_line: (libc)Error Messages.
* errx: (libc)Error Messages.
* execl: (libc)Executing a File.
* execle: (libc)Executing a File.
* execlp: (libc)Executing a File.
* execv: (libc)Executing a File.
* execve: (libc)Executing a File.
* execvp: (libc)Executing a File.
* exit: (libc)Normal Termination.
* exp10: (libc)Exponents and Logarithms.
* exp10f: (libc)Exponents and Logarithms.
* exp10fN: (libc)Exponents and Logarithms.
* exp10fNx: (libc)Exponents and Logarithms.
* exp10l: (libc)Exponents and Logarithms.
* exp2: (libc)Exponents and Logarithms.
* exp2f: (libc)Exponents and Logarithms.
* exp2fN: (libc)Exponents and Logarithms.
* exp2fNx: (libc)Exponents and Logarithms.
* exp2l: (libc)Exponents and Logarithms.
* exp: (libc)Exponents and Logarithms.
* expf: (libc)Exponents and Logarithms.
* expfN: (libc)Exponents and Logarithms.
* expfNx: (libc)Exponents and Logarithms.
* expl: (libc)Exponents and Logarithms.
* explicit_bzero: (libc)Erasing Sensitive Data.
* expm1: (libc)Exponents and Logarithms.
* expm1f: (libc)Exponents and Logarithms.
* expm1fN: (libc)Exponents and Logarithms.
* expm1fNx: (libc)Exponents and Logarithms.
* expm1l: (libc)Exponents and Logarithms.
* fMaddfN: (libc)Misc FP Arithmetic.
* fMaddfNx: (libc)Misc FP Arithmetic.
* fMdivfN: (libc)Misc FP Arithmetic.
* fMdivfNx: (libc)Misc FP Arithmetic.
* fMmulfN: (libc)Misc FP Arithmetic.
* fMmulfNx: (libc)Misc FP Arithmetic.
* fMsubfN: (libc)Misc FP Arithmetic.
* fMsubfNx: (libc)Misc FP Arithmetic.
* fMxaddfN: (libc)Misc FP Arithmetic.
* fMxaddfNx: (libc)Misc FP Arithmetic.
* fMxdivfN: (libc)Misc FP Arithmetic.
* fMxdivfNx: (libc)Misc FP Arithmetic.
* fMxmulfN: (libc)Misc FP Arithmetic.
* fMxmulfNx: (libc)Misc FP Arithmetic.
* fMxsubfN: (libc)Misc FP Arithmetic.
* fMxsubfNx: (libc)Misc FP Arithmetic.
* fabs: (libc)Absolute Value.
* fabsf: (libc)Absolute Value.
* fabsfN: (libc)Absolute Value.
* fabsfNx: (libc)Absolute Value.
* fabsl: (libc)Absolute Value.
* fadd: (libc)Misc FP Arithmetic.
* faddl: (libc)Misc FP Arithmetic.
* fchdir: (libc)Working Directory.
* fchmod: (libc)Setting Permissions.
* fchown: (libc)File Owner.
* fclose: (libc)Closing Streams.
* fcloseall: (libc)Closing Streams.
* fcntl: (libc)Control Operations.
* fcvt: (libc)System V Number Conversion.
* fcvt_r: (libc)System V Number Conversion.
* fdatasync: (libc)Synchronizing I/O.
* fdim: (libc)Misc FP Arithmetic.
* fdimf: (libc)Misc FP Arithmetic.
* fdimfN: (libc)Misc FP Arithmetic.
* fdimfNx: (libc)Misc FP Arithmetic.
* fdiml: (libc)Misc FP Arithmetic.
* fdiv: (libc)Misc FP Arithmetic.
* fdivl: (libc)Misc FP Arithmetic.
* fdopen: (libc)Descriptors and Streams.
* fdopendir: (libc)Opening a Directory.
* feclearexcept: (libc)Status bit operations.
* fedisableexcept: (libc)Control Functions.
* feenableexcept: (libc)Control Functions.
* fegetenv: (libc)Control Functions.
* fegetexcept: (libc)Control Functions.
* fegetexceptflag: (libc)Status bit operations.
* fegetmode: (libc)Control Functions.
* fegetround: (libc)Rounding.
* feholdexcept: (libc)Control Functions.
* feof: (libc)EOF and Errors.
* feof_unlocked: (libc)EOF and Errors.
* feraiseexcept: (libc)Status bit operations.
* ferror: (libc)EOF and Errors.
* ferror_unlocked: (libc)EOF and Errors.
* fesetenv: (libc)Control Functions.
* fesetexcept: (libc)Status bit operations.
* fesetexceptflag: (libc)Status bit operations.
* fesetmode: (libc)Control Functions.
* fesetround: (libc)Rounding.
* fetestexcept: (libc)Status bit operations.
* fetestexceptflag: (libc)Status bit operations.
* feupdateenv: (libc)Control Functions.
* fexecve: (libc)Executing a File.
* fflush: (libc)Flushing Buffers.
* fflush_unlocked: (libc)Flushing Buffers.
* fgetc: (libc)Character Input.
* fgetc_unlocked: (libc)Character Input.
* fgetgrent: (libc)Scanning All Groups.
* fgetgrent_r: (libc)Scanning All Groups.
* fgetpos64: (libc)Portable Positioning.
* fgetpos: (libc)Portable Positioning.
* fgetpwent: (libc)Scanning All Users.
* fgetpwent_r: (libc)Scanning All Users.
* fgets: (libc)Line Input.
* fgets_unlocked: (libc)Line Input.
* fgetwc: (libc)Character Input.
* fgetwc_unlocked: (libc)Character Input.
* fgetws: (libc)Line Input.
* fgetws_unlocked: (libc)Line Input.
* fileno: (libc)Descriptors and Streams.
* fileno_unlocked: (libc)Descriptors and Streams.
* finite: (libc)Floating Point Classes.
* finitef: (libc)Floating Point Classes.
* finitel: (libc)Floating Point Classes.
* flockfile: (libc)Streams and Threads.
* floor: (libc)Rounding Functions.
* floorf: (libc)Rounding Functions.
* floorfN: (libc)Rounding Functions.
* floorfNx: (libc)Rounding Functions.
* floorl: (libc)Rounding Functions.
* fma: (libc)Misc FP Arithmetic.
* fmaf: (libc)Misc FP Arithmetic.
* fmafN: (libc)Misc FP Arithmetic.
* fmafNx: (libc)Misc FP Arithmetic.
* fmal: (libc)Misc FP Arithmetic.
* fmax: (libc)Misc FP Arithmetic.
* fmaxf: (libc)Misc FP Arithmetic.
* fmaxfN: (libc)Misc FP Arithmetic.
* fmaxfNx: (libc)Misc FP Arithmetic.
* fmaxl: (libc)Misc FP Arithmetic.
* fmaxmag: (libc)Misc FP Arithmetic.
* fmaxmagf: (libc)Misc FP Arithmetic.
* fmaxmagfN: (libc)Misc FP Arithmetic.
* fmaxmagfNx: (libc)Misc FP Arithmetic.
* fmaxmagl: (libc)Misc FP Arithmetic.
* fmemopen: (libc)String Streams.
* fmin: (libc)Misc FP Arithmetic.
* fminf: (libc)Misc FP Arithmetic.
* fminfN: (libc)Misc FP Arithmetic.
* fminfNx: (libc)Misc FP Arithmetic.
* fminl: (libc)Misc FP Arithmetic.
* fminmag: (libc)Misc FP Arithmetic.
* fminmagf: (libc)Misc FP Arithmetic.
* fminmagfN: (libc)Misc FP Arithmetic.
* fminmagfNx: (libc)Misc FP Arithmetic.
* fminmagl: (libc)Misc FP Arithmetic.
* fmod: (libc)Remainder Functions.
* fmodf: (libc)Remainder Functions.
* fmodfN: (libc)Remainder Functions.
* fmodfNx: (libc)Remainder Functions.
* fmodl: (libc)Remainder Functions.
* fmtmsg: (libc)Printing Formatted Messages.
* fmul: (libc)Misc FP Arithmetic.
* fmull: (libc)Misc FP Arithmetic.
* fnmatch: (libc)Wildcard Matching.
* fopen64: (libc)Opening Streams.
* fopen: (libc)Opening Streams.
* fopencookie: (libc)Streams and Cookies.
* fork: (libc)Creating a Process.
* forkpty: (libc)Pseudo-Terminal Pairs.
* fpathconf: (libc)Pathconf.
* fpclassify: (libc)Floating Point Classes.
* fprintf: (libc)Formatted Output Functions.
* fputc: (libc)Simple Output.
* fputc_unlocked: (libc)Simple Output.
* fputs: (libc)Simple Output.
* fputs_unlocked: (libc)Simple Output.
* fputwc: (libc)Simple Output.
* fputwc_unlocked: (libc)Simple Output.
* fputws: (libc)Simple Output.
* fputws_unlocked: (libc)Simple Output.
* fread: (libc)Block Input/Output.
* fread_unlocked: (libc)Block Input/Output.
* free: (libc)Freeing after Malloc.
* freopen64: (libc)Opening Streams.
* freopen: (libc)Opening Streams.
* frexp: (libc)Normalization Functions.
* frexpf: (libc)Normalization Functions.
* frexpfN: (libc)Normalization Functions.
* frexpfNx: (libc)Normalization Functions.
* frexpl: (libc)Normalization Functions.
* fromfp: (libc)Rounding Functions.
* fromfpf: (libc)Rounding Functions.
* fromfpfN: (libc)Rounding Functions.
* fromfpfNx: (libc)Rounding Functions.
* fromfpl: (libc)Rounding Functions.
* fromfpx: (libc)Rounding Functions.
* fromfpxf: (libc)Rounding Functions.
* fromfpxfN: (libc)Rounding Functions.
* fromfpxfNx: (libc)Rounding Functions.
* fromfpxl: (libc)Rounding Functions.
* fscanf: (libc)Formatted Input Functions.
* fseek: (libc)File Positioning.
* fseeko64: (libc)File Positioning.
* fseeko: (libc)File Positioning.
* fsetpos64: (libc)Portable Positioning.
* fsetpos: (libc)Portable Positioning.
* fstat64: (libc)Reading Attributes.
* fstat: (libc)Reading Attributes.
* fsub: (libc)Misc FP Arithmetic.
* fsubl: (libc)Misc FP Arithmetic.
* fsync: (libc)Synchronizing I/O.
* ftell: (libc)File Positioning.
* ftello64: (libc)File Positioning.
* ftello: (libc)File Positioning.
* ftruncate64: (libc)File Size.
* ftruncate: (libc)File Size.
* ftrylockfile: (libc)Streams and Threads.
* ftw64: (libc)Working with Directory Trees.
* ftw: (libc)Working with Directory Trees.
* funlockfile: (libc)Streams and Threads.
* futimes: (libc)File Times.
* fwide: (libc)Streams and I18N.
* fwprintf: (libc)Formatted Output Functions.
* fwrite: (libc)Block Input/Output.
* fwrite_unlocked: (libc)Block Input/Output.
* fwscanf: (libc)Formatted Input Functions.
* gamma: (libc)Special Functions.
* gammaf: (libc)Special Functions.
* gammal: (libc)Special Functions.
* gcvt: (libc)System V Number Conversion.
* get_avphys_pages: (libc)Query Memory Parameters.
* get_current_dir_name: (libc)Working Directory.
* get_nprocs: (libc)Processor Resources.
* get_nprocs_conf: (libc)Processor Resources.
* get_phys_pages: (libc)Query Memory Parameters.
* getauxval: (libc)Auxiliary Vector.
* getc: (libc)Character Input.
* getc_unlocked: (libc)Character Input.
* getchar: (libc)Character Input.
* getchar_unlocked: (libc)Character Input.
* getcontext: (libc)System V contexts.
* getcpu: (libc)CPU Affinity.
* getcwd: (libc)Working Directory.
* getdate: (libc)General Time String Parsing.
* getdate_r: (libc)General Time String Parsing.
* getdelim: (libc)Line Input.
* getdents64: (libc)Low-level Directory Access.
* getdomainnname: (libc)Host Identification.
* getegid: (libc)Reading Persona.
* getentropy: (libc)Unpredictable Bytes.
* getenv: (libc)Environment Access.
* geteuid: (libc)Reading Persona.
* getfsent: (libc)fstab.
* getfsfile: (libc)fstab.
* getfsspec: (libc)fstab.
* getgid: (libc)Reading Persona.
* getgrent: (libc)Scanning All Groups.
* getgrent_r: (libc)Scanning All Groups.
* getgrgid: (libc)Lookup Group.
* getgrgid_r: (libc)Lookup Group.
* getgrnam: (libc)Lookup Group.
* getgrnam_r: (libc)Lookup Group.
* getgrouplist: (libc)Setting Groups.
* getgroups: (libc)Reading Persona.
* gethostbyaddr: (libc)Host Names.
* gethostbyaddr_r: (libc)Host Names.
* gethostbyname2: (libc)Host Names.
* gethostbyname2_r: (libc)Host Names.
* gethostbyname: (libc)Host Names.
* gethostbyname_r: (libc)Host Names.
* gethostent: (libc)Host Names.
* gethostid: (libc)Host Identification.
* gethostname: (libc)Host Identification.
* getitimer: (libc)Setting an Alarm.
* getline: (libc)Line Input.
* getloadavg: (libc)Processor Resources.
* getlogin: (libc)Who Logged In.
* getmntent: (libc)mtab.
* getmntent_r: (libc)mtab.
* getnetbyaddr: (libc)Networks Database.
* getnetbyname: (libc)Networks Database.
* getnetent: (libc)Networks Database.
* getnetgrent: (libc)Lookup Netgroup.
* getnetgrent_r: (libc)Lookup Netgroup.
* getopt: (libc)Using Getopt.
* getopt_long: (libc)Getopt Long Options.
* getopt_long_only: (libc)Getopt Long Options.
* getpagesize: (libc)Query Memory Parameters.
* getpass: (libc)getpass.
* getpayload: (libc)FP Bit Twiddling.
* getpayloadf: (libc)FP Bit Twiddling.
* getpayloadfN: (libc)FP Bit Twiddling.
* getpayloadfNx: (libc)FP Bit Twiddling.
* getpayloadl: (libc)FP Bit Twiddling.
* getpeername: (libc)Who is Connected.
* getpgid: (libc)Process Group Functions.
* getpgrp: (libc)Process Group Functions.
* getpid: (libc)Process Identification.
* getppid: (libc)Process Identification.
* getpriority: (libc)Traditional Scheduling Functions.
* getprotobyname: (libc)Protocols Database.
* getprotobynumber: (libc)Protocols Database.
* getprotoent: (libc)Protocols Database.
* getpt: (libc)Allocation.
* getpwent: (libc)Scanning All Users.
* getpwent_r: (libc)Scanning All Users.
* getpwnam: (libc)Lookup User.
* getpwnam_r: (libc)Lookup User.
* getpwuid: (libc)Lookup User.
* getpwuid_r: (libc)Lookup User.
* getrandom: (libc)Unpredictable Bytes.
* getrlimit64: (libc)Limits on Resources.
* getrlimit: (libc)Limits on Resources.
* getrusage: (libc)Resource Usage.
* gets: (libc)Line Input.
* getservbyname: (libc)Services Database.
* getservbyport: (libc)Services Database.
* getservent: (libc)Services Database.
* getsid: (libc)Process Group Functions.
* getsockname: (libc)Reading Address.
* getsockopt: (libc)Socket Option Functions.
* getsubopt: (libc)Suboptions.
* gettext: (libc)Translation with gettext.
* gettid: (libc)Process Identification.
* gettimeofday: (libc)Getting the Time.
* getuid: (libc)Reading Persona.
* getumask: (libc)Setting Permissions.
* getutent: (libc)Manipulating the Database.
* getutent_r: (libc)Manipulating the Database.
* getutid: (libc)Manipulating the Database.
* getutid_r: (libc)Manipulating the Database.
* getutline: (libc)Manipulating the Database.
* getutline_r: (libc)Manipulating the Database.
* getutmp: (libc)XPG Functions.
* getutmpx: (libc)XPG Functions.
* getutxent: (libc)XPG Functions.
* getutxid: (libc)XPG Functions.
* getutxline: (libc)XPG Functions.
* getw: (libc)Character Input.
* getwc: (libc)Character Input.
* getwc_unlocked: (libc)Character Input.
* getwchar: (libc)Character Input.
* getwchar_unlocked: (libc)Character Input.
* getwd: (libc)Working Directory.
* glob64: (libc)Calling Glob.
* glob: (libc)Calling Glob.
* globfree64: (libc)More Flags for Globbing.
* globfree: (libc)More Flags for Globbing.
* gmtime: (libc)Broken-down Time.
* gmtime_r: (libc)Broken-down Time.
* grantpt: (libc)Allocation.
* gsignal: (libc)Signaling Yourself.
* gtty: (libc)BSD Terminal Modes.
* hasmntopt: (libc)mtab.
* hcreate: (libc)Hash Search Function.
* hcreate_r: (libc)Hash Search Function.
* hdestroy: (libc)Hash Search Function.
* hdestroy_r: (libc)Hash Search Function.
* hsearch: (libc)Hash Search Function.
* hsearch_r: (libc)Hash Search Function.
* htonl: (libc)Byte Order.
* htons: (libc)Byte Order.
* hypot: (libc)Exponents and Logarithms.
* hypotf: (libc)Exponents and Logarithms.
* hypotfN: (libc)Exponents and Logarithms.
* hypotfNx: (libc)Exponents and Logarithms.
* hypotl: (libc)Exponents and Logarithms.
* iconv: (libc)Generic Conversion Interface.
* iconv_close: (libc)Generic Conversion Interface.
* iconv_open: (libc)Generic Conversion Interface.
* if_freenameindex: (libc)Interface Naming.
* if_indextoname: (libc)Interface Naming.
* if_nameindex: (libc)Interface Naming.
* if_nametoindex: (libc)Interface Naming.
* ilogb: (libc)Exponents and Logarithms.
* ilogbf: (libc)Exponents and Logarithms.
* ilogbfN: (libc)Exponents and Logarithms.
* ilogbfNx: (libc)Exponents and Logarithms.
* ilogbl: (libc)Exponents and Logarithms.
* imaxabs: (libc)Absolute Value.
* imaxdiv: (libc)Integer Division.
* in6addr_any: (libc)Host Address Data Type.
* in6addr_loopback: (libc)Host Address Data Type.
* index: (libc)Search Functions.
* inet_addr: (libc)Host Address Functions.
* inet_aton: (libc)Host Address Functions.
* inet_lnaof: (libc)Host Address Functions.
* inet_makeaddr: (libc)Host Address Functions.
* inet_netof: (libc)Host Address Functions.
* inet_network: (libc)Host Address Functions.
* inet_ntoa: (libc)Host Address Functions.
* inet_ntop: (libc)Host Address Functions.
* inet_pton: (libc)Host Address Functions.
* initgroups: (libc)Setting Groups.
* initstate: (libc)BSD Random.
* initstate_r: (libc)BSD Random.
* innetgr: (libc)Netgroup Membership.
* ioctl: (libc)IOCTLs.
* isalnum: (libc)Classification of Characters.
* isalpha: (libc)Classification of Characters.
* isascii: (libc)Classification of Characters.
* isatty: (libc)Is It a Terminal.
* isblank: (libc)Classification of Characters.
* iscanonical: (libc)Floating Point Classes.
* iscntrl: (libc)Classification of Characters.
* isdigit: (libc)Classification of Characters.
* iseqsig: (libc)FP Comparison Functions.
* isfinite: (libc)Floating Point Classes.
* isgraph: (libc)Classification of Characters.
* isgreater: (libc)FP Comparison Functions.
* isgreaterequal: (libc)FP Comparison Functions.
* isinf: (libc)Floating Point Classes.
* isinff: (libc)Floating Point Classes.
* isinfl: (libc)Floating Point Classes.
* isless: (libc)FP Comparison Functions.
* islessequal: (libc)FP Comparison Functions.
* islessgreater: (libc)FP Comparison Functions.
* islower: (libc)Classification of Characters.
* isnan: (libc)Floating Point Classes.
* isnan: (libc)Floating Point Classes.
* isnanf: (libc)Floating Point Classes.
* isnanl: (libc)Floating Point Classes.
* isnormal: (libc)Floating Point Classes.
* isprint: (libc)Classification of Characters.
* ispunct: (libc)Classification of Characters.
* issignaling: (libc)Floating Point Classes.
* isspace: (libc)Classification of Characters.
* issubnormal: (libc)Floating Point Classes.
* isunordered: (libc)FP Comparison Functions.
* isupper: (libc)Classification of Characters.
* iswalnum: (libc)Classification of Wide Characters.
* iswalpha: (libc)Classification of Wide Characters.
* iswblank: (libc)Classification of Wide Characters.
* iswcntrl: (libc)Classification of Wide Characters.
* iswctype: (libc)Classification of Wide Characters.
* iswdigit: (libc)Classification of Wide Characters.
* iswgraph: (libc)Classification of Wide Characters.
* iswlower: (libc)Classification of Wide Characters.
* iswprint: (libc)Classification of Wide Characters.
* iswpunct: (libc)Classification of Wide Characters.
* iswspace: (libc)Classification of Wide Characters.
* iswupper: (libc)Classification of Wide Characters.
* iswxdigit: (libc)Classification of Wide Characters.
* isxdigit: (libc)Classification of Characters.
* iszero: (libc)Floating Point Classes.
* j0: (libc)Special Functions.
* j0f: (libc)Special Functions.
* j0fN: (libc)Special Functions.
* j0fNx: (libc)Special Functions.
* j0l: (libc)Special Functions.
* j1: (libc)Special Functions.
* j1f: (libc)Special Functions.
* j1fN: (libc)Special Functions.
* j1fNx: (libc)Special Functions.
* j1l: (libc)Special Functions.
* jn: (libc)Special Functions.
* jnf: (libc)Special Functions.
* jnfN: (libc)Special Functions.
* jnfNx: (libc)Special Functions.
* jnl: (libc)Special Functions.
* jrand48: (libc)SVID Random.
* jrand48_r: (libc)SVID Random.
* kill: (libc)Signaling Another Process.
* killpg: (libc)Signaling Another Process.
* l64a: (libc)Encode Binary Data.
* labs: (libc)Absolute Value.
* lcong48: (libc)SVID Random.
* lcong48_r: (libc)SVID Random.
* ldexp: (libc)Normalization Functions.
* ldexpf: (libc)Normalization Functions.
* ldexpfN: (libc)Normalization Functions.
* ldexpfNx: (libc)Normalization Functions.
* ldexpl: (libc)Normalization Functions.
* ldiv: (libc)Integer Division.
* lfind: (libc)Array Search Function.
* lgamma: (libc)Special Functions.
* lgamma_r: (libc)Special Functions.
* lgammaf: (libc)Special Functions.
* lgammafN: (libc)Special Functions.
* lgammafN_r: (libc)Special Functions.
* lgammafNx: (libc)Special Functions.
* lgammafNx_r: (libc)Special Functions.
* lgammaf_r: (libc)Special Functions.
* lgammal: (libc)Special Functions.
* lgammal_r: (libc)Special Functions.
* link: (libc)Hard Links.
* linkat: (libc)Hard Links.
* lio_listio64: (libc)Asynchronous Reads/Writes.
* lio_listio: (libc)Asynchronous Reads/Writes.
* listen: (libc)Listening.
* llabs: (libc)Absolute Value.
* lldiv: (libc)Integer Division.
* llogb: (libc)Exponents and Logarithms.
* llogbf: (libc)Exponents and Logarithms.
* llogbfN: (libc)Exponents and Logarithms.
* llogbfNx: (libc)Exponents and Logarithms.
* llogbl: (libc)Exponents and Logarithms.
* llrint: (libc)Rounding Functions.
* llrintf: (libc)Rounding Functions.
* llrintfN: (libc)Rounding Functions.
* llrintfNx: (libc)Rounding Functions.
* llrintl: (libc)Rounding Functions.
* llround: (libc)Rounding Functions.
* llroundf: (libc)Rounding Functions.
* llroundfN: (libc)Rounding Functions.
* llroundfNx: (libc)Rounding Functions.
* llroundl: (libc)Rounding Functions.
* localeconv: (libc)The Lame Way to Locale Data.
* localtime: (libc)Broken-down Time.
* localtime_r: (libc)Broken-down Time.
* log10: (libc)Exponents and Logarithms.
* log10f: (libc)Exponents and Logarithms.
* log10fN: (libc)Exponents and Logarithms.
* log10fNx: (libc)Exponents and Logarithms.
* log10l: (libc)Exponents and Logarithms.
* log1p: (libc)Exponents and Logarithms.
* log1pf: (libc)Exponents and Logarithms.
* log1pfN: (libc)Exponents and Logarithms.
* log1pfNx: (libc)Exponents and Logarithms.
* log1pl: (libc)Exponents and Logarithms.
* log2: (libc)Exponents and Logarithms.
* log2f: (libc)Exponents and Logarithms.
* log2fN: (libc)Exponents and Logarithms.
* log2fNx: (libc)Exponents and Logarithms.
* log2l: (libc)Exponents and Logarithms.
* log: (libc)Exponents and Logarithms.
* logb: (libc)Exponents and Logarithms.
* logbf: (libc)Exponents and Logarithms.
* logbfN: (libc)Exponents and Logarithms.
* logbfNx: (libc)Exponents and Logarithms.
* logbl: (libc)Exponents and Logarithms.
* logf: (libc)Exponents and Logarithms.
* logfN: (libc)Exponents and Logarithms.
* logfNx: (libc)Exponents and Logarithms.
* login: (libc)Logging In and Out.
* login_tty: (libc)Logging In and Out.
* logl: (libc)Exponents and Logarithms.
* logout: (libc)Logging In and Out.
* logwtmp: (libc)Logging In and Out.
* longjmp: (libc)Non-Local Details.
* lrand48: (libc)SVID Random.
* lrand48_r: (libc)SVID Random.
* lrint: (libc)Rounding Functions.
* lrintf: (libc)Rounding Functions.
* lrintfN: (libc)Rounding Functions.
* lrintfNx: (libc)Rounding Functions.
* lrintl: (libc)Rounding Functions.
* lround: (libc)Rounding Functions.
* lroundf: (libc)Rounding Functions.
* lroundfN: (libc)Rounding Functions.
* lroundfNx: (libc)Rounding Functions.
* lroundl: (libc)Rounding Functions.
* lsearch: (libc)Array Search Function.
* lseek64: (libc)File Position Primitive.
* lseek: (libc)File Position Primitive.
* lstat64: (libc)Reading Attributes.
* lstat: (libc)Reading Attributes.
* lutimes: (libc)File Times.
* madvise: (libc)Memory-mapped I/O.
* makecontext: (libc)System V contexts.
* mallinfo2: (libc)Statistics of Malloc.
* malloc: (libc)Basic Allocation.
* mallopt: (libc)Malloc Tunable Parameters.
* mblen: (libc)Non-reentrant Character Conversion.
* mbrlen: (libc)Converting a Character.
* mbrtowc: (libc)Converting a Character.
* mbsinit: (libc)Keeping the state.
* mbsnrtowcs: (libc)Converting Strings.
* mbsrtowcs: (libc)Converting Strings.
* mbstowcs: (libc)Non-reentrant String Conversion.
* mbtowc: (libc)Non-reentrant Character Conversion.
* mcheck: (libc)Heap Consistency Checking.
* memalign: (libc)Aligned Memory Blocks.
* memccpy: (libc)Copying Strings and Arrays.
* memchr: (libc)Search Functions.
* memcmp: (libc)String/Array Comparison.
* memcpy: (libc)Copying Strings and Arrays.
* memfd_create: (libc)Memory-mapped I/O.
* memfrob: (libc)Obfuscating Data.
* memmem: (libc)Search Functions.
* memmove: (libc)Copying Strings and Arrays.
* mempcpy: (libc)Copying Strings and Arrays.
* memrchr: (libc)Search Functions.
* memset: (libc)Copying Strings and Arrays.
* mkdir: (libc)Creating Directories.
* mkdtemp: (libc)Temporary Files.
* mkfifo: (libc)FIFO Special Files.
* mknod: (libc)Making Special Files.
* mkstemp: (libc)Temporary Files.
* mktemp: (libc)Temporary Files.
* mktime: (libc)Broken-down Time.
* mlock2: (libc)Page Lock Functions.
* mlock: (libc)Page Lock Functions.
* mlockall: (libc)Page Lock Functions.
* mmap64: (libc)Memory-mapped I/O.
* mmap: (libc)Memory-mapped I/O.
* modf: (libc)Rounding Functions.
* modff: (libc)Rounding Functions.
* modffN: (libc)Rounding Functions.
* modffNx: (libc)Rounding Functions.
* modfl: (libc)Rounding Functions.
* mount: (libc)Mount-Unmount-Remount.
* mprobe: (libc)Heap Consistency Checking.
* mprotect: (libc)Memory Protection.
* mrand48: (libc)SVID Random.
* mrand48_r: (libc)SVID Random.
* mremap: (libc)Memory-mapped I/O.
* msync: (libc)Memory-mapped I/O.
* mtrace: (libc)Tracing malloc.
* mtx_destroy: (libc)ISO C Mutexes.
* mtx_init: (libc)ISO C Mutexes.
* mtx_lock: (libc)ISO C Mutexes.
* mtx_timedlock: (libc)ISO C Mutexes.
* mtx_trylock: (libc)ISO C Mutexes.
* mtx_unlock: (libc)ISO C Mutexes.
* munlock: (libc)Page Lock Functions.
* munlockall: (libc)Page Lock Functions.
* munmap: (libc)Memory-mapped I/O.
* muntrace: (libc)Tracing malloc.
* nan: (libc)FP Bit Twiddling.
* nanf: (libc)FP Bit Twiddling.
* nanfN: (libc)FP Bit Twiddling.
* nanfNx: (libc)FP Bit Twiddling.
* nanl: (libc)FP Bit Twiddling.
* nanosleep: (libc)Sleeping.
* nearbyint: (libc)Rounding Functions.
* nearbyintf: (libc)Rounding Functions.
* nearbyintfN: (libc)Rounding Functions.
* nearbyintfNx: (libc)Rounding Functions.
* nearbyintl: (libc)Rounding Functions.
* nextafter: (libc)FP Bit Twiddling.
* nextafterf: (libc)FP Bit Twiddling.
* nextafterfN: (libc)FP Bit Twiddling.
* nextafterfNx: (libc)FP Bit Twiddling.
* nextafterl: (libc)FP Bit Twiddling.
* nextdown: (libc)FP Bit Twiddling.
* nextdownf: (libc)FP Bit Twiddling.
* nextdownfN: (libc)FP Bit Twiddling.
* nextdownfNx: (libc)FP Bit Twiddling.
* nextdownl: (libc)FP Bit Twiddling.
* nexttoward: (libc)FP Bit Twiddling.
* nexttowardf: (libc)FP Bit Twiddling.
* nexttowardl: (libc)FP Bit Twiddling.
* nextup: (libc)FP Bit Twiddling.
* nextupf: (libc)FP Bit Twiddling.
* nextupfN: (libc)FP Bit Twiddling.
* nextupfNx: (libc)FP Bit Twiddling.
* nextupl: (libc)FP Bit Twiddling.
* nftw64: (libc)Working with Directory Trees.
* nftw: (libc)Working with Directory Trees.
* ngettext: (libc)Advanced gettext functions.
* nice: (libc)Traditional Scheduling Functions.
* nl_langinfo: (libc)The Elegant and Fast Way.
* nrand48: (libc)SVID Random.
* nrand48_r: (libc)SVID Random.
* ntohl: (libc)Byte Order.
* ntohs: (libc)Byte Order.
* ntp_adjtime: (libc)Setting and Adjusting the Time.
* ntp_gettime: (libc)Setting and Adjusting the Time.
* obstack_1grow: (libc)Growing Objects.
* obstack_1grow_fast: (libc)Extra Fast Growing.
* obstack_alignment_mask: (libc)Obstacks Data Alignment.
* obstack_alloc: (libc)Allocation in an Obstack.
* obstack_base: (libc)Status of an Obstack.
* obstack_blank: (libc)Growing Objects.
* obstack_blank_fast: (libc)Extra Fast Growing.
* obstack_chunk_size: (libc)Obstack Chunks.
* obstack_copy0: (libc)Allocation in an Obstack.
* obstack_copy: (libc)Allocation in an Obstack.
* obstack_finish: (libc)Growing Objects.
* obstack_free: (libc)Freeing Obstack Objects.
* obstack_grow0: (libc)Growing Objects.
* obstack_grow: (libc)Growing Objects.
* obstack_init: (libc)Preparing for Obstacks.
* obstack_int_grow: (libc)Growing Objects.
* obstack_int_grow_fast: (libc)Extra Fast Growing.
* obstack_next_free: (libc)Status of an Obstack.
* obstack_object_size: (libc)Growing Objects.
* obstack_object_size: (libc)Status of an Obstack.
* obstack_printf: (libc)Dynamic Output.
* obstack_ptr_grow: (libc)Growing Objects.
* obstack_ptr_grow_fast: (libc)Extra Fast Growing.
* obstack_room: (libc)Extra Fast Growing.
* obstack_vprintf: (libc)Variable Arguments Output.
* offsetof: (libc)Structure Measurement.
* on_exit: (libc)Cleanups on Exit.
* open64: (libc)Opening and Closing Files.
* open: (libc)Opening and Closing Files.
* open_memstream: (libc)String Streams.
* opendir: (libc)Opening a Directory.
* openlog: (libc)openlog.
* openpty: (libc)Pseudo-Terminal Pairs.
* parse_printf_format: (libc)Parsing a Template String.
* pathconf: (libc)Pathconf.
* pause: (libc)Using Pause.
* pclose: (libc)Pipe to a Subprocess.
* perror: (libc)Error Messages.
* pipe: (libc)Creating a Pipe.
* pkey_alloc: (libc)Memory Protection.
* pkey_free: (libc)Memory Protection.
* pkey_get: (libc)Memory Protection.
* pkey_mprotect: (libc)Memory Protection.
* pkey_set: (libc)Memory Protection.
* popen: (libc)Pipe to a Subprocess.
* posix_fallocate64: (libc)Storage Allocation.
* posix_fallocate: (libc)Storage Allocation.
* posix_memalign: (libc)Aligned Memory Blocks.
* pow: (libc)Exponents and Logarithms.
* powf: (libc)Exponents and Logarithms.
* powfN: (libc)Exponents and Logarithms.
* powfNx: (libc)Exponents and Logarithms.
* powl: (libc)Exponents and Logarithms.
* pread64: (libc)I/O Primitives.
* pread: (libc)I/O Primitives.
* preadv2: (libc)Scatter-Gather.
* preadv64: (libc)Scatter-Gather.
* preadv64v2: (libc)Scatter-Gather.
* preadv: (libc)Scatter-Gather.
* printf: (libc)Formatted Output Functions.
* printf_size: (libc)Predefined Printf Handlers.
* printf_size_info: (libc)Predefined Printf Handlers.
* psignal: (libc)Signal Messages.
* pthread_attr_getsigmask_np: (libc)Initial Thread Signal Mask.
* pthread_attr_setsigmask_np: (libc)Initial Thread Signal Mask.
* pthread_clockjoin_np: (libc)Waiting with Explicit Clocks.
* pthread_cond_clockwait: (libc)Waiting with Explicit Clocks.
* pthread_getattr_default_np: (libc)Default Thread Attributes.
* pthread_getspecific: (libc)Thread-specific Data.
* pthread_key_create: (libc)Thread-specific Data.
* pthread_key_delete: (libc)Thread-specific Data.
* pthread_rwlock_clockrdlock: (libc)Waiting with Explicit Clocks.
* pthread_rwlock_clockwrlock: (libc)Waiting with Explicit Clocks.
* pthread_setattr_default_np: (libc)Default Thread Attributes.
* pthread_setspecific: (libc)Thread-specific Data.
* pthread_timedjoin_np: (libc)Waiting with Explicit Clocks.
* pthread_tryjoin_np: (libc)Waiting with Explicit Clocks.
* ptsname: (libc)Allocation.
* ptsname_r: (libc)Allocation.
* putc: (libc)Simple Output.
* putc_unlocked: (libc)Simple Output.
* putchar: (libc)Simple Output.
* putchar_unlocked: (libc)Simple Output.
* putenv: (libc)Environment Access.
* putpwent: (libc)Writing a User Entry.
* puts: (libc)Simple Output.
* pututline: (libc)Manipulating the Database.
* pututxline: (libc)XPG Functions.
* putw: (libc)Simple Output.
* putwc: (libc)Simple Output.
* putwc_unlocked: (libc)Simple Output.
* putwchar: (libc)Simple Output.
* putwchar_unlocked: (libc)Simple Output.
* pwrite64: (libc)I/O Primitives.
* pwrite: (libc)I/O Primitives.
* pwritev2: (libc)Scatter-Gather.
* pwritev64: (libc)Scatter-Gather.
* pwritev64v2: (libc)Scatter-Gather.
* pwritev: (libc)Scatter-Gather.
* qecvt: (libc)System V Number Conversion.
* qecvt_r: (libc)System V Number Conversion.
* qfcvt: (libc)System V Number Conversion.
* qfcvt_r: (libc)System V Number Conversion.
* qgcvt: (libc)System V Number Conversion.
* qsort: (libc)Array Sort Function.
* raise: (libc)Signaling Yourself.
* rand: (libc)ISO Random.
* rand_r: (libc)ISO Random.
* random: (libc)BSD Random.
* random_r: (libc)BSD Random.
* rawmemchr: (libc)Search Functions.
* read: (libc)I/O Primitives.
* readdir64: (libc)Reading/Closing Directory.
* readdir64_r: (libc)Reading/Closing Directory.
* readdir: (libc)Reading/Closing Directory.
* readdir_r: (libc)Reading/Closing Directory.
* readlink: (libc)Symbolic Links.
* readv: (libc)Scatter-Gather.
* realloc: (libc)Changing Block Size.
* reallocarray: (libc)Changing Block Size.
* realpath: (libc)Symbolic Links.
* recv: (libc)Receiving Data.
* recvfrom: (libc)Receiving Datagrams.
* recvmsg: (libc)Receiving Datagrams.
* regcomp: (libc)POSIX Regexp Compilation.
* regerror: (libc)Regexp Cleanup.
* regexec: (libc)Matching POSIX Regexps.
* regfree: (libc)Regexp Cleanup.
* register_printf_function: (libc)Registering New Conversions.
* remainder: (libc)Remainder Functions.
* remainderf: (libc)Remainder Functions.
* remainderfN: (libc)Remainder Functions.
* remainderfNx: (libc)Remainder Functions.
* remainderl: (libc)Remainder Functions.
* remove: (libc)Deleting Files.
* rename: (libc)Renaming Files.
* rewind: (libc)File Positioning.
* rewinddir: (libc)Random Access Directory.
* rindex: (libc)Search Functions.
* rint: (libc)Rounding Functions.
* rintf: (libc)Rounding Functions.
* rintfN: (libc)Rounding Functions.
* rintfNx: (libc)Rounding Functions.
* rintl: (libc)Rounding Functions.
* rmdir: (libc)Deleting Files.
* round: (libc)Rounding Functions.
* roundeven: (libc)Rounding Functions.
* roundevenf: (libc)Rounding Functions.
* roundevenfN: (libc)Rounding Functions.
* roundevenfNx: (libc)Rounding Functions.
* roundevenl: (libc)Rounding Functions.
* roundf: (libc)Rounding Functions.
* roundfN: (libc)Rounding Functions.
* roundfNx: (libc)Rounding Functions.
* roundl: (libc)Rounding Functions.
* rpmatch: (libc)Yes-or-No Questions.
* sbrk: (libc)Resizing the Data Segment.
* scalb: (libc)Normalization Functions.
* scalbf: (libc)Normalization Functions.
* scalbl: (libc)Normalization Functions.
* scalbln: (libc)Normalization Functions.
* scalblnf: (libc)Normalization Functions.
* scalblnfN: (libc)Normalization Functions.
* scalblnfNx: (libc)Normalization Functions.
* scalblnl: (libc)Normalization Functions.
* scalbn: (libc)Normalization Functions.
* scalbnf: (libc)Normalization Functions.
* scalbnfN: (libc)Normalization Functions.
* scalbnfNx: (libc)Normalization Functions.
* scalbnl: (libc)Normalization Functions.
* scandir64: (libc)Scanning Directory Content.
* scandir: (libc)Scanning Directory Content.
* scanf: (libc)Formatted Input Functions.
* sched_get_priority_max: (libc)Basic Scheduling Functions.
* sched_get_priority_min: (libc)Basic Scheduling Functions.
* sched_getaffinity: (libc)CPU Affinity.
* sched_getparam: (libc)Basic Scheduling Functions.
* sched_getscheduler: (libc)Basic Scheduling Functions.
* sched_rr_get_interval: (libc)Basic Scheduling Functions.
* sched_setaffinity: (libc)CPU Affinity.
* sched_setparam: (libc)Basic Scheduling Functions.
* sched_setscheduler: (libc)Basic Scheduling Functions.
* sched_yield: (libc)Basic Scheduling Functions.
* secure_getenv: (libc)Environment Access.
* seed48: (libc)SVID Random.
* seed48_r: (libc)SVID Random.
* seekdir: (libc)Random Access Directory.
* select: (libc)Waiting for I/O.
* sem_clockwait: (libc)Waiting with Explicit Clocks.
* sem_close: (libc)Semaphores.
* sem_destroy: (libc)Semaphores.
* sem_getvalue: (libc)Semaphores.
* sem_init: (libc)Semaphores.
* sem_open: (libc)Semaphores.
* sem_post: (libc)Semaphores.
* sem_timedwait: (libc)Semaphores.
* sem_trywait: (libc)Semaphores.
* sem_unlink: (libc)Semaphores.
* sem_wait: (libc)Semaphores.
* semctl: (libc)Semaphores.
* semget: (libc)Semaphores.
* semop: (libc)Semaphores.
* semtimedop: (libc)Semaphores.
* send: (libc)Sending Data.
* sendmsg: (libc)Receiving Datagrams.
* sendto: (libc)Sending Datagrams.
* setbuf: (libc)Controlling Buffering.
* setbuffer: (libc)Controlling Buffering.
* setcontext: (libc)System V contexts.
* setdomainname: (libc)Host Identification.
* setegid: (libc)Setting Groups.
* setenv: (libc)Environment Access.
* seteuid: (libc)Setting User ID.
* setfsent: (libc)fstab.
* setgid: (libc)Setting Groups.
* setgrent: (libc)Scanning All Groups.
* setgroups: (libc)Setting Groups.
* sethostent: (libc)Host Names.
* sethostid: (libc)Host Identification.
* sethostname: (libc)Host Identification.
* setitimer: (libc)Setting an Alarm.
* setjmp: (libc)Non-Local Details.
* setlinebuf: (libc)Controlling Buffering.
* setlocale: (libc)Setting the Locale.
* setlogmask: (libc)setlogmask.
* setmntent: (libc)mtab.
* setnetent: (libc)Networks Database.
* setnetgrent: (libc)Lookup Netgroup.
* setpayload: (libc)FP Bit Twiddling.
* setpayloadf: (libc)FP Bit Twiddling.
* setpayloadfN: (libc)FP Bit Twiddling.
* setpayloadfNx: (libc)FP Bit Twiddling.
* setpayloadl: (libc)FP Bit Twiddling.
* setpayloadsig: (libc)FP Bit Twiddling.
* setpayloadsigf: (libc)FP Bit Twiddling.
* setpayloadsigfN: (libc)FP Bit Twiddling.
* setpayloadsigfNx: (libc)FP Bit Twiddling.
* setpayloadsigl: (libc)FP Bit Twiddling.
* setpgid: (libc)Process Group Functions.
* setpgrp: (libc)Process Group Functions.
* setpriority: (libc)Traditional Scheduling Functions.
* setprotoent: (libc)Protocols Database.
* setpwent: (libc)Scanning All Users.
* setregid: (libc)Setting Groups.
* setreuid: (libc)Setting User ID.
* setrlimit64: (libc)Limits on Resources.
* setrlimit: (libc)Limits on Resources.
* setservent: (libc)Services Database.
* setsid: (libc)Process Group Functions.
* setsockopt: (libc)Socket Option Functions.
* setstate: (libc)BSD Random.
* setstate_r: (libc)BSD Random.
* settimeofday: (libc)Setting and Adjusting the Time.
* setuid: (libc)Setting User ID.
* setutent: (libc)Manipulating the Database.
* setutxent: (libc)XPG Functions.
* setvbuf: (libc)Controlling Buffering.
* shm_open: (libc)Memory-mapped I/O.
* shm_unlink: (libc)Memory-mapped I/O.
* shutdown: (libc)Closing a Socket.
* sigabbrev_np: (libc)Signal Messages.
* sigaction: (libc)Advanced Signal Handling.
* sigaddset: (libc)Signal Sets.
* sigaltstack: (libc)Signal Stack.
* sigblock: (libc)BSD Signal Handling.
* sigdelset: (libc)Signal Sets.
* sigdescr_np: (libc)Signal Messages.
* sigemptyset: (libc)Signal Sets.
* sigfillset: (libc)Signal Sets.
* siginterrupt: (libc)BSD Signal Handling.
* sigismember: (libc)Signal Sets.
* siglongjmp: (libc)Non-Local Exits and Signals.
* sigmask: (libc)BSD Signal Handling.
* signal: (libc)Basic Signal Handling.
* signbit: (libc)FP Bit Twiddling.
* significand: (libc)Normalization Functions.
* significandf: (libc)Normalization Functions.
* significandl: (libc)Normalization Functions.
* sigpause: (libc)BSD Signal Handling.
* sigpending: (libc)Checking for Pending Signals.
* sigprocmask: (libc)Process Signal Mask.
* sigsetjmp: (libc)Non-Local Exits and Signals.
* sigsetmask: (libc)BSD Signal Handling.
* sigstack: (libc)Signal Stack.
* sigsuspend: (libc)Sigsuspend.
* sin: (libc)Trig Functions.
* sincos: (libc)Trig Functions.
* sincosf: (libc)Trig Functions.
* sincosfN: (libc)Trig Functions.
* sincosfNx: (libc)Trig Functions.
* sincosl: (libc)Trig Functions.
* sinf: (libc)Trig Functions.
* sinfN: (libc)Trig Functions.
* sinfNx: (libc)Trig Functions.
* sinh: (libc)Hyperbolic Functions.
* sinhf: (libc)Hyperbolic Functions.
* sinhfN: (libc)Hyperbolic Functions.
* sinhfNx: (libc)Hyperbolic Functions.
* sinhl: (libc)Hyperbolic Functions.
* sinl: (libc)Trig Functions.
* sleep: (libc)Sleeping.
* snprintf: (libc)Formatted Output Functions.
* socket: (libc)Creating a Socket.
* socketpair: (libc)Socket Pairs.
* sprintf: (libc)Formatted Output Functions.
* sqrt: (libc)Exponents and Logarithms.
* sqrtf: (libc)Exponents and Logarithms.
* sqrtfN: (libc)Exponents and Logarithms.
* sqrtfNx: (libc)Exponents and Logarithms.
* sqrtl: (libc)Exponents and Logarithms.
* srand48: (libc)SVID Random.
* srand48_r: (libc)SVID Random.
* srand: (libc)ISO Random.
* srandom: (libc)BSD Random.
* srandom_r: (libc)BSD Random.
* sscanf: (libc)Formatted Input Functions.
* ssignal: (libc)Basic Signal Handling.
* stat64: (libc)Reading Attributes.
* stat: (libc)Reading Attributes.
* stime: (libc)Setting and Adjusting the Time.
* stpcpy: (libc)Copying Strings and Arrays.
* stpncpy: (libc)Truncating Strings.
* strcasecmp: (libc)String/Array Comparison.
* strcasestr: (libc)Search Functions.
* strcat: (libc)Concatenating Strings.
* strchr: (libc)Search Functions.
* strchrnul: (libc)Search Functions.
* strcmp: (libc)String/Array Comparison.
* strcoll: (libc)Collation Functions.
* strcpy: (libc)Copying Strings and Arrays.
* strcspn: (libc)Search Functions.
* strdup: (libc)Copying Strings and Arrays.
* strdupa: (libc)Copying Strings and Arrays.
* strerror: (libc)Error Messages.
* strerror_r: (libc)Error Messages.
* strerrordesc_np: (libc)Error Messages.
* strerrorname_np: (libc)Error Messages.
* strfmon: (libc)Formatting Numbers.
* strfromd: (libc)Printing of Floats.
* strfromf: (libc)Printing of Floats.
* strfromfN: (libc)Printing of Floats.
* strfromfNx: (libc)Printing of Floats.
* strfroml: (libc)Printing of Floats.
* strfry: (libc)Shuffling Bytes.
* strftime: (libc)Formatting Calendar Time.
* strlen: (libc)String Length.
* strncasecmp: (libc)String/Array Comparison.
* strncat: (libc)Truncating Strings.
* strncmp: (libc)String/Array Comparison.
* strncpy: (libc)Truncating Strings.
* strndup: (libc)Truncating Strings.
* strndupa: (libc)Truncating Strings.
* strnlen: (libc)String Length.
* strpbrk: (libc)Search Functions.
* strptime: (libc)Low-Level Time String Parsing.
* strrchr: (libc)Search Functions.
* strsep: (libc)Finding Tokens in a String.
* strsignal: (libc)Signal Messages.
* strspn: (libc)Search Functions.
* strstr: (libc)Search Functions.
* strtod: (libc)Parsing of Floats.
* strtof: (libc)Parsing of Floats.
* strtofN: (libc)Parsing of Floats.
* strtofNx: (libc)Parsing of Floats.
* strtoimax: (libc)Parsing of Integers.
* strtok: (libc)Finding Tokens in a String.
* strtok_r: (libc)Finding Tokens in a String.
* strtol: (libc)Parsing of Integers.
* strtold: (libc)Parsing of Floats.
* strtoll: (libc)Parsing of Integers.
* strtoq: (libc)Parsing of Integers.
* strtoul: (libc)Parsing of Integers.
* strtoull: (libc)Parsing of Integers.
* strtoumax: (libc)Parsing of Integers.
* strtouq: (libc)Parsing of Integers.
* strverscmp: (libc)String/Array Comparison.
* strxfrm: (libc)Collation Functions.
* stty: (libc)BSD Terminal Modes.
* swapcontext: (libc)System V contexts.
* swprintf: (libc)Formatted Output Functions.
* swscanf: (libc)Formatted Input Functions.
* symlink: (libc)Symbolic Links.
* sync: (libc)Synchronizing I/O.
* syscall: (libc)System Calls.
* sysconf: (libc)Sysconf Definition.
* syslog: (libc)syslog; vsyslog.
* system: (libc)Running a Command.
* sysv_signal: (libc)Basic Signal Handling.
* tan: (libc)Trig Functions.
* tanf: (libc)Trig Functions.
* tanfN: (libc)Trig Functions.
* tanfNx: (libc)Trig Functions.
* tanh: (libc)Hyperbolic Functions.
* tanhf: (libc)Hyperbolic Functions.
* tanhfN: (libc)Hyperbolic Functions.
* tanhfNx: (libc)Hyperbolic Functions.
* tanhl: (libc)Hyperbolic Functions.
* tanl: (libc)Trig Functions.
* tcdrain: (libc)Line Control.
* tcflow: (libc)Line Control.
* tcflush: (libc)Line Control.
* tcgetattr: (libc)Mode Functions.
* tcgetpgrp: (libc)Terminal Access Functions.
* tcgetsid: (libc)Terminal Access Functions.
* tcsendbreak: (libc)Line Control.
* tcsetattr: (libc)Mode Functions.
* tcsetpgrp: (libc)Terminal Access Functions.
* tdelete: (libc)Tree Search Function.
* tdestroy: (libc)Tree Search Function.
* telldir: (libc)Random Access Directory.
* tempnam: (libc)Temporary Files.
* textdomain: (libc)Locating gettext catalog.
* tfind: (libc)Tree Search Function.
* tgamma: (libc)Special Functions.
* tgammaf: (libc)Special Functions.
* tgammafN: (libc)Special Functions.
* tgammafNx: (libc)Special Functions.
* tgammal: (libc)Special Functions.
* tgkill: (libc)Signaling Another Process.
* thrd_create: (libc)ISO C Thread Management.
* thrd_current: (libc)ISO C Thread Management.
* thrd_detach: (libc)ISO C Thread Management.
* thrd_equal: (libc)ISO C Thread Management.
* thrd_exit: (libc)ISO C Thread Management.
* thrd_join: (libc)ISO C Thread Management.
* thrd_sleep: (libc)ISO C Thread Management.
* thrd_yield: (libc)ISO C Thread Management.
* time: (libc)Getting the Time.
* timegm: (libc)Broken-down Time.
* timelocal: (libc)Broken-down Time.
* times: (libc)Processor Time.
* tmpfile64: (libc)Temporary Files.
* tmpfile: (libc)Temporary Files.
* tmpnam: (libc)Temporary Files.
* tmpnam_r: (libc)Temporary Files.
* toascii: (libc)Case Conversion.
* tolower: (libc)Case Conversion.
* totalorder: (libc)FP Comparison Functions.
* totalorderf: (libc)FP Comparison Functions.
* totalorderfN: (libc)FP Comparison Functions.
* totalorderfNx: (libc)FP Comparison Functions.
* totalorderl: (libc)FP Comparison Functions.
* totalordermag: (libc)FP Comparison Functions.
* totalordermagf: (libc)FP Comparison Functions.
* totalordermagfN: (libc)FP Comparison Functions.
* totalordermagfNx: (libc)FP Comparison Functions.
* totalordermagl: (libc)FP Comparison Functions.
* toupper: (libc)Case Conversion.
* towctrans: (libc)Wide Character Case Conversion.
* towlower: (libc)Wide Character Case Conversion.
* towupper: (libc)Wide Character Case Conversion.
* trunc: (libc)Rounding Functions.
* truncate64: (libc)File Size.
* truncate: (libc)File Size.
* truncf: (libc)Rounding Functions.
* truncfN: (libc)Rounding Functions.
* truncfNx: (libc)Rounding Functions.
* truncl: (libc)Rounding Functions.
* tsearch: (libc)Tree Search Function.
* tss_create: (libc)ISO C Thread-local Storage.
* tss_delete: (libc)ISO C Thread-local Storage.
* tss_get: (libc)ISO C Thread-local Storage.
* tss_set: (libc)ISO C Thread-local Storage.
* ttyname: (libc)Is It a Terminal.
* ttyname_r: (libc)Is It a Terminal.
* twalk: (libc)Tree Search Function.
* twalk_r: (libc)Tree Search Function.
* tzset: (libc)Time Zone Functions.
* ufromfp: (libc)Rounding Functions.
* ufromfpf: (libc)Rounding Functions.
* ufromfpfN: (libc)Rounding Functions.
* ufromfpfNx: (libc)Rounding Functions.
* ufromfpl: (libc)Rounding Functions.
* ufromfpx: (libc)Rounding Functions.
* ufromfpxf: (libc)Rounding Functions.
* ufromfpxfN: (libc)Rounding Functions.
* ufromfpxfNx: (libc)Rounding Functions.
* ufromfpxl: (libc)Rounding Functions.
* ulimit: (libc)Limits on Resources.
* umask: (libc)Setting Permissions.
* umount2: (libc)Mount-Unmount-Remount.
* umount: (libc)Mount-Unmount-Remount.
* uname: (libc)Platform Type.
* ungetc: (libc)How Unread.
* ungetwc: (libc)How Unread.
* unlink: (libc)Deleting Files.
* unlockpt: (libc)Allocation.
* unsetenv: (libc)Environment Access.
* updwtmp: (libc)Manipulating the Database.
* utime: (libc)File Times.
* utimes: (libc)File Times.
* utmpname: (libc)Manipulating the Database.
* utmpxname: (libc)XPG Functions.
* va_arg: (libc)Argument Macros.
* va_copy: (libc)Argument Macros.
* va_end: (libc)Argument Macros.
* va_start: (libc)Argument Macros.
* valloc: (libc)Aligned Memory Blocks.
* vasprintf: (libc)Variable Arguments Output.
* verr: (libc)Error Messages.
* verrx: (libc)Error Messages.
* versionsort64: (libc)Scanning Directory Content.
* versionsort: (libc)Scanning Directory Content.
* vfork: (libc)Creating a Process.
* vfprintf: (libc)Variable Arguments Output.
* vfscanf: (libc)Variable Arguments Input.
* vfwprintf: (libc)Variable Arguments Output.
* vfwscanf: (libc)Variable Arguments Input.
* vlimit: (libc)Limits on Resources.
* vprintf: (libc)Variable Arguments Output.
* vscanf: (libc)Variable Arguments Input.
* vsnprintf: (libc)Variable Arguments Output.
* vsprintf: (libc)Variable Arguments Output.
* vsscanf: (libc)Variable Arguments Input.
* vswprintf: (libc)Variable Arguments Output.
* vswscanf: (libc)Variable Arguments Input.
* vsyslog: (libc)syslog; vsyslog.
* vwarn: (libc)Error Messages.
* vwarnx: (libc)Error Messages.
* vwprintf: (libc)Variable Arguments Output.
* vwscanf: (libc)Variable Arguments Input.
* wait3: (libc)BSD Wait Functions.
* wait4: (libc)Process Completion.
* wait: (libc)Process Completion.
* waitpid: (libc)Process Completion.
* warn: (libc)Error Messages.
* warnx: (libc)Error Messages.
* wcpcpy: (libc)Copying Strings and Arrays.
* wcpncpy: (libc)Truncating Strings.
* wcrtomb: (libc)Converting a Character.
* wcscasecmp: (libc)String/Array Comparison.
* wcscat: (libc)Concatenating Strings.
* wcschr: (libc)Search Functions.
* wcschrnul: (libc)Search Functions.
* wcscmp: (libc)String/Array Comparison.
* wcscoll: (libc)Collation Functions.
* wcscpy: (libc)Copying Strings and Arrays.
* wcscspn: (libc)Search Functions.
* wcsdup: (libc)Copying Strings and Arrays.
* wcsftime: (libc)Formatting Calendar Time.
* wcslen: (libc)String Length.
* wcsncasecmp: (libc)String/Array Comparison.
* wcsncat: (libc)Truncating Strings.
* wcsncmp: (libc)String/Array Comparison.
* wcsncpy: (libc)Truncating Strings.
* wcsnlen: (libc)String Length.
* wcsnrtombs: (libc)Converting Strings.
* wcspbrk: (libc)Search Functions.
* wcsrchr: (libc)Search Functions.
* wcsrtombs: (libc)Converting Strings.
* wcsspn: (libc)Search Functions.
* wcsstr: (libc)Search Functions.
* wcstod: (libc)Parsing of Floats.
* wcstof: (libc)Parsing of Floats.
* wcstofN: (libc)Parsing of Floats.
* wcstofNx: (libc)Parsing of Floats.
* wcstoimax: (libc)Parsing of Integers.
* wcstok: (libc)Finding Tokens in a String.
* wcstol: (libc)Parsing of Integers.
* wcstold: (libc)Parsing of Floats.
* wcstoll: (libc)Parsing of Integers.
* wcstombs: (libc)Non-reentrant String Conversion.
* wcstoq: (libc)Parsing of Integers.
* wcstoul: (libc)Parsing of Integers.
* wcstoull: (libc)Parsing of Integers.
* wcstoumax: (libc)Parsing of Integers.
* wcstouq: (libc)Parsing of Integers.
* wcswcs: (libc)Search Functions.
* wcsxfrm: (libc)Collation Functions.
* wctob: (libc)Converting a Character.
* wctomb: (libc)Non-reentrant Character Conversion.
* wctrans: (libc)Wide Character Case Conversion.
* wctype: (libc)Classification of Wide Characters.
* wmemchr: (libc)Search Functions.
* wmemcmp: (libc)String/Array Comparison.
* wmemcpy: (libc)Copying Strings and Arrays.
* wmemmove: (libc)Copying Strings and Arrays.
* wmempcpy: (libc)Copying Strings and Arrays.
* wmemset: (libc)Copying Strings and Arrays.
* wordexp: (libc)Calling Wordexp.
* wordfree: (libc)Calling Wordexp.
* wprintf: (libc)Formatted Output Functions.
* write: (libc)I/O Primitives.
* writev: (libc)Scatter-Gather.
* wscanf: (libc)Formatted Input Functions.
* y0: (libc)Special Functions.
* y0f: (libc)Special Functions.
* y0fN: (libc)Special Functions.
* y0fNx: (libc)Special Functions.
* y0l: (libc)Special Functions.
* y1: (libc)Special Functions.
* y1f: (libc)Special Functions.
* y1fN: (libc)Special Functions.
* y1fNx: (libc)Special Functions.
* y1l: (libc)Special Functions.
* yn: (libc)Special Functions.
* ynf: (libc)Special Functions.
* ynfN: (libc)Special Functions.
* ynfNx: (libc)Special Functions.
* ynl: (libc)Special Functions.
END-INFO-DIR-ENTRY
 
 
File: libc.info,  Node: Character Input,  Next: Line Input,  Prev: Simple Output,  Up: I/O on Streams
 
12.8 Character Input
====================
 
This section describes functions for performing character-oriented
input.  These narrow stream functions are declared in the header file
‘stdio.h’ and the wide character functions are declared in ‘wchar.h’.
 
   These functions return an ‘int’ or ‘wint_t’ value (for narrow and
wide stream functions respectively) that is either a character of input,
or the special value ‘EOF’/‘WEOF’ (usually -1).  For the narrow stream
functions it is important to store the result of these functions in a
variable of type ‘int’ instead of ‘char’, even when you plan to use it
only as a character.  Storing ‘EOF’ in a ‘char’ variable truncates its
value to the size of a character, so that it is no longer
distinguishable from the valid character ‘(char) -1’.  So always use an
‘int’ for the result of ‘getc’ and friends, and check for ‘EOF’ after
the call; once you’ve verified that the result is not ‘EOF’, you can be
sure that it will fit in a ‘char’ variable without loss of information.
 
 -- Function: int fgetc (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function reads the next character as an ‘unsigned char’ from
     the stream STREAM and returns its value, converted to an ‘int’.  If
     an end-of-file condition or read error occurs, ‘EOF’ is returned
     instead.
 
 -- Function: wint_t fgetwc (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function reads the next wide character from the stream STREAM
     and returns its value.  If an end-of-file condition or read error
     occurs, ‘WEOF’ is returned instead.
 
 -- Function: int fgetc_unlocked (FILE *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
     corrupt | *Note POSIX Safety Concepts::.
 
     The ‘fgetc_unlocked’ function is equivalent to the ‘fgetc’ function
     except that it does not implicitly lock the stream.
 
 -- Function: wint_t fgetwc_unlocked (FILE *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
     corrupt | *Note POSIX Safety Concepts::.
 
     The ‘fgetwc_unlocked’ function is equivalent to the ‘fgetwc’
     function except that it does not implicitly lock the stream.
 
     This function is a GNU extension.
 
 -- Function: int getc (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This is just like ‘fgetc’, except that it is permissible (and
     typical) for it to be implemented as a macro that evaluates the
     STREAM argument more than once.  ‘getc’ is often highly optimized,
     so it is usually the best function to use to read a single
     character.
 
 -- Function: wint_t getwc (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This is just like ‘fgetwc’, except that it is permissible for it to
     be implemented as a macro that evaluates the STREAM argument more
     than once.  ‘getwc’ can be highly optimized, so it is usually the
     best function to use to read a single wide character.
 
 -- Function: int getc_unlocked (FILE *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
     corrupt | *Note POSIX Safety Concepts::.
 
     The ‘getc_unlocked’ function is equivalent to the ‘getc’ function
     except that it does not implicitly lock the stream.
 
 -- Function: wint_t getwc_unlocked (FILE *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
     corrupt | *Note POSIX Safety Concepts::.
 
     The ‘getwc_unlocked’ function is equivalent to the ‘getwc’ function
     except that it does not implicitly lock the stream.
 
     This function is a GNU extension.
 
 -- Function: int getchar (void)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     The ‘getchar’ function is equivalent to ‘getc’ with ‘stdin’ as the
     value of the STREAM argument.
 
 -- Function: wint_t getwchar (void)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     The ‘getwchar’ function is equivalent to ‘getwc’ with ‘stdin’ as
     the value of the STREAM argument.
 
 -- Function: int getchar_unlocked (void)
 
     Preliminary: | MT-Unsafe race:stdin | AS-Unsafe corrupt | AC-Unsafe
     corrupt | *Note POSIX Safety Concepts::.
 
     The ‘getchar_unlocked’ function is equivalent to the ‘getchar’
     function except that it does not implicitly lock the stream.
 
 -- Function: wint_t getwchar_unlocked (void)
 
     Preliminary: | MT-Unsafe race:stdin | AS-Unsafe corrupt | AC-Unsafe
     corrupt | *Note POSIX Safety Concepts::.
 
     The ‘getwchar_unlocked’ function is equivalent to the ‘getwchar’
     function except that it does not implicitly lock the stream.
 
     This function is a GNU extension.
 
   Here is an example of a function that does input using ‘fgetc’.  It
would work just as well using ‘getc’ instead, or using ‘getchar ()’
instead of ‘fgetc (stdin)’.  The code would also work the same for the
wide character stream functions.
 
     int
     y_or_n_p (const char *question)
     {
       fputs (question, stdout);
       while (1)
         {
           int c, answer;
           /* Write a space to separate answer from question. */
           fputc (' ', stdout);
           /* Read the first character of the line.
         This should be the answer character, but might not be. */
           c = tolower (fgetc (stdin));
           answer = c;
           /* Discard rest of input line. */
           while (c != '\n' && c != EOF)
         c = fgetc (stdin);
           /* Obey the answer if it was valid. */
           if (answer == 'y')
         return 1;
           if (answer == 'n')
         return 0;
           /* Answer was invalid: ask for valid answer. */
           fputs ("Please answer y or n:", stdout);
         }
     }
 
 -- Function: int getw (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function reads a word (that is, an ‘int’) from STREAM.  It’s
     provided for compatibility with SVID. We recommend you use ‘fread’
     instead (*note Block Input/Output::).  Unlike ‘getc’, any ‘int’
     value could be a valid result.  ‘getw’ returns ‘EOF’ when it
     encounters end-of-file or an error, but there is no way to
     distinguish this from an input word with value -1.
 
 
File: libc.info,  Node: Line Input,  Next: Unreading,  Prev: Character Input,  Up: I/O on Streams
 
12.9 Line-Oriented Input
========================
 
Since many programs interpret input on the basis of lines, it is
convenient to have functions to read a line of text from a stream.
 
   Standard C has functions to do this, but they aren’t very safe: null
characters and even (for ‘gets’) long lines can confuse them.  So the
GNU C Library provides the nonstandard ‘getline’ function that makes it
easy to read lines reliably.
 
   Another GNU extension, ‘getdelim’, generalizes ‘getline’.  It reads a
delimited record, defined as everything through the next occurrence of a
specified delimiter character.
 
   All these functions are declared in ‘stdio.h’.
 
 -- Function: ssize_t getline (char **LINEPTR, size_t *N, FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt heap | AC-Unsafe lock
     corrupt mem | *Note POSIX Safety Concepts::.
 
     This function reads an entire line from STREAM, storing the text
     (including the newline and a terminating null character) in a
     buffer and storing the buffer address in ‘*LINEPTR’.
 
     Before calling ‘getline’, you should place in ‘*LINEPTR’ the
     address of a buffer ‘*N’ bytes long, allocated with ‘malloc’.  If
     this buffer is long enough to hold the line, ‘getline’ stores the
     line in this buffer.  Otherwise, ‘getline’ makes the buffer bigger
     using ‘realloc’, storing the new buffer address back in ‘*LINEPTR’
     and the increased size back in ‘*N’.  *Note Unconstrained
     Allocation::.
 
     If you set ‘*LINEPTR’ to a null pointer, and ‘*N’ to zero, before
     the call, then ‘getline’ allocates the initial buffer for you by
     calling ‘malloc’.  This buffer remains allocated even if ‘getline’
     encounters errors and is unable to read any bytes.
 
     In either case, when ‘getline’ returns, ‘*LINEPTR’ is a ‘char *’
     which points to the text of the line.
 
     When ‘getline’ is successful, it returns the number of characters
     read (including the newline, but not including the terminating
     null).  This value enables you to distinguish null characters that
     are part of the line from the null character inserted as a
     terminator.
 
     This function is a GNU extension, but it is the recommended way to
     read lines from a stream.  The alternative standard functions are
     unreliable.
 
     If an error occurs or end of file is reached without any bytes
     read, ‘getline’ returns ‘-1’.
 
 -- Function: ssize_t getdelim (char **LINEPTR, size_t *N, int
          DELIMITER, FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt heap | AC-Unsafe lock
     corrupt mem | *Note POSIX Safety Concepts::.
 
     This function is like ‘getline’ except that the character which
     tells it to stop reading is not necessarily newline.  The argument
     DELIMITER specifies the delimiter character; ‘getdelim’ keeps
     reading until it sees that character (or end of file).
 
     The text is stored in LINEPTR, including the delimiter character
     and a terminating null.  Like ‘getline’, ‘getdelim’ makes LINEPTR
     bigger if it isn’t big enough.
 
     ‘getline’ is in fact implemented in terms of ‘getdelim’, just like
     this:
 
          ssize_t
          getline (char **lineptr, size_t *n, FILE *stream)
          {
            return getdelim (lineptr, n, '\n', stream);
          }
 
 -- Function: char * fgets (char *S, int COUNT, FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     The ‘fgets’ function reads characters from the stream STREAM up to
     and including a newline character and stores them in the string S,
     adding a null character to mark the end of the string.  You must
     supply COUNT characters worth of space in S, but the number of
     characters read is at most COUNT − 1.  The extra character space is
     used to hold the null character at the end of the string.
 
     If the system is already at end of file when you call ‘fgets’, then
     the contents of the array S are unchanged and a null pointer is
     returned.  A null pointer is also returned if a read error occurs.
     Otherwise, the return value is the pointer S.
 
     *Warning:* If the input data has a null character, you can’t tell.
     So don’t use ‘fgets’ unless you know the data cannot contain a
     null.  Don’t use it to read files edited by the user because, if
     the user inserts a null character, you should either handle it
     properly or print a clear error message.  We recommend using
     ‘getline’ instead of ‘fgets’.
 
 -- Function: wchar_t * fgetws (wchar_t *WS, int COUNT, FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     The ‘fgetws’ function reads wide characters from the stream STREAM
     up to and including a newline character and stores them in the
     string WS, adding a null wide character to mark the end of the
     string.  You must supply COUNT wide characters worth of space in
     WS, but the number of characters read is at most COUNT − 1.  The
     extra character space is used to hold the null wide character at
     the end of the string.
 
     If the system is already at end of file when you call ‘fgetws’,
     then the contents of the array WS are unchanged and a null pointer
     is returned.  A null pointer is also returned if a read error
     occurs.  Otherwise, the return value is the pointer WS.
 
     *Warning:* If the input data has a null wide character (which are
     null bytes in the input stream), you can’t tell.  So don’t use
     ‘fgetws’ unless you know the data cannot contain a null.  Don’t use
     it to read files edited by the user because, if the user inserts a
     null character, you should either handle it properly or print a
     clear error message.
 
 -- Function: char * fgets_unlocked (char *S, int COUNT, FILE *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
     corrupt | *Note POSIX Safety Concepts::.
 
     The ‘fgets_unlocked’ function is equivalent to the ‘fgets’ function
     except that it does not implicitly lock the stream.
 
     This function is a GNU extension.
 
 -- Function: wchar_t * fgetws_unlocked (wchar_t *WS, int COUNT, FILE
          *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
     corrupt | *Note POSIX Safety Concepts::.
 
     The ‘fgetws_unlocked’ function is equivalent to the ‘fgetws’
     function except that it does not implicitly lock the stream.
 
     This function is a GNU extension.
 
 -- Deprecated function: char * gets (char *S)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     The function ‘gets’ reads characters from the stream ‘stdin’ up to
     the next newline character, and stores them in the string S.  The
     newline character is discarded (note that this differs from the
     behavior of ‘fgets’, which copies the newline character into the
     string).  If ‘gets’ encounters a read error or end-of-file, it
     returns a null pointer; otherwise it returns S.
 
     *Warning:* The ‘gets’ function is *very dangerous* because it
     provides no protection against overflowing the string S.  The GNU C
     Library includes it for compatibility only.  You should *always*
     use ‘fgets’ or ‘getline’ instead.  To remind you of this, the
     linker (if using GNU ‘ld’) will issue a warning whenever you use
     ‘gets’.
 
 
File: libc.info,  Node: Unreading,  Next: Block Input/Output,  Prev: Line Input,  Up: I/O on Streams
 
12.10 Unreading
===============
 
In parser programs it is often useful to examine the next character in
the input stream without removing it from the stream.  This is called
“peeking ahead” at the input because your program gets a glimpse of the
input it will read next.
 
   Using stream I/O, you can peek ahead at input by first reading it and
then "unreading" it (also called "pushing it back" on the stream).
Unreading a character makes it available to be input again from the
stream, by the next call to ‘fgetc’ or other input function on that
stream.
 
* Menu:
 
* Unreading Idea::              An explanation of unreading with pictures.
* How Unread::                  How to call ‘ungetc’ to do unreading.
 
 
File: libc.info,  Node: Unreading Idea,  Next: How Unread,  Up: Unreading
 
12.10.1 What Unreading Means
----------------------------
 
Here is a pictorial explanation of unreading.  Suppose you have a stream
reading a file that contains just six characters, the letters ‘foobar’.
Suppose you have read three characters so far.  The situation looks like
this:
 
     f  o  o  b  a  r
          ^
 
so the next input character will be ‘b’.
 
   If instead of reading ‘b’ you unread the letter ‘o’, you get a
situation like this:
 
     f  o  o  b  a  r
          |
           o--
           ^
 
so that the next input characters will be ‘o’ and ‘b’.
 
   If you unread ‘9’ instead of ‘o’, you get this situation:
 
     f  o  o  b  a  r
          |
           9--
           ^
 
so that the next input characters will be ‘9’ and ‘b’.
 
 
File: libc.info,  Node: How Unread,  Prev: Unreading Idea,  Up: Unreading
 
12.10.2 Using ‘ungetc’ To Do Unreading
--------------------------------------
 
The function to unread a character is called ‘ungetc’, because it
reverses the action of ‘getc’.
 
 -- Function: int ungetc (int C, FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     The ‘ungetc’ function pushes back the character C onto the input
     stream STREAM.  So the next input from STREAM will read C before
     anything else.
 
     If C is ‘EOF’, ‘ungetc’ does nothing and just returns ‘EOF’.  This
     lets you call ‘ungetc’ with the return value of ‘getc’ without
     needing to check for an error from ‘getc’.
 
     The character that you push back doesn’t have to be the same as the
     last character that was actually read from the stream.  In fact, it
     isn’t necessary to actually read any characters from the stream
     before unreading them with ‘ungetc’!  But that is a strange way to
     write a program; usually ‘ungetc’ is used only to unread a
     character that was just read from the same stream.  The GNU C
     Library supports this even on files opened in binary mode, but
     other systems might not.
 
     The GNU C Library only supports one character of pushback—in other
     words, it does not work to call ‘ungetc’ twice without doing input
     in between.  Other systems might let you push back multiple
     characters; then reading from the stream retrieves the characters
     in the reverse order that they were pushed.
 
     Pushing back characters doesn’t alter the file; only the internal
     buffering for the stream is affected.  If a file positioning
     function (such as ‘fseek’, ‘fseeko’ or ‘rewind’; *note File
     Positioning::) is called, any pending pushed-back characters are
     discarded.
 
     Unreading a character on a stream that is at end of file clears the
     end-of-file indicator for the stream, because it makes the
     character of input available.  After you read that character,
     trying to read again will encounter end of file.
 
 -- Function: wint_t ungetwc (wint_t WC, FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     The ‘ungetwc’ function behaves just like ‘ungetc’ just that it
     pushes back a wide character.
 
   Here is an example showing the use of ‘getc’ and ‘ungetc’ to skip
over whitespace characters.  When this function reaches a non-whitespace
character, it unreads that character to be seen again on the next read
operation on the stream.
 
     #include <stdio.h>
     #include <ctype.h>
 
     void
     skip_whitespace (FILE *stream)
     {
       int c;
       do
         /* No need to check for ‘EOF’ because it is not
            ‘isspace’, and ‘ungetc’ ignores ‘EOF’.  */
         c = getc (stream);
       while (isspace (c));
       ungetc (c, stream);
     }
 
 
File: libc.info,  Node: Block Input/Output,  Next: Formatted Output,  Prev: Unreading,  Up: I/O on Streams
 
12.11 Block Input/Output
========================
 
This section describes how to do input and output operations on blocks
of data.  You can use these functions to read and write binary data, as
well as to read and write text in fixed-size blocks instead of by
characters or lines.
 
   Binary files are typically used to read and write blocks of data in
the same format as is used to represent the data in a running program.
In other words, arbitrary blocks of memory—not just character or string
objects—can be written to a binary file, and meaningfully read in again
by the same program.
 
   Storing data in binary form is often considerably more efficient than
using the formatted I/O functions.  Also, for floating-point numbers,
the binary form avoids possible loss of precision in the conversion
process.  On the other hand, binary files can’t be examined or modified
easily using many standard file utilities (such as text editors), and
are not portable between different implementations of the language, or
different kinds of computers.
 
   These functions are declared in ‘stdio.h’.
 
 -- Function: size_t fread (void *DATA, size_t SIZE, size_t COUNT, FILE
          *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function reads up to COUNT objects of size SIZE into the array
     DATA, from the stream STREAM.  It returns the number of objects
     actually read, which might be less than COUNT if a read error
     occurs or the end of the file is reached.  This function returns a
     value of zero (and doesn’t read anything) if either SIZE or COUNT
     is zero.
 
     If ‘fread’ encounters end of file in the middle of an object, it
     returns the number of complete objects read, and discards the
     partial object.  Therefore, the stream remains at the actual end of
     the file.
 
 -- Function: size_t fread_unlocked (void *DATA, size_t SIZE, size_t
          COUNT, FILE *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
     corrupt | *Note POSIX Safety Concepts::.
 
     The ‘fread_unlocked’ function is equivalent to the ‘fread’ function
     except that it does not implicitly lock the stream.
 
     This function is a GNU extension.
 
 -- Function: size_t fwrite (const void *DATA, size_t SIZE, size_t
          COUNT, FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function writes up to COUNT objects of size SIZE from the
     array DATA, to the stream STREAM.  The return value is normally
     COUNT, if the call succeeds.  Any other value indicates some sort
     of error, such as running out of space.
 
 -- Function: size_t fwrite_unlocked (const void *DATA, size_t SIZE,
          size_t COUNT, FILE *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
     corrupt | *Note POSIX Safety Concepts::.
 
     The ‘fwrite_unlocked’ function is equivalent to the ‘fwrite’
     function except that it does not implicitly lock the stream.
 
     This function is a GNU extension.
 
 
File: libc.info,  Node: Formatted Output,  Next: Customizing Printf,  Prev: Block Input/Output,  Up: I/O on Streams
 
12.12 Formatted Output
======================
 
The functions described in this section (‘printf’ and related functions)
provide a convenient way to perform formatted output.  You call ‘printf’
with a "format string" or "template string" that specifies how to format
the values of the remaining arguments.
 
   Unless your program is a filter that specifically performs line- or
character-oriented processing, using ‘printf’ or one of the other
related functions described in this section is usually the easiest and
most concise way to perform output.  These functions are especially
useful for printing error messages, tables of data, and the like.
 
* Menu:
 
* Formatted Output Basics::     Some examples to get you started.
* Output Conversion Syntax::    General syntax of conversion
                specifications.
* Table of Output Conversions:: Summary of output conversions and
                what they do.
* Integer Conversions::         Details about formatting of integers.
* Floating-Point Conversions::  Details about formatting of
                floating-point numbers.
* Other Output Conversions::    Details about formatting of strings,
                characters, pointers, and the like.
* Formatted Output Functions::  Descriptions of the actual functions.
* Dynamic Output::        Functions that allocate memory for the output.
* Variable Arguments Output::   ‘vprintf’ and friends.
* Parsing a Template String::   What kinds of args does a given template
                call for?
* Example of Parsing::          Sample program using ‘parse_printf_format’.
 
 
File: libc.info,  Node: Formatted Output Basics,  Next: Output Conversion Syntax,  Up: Formatted Output
 
12.12.1 Formatted Output Basics
-------------------------------
 
The ‘printf’ function can be used to print any number of arguments.  The
template string argument you supply in a call provides information not
only about the number of additional arguments, but also about their
types and what style should be used for printing them.
 
   Ordinary characters in the template string are simply written to the
output stream as-is, while "conversion specifications" introduced by a
‘%’ character in the template cause subsequent arguments to be formatted
and written to the output stream.  For example,
 
     int pct = 37;
     char filename[] = "foo.txt";
     printf ("Processing of `%s' is %d%% finished.\nPlease be patient.\n",
         filename, pct);
 
produces output like
 
     Processing of `foo.txt' is 37% finished.
     Please be patient.
 
   This example shows the use of the ‘%d’ conversion to specify that an
‘int’ argument should be printed in decimal notation, the ‘%s’
conversion to specify printing of a string argument, and the ‘%%’
conversion to print a literal ‘%’ character.
 
   There are also conversions for printing an integer argument as an
unsigned value in octal, decimal, or hexadecimal radix (‘%o’, ‘%u’, or
‘%x’, respectively); or as a character value (‘%c’).
 
   Floating-point numbers can be printed in normal, fixed-point notation
using the ‘%f’ conversion or in exponential notation using the ‘%e’
conversion.  The ‘%g’ conversion uses either ‘%e’ or ‘%f’ format,
depending on what is more appropriate for the magnitude of the
particular number.
 
   You can control formatting more precisely by writing "modifiers"
between the ‘%’ and the character that indicates which conversion to
apply.  These slightly alter the ordinary behavior of the conversion.
For example, most conversion specifications permit you to specify a
minimum field width and a flag indicating whether you want the result
left- or right-justified within the field.
 
   The specific flags and modifiers that are permitted and their
interpretation vary depending on the particular conversion.  They’re all
described in more detail in the following sections.  Don’t worry if this
all seems excessively complicated at first; you can almost always get
reasonable free-format output without using any of the modifiers at all.
The modifiers are mostly used to make the output look “prettier” in
tables.
 
 
File: libc.info,  Node: Output Conversion Syntax,  Next: Table of Output Conversions,  Prev: Formatted Output Basics,  Up: Formatted Output
 
12.12.2 Output Conversion Syntax
--------------------------------
 
This section provides details about the precise syntax of conversion
specifications that can appear in a ‘printf’ template string.
 
   Characters in the template string that are not part of a conversion
specification are printed as-is to the output stream.  Multibyte
character sequences (*note Character Set Handling::) are permitted in a
template string.
 
   The conversion specifications in a ‘printf’ template string have the
general form:
 
     % [ PARAM-NO $] FLAGS WIDTH [ . PRECISION ] TYPE CONVERSION
 
or
 
     % [ PARAM-NO $] FLAGS WIDTH . * [ PARAM-NO $] TYPE CONVERSION
 
   For example, in the conversion specifier ‘%-10.8ld’, the ‘-’ is a
flag, ‘10’ specifies the field width, the precision is ‘8’, the letter
‘l’ is a type modifier, and ‘d’ specifies the conversion style.  (This
particular type specifier says to print a ‘long int’ argument in decimal
notation, with a minimum of 8 digits left-justified in a field at least
10 characters wide.)
 
   In more detail, output conversion specifications consist of an
initial ‘%’ character followed in sequence by:
 
   • An optional specification of the parameter used for this format.
     Normally the parameters to the ‘printf’ function are assigned to
     the formats in the order of appearance in the format string.  But
     in some situations (such as message translation) this is not
     desirable and this extension allows an explicit parameter to be
     specified.
 
     The PARAM-NO parts of the format must be integers in the range of 1
     to the maximum number of arguments present to the function call.
     Some implementations limit this number to a certain upper bound.
     The exact limit can be retrieved by the following constant.
 
      -- Macro: NL_ARGMAX
          The value of ‘NL_ARGMAX’ is the maximum value allowed for the
          specification of a positional parameter in a ‘printf’ call.
          The actual value in effect at runtime can be retrieved by
          using ‘sysconf’ using the ‘_SC_NL_ARGMAX’ parameter *note
          Sysconf Definition::.
 
          Some systems have a quite low limit such as 9 for System V
          systems.  The GNU C Library has no real limit.
 
     If any of the formats has a specification for the parameter
     position all of them in the format string shall have one.
     Otherwise the behavior is undefined.
 
   • Zero or more "flag characters" that modify the normal behavior of
     the conversion specification.
 
   • An optional decimal integer specifying the "minimum field width".
     If the normal conversion produces fewer characters than this, the
     field is padded with spaces to the specified width.  This is a
     _minimum_ value; if the normal conversion produces more characters
     than this, the field is _not_ truncated.  Normally, the output is
     right-justified within the field.
 
     You can also specify a field width of ‘*’.  This means that the
     next argument in the argument list (before the actual value to be
     printed) is used as the field width.  The value must be an ‘int’.
     If the value is negative, this means to set the ‘-’ flag (see
     below) and to use the absolute value as the field width.
 
   • An optional "precision" to specify the number of digits to be
     written for the numeric conversions.  If the precision is
     specified, it consists of a period (‘.’) followed optionally by a
     decimal integer (which defaults to zero if omitted).
 
     You can also specify a precision of ‘*’.  This means that the next
     argument in the argument list (before the actual value to be
     printed) is used as the precision.  The value must be an ‘int’, and
     is ignored if it is negative.  If you specify ‘*’ for both the
     field width and precision, the field width argument precedes the
     precision argument.  Other C library versions may not recognize
     this syntax.
 
   • An optional "type modifier character", which is used to specify the
     data type of the corresponding argument if it differs from the
     default type.  (For example, the integer conversions assume a type
     of ‘int’, but you can specify ‘h’, ‘l’, or ‘L’ for other integer
     types.)
 
   • A character that specifies the conversion to be applied.
 
   The exact options that are permitted and how they are interpreted
vary between the different conversion specifiers.  See the descriptions
of the individual conversions for information about the particular
options that they use.
 
   With the ‘-Wformat’ option, the GNU C compiler checks calls to
‘printf’ and related functions.  It examines the format string and
verifies that the correct number and types of arguments are supplied.
There is also a GNU C syntax to tell the compiler that a function you
write uses a ‘printf’-style format string.  *Note Declaring Attributes
of Functions: (gcc)Function Attributes, for more information.
 
 
File: libc.info,  Node: Table of Output Conversions,  Next: Integer Conversions,  Prev: Output Conversion Syntax,  Up: Formatted Output
 
12.12.3 Table of Output Conversions
-----------------------------------
 
Here is a table summarizing what all the different conversions do:
 
‘%d’, ‘%i’
     Print an integer as a signed decimal number.  *Note Integer
     Conversions::, for details.  ‘%d’ and ‘%i’ are synonymous for
     output, but are different when used with ‘scanf’ for input (*note
     Table of Input Conversions::).
 
‘%o’
     Print an integer as an unsigned octal number.  *Note Integer
     Conversions::, for details.
 
‘%u’
     Print an integer as an unsigned decimal number.  *Note Integer
     Conversions::, for details.
 
‘%x’, ‘%X’
     Print an integer as an unsigned hexadecimal number.  ‘%x’ uses
     lower-case letters and ‘%X’ uses upper-case.  *Note Integer
     Conversions::, for details.
 
‘%f’
     Print a floating-point number in normal (fixed-point) notation.
     *Note Floating-Point Conversions::, for details.
 
‘%e’, ‘%E’
     Print a floating-point number in exponential notation.  ‘%e’ uses
     lower-case letters and ‘%E’ uses upper-case.  *Note Floating-Point
     Conversions::, for details.
 
‘%g’, ‘%G’
     Print a floating-point number in either normal or exponential
     notation, whichever is more appropriate for its magnitude.  ‘%g’
     uses lower-case letters and ‘%G’ uses upper-case.  *Note
     Floating-Point Conversions::, for details.
 
‘%a’, ‘%A’
     Print a floating-point number in a hexadecimal fractional notation
     with the exponent to base 2 represented in decimal digits.  ‘%a’
     uses lower-case letters and ‘%A’ uses upper-case.  *Note
     Floating-Point Conversions::, for details.
 
‘%c’
     Print a single character.  *Note Other Output Conversions::.
 
‘%C’
     This is an alias for ‘%lc’ which is supported for compatibility
     with the Unix standard.
 
‘%s’
     Print a string.  *Note Other Output Conversions::.
 
‘%S’
     This is an alias for ‘%ls’ which is supported for compatibility
     with the Unix standard.
 
‘%p’
     Print the value of a pointer.  *Note Other Output Conversions::.
 
‘%n’
     Get the number of characters printed so far.  *Note Other Output
     Conversions::.  Note that this conversion specification never
     produces any output.
 
‘%m’
     Print the string corresponding to the value of ‘errno’.  (This is a
     GNU extension.)  *Note Other Output Conversions::.
 
‘%%’
     Print a literal ‘%’ character.  *Note Other Output Conversions::.
 
   If the syntax of a conversion specification is invalid, unpredictable
things will happen, so don’t do this.  If there aren’t enough function
arguments provided to supply values for all the conversion
specifications in the template string, or if the arguments are not of
the correct types, the results are unpredictable.  If you supply more
arguments than conversion specifications, the extra argument values are
simply ignored; this is sometimes useful.
 
 
File: libc.info,  Node: Integer Conversions,  Next: Floating-Point Conversions,  Prev: Table of Output Conversions,  Up: Formatted Output
 
12.12.4 Integer Conversions
---------------------------
 
This section describes the options for the ‘%d’, ‘%i’, ‘%o’, ‘%u’, ‘%x’,
and ‘%X’ conversion specifications.  These conversions print integers in
various formats.
 
   The ‘%d’ and ‘%i’ conversion specifications both print an ‘int’
argument as a signed decimal number; while ‘%o’, ‘%u’, and ‘%x’ print
the argument as an unsigned octal, decimal, or hexadecimal number
(respectively).  The ‘%X’ conversion specification is just like ‘%x’
except that it uses the characters ‘ABCDEF’ as digits instead of
‘abcdef’.
 
   The following flags are meaningful:
 
‘-’
     Left-justify the result in the field (instead of the normal
     right-justification).
 
‘+’
     For the signed ‘%d’ and ‘%i’ conversions, print a plus sign if the
     value is positive.
 
‘ ’
     For the signed ‘%d’ and ‘%i’ conversions, if the result doesn’t
     start with a plus or minus sign, prefix it with a space character
     instead.  Since the ‘+’ flag ensures that the result includes a
     sign, this flag is ignored if you supply both of them.
 
‘#’
     For the ‘%o’ conversion, this forces the leading digit to be ‘0’,
     as if by increasing the precision.  For ‘%x’ or ‘%X’, this prefixes
     a leading ‘0x’ or ‘0X’ (respectively) to the result.  This doesn’t
     do anything useful for the ‘%d’, ‘%i’, or ‘%u’ conversions.  Using
     this flag produces output which can be parsed by the ‘strtoul’
     function (*note Parsing of Integers::) and ‘scanf’ with the ‘%i’
     conversion (*note Numeric Input Conversions::).
 
‘'’
     Separate the digits into groups as specified by the locale
     specified for the ‘LC_NUMERIC’ category; *note General Numeric::.
     This flag is a GNU extension.
 
‘0’
     Pad the field with zeros instead of spaces.  The zeros are placed
     after any indication of sign or base.  This flag is ignored if the
     ‘-’ flag is also specified, or if a precision is specified.
 
   If a precision is supplied, it specifies the minimum number of digits
to appear; leading zeros are produced if necessary.  If you don’t
specify a precision, the number is printed with as many digits as it
needs.  If you convert a value of zero with an explicit precision of
zero, then no characters at all are produced.
 
   Without a type modifier, the corresponding argument is treated as an
‘int’ (for the signed conversions ‘%i’ and ‘%d’) or ‘unsigned int’ (for
the unsigned conversions ‘%o’, ‘%u’, ‘%x’, and ‘%X’).  Recall that since
‘printf’ and friends are variadic, any ‘char’ and ‘short’ arguments are
automatically converted to ‘int’ by the default argument promotions.
For arguments of other integer types, you can use these modifiers:
 
‘hh’
     Specifies that the argument is a ‘signed char’ or ‘unsigned char’,
     as appropriate.  A ‘char’ argument is converted to an ‘int’ or
     ‘unsigned int’ by the default argument promotions anyway, but the
     ‘hh’ modifier says to convert it back to a ‘char’ again.
 
     This modifier was introduced in ISO C99.
 
‘h’
     Specifies that the argument is a ‘short int’ or ‘unsigned short
     int’, as appropriate.  A ‘short’ argument is converted to an ‘int’
     or ‘unsigned int’ by the default argument promotions anyway, but
     the ‘h’ modifier says to convert it back to a ‘short’ again.
 
‘j’
     Specifies that the argument is a ‘intmax_t’ or ‘uintmax_t’, as
     appropriate.
 
     This modifier was introduced in ISO C99.
 
‘l’
     Specifies that the argument is a ‘long int’ or ‘unsigned long int’,
     as appropriate.  Two ‘l’ characters are like the ‘L’ modifier,
     below.
 
     If used with ‘%c’ or ‘%s’ the corresponding parameter is considered
     as a wide character or wide character string respectively.  This
     use of ‘l’ was introduced in Amendment 1 to ISO C90.
 
‘L’
‘ll’
‘q’
     Specifies that the argument is a ‘long long int’.  (This type is an
     extension supported by the GNU C compiler.  On systems that don’t
     support extra-long integers, this is the same as ‘long int’.)
 
     The ‘q’ modifier is another name for the same thing, which comes
     from 4.4 BSD; a ‘long long int’ is sometimes called a “quad” ‘int’.
 
‘t’
     Specifies that the argument is a ‘ptrdiff_t’.
 
     This modifier was introduced in ISO C99.
 
‘z’
‘Z’
     Specifies that the argument is a ‘size_t’.
 
     ‘z’ was introduced in ISO C99.  ‘Z’ is a GNU extension predating
     this addition and should not be used in new code.
 
   Here is an example.  Using the template string:
 
     "|%5d|%-5d|%+5d|%+-5d|% 5d|%05d|%5.0d|%5.2d|%d|\n"
 
to print numbers using the different options for the ‘%d’ conversion
gives results like:
 
     |    0|0    |   +0|+0   |    0|00000|     |   00|0|
     |    1|1    |   +1|+1   |    1|00001|    1|   01|1|
     |   -1|-1   |   -1|-1   |   -1|-0001|   -1|  -01|-1|
     |100000|100000|+100000|+100000| 100000|100000|100000|100000|100000|
 
   In particular, notice what happens in the last case where the number
is too large to fit in the minimum field width specified.
 
   Here are some more examples showing how unsigned integers print under
various format options, using the template string:
 
     "|%5u|%5o|%5x|%5X|%#5o|%#5x|%#5X|%#10.8x|\n"
 
     |    0|    0|    0|    0|    0|    0|    0|  00000000|
     |    1|    1|    1|    1|   01|  0x1|  0X1|0x00000001|
     |100000|303240|186a0|186A0|0303240|0x186a0|0X186A0|0x000186a0|
 
 
File: libc.info,  Node: Floating-Point Conversions,  Next: Other Output Conversions,  Prev: Integer Conversions,  Up: Formatted Output
 
12.12.5 Floating-Point Conversions
----------------------------------
 
This section discusses the conversion specifications for floating-point
numbers: the ‘%f’, ‘%e’, ‘%E’, ‘%g’, and ‘%G’ conversions.
 
   The ‘%f’ conversion prints its argument in fixed-point notation,
producing output of the form [‘-’]DDD‘.’DDD, where the number of digits
following the decimal point is controlled by the precision you specify.
 
   The ‘%e’ conversion prints its argument in exponential notation,
producing output of the form [‘-’]D‘.’DDD‘e’[‘+’|‘-’]DD.  Again, the
number of digits following the decimal point is controlled by the
precision.  The exponent always contains at least two digits.  The ‘%E’
conversion is similar but the exponent is marked with the letter ‘E’
instead of ‘e’.
 
   The ‘%g’ and ‘%G’ conversions print the argument in the style of ‘%e’
or ‘%E’ (respectively) if the exponent would be less than -4 or greater
than or equal to the precision; otherwise they use the ‘%f’ style.  A
precision of ‘0’, is taken as 1.  Trailing zeros are removed from the
fractional portion of the result and a decimal-point character appears
only if it is followed by a digit.
 
   The ‘%a’ and ‘%A’ conversions are meant for representing
floating-point numbers exactly in textual form so that they can be
exchanged as texts between different programs and/or machines.  The
numbers are represented in the form [‘-’]‘0x’H‘.’HHH‘p’[‘+’|‘-’]DD.  At
the left of the decimal-point character exactly one digit is print.
This character is only ‘0’ if the number is denormalized.  Otherwise the
value is unspecified; it is implementation dependent how many bits are
used.  The number of hexadecimal digits on the right side of the
decimal-point character is equal to the precision.  If the precision is
zero it is determined to be large enough to provide an exact
representation of the number (or it is large enough to distinguish two
adjacent values if the ‘FLT_RADIX’ is not a power of 2, *note Floating
Point Parameters::).  For the ‘%a’ conversion lower-case characters are
used to represent the hexadecimal number and the prefix and exponent
sign are printed as ‘0x’ and ‘p’ respectively.  Otherwise upper-case
characters are used and ‘0X’ and ‘P’ are used for the representation of
prefix and exponent string.  The exponent to the base of two is printed
as a decimal number using at least one digit but at most as many digits
as necessary to represent the value exactly.
 
   If the value to be printed represents infinity or a NaN, the output
is [‘-’]‘inf’ or ‘nan’ respectively if the conversion specifier is ‘%a’,
‘%e’, ‘%f’, or ‘%g’ and it is [‘-’]‘INF’ or ‘NAN’ respectively if the
conversion is ‘%A’, ‘%E’, or ‘%G’.
 
   The following flags can be used to modify the behavior:
 
‘-’
     Left-justify the result in the field.  Normally the result is
     right-justified.
 
‘+’
     Always include a plus or minus sign in the result.
 
‘ ’
     If the result doesn’t start with a plus or minus sign, prefix it
     with a space instead.  Since the ‘+’ flag ensures that the result
     includes a sign, this flag is ignored if you supply both of them.
 
‘#’
     Specifies that the result should always include a decimal point,
     even if no digits follow it.  For the ‘%g’ and ‘%G’ conversions,
     this also forces trailing zeros after the decimal point to be left
     in place where they would otherwise be removed.
 
‘'’
     Separate the digits of the integer part of the result into groups
     as specified by the locale specified for the ‘LC_NUMERIC’ category;
     *note General Numeric::.  This flag is a GNU extension.
 
‘0’
     Pad the field with zeros instead of spaces; the zeros are placed
     after any sign.  This flag is ignored if the ‘-’ flag is also
     specified.
 
   The precision specifies how many digits follow the decimal-point
character for the ‘%f’, ‘%e’, and ‘%E’ conversions.  For these
conversions, the default precision is ‘6’.  If the precision is
explicitly ‘0’, this suppresses the decimal point character entirely.
For the ‘%g’ and ‘%G’ conversions, the precision specifies how many
significant digits to print.  Significant digits are the first digit
before the decimal point, and all the digits after it.  If the precision
is ‘0’ or not specified for ‘%g’ or ‘%G’, it is treated like a value of
‘1’.  If the value being printed cannot be expressed accurately in the
specified number of digits, the value is rounded to the nearest number
that fits.
 
   Without a type modifier, the floating-point conversions use an
argument of type ‘double’.  (By the default argument promotions, any
‘float’ arguments are automatically converted to ‘double’.)  The
following type modifier is supported:
 
‘L’
     An uppercase ‘L’ specifies that the argument is a ‘long double’.
 
   Here are some examples showing how numbers print using the various
floating-point conversions.  All of the numbers were printed using this
template string:
 
     "|%13.4a|%13.4f|%13.4e|%13.4g|\n"
 
   Here is the output:
 
     |  0x0.0000p+0|       0.0000|   0.0000e+00|            0|
     |  0x1.0000p-1|       0.5000|   5.0000e-01|          0.5|
     |  0x1.0000p+0|       1.0000|   1.0000e+00|            1|
     | -0x1.0000p+0|      -1.0000|  -1.0000e+00|           -1|
     |  0x1.9000p+6|     100.0000|   1.0000e+02|          100|
     |  0x1.f400p+9|    1000.0000|   1.0000e+03|         1000|
     | 0x1.3880p+13|   10000.0000|   1.0000e+04|        1e+04|
     | 0x1.81c8p+13|   12345.0000|   1.2345e+04|    1.234e+04|
     | 0x1.86a0p+16|  100000.0000|   1.0000e+05|        1e+05|
     | 0x1.e240p+16|  123456.0000|   1.2346e+05|    1.235e+05|
 
   Notice how the ‘%g’ conversion drops trailing zeros.
 
 
File: libc.info,  Node: Other Output Conversions,  Next: Formatted Output Functions,  Prev: Floating-Point Conversions,  Up: Formatted Output
 
12.12.6 Other Output Conversions
--------------------------------
 
This section describes miscellaneous conversions for ‘printf’.
 
   The ‘%c’ conversion prints a single character.  In case there is no
‘l’ modifier the ‘int’ argument is first converted to an ‘unsigned
char’.  Then, if used in a wide stream function, the character is
converted into the corresponding wide character.  The ‘-’ flag can be
used to specify left-justification in the field, but no other flags are
defined, and no precision or type modifier can be given.  For example:
 
     printf ("%c%c%c%c%c", 'h', 'e', 'l', 'l', 'o');
 
prints ‘hello’.
 
   If there is an ‘l’ modifier present the argument is expected to be of
type ‘wint_t’.  If used in a multibyte function the wide character is
converted into a multibyte character before being added to the output.
In this case more than one output byte can be produced.
 
   The ‘%s’ conversion prints a string.  If no ‘l’ modifier is present
the corresponding argument must be of type ‘char *’ (or ‘const char *’).
If used in a wide stream function the string is first converted to a
wide character string.  A precision can be specified to indicate the
maximum number of characters to write; otherwise characters in the
string up to but not including the terminating null character are
written to the output stream.  The ‘-’ flag can be used to specify
left-justification in the field, but no other flags or type modifiers
are defined for this conversion.  For example:
 
     printf ("%3s%-6s", "no", "where");
 
prints ‘ nowhere ’.
 
   If there is an ‘l’ modifier present, the argument is expected to be
of type ‘wchar_t’ (or ‘const wchar_t *’).
 
   If you accidentally pass a null pointer as the argument for a ‘%s’
conversion, the GNU C Library prints it as ‘(null)’.  We think this is
more useful than crashing.  But it’s not good practice to pass a null
argument intentionally.
 
   The ‘%m’ conversion prints the string corresponding to the error code
in ‘errno’.  *Note Error Messages::.  Thus:
 
     fprintf (stderr, "can't open `%s': %m\n", filename);
 
is equivalent to:
 
     fprintf (stderr, "can't open `%s': %s\n", filename, strerror (errno));
 
The ‘%m’ conversion is a GNU C Library extension.
 
   The ‘%p’ conversion prints a pointer value.  The corresponding
argument must be of type ‘void *’.  In practice, you can use any type of
pointer.
 
   In the GNU C Library, non-null pointers are printed as unsigned
integers, as if a ‘%#x’ conversion were used.  Null pointers print as
‘(nil)’.  (Pointers might print differently in other systems.)
 
   For example:
 
     printf ("%p", "testing");
 
prints ‘0x’ followed by a hexadecimal number—the address of the string
constant ‘"testing"’.  It does not print the word ‘testing’.
 
   You can supply the ‘-’ flag with the ‘%p’ conversion to specify
left-justification, but no other flags, precision, or type modifiers are
defined.
 
   The ‘%n’ conversion is unlike any of the other output conversions.
It uses an argument which must be a pointer to an ‘int’, but instead of
printing anything it stores the number of characters printed so far by
this call at that location.  The ‘h’ and ‘l’ type modifiers are
permitted to specify that the argument is of type ‘short int *’ or ‘long
int *’ instead of ‘int *’, but no flags, field width, or precision are
permitted.
 
   For example,
 
     int nchar;
     printf ("%d %s%n\n", 3, "bears", &nchar);
 
prints:
 
     3 bears
 
and sets ‘nchar’ to ‘7’, because ‘3 bears’ is seven characters.
 
   The ‘%%’ conversion prints a literal ‘%’ character.  This conversion
doesn’t use an argument, and no flags, field width, precision, or type
modifiers are permitted.
 
 
File: libc.info,  Node: Formatted Output Functions,  Next: Dynamic Output,  Prev: Other Output Conversions,  Up: Formatted Output
 
12.12.7 Formatted Output Functions
----------------------------------
 
This section describes how to call ‘printf’ and related functions.
Prototypes for these functions are in the header file ‘stdio.h’.
Because these functions take a variable number of arguments, you _must_
declare prototypes for them before using them.  Of course, the easiest
way to make sure you have all the right prototypes is to just include
‘stdio.h’.
 
 -- Function: int printf (const char *TEMPLATE, …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     The ‘printf’ function prints the optional arguments under the
     control of the template string TEMPLATE to the stream ‘stdout’.  It
     returns the number of characters printed, or a negative value if
     there was an output error.
 
 -- Function: int wprintf (const wchar_t *TEMPLATE, …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     The ‘wprintf’ function prints the optional arguments under the
     control of the wide template string TEMPLATE to the stream
     ‘stdout’.  It returns the number of wide characters printed, or a
     negative value if there was an output error.
 
 -- Function: int fprintf (FILE *STREAM, const char *TEMPLATE, …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     This function is just like ‘printf’, except that the output is
     written to the stream STREAM instead of ‘stdout’.
 
 -- Function: int fwprintf (FILE *STREAM, const wchar_t *TEMPLATE, …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     This function is just like ‘wprintf’, except that the output is
     written to the stream STREAM instead of ‘stdout’.
 
 -- Function: int sprintf (char *S, const char *TEMPLATE, …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
     *Note POSIX Safety Concepts::.
 
     This is like ‘printf’, except that the output is stored in the
     character array S instead of written to a stream.  A null character
     is written to mark the end of the string.
 
     The ‘sprintf’ function returns the number of characters stored in
     the array S, not including the terminating null character.
 
     The behavior of this function is undefined if copying takes place
     between objects that overlap—for example, if S is also given as an
     argument to be printed under control of the ‘%s’ conversion.  *Note
     Copying Strings and Arrays::.
 
     *Warning:* The ‘sprintf’ function can be *dangerous* because it can
     potentially output more characters than can fit in the allocation
     size of the string S.  Remember that the field width given in a
     conversion specification is only a _minimum_ value.
 
     To avoid this problem, you can use ‘snprintf’ or ‘asprintf’,
     described below.
 
 -- Function: int swprintf (wchar_t *WS, size_t SIZE, const wchar_t
          *TEMPLATE, …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
     *Note POSIX Safety Concepts::.
 
     This is like ‘wprintf’, except that the output is stored in the
     wide character array WS instead of written to a stream.  A null
     wide character is written to mark the end of the string.  The SIZE
     argument specifies the maximum number of characters to produce.
     The trailing null character is counted towards this limit, so you
     should allocate at least SIZE wide characters for the string WS.
 
     The return value is the number of characters generated for the
     given input, excluding the trailing null.  If not all output fits
     into the provided buffer a negative value is returned.  You should
     try again with a bigger output string.  _Note:_ this is different
     from how ‘snprintf’ handles this situation.
 
     Note that the corresponding narrow stream function takes fewer
     parameters.  ‘swprintf’ in fact corresponds to the ‘snprintf’
     function.  Since the ‘sprintf’ function can be dangerous and should
     be avoided the ISO C committee refused to make the same mistake
     again and decided to not define a function exactly corresponding to
     ‘sprintf’.
 
 -- Function: int snprintf (char *S, size_t SIZE, const char *TEMPLATE,
          …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
     *Note POSIX Safety Concepts::.
 
     The ‘snprintf’ function is similar to ‘sprintf’, except that the
     SIZE argument specifies the maximum number of characters to
     produce.  The trailing null character is counted towards this
     limit, so you should allocate at least SIZE characters for the
     string S.  If SIZE is zero, nothing, not even the null byte, shall
     be written and S may be a null pointer.
 
     The return value is the number of characters which would be
     generated for the given input, excluding the trailing null.  If
     this value is greater than or equal to SIZE, not all characters
     from the result have been stored in S.  You should try again with a
     bigger output string.  Here is an example of doing this:
 
          /* Construct a message describing the value of a variable
             whose name is NAME and whose value is VALUE. */
          char *
          make_message (char *name, char *value)
          {
            /* Guess we need no more than 100 chars of space. */
            int size = 100;
            char *buffer = (char *) xmalloc (size);
            int nchars;
            if (buffer == NULL)
              return NULL;
 
           /* Try to print in the allocated space. */
            nchars = snprintf (buffer, size, "value of %s is %s",
                       name, value);
            if (nchars >= size)
              {
                /* Reallocate buffer now that we know
               how much space is needed. */
                size = nchars + 1;
                buffer = (char *) xrealloc (buffer, size);
 
                if (buffer != NULL)
              /* Try again. */
              snprintf (buffer, size, "value of %s is %s",
                    name, value);
              }
            /* The last call worked, return the string. */
            return buffer;
          }
 
     In practice, it is often easier just to use ‘asprintf’, below.
 
     *Attention:* In versions of the GNU C Library prior to 2.1 the
     return value is the number of characters stored, not including the
     terminating null; unless there was not enough space in S to store
     the result in which case ‘-1’ is returned.  This was changed in
     order to comply with the ISO C99 standard.
 
 
File: libc.info,  Node: Dynamic Output,  Next: Variable Arguments Output,  Prev: Formatted Output Functions,  Up: Formatted Output
 
12.12.8 Dynamically Allocating Formatted Output
-----------------------------------------------
 
The functions in this section do formatted output and place the results
in dynamically allocated memory.
 
 -- Function: int asprintf (char **PTR, const char *TEMPLATE, …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
     *Note POSIX Safety Concepts::.
 
     This function is similar to ‘sprintf’, except that it dynamically
     allocates a string (as with ‘malloc’; *note Unconstrained
     Allocation::) to hold the output, instead of putting the output in
     a buffer you allocate in advance.  The PTR argument should be the
     address of a ‘char *’ object, and a successful call to ‘asprintf’
     stores a pointer to the newly allocated string at that location.
 
     The return value is the number of characters allocated for the
     buffer, or less than zero if an error occurred.  Usually this means
     that the buffer could not be allocated.
 
     Here is how to use ‘asprintf’ to get the same result as the
     ‘snprintf’ example, but more easily:
 
          /* Construct a message describing the value of a variable
             whose name is NAME and whose value is VALUE. */
          char *
          make_message (char *name, char *value)
          {
            char *result;
            if (asprintf (&result, "value of %s is %s", name, value) < 0)
              return NULL;
            return result;
          }
 
 -- Function: int obstack_printf (struct obstack *OBSTACK, const char
          *TEMPLATE, …)
 
     Preliminary: | MT-Safe race:obstack locale | AS-Unsafe corrupt heap
     | AC-Unsafe corrupt mem | *Note POSIX Safety Concepts::.
 
     This function is similar to ‘asprintf’, except that it uses the
     obstack OBSTACK to allocate the space.  *Note Obstacks::.
 
     The characters are written onto the end of the current object.  To
     get at them, you must finish the object with ‘obstack_finish’
     (*note Growing Objects::).
 
 
File: libc.info,  Node: Variable Arguments Output,  Next: Parsing a Template String,  Prev: Dynamic Output,  Up: Formatted Output
 
12.12.9 Variable Arguments Output Functions
-------------------------------------------
 
The functions ‘vprintf’ and friends are provided so that you can define
your own variadic ‘printf’-like functions that make use of the same
internals as the built-in formatted output functions.
 
   The most natural way to define such functions would be to use a
language construct to say, “Call ‘printf’ and pass this template plus
all of my arguments after the first five.” But there is no way to do
this in C, and it would be hard to provide a way, since at the C
language level there is no way to tell how many arguments your function
received.
 
   Since that method is impossible, we provide alternative functions,
the ‘vprintf’ series, which lets you pass a ‘va_list’ to describe “all
of my arguments after the first five.”
 
   When it is sufficient to define a macro rather than a real function,
the GNU C compiler provides a way to do this much more easily with
macros.  For example:
 
     #define myprintf(a, b, c, d, e, rest...) \
             printf (mytemplate , ## rest)
 
*Note (cpp)Variadic Macros::, for details.  But this is limited to
macros, and does not apply to real functions at all.
 
   Before calling ‘vprintf’ or the other functions listed in this
section, you _must_ call ‘va_start’ (*note Variadic Functions::) to
initialize a pointer to the variable arguments.  Then you can call
‘va_arg’ to fetch the arguments that you want to handle yourself.  This
advances the pointer past those arguments.
 
   Once your ‘va_list’ pointer is pointing at the argument of your
choice, you are ready to call ‘vprintf’.  That argument and all
subsequent arguments that were passed to your function are used by
‘vprintf’ along with the template that you specified separately.
 
   *Portability Note:* The value of the ‘va_list’ pointer is
undetermined after the call to ‘vprintf’, so you must not use ‘va_arg’
after you call ‘vprintf’.  Instead, you should call ‘va_end’ to retire
the pointer from service.  You can call ‘va_start’ again and begin
fetching the arguments from the start of the variable argument list.
(Alternatively, you can use ‘va_copy’ to make a copy of the ‘va_list’
pointer before calling ‘vfprintf’.)  Calling ‘vprintf’ does not destroy
the argument list of your function, merely the particular pointer that
you passed to it.
 
   Prototypes for these functions are declared in ‘stdio.h’.
 
 -- Function: int vprintf (const char *TEMPLATE, va_list AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     This function is similar to ‘printf’ except that, instead of taking
     a variable number of arguments directly, it takes an argument list
     pointer AP.
 
 -- Function: int vwprintf (const wchar_t *TEMPLATE, va_list AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     This function is similar to ‘wprintf’ except that, instead of
     taking a variable number of arguments directly, it takes an
     argument list pointer AP.
 
 -- Function: int vfprintf (FILE *STREAM, const char *TEMPLATE, va_list
          AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     This is the equivalent of ‘fprintf’ with the variable argument list
     specified directly as for ‘vprintf’.
 
 -- Function: int vfwprintf (FILE *STREAM, const wchar_t *TEMPLATE,
          va_list AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     This is the equivalent of ‘fwprintf’ with the variable argument
     list specified directly as for ‘vwprintf’.
 
 -- Function: int vsprintf (char *S, const char *TEMPLATE, va_list AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
     *Note POSIX Safety Concepts::.
 
     This is the equivalent of ‘sprintf’ with the variable argument list
     specified directly as for ‘vprintf’.
 
 -- Function: int vswprintf (wchar_t *WS, size_t SIZE, const wchar_t
          *TEMPLATE, va_list AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
     *Note POSIX Safety Concepts::.
 
     This is the equivalent of ‘swprintf’ with the variable argument
     list specified directly as for ‘vwprintf’.
 
 -- Function: int vsnprintf (char *S, size_t SIZE, const char *TEMPLATE,
          va_list AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
     *Note POSIX Safety Concepts::.
 
     This is the equivalent of ‘snprintf’ with the variable argument
     list specified directly as for ‘vprintf’.
 
 -- Function: int vasprintf (char **PTR, const char *TEMPLATE, va_list
          AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
     *Note POSIX Safety Concepts::.
 
     The ‘vasprintf’ function is the equivalent of ‘asprintf’ with the
     variable argument list specified directly as for ‘vprintf’.
 
 -- Function: int obstack_vprintf (struct obstack *OBSTACK, const char
          *TEMPLATE, va_list AP)
 
     Preliminary: | MT-Safe race:obstack locale | AS-Unsafe corrupt heap
     | AC-Unsafe corrupt mem | *Note POSIX Safety Concepts::.
 
     The ‘obstack_vprintf’ function is the equivalent of
     ‘obstack_printf’ with the variable argument list specified directly
     as for ‘vprintf’.
 
   Here’s an example showing how you might use ‘vfprintf’.  This is a
function that prints error messages to the stream ‘stderr’, along with a
prefix indicating the name of the program (*note Error Messages::, for a
description of ‘program_invocation_short_name’).
 
     #include <stdio.h>
     #include <stdarg.h>
 
     void
     eprintf (const char *template, ...)
     {
       va_list ap;
       extern char *program_invocation_short_name;
 
       fprintf (stderr, "%s: ", program_invocation_short_name);
       va_start (ap, template);
       vfprintf (stderr, template, ap);
       va_end (ap);
     }
 
You could call ‘eprintf’ like this:
 
     eprintf ("file `%s' does not exist\n", filename);
 
   In GNU C, there is a special construct you can use to let the
compiler know that a function uses a ‘printf’-style format string.  Then
it can check the number and types of arguments in each call to the
function, and warn you when they do not match the format string.  For
example, take this declaration of ‘eprintf’:
 
     void eprintf (const char *template, ...)
         __attribute__ ((format (printf, 1, 2)));
 
This tells the compiler that ‘eprintf’ uses a format string like
‘printf’ (as opposed to ‘scanf’; *note Formatted Input::); the format
string appears as the first argument; and the arguments to satisfy the
format begin with the second.  *Note Declaring Attributes of Functions:
(gcc)Function Attributes, for more information.
 
 
File: libc.info,  Node: Parsing a Template String,  Next: Example of Parsing,  Prev: Variable Arguments Output,  Up: Formatted Output
 
12.12.10 Parsing a Template String
----------------------------------
 
You can use the function ‘parse_printf_format’ to obtain information
about the number and types of arguments that are expected by a given
template string.  This function permits interpreters that provide
interfaces to ‘printf’ to avoid passing along invalid arguments from the
user’s program, which could cause a crash.
 
   All the symbols described in this section are declared in the header
file ‘printf.h’.
 
 -- Function: size_t parse_printf_format (const char *TEMPLATE, size_t
          N, int *ARGTYPES)
 
     Preliminary: | MT-Safe locale | AS-Safe | AC-Safe | *Note POSIX
     Safety Concepts::.
 
     This function returns information about the number and types of
     arguments expected by the ‘printf’ template string TEMPLATE.  The
     information is stored in the array ARGTYPES; each element of this
     array describes one argument.  This information is encoded using
     the various ‘PA_’ macros, listed below.
 
     The argument N specifies the number of elements in the array
     ARGTYPES.  This is the maximum number of elements that
     ‘parse_printf_format’ will try to write.
 
     ‘parse_printf_format’ returns the total number of arguments
     required by TEMPLATE.  If this number is greater than N, then the
     information returned describes only the first N arguments.  If you
     want information about additional arguments, allocate a bigger
     array and call ‘parse_printf_format’ again.
 
   The argument types are encoded as a combination of a basic type and
modifier flag bits.
 
 -- Macro: int PA_FLAG_MASK
 
     This macro is a bitmask for the type modifier flag bits.  You can
     write the expression ‘(argtypes[i] & PA_FLAG_MASK)’ to extract just
     the flag bits for an argument, or ‘(argtypes[i] & ~PA_FLAG_MASK)’
     to extract just the basic type code.
 
   Here are symbolic constants that represent the basic types; they
stand for integer values.
 
‘PA_INT’
 
     This specifies that the base type is ‘int’.
 
‘PA_CHAR’
 
     This specifies that the base type is ‘int’, cast to ‘char’.
 
‘PA_STRING’
 
     This specifies that the base type is ‘char *’, a null-terminated
     string.
 
‘PA_POINTER’
 
     This specifies that the base type is ‘void *’, an arbitrary
     pointer.
 
‘PA_FLOAT’
 
     This specifies that the base type is ‘float’.
 
‘PA_DOUBLE’
 
     This specifies that the base type is ‘double’.
 
‘PA_LAST’
 
     You can define additional base types for your own programs as
     offsets from ‘PA_LAST’.  For example, if you have data types ‘foo’
     and ‘bar’ with their own specialized ‘printf’ conversions, you
     could define encodings for these types as:
 
          #define PA_FOO  PA_LAST
          #define PA_BAR  (PA_LAST + 1)
 
   Here are the flag bits that modify a basic type.  They are combined
with the code for the basic type using inclusive-or.
 
‘PA_FLAG_PTR’
 
     If this bit is set, it indicates that the encoded type is a pointer
     to the base type, rather than an immediate value.  For example,
     ‘PA_INT|PA_FLAG_PTR’ represents the type ‘int *’.
 
‘PA_FLAG_SHORT’
 
     If this bit is set, it indicates that the base type is modified
     with ‘short’.  (This corresponds to the ‘h’ type modifier.)
 
‘PA_FLAG_LONG’
 
     If this bit is set, it indicates that the base type is modified
     with ‘long’.  (This corresponds to the ‘l’ type modifier.)
 
‘PA_FLAG_LONG_LONG’
 
     If this bit is set, it indicates that the base type is modified
     with ‘long long’.  (This corresponds to the ‘L’ type modifier.)
 
‘PA_FLAG_LONG_DOUBLE’
 
     This is a synonym for ‘PA_FLAG_LONG_LONG’, used by convention with
     a base type of ‘PA_DOUBLE’ to indicate a type of ‘long double’.
 
   For an example of using these facilities, see *note Example of
Parsing::.
 
 
File: libc.info,  Node: Example of Parsing,  Prev: Parsing a Template String,  Up: Formatted Output
 
12.12.11 Example of Parsing a Template String
---------------------------------------------
 
Here is an example of decoding argument types for a format string.  We
assume this is part of an interpreter which contains arguments of type
‘NUMBER’, ‘CHAR’, ‘STRING’ and ‘STRUCTURE’ (and perhaps others which are
not valid here).
 
     /* Test whether the NARGS specified objects
        in the vector ARGS are valid
        for the format string FORMAT:
        if so, return 1.
        If not, return 0 after printing an error message.  */
 
     int
     validate_args (char *format, int nargs, OBJECT *args)
     {
       int *argtypes;
       int nwanted;
 
       /* Get the information about the arguments.
          Each conversion specification must be at least two characters
          long, so there cannot be more specifications than half the
          length of the string.  */
 
       argtypes = (int *) alloca (strlen (format) / 2 * sizeof (int));
       nwanted = parse_printf_format (format, nargs, argtypes);
 
       /* Check the number of arguments.  */
       if (nwanted > nargs)
         {
           error ("too few arguments (at least %d required)", nwanted);
           return 0;
         }
 
       /* Check the C type wanted for each argument
          and see if the object given is suitable.  */
       for (i = 0; i < nwanted; i++)
         {
           int wanted;
 
           if (argtypes[i] & PA_FLAG_PTR)
         wanted = STRUCTURE;
           else
         switch (argtypes[i] & ~PA_FLAG_MASK)
          {
           case PA_INT:
           case PA_FLOAT:
           case PA_DOUBLE:
             wanted = NUMBER;
             break;
           case PA_CHAR:
             wanted = CHAR;
             break;
           case PA_STRING:
             wanted = STRING;
             break;
           case PA_POINTER:
             wanted = STRUCTURE;
             break;
          }
           if (TYPE (args[i]) != wanted)
        {
           error ("type mismatch for arg number %d", i);
           return 0;
        }
         }
       return 1;
     }
 
 
File: libc.info,  Node: Customizing Printf,  Next: Formatted Input,  Prev: Formatted Output,  Up: I/O on Streams
 
12.13 Customizing ‘printf’
==========================
 
The GNU C Library lets you define your own custom conversion specifiers
for ‘printf’ template strings, to teach ‘printf’ clever ways to print
the important data structures of your program.
 
   The way you do this is by registering the conversion with the
function ‘register_printf_function’; see *note Registering New
Conversions::.  One of the arguments you pass to this function is a
pointer to a handler function that produces the actual output; see *note
Defining the Output Handler::, for information on how to write this
function.
 
   You can also install a function that just returns information about
the number and type of arguments expected by the conversion specifier.
*Note Parsing a Template String::, for information about this.
 
   The facilities of this section are declared in the header file
‘printf.h’.
 
* Menu:
 
* Registering New Conversions::         Using ‘register_printf_function’
                    to register a new output conversion.
* Conversion Specifier Options::        The handler must be able to get
                    the options specified in the
                    template when it is called.
* Defining the Output Handler::         Defining the handler and arginfo
                    functions that are passed as arguments
                    to ‘register_printf_function’.
* Printf Extension Example::            How to define a ‘printf’
                    handler function.
* Predefined Printf Handlers::          Predefined ‘printf’ handlers.
 
   *Portability Note:* The ability to extend the syntax of ‘printf’
template strings is a GNU extension.  ISO standard C has nothing
similar.  When using the GNU C compiler or any other compiler that
interprets calls to standard I/O functions according to the rules of the
language standard it is necessary to disable such handling by the
appropriate compiler option.  Otherwise the behavior of a program that
relies on the extension is undefined.
 
 
File: libc.info,  Node: Registering New Conversions,  Next: Conversion Specifier Options,  Up: Customizing Printf
 
12.13.1 Registering New Conversions
-----------------------------------
 
The function to register a new output conversion is
‘register_printf_function’, declared in ‘printf.h’.
 
 -- Function: int register_printf_function (int SPEC, printf_function
          HANDLER-FUNCTION, printf_arginfo_function ARGINFO-FUNCTION)
 
     Preliminary: | MT-Unsafe const:printfext | AS-Unsafe heap lock |
     AC-Unsafe mem lock | *Note POSIX Safety Concepts::.
 
     This function defines the conversion specifier character SPEC.
     Thus, if SPEC is ‘'Y'’, it defines the conversion ‘%Y’.  You can
     redefine the built-in conversions like ‘%s’, but flag characters
     like ‘#’ and type modifiers like ‘l’ can never be used as
     conversions; calling ‘register_printf_function’ for those
     characters has no effect.  It is advisable not to use lowercase
     letters, since the ISO C standard warns that additional lowercase
     letters may be standardized in future editions of the standard.
 
     The HANDLER-FUNCTION is the function called by ‘printf’ and friends
     when this conversion appears in a template string.  *Note Defining
     the Output Handler::, for information about how to define a
     function to pass as this argument.  If you specify a null pointer,
     any existing handler function for SPEC is removed.
 
     The ARGINFO-FUNCTION is the function called by
     ‘parse_printf_format’ when this conversion appears in a template
     string.  *Note Parsing a Template String::, for information about
     this.
 
     *Attention:* In the GNU C Library versions before 2.0 the
     ARGINFO-FUNCTION function did not need to be installed unless the
     user used the ‘parse_printf_format’ function.  This has changed.
     Now a call to any of the ‘printf’ functions will call this function
     when this format specifier appears in the format string.
 
     The return value is ‘0’ on success, and ‘-1’ on failure (which
     occurs if SPEC is out of range).
 
     *Portability Note:* It is possible to redefine the standard output
     conversions but doing so is strongly discouraged because it may
     interfere with the behavior of programs and compiler
     implementations that assume the effects of the conversions conform
     to the relevant language standards.  In addition, conforming
     compilers need not guarantee that the function registered for a
     standard conversion will be called for each such conversion in
     every format string in a program.
 
 
File: libc.info,  Node: Conversion Specifier Options,  Next: Defining the Output Handler,  Prev: Registering New Conversions,  Up: Customizing Printf
 
12.13.2 Conversion Specifier Options
------------------------------------
 
If you define a meaning for ‘%A’, what if the template contains ‘%+23A’
or ‘%-#A’?  To implement a sensible meaning for these, the handler when
called needs to be able to get the options specified in the template.
 
   Both the HANDLER-FUNCTION and ARGINFO-FUNCTION accept an argument
that points to a ‘struct printf_info’, which contains information about
the options appearing in an instance of the conversion specifier.  This
data type is declared in the header file ‘printf.h’.
 
 -- Type: struct printf_info
 
     This structure is used to pass information about the options
     appearing in an instance of a conversion specifier in a ‘printf’
     template string to the handler and arginfo functions for that
     specifier.  It contains the following members:
 
     ‘int prec’
          This is the precision specified.  The value is ‘-1’ if no
          precision was specified.  If the precision was given as ‘*’,
          the ‘printf_info’ structure passed to the handler function
          contains the actual value retrieved from the argument list.
          But the structure passed to the arginfo function contains a
          value of ‘INT_MIN’, since the actual value is not known.
 
     ‘int width’
          This is the minimum field width specified.  The value is ‘0’
          if no width was specified.  If the field width was given as
          ‘*’, the ‘printf_info’ structure passed to the handler
          function contains the actual value retrieved from the argument
          list.  But the structure passed to the arginfo function
          contains a value of ‘INT_MIN’, since the actual value is not
          known.
 
     ‘wchar_t spec’
          This is the conversion specifier character specified.  It’s
          stored in the structure so that you can register the same
          handler function for multiple characters, but still have a way
          to tell them apart when the handler function is called.
 
     ‘unsigned int is_long_double’
          This is a boolean that is true if the ‘L’, ‘ll’, or ‘q’ type
          modifier was specified.  For integer conversions, this
          indicates ‘long long int’, as opposed to ‘long double’ for
          floating point conversions.
 
     ‘unsigned int is_char’
          This is a boolean that is true if the ‘hh’ type modifier was
          specified.
 
     ‘unsigned int is_short’
          This is a boolean that is true if the ‘h’ type modifier was
          specified.
 
     ‘unsigned int is_long’
          This is a boolean that is true if the ‘l’ type modifier was
          specified.
 
     ‘unsigned int alt’
          This is a boolean that is true if the ‘#’ flag was specified.
 
     ‘unsigned int space’
          This is a boolean that is true if the ‘ ’ flag was specified.
 
     ‘unsigned int left’
          This is a boolean that is true if the ‘-’ flag was specified.
 
     ‘unsigned int showsign’
          This is a boolean that is true if the ‘+’ flag was specified.
 
     ‘unsigned int group’
          This is a boolean that is true if the ‘'’ flag was specified.
 
     ‘unsigned int extra’
          This flag has a special meaning depending on the context.  It
          could be used freely by the user-defined handlers but when
          called from the ‘printf’ function this variable always
          contains the value ‘0’.
 
     ‘unsigned int wide’
          This flag is set if the stream is wide oriented.
 
     ‘wchar_t pad’
          This is the character to use for padding the output to the
          minimum field width.  The value is ‘'0'’ if the ‘0’ flag was
          specified, and ‘' '’ otherwise.
 
 
File: libc.info,  Node: Defining the Output Handler,  Next: Printf Extension Example,  Prev: Conversion Specifier Options,  Up: Customizing Printf
 
12.13.3 Defining the Output Handler
-----------------------------------
 
Now let’s look at how to define the handler and arginfo functions which
are passed as arguments to ‘register_printf_function’.
 
   *Compatibility Note:* The interface changed in the GNU C Library
version 2.0.  Previously the third argument was of type ‘va_list *’.
 
   You should define your handler functions with a prototype like:
 
     int FUNCTION (FILE *stream, const struct printf_info *info,
                 const void *const *args)
 
   The STREAM argument passed to the handler function is the stream to
which it should write output.
 
   The INFO argument is a pointer to a structure that contains
information about the various options that were included with the
conversion in the template string.  You should not modify this structure
inside your handler function.  *Note Conversion Specifier Options::, for
a description of this data structure.
 
   The ARGS is a vector of pointers to the arguments data.  The number
of arguments was determined by calling the argument information function
provided by the user.
 
   Your handler function should return a value just like ‘printf’ does:
it should return the number of characters it has written, or a negative
value to indicate an error.
 
 -- Data Type: printf_function
 
     This is the data type that a handler function should have.
 
   If you are going to use ‘parse_printf_format’ in your application,
you must also define a function to pass as the ARGINFO-FUNCTION argument
for each new conversion you install with ‘register_printf_function’.
 
   You have to define these functions with a prototype like:
 
     int FUNCTION (const struct printf_info *info,
                 size_t n, int *argtypes)
 
   The return value from the function should be the number of arguments
the conversion expects.  The function should also fill in no more than N
elements of the ARGTYPES array with information about the types of each
of these arguments.  This information is encoded using the various ‘PA_’
macros.  (You will notice that this is the same calling convention
‘parse_printf_format’ itself uses.)
 
 -- Data Type: printf_arginfo_function
 
     This type is used to describe functions that return information
     about the number and type of arguments used by a conversion
     specifier.
 
 
File: libc.info,  Node: Printf Extension Example,  Next: Predefined Printf Handlers,  Prev: Defining the Output Handler,  Up: Customizing Printf
 
12.13.4 ‘printf’ Extension Example
----------------------------------
 
Here is an example showing how to define a ‘printf’ handler function.
This program defines a data structure called a ‘Widget’ and defines the
‘%W’ conversion to print information about ‘Widget *’ arguments,
including the pointer value and the name stored in the data structure.
The ‘%W’ conversion supports the minimum field width and
left-justification options, but ignores everything else.
 
 
     #include <stdio.h>
     #include <stdlib.h>
     #include <printf.h>
 
     typedef struct
     {
       char *name;
     }
     Widget;
 
     int
     print_widget (FILE *stream,
                   const struct printf_info *info,
                   const void *const *args)
     {
       const Widget *w;
       char *buffer;
       int len;
 
       /* Format the output into a string. */
       w = *((const Widget **) (args[0]));
       len = asprintf (&buffer, "<Widget %p: %s>", w, w->name);
       if (len == -1)
         return -1;
 
       /* Pad to the minimum field width and print to the stream. */
       len = fprintf (stream, "%*s",
                      (info->left ? -info->width : info->width),
                      buffer);
 
       /* Clean up and return. */
       free (buffer);
       return len;
     }
 
 
     int
     print_widget_arginfo (const struct printf_info *info, size_t n,
                           int *argtypes)
     {
       /* We always take exactly one argument and this is a pointer to the
          structure.. */
       if (n > 0)
         argtypes[0] = PA_POINTER;
       return 1;
     }
 
 
     int
     main (void)
     {
       /* Make a widget to print. */
       Widget mywidget;
       mywidget.name = "mywidget";
 
       /* Register the print function for widgets. */
       register_printf_function ('W', print_widget, print_widget_arginfo);
 
       /* Now print the widget. */
       printf ("|%W|\n", &mywidget);
       printf ("|%35W|\n", &mywidget);
       printf ("|%-35W|\n", &mywidget);
 
       return 0;
     }
 
   The output produced by this program looks like:
 
     |<Widget 0xffeffb7c: mywidget>|
     |      <Widget 0xffeffb7c: mywidget>|
     |<Widget 0xffeffb7c: mywidget>      |
 
 
File: libc.info,  Node: Predefined Printf Handlers,  Prev: Printf Extension Example,  Up: Customizing Printf
 
12.13.5 Predefined ‘printf’ Handlers
------------------------------------
 
The GNU C Library also contains a concrete and useful application of the
‘printf’ handler extension.  There are two functions available which
implement a special way to print floating-point numbers.
 
 -- Function: int printf_size (FILE *FP, const struct printf_info *INFO,
          const void *const *ARGS)
 
     Preliminary: | MT-Safe race:fp locale | AS-Unsafe corrupt heap |
     AC-Unsafe mem corrupt | *Note POSIX Safety Concepts::.
 
     Print a given floating point number as for the format ‘%f’ except
     that there is a postfix character indicating the divisor for the
     number to make this less than 1000.  There are two possible
     divisors: powers of 1024 or powers of 1000.  Which one is used
     depends on the format character specified while registered this
     handler.  If the character is of lower case, 1024 is used.  For
     upper case characters, 1000 is used.
 
     The postfix tag corresponds to bytes, kilobytes, megabytes,
     gigabytes, etc.  The full table is:
 
     low   Multiplier    From    Upper   Multiplier
     ’ ’   1                     ’ ’     1
     k     2^10 (1024)   kilo    K       10^3 (1000)
     m     2^20          mega    M       10^6
     g     2^30          giga    G       10^9
     t     2^40          tera    T       10^12
     p     2^50          peta    P       10^15
     e     2^60          exa     E       10^18
     z     2^70          zetta   Z       10^21
     y     2^80          yotta   Y       10^24
 
     The default precision is 3, i.e., 1024 is printed with a lower-case
     format character as if it were ‘%.3fk’ and will yield ‘1.000k’.
 
   Due to the requirements of ‘register_printf_function’ we must also
provide the function which returns information about the arguments.
 
 -- Function: int printf_size_info (const struct printf_info *INFO,
          size_t N, int *ARGTYPES)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
     Concepts::.
 
     This function will return in ARGTYPES the information about the
     used parameters in the way the ‘vfprintf’ implementation expects
     it.  The format always takes one argument.
 
   To use these functions both functions must be registered with a call
like
 
     register_printf_function ('B', printf_size, printf_size_info);
 
   Here we register the functions to print numbers as powers of 1000
since the format character ‘'B'’ is an upper-case character.  If we
would additionally use ‘'b'’ in a line like
 
     register_printf_function ('b', printf_size, printf_size_info);
 
we could also print using a power of 1024.  Please note that all that is
different in these two lines is the format specifier.  The ‘printf_size’
function knows about the difference between lower and upper case format
specifiers.
 
   The use of ‘'B'’ and ‘'b'’ is no coincidence.  Rather it is the
preferred way to use this functionality since it is available on some
other systems which also use format specifiers.
 
 
File: libc.info,  Node: Formatted Input,  Next: EOF and Errors,  Prev: Customizing Printf,  Up: I/O on Streams
 
12.14 Formatted Input
=====================
 
The functions described in this section (‘scanf’ and related functions)
provide facilities for formatted input analogous to the formatted output
facilities.  These functions provide a mechanism for reading arbitrary
values under the control of a "format string" or "template string".
 
* Menu:
 
* Formatted Input Basics::      Some basics to get you started.
* Input Conversion Syntax::     Syntax of conversion specifications.
* Table of Input Conversions::  Summary of input conversions and what they do.
* Numeric Input Conversions::   Details of conversions for reading numbers.
* String Input Conversions::    Details of conversions for reading strings.
* Dynamic String Input::    String conversions that ‘malloc’ the buffer.
* Other Input Conversions::     Details of miscellaneous other conversions.
* Formatted Input Functions::   Descriptions of the actual functions.
* Variable Arguments Input::    ‘vscanf’ and friends.
 
 
File: libc.info,  Node: Formatted Input Basics,  Next: Input Conversion Syntax,  Up: Formatted Input
 
12.14.1 Formatted Input Basics
------------------------------
 
Calls to ‘scanf’ are superficially similar to calls to ‘printf’ in that
arbitrary arguments are read under the control of a template string.
While the syntax of the conversion specifications in the template is
very similar to that for ‘printf’, the interpretation of the template is
oriented more towards free-format input and simple pattern matching,
rather than fixed-field formatting.  For example, most ‘scanf’
conversions skip over any amount of “white space” (including spaces,
tabs, and newlines) in the input file, and there is no concept of
precision for the numeric input conversions as there is for the
corresponding output conversions.  Ordinarily, non-whitespace characters
in the template are expected to match characters in the input stream
exactly, but a matching failure is distinct from an input error on the
stream.
 
   Another area of difference between ‘scanf’ and ‘printf’ is that you
must remember to supply pointers rather than immediate values as the
optional arguments to ‘scanf’; the values that are read are stored in
the objects that the pointers point to.  Even experienced programmers
tend to forget this occasionally, so if your program is getting strange
errors that seem to be related to ‘scanf’, you might want to
double-check this.
 
   When a "matching failure" occurs, ‘scanf’ returns immediately,
leaving the first non-matching character as the next character to be
read from the stream.  The normal return value from ‘scanf’ is the
number of values that were assigned, so you can use this to determine if
a matching error happened before all the expected values were read.
 
   The ‘scanf’ function is typically used for things like reading in the
contents of tables.  For example, here is a function that uses ‘scanf’
to initialize an array of ‘double’:
 
     void
     readarray (double *array, int n)
     {
       int i;
       for (i=0; i<n; i++)
         if (scanf (" %lf", &(array[i])) != 1)
           invalid_input_error ();
     }
 
   The formatted input functions are not used as frequently as the
formatted output functions.  Partly, this is because it takes some care
to use them properly.  Another reason is that it is difficult to recover
from a matching error.
 
   If you are trying to read input that doesn’t match a single, fixed
pattern, you may be better off using a tool such as Flex to generate a
lexical scanner, or Bison to generate a parser, rather than using
‘scanf’.  For more information about these tools, see *note
(flex.info)Top::, and *note (bison.info)Top::.
 
 
File: libc.info,  Node: Input Conversion Syntax,  Next: Table of Input Conversions,  Prev: Formatted Input Basics,  Up: Formatted Input
 
12.14.2 Input Conversion Syntax
-------------------------------
 
A ‘scanf’ template string is a string that contains ordinary multibyte
characters interspersed with conversion specifications that start with
‘%’.
 
   Any whitespace character (as defined by the ‘isspace’ function; *note
Classification of Characters::) in the template causes any number of
whitespace characters in the input stream to be read and discarded.  The
whitespace characters that are matched need not be exactly the same
whitespace characters that appear in the template string.  For example,
write ‘ , ’ in the template to recognize a comma with optional
whitespace before and after.
 
   Other characters in the template string that are not part of
conversion specifications must match characters in the input stream
exactly; if this is not the case, a matching failure occurs.
 
   The conversion specifications in a ‘scanf’ template string have the
general form:
 
     % FLAGS WIDTH TYPE CONVERSION
 
   In more detail, an input conversion specification consists of an
initial ‘%’ character followed in sequence by:
 
   • An optional "flag character" ‘*’, which says to ignore the text
     read for this specification.  When ‘scanf’ finds a conversion
     specification that uses this flag, it reads input as directed by
     the rest of the conversion specification, but it discards this
     input, does not use a pointer argument, and does not increment the
     count of successful assignments.
 
   • An optional flag character ‘a’ (valid with string conversions only)
     which requests allocation of a buffer long enough to store the
     string in.  (This is a GNU extension.)  *Note Dynamic String
     Input::.
 
   • An optional decimal integer that specifies the "maximum field
     width".  Reading of characters from the input stream stops either
     when this maximum is reached or when a non-matching character is
     found, whichever happens first.  Most conversions discard initial
     whitespace characters (those that don’t are explicitly documented),
     and these discarded characters don’t count towards the maximum
     field width.  String input conversions store a null character to
     mark the end of the input; the maximum field width does not include
     this terminator.
 
   • An optional "type modifier character".  For example, you can
     specify a type modifier of ‘l’ with integer conversions such as
     ‘%d’ to specify that the argument is a pointer to a ‘long int’
     rather than a pointer to an ‘int’.
 
   • A character that specifies the conversion to be applied.
 
   The exact options that are permitted and how they are interpreted
vary between the different conversion specifiers.  See the descriptions
of the individual conversions for information about the particular
options that they allow.
 
   With the ‘-Wformat’ option, the GNU C compiler checks calls to
‘scanf’ and related functions.  It examines the format string and
verifies that the correct number and types of arguments are supplied.
There is also a GNU C syntax to tell the compiler that a function you
write uses a ‘scanf’-style format string.  *Note Declaring Attributes of
Functions: (gcc)Function Attributes, for more information.
 
 
File: libc.info,  Node: Table of Input Conversions,  Next: Numeric Input Conversions,  Prev: Input Conversion Syntax,  Up: Formatted Input
 
12.14.3 Table of Input Conversions
----------------------------------
 
Here is a table that summarizes the various conversion specifications:
 
‘%d’
     Matches an optionally signed integer written in decimal.  *Note
     Numeric Input Conversions::.
 
‘%i’
     Matches an optionally signed integer in any of the formats that the
     C language defines for specifying an integer constant.  *Note
     Numeric Input Conversions::.
 
‘%o’
     Matches an unsigned integer written in octal radix.  *Note Numeric
     Input Conversions::.
 
‘%u’
     Matches an unsigned integer written in decimal radix.  *Note
     Numeric Input Conversions::.
 
‘%x’, ‘%X’
     Matches an unsigned integer written in hexadecimal radix.  *Note
     Numeric Input Conversions::.
 
‘%e’, ‘%f’, ‘%g’, ‘%E’, ‘%G’
     Matches an optionally signed floating-point number.  *Note Numeric
     Input Conversions::.
 
‘%s’
 
     Matches a string containing only non-whitespace characters.  *Note
     String Input Conversions::.  The presence of the ‘l’ modifier
     determines whether the output is stored as a wide character string
     or a multibyte string.  If ‘%s’ is used in a wide character
     function the string is converted as with multiple calls to
     ‘wcrtomb’ into a multibyte string.  This means that the buffer must
     provide room for ‘MB_CUR_MAX’ bytes for each wide character read.
     In case ‘%ls’ is used in a multibyte function the result is
     converted into wide characters as with multiple calls of ‘mbrtowc’
     before being stored in the user provided buffer.
 
‘%S’
     This is an alias for ‘%ls’ which is supported for compatibility
     with the Unix standard.
 
‘%[’
     Matches a string of characters that belong to a specified set.
     *Note String Input Conversions::.  The presence of the ‘l’ modifier
     determines whether the output is stored as a wide character string
     or a multibyte string.  If ‘%[’ is used in a wide character
     function the string is converted as with multiple calls to
     ‘wcrtomb’ into a multibyte string.  This means that the buffer must
     provide room for ‘MB_CUR_MAX’ bytes for each wide character read.
     In case ‘%l[’ is used in a multibyte function the result is
     converted into wide characters as with multiple calls of ‘mbrtowc’
     before being stored in the user provided buffer.
 
‘%c’
     Matches a string of one or more characters; the number of
     characters read is controlled by the maximum field width given for
     the conversion.  *Note String Input Conversions::.
 
     If ‘%c’ is used in a wide stream function the read value is
     converted from a wide character to the corresponding multibyte
     character before storing it.  Note that this conversion can produce
     more than one byte of output and therefore the provided buffer must
     be large enough for up to ‘MB_CUR_MAX’ bytes for each character.
     If ‘%lc’ is used in a multibyte function the input is treated as a
     multibyte sequence (and not bytes) and the result is converted as
     with calls to ‘mbrtowc’.
 
‘%C’
     This is an alias for ‘%lc’ which is supported for compatibility
     with the Unix standard.
 
‘%p’
     Matches a pointer value in the same implementation-defined format
     used by the ‘%p’ output conversion for ‘printf’.  *Note Other Input
     Conversions::.
 
‘%n’
     This conversion doesn’t read any characters; it records the number
     of characters read so far by this call.  *Note Other Input
     Conversions::.
 
‘%%’
     This matches a literal ‘%’ character in the input stream.  No
     corresponding argument is used.  *Note Other Input Conversions::.
 
   If the syntax of a conversion specification is invalid, the behavior
is undefined.  If there aren’t enough function arguments provided to
supply addresses for all the conversion specifications in the template
strings that perform assignments, or if the arguments are not of the
correct types, the behavior is also undefined.  On the other hand, extra
arguments are simply ignored.
 
 
File: libc.info,  Node: Numeric Input Conversions,  Next: String Input Conversions,  Prev: Table of Input Conversions,  Up: Formatted Input
 
12.14.4 Numeric Input Conversions
---------------------------------
 
This section describes the ‘scanf’ conversions for reading numeric
values.
 
   The ‘%d’ conversion matches an optionally signed integer in decimal
radix.  The syntax that is recognized is the same as that for the
‘strtol’ function (*note Parsing of Integers::) with the value ‘10’ for
the BASE argument.
 
   The ‘%i’ conversion matches an optionally signed integer in any of
the formats that the C language defines for specifying an integer
constant.  The syntax that is recognized is the same as that for the
‘strtol’ function (*note Parsing of Integers::) with the value ‘0’ for
the BASE argument.  (You can print integers in this syntax with ‘printf’
by using the ‘#’ flag character with the ‘%x’, ‘%o’, or ‘%d’ conversion.
*Note Integer Conversions::.)
 
   For example, any of the strings ‘10’, ‘0xa’, or ‘012’ could be read
in as integers under the ‘%i’ conversion.  Each of these specifies a
number with decimal value ‘10’.
 
   The ‘%o’, ‘%u’, and ‘%x’ conversions match unsigned integers in
octal, decimal, and hexadecimal radices, respectively.  The syntax that
is recognized is the same as that for the ‘strtoul’ function (*note
Parsing of Integers::) with the appropriate value (‘8’, ‘10’, or ‘16’)
for the BASE argument.
 
   The ‘%X’ conversion is identical to the ‘%x’ conversion.  They both
permit either uppercase or lowercase letters to be used as digits.
 
   The default type of the corresponding argument for the ‘%d’ and ‘%i’
conversions is ‘int *’, and ‘unsigned int *’ for the other integer
conversions.  You can use the following type modifiers to specify other
sizes of integer:
 
‘hh’
     Specifies that the argument is a ‘signed char *’ or ‘unsigned char
     *’.
 
     This modifier was introduced in ISO C99.
 
‘h’
     Specifies that the argument is a ‘short int *’ or ‘unsigned short
     int *’.
 
‘j’
     Specifies that the argument is a ‘intmax_t *’ or ‘uintmax_t *’.
 
     This modifier was introduced in ISO C99.
 
‘l’
     Specifies that the argument is a ‘long int *’ or ‘unsigned long int
     *’.  Two ‘l’ characters is like the ‘L’ modifier, below.
 
     If used with ‘%c’ or ‘%s’ the corresponding parameter is considered
     as a pointer to a wide character or wide character string
     respectively.  This use of ‘l’ was introduced in Amendment 1 to
     ISO C90.
 
‘ll’
‘L’
‘q’
     Specifies that the argument is a ‘long long int *’ or ‘unsigned
     long long int *’.  (The ‘long long’ type is an extension supported
     by the GNU C compiler.  For systems that don’t provide extra-long
     integers, this is the same as ‘long int’.)
 
     The ‘q’ modifier is another name for the same thing, which comes
     from 4.4 BSD; a ‘long long int’ is sometimes called a “quad” ‘int’.
 
‘t’
     Specifies that the argument is a ‘ptrdiff_t *’.
 
     This modifier was introduced in ISO C99.
 
‘z’
     Specifies that the argument is a ‘size_t *’.
 
     This modifier was introduced in ISO C99.
 
   All of the ‘%e’, ‘%f’, ‘%g’, ‘%E’, and ‘%G’ input conversions are
interchangeable.  They all match an optionally signed floating point
number, in the same syntax as for the ‘strtod’ function (*note Parsing
of Floats::).
 
   For the floating-point input conversions, the default argument type
is ‘float *’.  (This is different from the corresponding output
conversions, where the default type is ‘double’; remember that ‘float’
arguments to ‘printf’ are converted to ‘double’ by the default argument
promotions, but ‘float *’ arguments are not promoted to ‘double *’.)
You can specify other sizes of float using these type modifiers:
 
‘l’
     Specifies that the argument is of type ‘double *’.
 
‘L’
     Specifies that the argument is of type ‘long double *’.
 
   For all the above number parsing formats there is an additional
optional flag ‘'’.  When this flag is given the ‘scanf’ function expects
the number represented in the input string to be formatted according to
the grouping rules of the currently selected locale (*note General
Numeric::).
 
   If the ‘"C"’ or ‘"POSIX"’ locale is selected there is no difference.
But for a locale which specifies values for the appropriate fields in
the locale the input must have the correct form in the input.  Otherwise
the longest prefix with a correct form is processed.
 
 
File: libc.info,  Node: String Input Conversions,  Next: Dynamic String Input,  Prev: Numeric Input Conversions,  Up: Formatted Input
 
12.14.5 String Input Conversions
--------------------------------
 
This section describes the ‘scanf’ input conversions for reading string
and character values: ‘%s’, ‘%S’, ‘%[’, ‘%c’, and ‘%C’.
 
   You have two options for how to receive the input from these
conversions:
 
   • Provide a buffer to store it in.  This is the default.  You should
     provide an argument of type ‘char *’ or ‘wchar_t *’ (the latter if
     the ‘l’ modifier is present).
 
     *Warning:* To make a robust program, you must make sure that the
     input (plus its terminating null) cannot possibly exceed the size
     of the buffer you provide.  In general, the only way to do this is
     to specify a maximum field width one less than the buffer size.
     *If you provide the buffer, always specify a maximum field width to
     prevent overflow.*
 
   • Ask ‘scanf’ to allocate a big enough buffer, by specifying the ‘a’
     flag character.  This is a GNU extension.  You should provide an
     argument of type ‘char **’ for the buffer address to be stored in.
     *Note Dynamic String Input::.
 
   The ‘%c’ conversion is the simplest: it matches a fixed number of
characters, always.  The maximum field width says how many characters to
read; if you don’t specify the maximum, the default is 1.  This
conversion doesn’t append a null character to the end of the text it
reads.  It also does not skip over initial whitespace characters.  It
reads precisely the next N characters, and fails if it cannot get that
many.  Since there is always a maximum field width with ‘%c’ (whether
specified, or 1 by default), you can always prevent overflow by making
the buffer long enough.
 
   If the format is ‘%lc’ or ‘%C’ the function stores wide characters
which are converted using the conversion determined at the time the
stream was opened from the external byte stream.  The number of bytes
read from the medium is limited by ‘MB_CUR_LEN * N’ but at most N wide
characters get stored in the output string.
 
   The ‘%s’ conversion matches a string of non-whitespace characters.
It skips and discards initial whitespace, but stops when it encounters
more whitespace after having read something.  It stores a null character
at the end of the text that it reads.
 
   For example, reading the input:
 
      hello, world
 
with the conversion ‘%10c’ produces ‘" hello, wo"’, but reading the same
input with the conversion ‘%10s’ produces ‘"hello,"’.
 
   *Warning:* If you do not specify a field width for ‘%s’, then the
number of characters read is limited only by where the next whitespace
character appears.  This almost certainly means that invalid input can
make your program crash—which is a bug.
 
   The ‘%ls’ and ‘%S’ format are handled just like ‘%s’ except that the
external byte sequence is converted using the conversion associated with
the stream to wide characters with their own encoding.  A width or
precision specified with the format do not directly determine how many
bytes are read from the stream since they measure wide characters.  But
an upper limit can be computed by multiplying the value of the width or
precision by ‘MB_CUR_MAX’.
 
   To read in characters that belong to an arbitrary set of your choice,
use the ‘%[’ conversion.  You specify the set between the ‘[’ character
and a following ‘]’ character, using the same syntax used in regular
expressions for explicit sets of characters.  As special cases:
 
   • A literal ‘]’ character can be specified as the first character of
     the set.
 
   • An embedded ‘-’ character (that is, one that is not the first or
     last character of the set) is used to specify a range of
     characters.
 
   • If a caret character ‘^’ immediately follows the initial ‘[’, then
     the set of allowed input characters is everything _except_ the
     characters listed.
 
   The ‘%[’ conversion does not skip over initial whitespace characters.
 
   Note that the "character class" syntax available in character sets
that appear inside regular expressions (such as ‘[:alpha:]’) is _not_
available in the ‘%[’ conversion.
 
   Here are some examples of ‘%[’ conversions and what they mean:
 
‘%25[1234567890]’
     Matches a string of up to 25 digits.
 
‘%25[][]’
     Matches a string of up to 25 square brackets.
 
‘%25[^ \f\n\r\t\v]’
     Matches a string up to 25 characters long that doesn’t contain any
     of the standard whitespace characters.  This is slightly different
     from ‘%s’, because if the input begins with a whitespace character,
     ‘%[’ reports a matching failure while ‘%s’ simply discards the
     initial whitespace.
 
‘%25[a-z]’
     Matches up to 25 lowercase characters.
 
   As for ‘%c’ and ‘%s’ the ‘%[’ format is also modified to produce wide
characters if the ‘l’ modifier is present.  All what is said about ‘%ls’
above is true for ‘%l[’.
 
   One more reminder: the ‘%s’ and ‘%[’ conversions are *dangerous* if
you don’t specify a maximum width or use the ‘a’ flag, because input too
long would overflow whatever buffer you have provided for it.  No matter
how long your buffer is, a user could supply input that is longer.  A
well-written program reports invalid input with a comprehensible error
message, not with a crash.
 
 
File: libc.info,  Node: Dynamic String Input,  Next: Other Input Conversions,  Prev: String Input Conversions,  Up: Formatted Input
 
12.14.6 Dynamically Allocating String Conversions
-------------------------------------------------
 
A GNU extension to formatted input lets you safely read a string with no
maximum size.  Using this feature, you don’t supply a buffer; instead,
‘scanf’ allocates a buffer big enough to hold the data and gives you its
address.  To use this feature, write ‘a’ as a flag character, as in
‘%as’ or ‘%a[0-9a-z]’.
 
   The pointer argument you supply for where to store the input should
have type ‘char **’.  The ‘scanf’ function allocates a buffer and stores
its address in the word that the argument points to.  You should free
the buffer with ‘free’ when you no longer need it.
 
   Here is an example of using the ‘a’ flag with the ‘%[…]’ conversion
specification to read a “variable assignment” of the form ‘VARIABLE =
VALUE’.
 
     {
       char *variable, *value;
 
       if (2 > scanf ("%a[a-zA-Z0-9] = %a[^\n]\n",
              &variable, &value))
         {
           invalid_input_error ();
           return 0;
         }
 
       …
     }
 
 
File: libc.info,  Node: Other Input Conversions,  Next: Formatted Input Functions,  Prev: Dynamic String Input,  Up: Formatted Input
 
12.14.7 Other Input Conversions
-------------------------------
 
This section describes the miscellaneous input conversions.
 
   The ‘%p’ conversion is used to read a pointer value.  It recognizes
the same syntax used by the ‘%p’ output conversion for ‘printf’ (*note
Other Output Conversions::); that is, a hexadecimal number just as the
‘%x’ conversion accepts.  The corresponding argument should be of type
‘void **’; that is, the address of a place to store a pointer.
 
   The resulting pointer value is not guaranteed to be valid if it was
not originally written during the same program execution that reads it
in.
 
   The ‘%n’ conversion produces the number of characters read so far by
this call.  The corresponding argument should be of type ‘int *’.  This
conversion works in the same way as the ‘%n’ conversion for ‘printf’;
see *note Other Output Conversions::, for an example.
 
   The ‘%n’ conversion is the only mechanism for determining the success
of literal matches or conversions with suppressed assignments.  If the
‘%n’ follows the locus of a matching failure, then no value is stored
for it since ‘scanf’ returns before processing the ‘%n’.  If you store
‘-1’ in that argument slot before calling ‘scanf’, the presence of ‘-1’
after ‘scanf’ indicates an error occurred before the ‘%n’ was reached.
 
   Finally, the ‘%%’ conversion matches a literal ‘%’ character in the
input stream, without using an argument.  This conversion does not
permit any flags, field width, or type modifier to be specified.
 
 
File: libc.info,  Node: Formatted Input Functions,  Next: Variable Arguments Input,  Prev: Other Input Conversions,  Up: Formatted Input
 
12.14.8 Formatted Input Functions
---------------------------------
 
Here are the descriptions of the functions for performing formatted
input.  Prototypes for these functions are in the header file ‘stdio.h’.
 
 -- Function: int scanf (const char *TEMPLATE, …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     The ‘scanf’ function reads formatted input from the stream ‘stdin’
     under the control of the template string TEMPLATE.  The optional
     arguments are pointers to the places which receive the resulting
     values.
 
     The return value is normally the number of successful assignments.
     If an end-of-file condition is detected before any matches are
     performed, including matches against whitespace and literal
     characters in the template, then ‘EOF’ is returned.
 
 -- Function: int wscanf (const wchar_t *TEMPLATE, …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     The ‘wscanf’ function reads formatted input from the stream ‘stdin’
     under the control of the template string TEMPLATE.  The optional
     arguments are pointers to the places which receive the resulting
     values.
 
     The return value is normally the number of successful assignments.
     If an end-of-file condition is detected before any matches are
     performed, including matches against whitespace and literal
     characters in the template, then ‘WEOF’ is returned.
 
 -- Function: int fscanf (FILE *STREAM, const char *TEMPLATE, …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     This function is just like ‘scanf’, except that the input is read
     from the stream STREAM instead of ‘stdin’.
 
 -- Function: int fwscanf (FILE *STREAM, const wchar_t *TEMPLATE, …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     This function is just like ‘wscanf’, except that the input is read
     from the stream STREAM instead of ‘stdin’.
 
 -- Function: int sscanf (const char *S, const char *TEMPLATE, …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
     *Note POSIX Safety Concepts::.
 
     This is like ‘scanf’, except that the characters are taken from the
     null-terminated string S instead of from a stream.  Reaching the
     end of the string is treated as an end-of-file condition.
 
     The behavior of this function is undefined if copying takes place
     between objects that overlap—for example, if S is also given as an
     argument to receive a string read under control of the ‘%s’, ‘%S’,
     or ‘%[’ conversion.
 
 -- Function: int swscanf (const wchar_t *WS, const wchar_t *TEMPLATE,
          …)
 
     Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
     *Note POSIX Safety Concepts::.
 
     This is like ‘wscanf’, except that the characters are taken from
     the null-terminated string WS instead of from a stream.  Reaching
     the end of the string is treated as an end-of-file condition.
 
     The behavior of this function is undefined if copying takes place
     between objects that overlap—for example, if WS is also given as an
     argument to receive a string read under control of the ‘%s’, ‘%S’,
     or ‘%[’ conversion.
 
 
File: libc.info,  Node: Variable Arguments Input,  Prev: Formatted Input Functions,  Up: Formatted Input
 
12.14.9 Variable Arguments Input Functions
------------------------------------------
 
The functions ‘vscanf’ and friends are provided so that you can define
your own variadic ‘scanf’-like functions that make use of the same
internals as the built-in formatted output functions.  These functions
are analogous to the ‘vprintf’ series of output functions.  *Note
Variable Arguments Output::, for important information on how to use
them.
 
   *Portability Note:* The functions listed in this section were
introduced in ISO C99 and were before available as GNU extensions.
 
 -- Function: int vscanf (const char *TEMPLATE, va_list AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     This function is similar to ‘scanf’, but instead of taking a
     variable number of arguments directly, it takes an argument list
     pointer AP of type ‘va_list’ (*note Variadic Functions::).
 
 -- Function: int vwscanf (const wchar_t *TEMPLATE, va_list AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     This function is similar to ‘wscanf’, but instead of taking a
     variable number of arguments directly, it takes an argument list
     pointer AP of type ‘va_list’ (*note Variadic Functions::).
 
 -- Function: int vfscanf (FILE *STREAM, const char *TEMPLATE, va_list
          AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     This is the equivalent of ‘fscanf’ with the variable argument list
     specified directly as for ‘vscanf’.
 
 -- Function: int vfwscanf (FILE *STREAM, const wchar_t *TEMPLATE,
          va_list AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
     mem lock corrupt | *Note POSIX Safety Concepts::.
 
     This is the equivalent of ‘fwscanf’ with the variable argument list
     specified directly as for ‘vwscanf’.
 
 -- Function: int vsscanf (const char *S, const char *TEMPLATE, va_list
          AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
     *Note POSIX Safety Concepts::.
 
     This is the equivalent of ‘sscanf’ with the variable argument list
     specified directly as for ‘vscanf’.
 
 -- Function: int vswscanf (const wchar_t *S, const wchar_t *TEMPLATE,
          va_list AP)
 
     Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
     *Note POSIX Safety Concepts::.
 
     This is the equivalent of ‘swscanf’ with the variable argument list
     specified directly as for ‘vwscanf’.
 
   In GNU C, there is a special construct you can use to let the
compiler know that a function uses a ‘scanf’-style format string.  Then
it can check the number and types of arguments in each call to the
function, and warn you when they do not match the format string.  For
details, see *note Declaring Attributes of Functions: (gcc)Function
Attributes.
 
 
File: libc.info,  Node: EOF and Errors,  Next: Error Recovery,  Prev: Formatted Input,  Up: I/O on Streams
 
12.15 End-Of-File and Errors
============================
 
Many of the functions described in this chapter return the value of the
macro ‘EOF’ to indicate unsuccessful completion of the operation.  Since
‘EOF’ is used to report both end of file and random errors, it’s often
better to use the ‘feof’ function to check explicitly for end of file
and ‘ferror’ to check for errors.  These functions check indicators that
are part of the internal state of the stream object, indicators set if
the appropriate condition was detected by a previous I/O operation on
that stream.
 
 -- Macro: int EOF
 
     This macro is an integer value that is returned by a number of
     narrow stream functions to indicate an end-of-file condition, or
     some other error situation.  With the GNU C Library, ‘EOF’ is ‘-1’.
     In other libraries, its value may be some other negative number.
 
     This symbol is declared in ‘stdio.h’.
 
 -- Macro: int WEOF
 
     This macro is an integer value that is returned by a number of wide
     stream functions to indicate an end-of-file condition, or some
     other error situation.  With the GNU C Library, ‘WEOF’ is ‘-1’.  In
     other libraries, its value may be some other negative number.
 
     This symbol is declared in ‘wchar.h’.
 
 -- Function: int feof (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Unsafe lock | *Note POSIX
     Safety Concepts::.
 
     The ‘feof’ function returns nonzero if and only if the end-of-file
     indicator for the stream STREAM is set.
 
     This symbol is declared in ‘stdio.h’.
 
 -- Function: int feof_unlocked (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
     Concepts::.
 
     The ‘feof_unlocked’ function is equivalent to the ‘feof’ function
     except that it does not implicitly lock the stream.
 
     This function is a GNU extension.
 
     This symbol is declared in ‘stdio.h’.
 
 -- Function: int ferror (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Unsafe lock | *Note POSIX
     Safety Concepts::.
 
     The ‘ferror’ function returns nonzero if and only if the error
     indicator for the stream STREAM is set, indicating that an error
     has occurred on a previous operation on the stream.
 
     This symbol is declared in ‘stdio.h’.
 
 -- Function: int ferror_unlocked (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
     Concepts::.
 
     The ‘ferror_unlocked’ function is equivalent to the ‘ferror’
     function except that it does not implicitly lock the stream.
 
     This function is a GNU extension.
 
     This symbol is declared in ‘stdio.h’.
 
   In addition to setting the error indicator associated with the
stream, the functions that operate on streams also set ‘errno’ in the
same way as the corresponding low-level functions that operate on file
descriptors.  For example, all of the functions that perform output to a
stream—such as ‘fputc’, ‘printf’, and ‘fflush’—are implemented in terms
of ‘write’, and all of the ‘errno’ error conditions defined for ‘write’
are meaningful for these functions.  For more information about the
descriptor-level I/O functions, see *note Low-Level I/O::.
 
 
File: libc.info,  Node: Error Recovery,  Next: Binary Streams,  Prev: EOF and Errors,  Up: I/O on Streams
 
12.16 Recovering from errors
============================
 
You may explicitly clear the error and EOF flags with the ‘clearerr’
function.
 
 -- Function: void clearerr (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Unsafe lock | *Note POSIX
     Safety Concepts::.
 
     This function clears the end-of-file and error indicators for the
     stream STREAM.
 
     The file positioning functions (*note File Positioning::) also
     clear the end-of-file indicator for the stream.
 
 -- Function: void clearerr_unlocked (FILE *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Safe | AC-Safe | *Note
     POSIX Safety Concepts::.
 
     The ‘clearerr_unlocked’ function is equivalent to the ‘clearerr’
     function except that it does not implicitly lock the stream.
 
     This function is a GNU extension.
 
   Note that it is _not_ correct to just clear the error flag and retry
a failed stream operation.  After a failed write, any number of
characters since the last buffer flush may have been committed to the
file, while some buffered data may have been discarded.  Merely retrying
can thus cause lost or repeated data.
 
   A failed read may leave the file pointer in an inappropriate position
for a second try.  In both cases, you should seek to a known position
before retrying.
 
   Most errors that can happen are not recoverable — a second try will
always fail again in the same way.  So usually it is best to give up and
report the error to the user, rather than install complicated recovery
logic.
 
   One important exception is ‘EINTR’ (*note Interrupted Primitives::).
Many stream I/O implementations will treat it as an ordinary error,
which can be quite inconvenient.  You can avoid this hassle by
installing all signals with the ‘SA_RESTART’ flag.
 
   For similar reasons, setting nonblocking I/O on a stream’s file
descriptor is not usually advisable.
 
 
File: libc.info,  Node: Binary Streams,  Next: File Positioning,  Prev: Error Recovery,  Up: I/O on Streams
 
12.17 Text and Binary Streams
=============================
 
GNU systems and other POSIX-compatible operating systems organize all
files as uniform sequences of characters.  However, some other systems
make a distinction between files containing text and files containing
binary data, and the input and output facilities of ISO C provide for
this distinction.  This section tells you how to write programs portable
to such systems.
 
   When you open a stream, you can specify either a "text stream" or a
"binary stream".  You indicate that you want a binary stream by
specifying the ‘b’ modifier in the OPENTYPE argument to ‘fopen’; see
*note Opening Streams::.  Without this option, ‘fopen’ opens the file as
a text stream.
 
   Text and binary streams differ in several ways:
 
   • The data read from a text stream is divided into "lines" which are
     terminated by newline (‘'\n'’) characters, while a binary stream is
     simply a long series of characters.  A text stream might on some
     systems fail to handle lines more than 254 characters long
     (including the terminating newline character).
 
   • On some systems, text files can contain only printing characters,
     horizontal tab characters, and newlines, and so text streams may
     not support other characters.  However, binary streams can handle
     any character value.
 
   • Space characters that are written immediately preceding a newline
     character in a text stream may disappear when the file is read in
     again.
 
   • More generally, there need not be a one-to-one mapping between
     characters that are read from or written to a text stream, and the
     characters in the actual file.
 
   Since a binary stream is always more capable and more predictable
than a text stream, you might wonder what purpose text streams serve.
Why not simply always use binary streams?  The answer is that on these
operating systems, text and binary streams use different file formats,
and the only way to read or write “an ordinary file of text” that can
work with other text-oriented programs is through a text stream.
 
   In the GNU C Library, and on all POSIX systems, there is no
difference between text streams and binary streams.  When you open a
stream, you get the same kind of stream regardless of whether you ask
for binary.  This stream can handle any file content, and has none of
the restrictions that text streams sometimes have.
 
 
File: libc.info,  Node: File Positioning,  Next: Portable Positioning,  Prev: Binary Streams,  Up: I/O on Streams
 
12.18 File Positioning
======================
 
The "file position" of a stream describes where in the file the stream
is currently reading or writing.  I/O on the stream advances the file
position through the file.  On GNU systems, the file position is
represented as an integer, which counts the number of bytes from the
beginning of the file.  *Note File Position::.
 
   During I/O to an ordinary disk file, you can change the file position
whenever you wish, so as to read or write any portion of the file.  Some
other kinds of files may also permit this.  Files which support changing
the file position are sometimes referred to as "random-access" files.
 
   You can use the functions in this section to examine or modify the
file position indicator associated with a stream.  The symbols listed
below are declared in the header file ‘stdio.h’.
 
 -- Function: long int ftell (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function returns the current file position of the stream
     STREAM.
 
     This function can fail if the stream doesn’t support file
     positioning, or if the file position can’t be represented in a
     ‘long int’, and possibly for other reasons as well.  If a failure
     occurs, a value of ‘-1’ is returned.
 
 -- Function: off_t ftello (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     The ‘ftello’ function is similar to ‘ftell’, except that it returns
     a value of type ‘off_t’.  Systems which support this type use it to
     describe all file positions, unlike the POSIX specification which
     uses a long int.  The two are not necessarily the same size.
     Therefore, using ftell can lead to problems if the implementation
     is written on top of a POSIX compliant low-level I/O
     implementation, and using ‘ftello’ is preferable whenever it is
     available.
 
     If this function fails it returns ‘(off_t) -1’.  This can happen
     due to missing support for file positioning or internal errors.
     Otherwise the return value is the current file position.
 
     The function is an extension defined in the Unix Single
     Specification version 2.
 
     When the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a
     32 bit system this function is in fact ‘ftello64’.  I.e., the LFS
     interface transparently replaces the old interface.
 
 -- Function: off64_t ftello64 (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function is similar to ‘ftello’ with the only difference that
     the return value is of type ‘off64_t’.  This also requires that the
     stream STREAM was opened using either ‘fopen64’, ‘freopen64’, or
     ‘tmpfile64’ since otherwise the underlying file operations to
     position the file pointer beyond the 2^31 bytes limit might fail.
 
     If the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a 32
     bits machine this function is available under the name ‘ftello’ and
     so transparently replaces the old interface.
 
 -- Function: int fseek (FILE *STREAM, long int OFFSET, int WHENCE)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     The ‘fseek’ function is used to change the file position of the
     stream STREAM.  The value of WHENCE must be one of the constants
     ‘SEEK_SET’, ‘SEEK_CUR’, or ‘SEEK_END’, to indicate whether the
     OFFSET is relative to the beginning of the file, the current file
     position, or the end of the file, respectively.
 
     This function returns a value of zero if the operation was
     successful, and a nonzero value to indicate failure.  A successful
     call also clears the end-of-file indicator of STREAM and discards
     any characters that were “pushed back” by the use of ‘ungetc’.
 
     ‘fseek’ either flushes any buffered output before setting the file
     position or else remembers it so it will be written later in its
     proper place in the file.
 
 -- Function: int fseeko (FILE *STREAM, off_t OFFSET, int WHENCE)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function is similar to ‘fseek’ but it corrects a problem with
     ‘fseek’ in a system with POSIX types.  Using a value of type ‘long
     int’ for the offset is not compatible with POSIX. ‘fseeko’ uses the
     correct type ‘off_t’ for the OFFSET parameter.
 
     For this reason it is a good idea to prefer ‘ftello’ whenever it is
     available since its functionality is (if different at all) closer
     the underlying definition.
 
     The functionality and return value are the same as for ‘fseek’.
 
     The function is an extension defined in the Unix Single
     Specification version 2.
 
     When the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a
     32 bit system this function is in fact ‘fseeko64’.  I.e., the LFS
     interface transparently replaces the old interface.
 
 -- Function: int fseeko64 (FILE *STREAM, off64_t OFFSET, int WHENCE)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function is similar to ‘fseeko’ with the only difference that
     the OFFSET parameter is of type ‘off64_t’.  This also requires that
     the stream STREAM was opened using either ‘fopen64’, ‘freopen64’,
     or ‘tmpfile64’ since otherwise the underlying file operations to
     position the file pointer beyond the 2^31 bytes limit might fail.
 
     If the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a 32
     bits machine this function is available under the name ‘fseeko’ and
     so transparently replaces the old interface.
 
   *Portability Note:* In non-POSIX systems, ‘ftell’, ‘ftello’, ‘fseek’
and ‘fseeko’ might work reliably only on binary streams.  *Note Binary
Streams::.
 
   The following symbolic constants are defined for use as the WHENCE
argument to ‘fseek’.  They are also used with the ‘lseek’ function
(*note I/O Primitives::) and to specify offsets for file locks (*note
Control Operations::).
 
 -- Macro: int SEEK_SET
 
     This is an integer constant which, when used as the WHENCE argument
     to the ‘fseek’ or ‘fseeko’ functions, specifies that the offset
     provided is relative to the beginning of the file.
 
 -- Macro: int SEEK_CUR
 
     This is an integer constant which, when used as the WHENCE argument
     to the ‘fseek’ or ‘fseeko’ functions, specifies that the offset
     provided is relative to the current file position.
 
 -- Macro: int SEEK_END
 
     This is an integer constant which, when used as the WHENCE argument
     to the ‘fseek’ or ‘fseeko’ functions, specifies that the offset
     provided is relative to the end of the file.
 
 -- Function: void rewind (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     The ‘rewind’ function positions the stream STREAM at the beginning
     of the file.  It is equivalent to calling ‘fseek’ or ‘fseeko’ on
     the STREAM with an OFFSET argument of ‘0L’ and a WHENCE argument of
     ‘SEEK_SET’, except that the return value is discarded and the error
     indicator for the stream is reset.
 
   These three aliases for the ‘SEEK_…’ constants exist for the sake of
compatibility with older BSD systems.  They are defined in two different
header files: ‘fcntl.h’ and ‘sys/file.h’.
 
‘L_SET’
 
     An alias for ‘SEEK_SET’.
 
‘L_INCR’
 
     An alias for ‘SEEK_CUR’.
 
‘L_XTND’
 
     An alias for ‘SEEK_END’.
 
 
File: libc.info,  Node: Portable Positioning,  Next: Stream Buffering,  Prev: File Positioning,  Up: I/O on Streams
 
12.19 Portable File-Position Functions
======================================
 
On GNU systems, the file position is truly a character count.  You can
specify any character count value as an argument to ‘fseek’ or ‘fseeko’
and get reliable results for any random access file.  However, some ISO C
systems do not represent file positions in this way.
 
   On some systems where text streams truly differ from binary streams,
it is impossible to represent the file position of a text stream as a
count of characters from the beginning of the file.  For example, the
file position on some systems must encode both a record offset within
the file, and a character offset within the record.
 
   As a consequence, if you want your programs to be portable to these
systems, you must observe certain rules:
 
   • The value returned from ‘ftell’ on a text stream has no predictable
     relationship to the number of characters you have read so far.  The
     only thing you can rely on is that you can use it subsequently as
     the OFFSET argument to ‘fseek’ or ‘fseeko’ to move back to the same
     file position.
 
   • In a call to ‘fseek’ or ‘fseeko’ on a text stream, either the
     OFFSET must be zero, or WHENCE must be ‘SEEK_SET’ and the OFFSET
     must be the result of an earlier call to ‘ftell’ on the same
     stream.
 
   • The value of the file position indicator of a text stream is
     undefined while there are characters that have been pushed back
     with ‘ungetc’ that haven’t been read or discarded.  *Note
     Unreading::.
 
   But even if you observe these rules, you may still have trouble for
long files, because ‘ftell’ and ‘fseek’ use a ‘long int’ value to
represent the file position.  This type may not have room to encode all
the file positions in a large file.  Using the ‘ftello’ and ‘fseeko’
functions might help here since the ‘off_t’ type is expected to be able
to hold all file position values but this still does not help to handle
additional information which must be associated with a file position.
 
   So if you do want to support systems with peculiar encodings for the
file positions, it is better to use the functions ‘fgetpos’ and
‘fsetpos’ instead.  These functions represent the file position using
the data type ‘fpos_t’, whose internal representation varies from system
to system.
 
   These symbols are declared in the header file ‘stdio.h’.
 
 -- Data Type: fpos_t
 
     This is the type of an object that can encode information about the
     file position of a stream, for use by the functions ‘fgetpos’ and
     ‘fsetpos’.
 
     In the GNU C Library, ‘fpos_t’ is an opaque data structure that
     contains internal data to represent file offset and conversion
     state information.  In other systems, it might have a different
     internal representation.
 
     When compiling with ‘_FILE_OFFSET_BITS == 64’ on a 32 bit machine
     this type is in fact equivalent to ‘fpos64_t’ since the LFS
     interface transparently replaces the old interface.
 
 -- Data Type: fpos64_t
 
     This is the type of an object that can encode information about the
     file position of a stream, for use by the functions ‘fgetpos64’ and
     ‘fsetpos64’.
 
     In the GNU C Library, ‘fpos64_t’ is an opaque data structure that
     contains internal data to represent file offset and conversion
     state information.  In other systems, it might have a different
     internal representation.
 
 -- Function: int fgetpos (FILE *STREAM, fpos_t *POSITION)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function stores the value of the file position indicator for
     the stream STREAM in the ‘fpos_t’ object pointed to by POSITION.
     If successful, ‘fgetpos’ returns zero; otherwise it returns a
     nonzero value and stores an implementation-defined positive value
     in ‘errno’.
 
     When the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a
     32 bit system the function is in fact ‘fgetpos64’.  I.e., the LFS
     interface transparently replaces the old interface.
 
 -- Function: int fgetpos64 (FILE *STREAM, fpos64_t *POSITION)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function is similar to ‘fgetpos’ but the file position is
     returned in a variable of type ‘fpos64_t’ to which POSITION points.
 
     If the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a 32
     bits machine this function is available under the name ‘fgetpos’
     and so transparently replaces the old interface.
 
 -- Function: int fsetpos (FILE *STREAM, const fpos_t *POSITION)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function sets the file position indicator for the stream
     STREAM to the position POSITION, which must have been set by a
     previous call to ‘fgetpos’ on the same stream.  If successful,
     ‘fsetpos’ clears the end-of-file indicator on the stream, discards
     any characters that were “pushed back” by the use of ‘ungetc’, and
     returns a value of zero.  Otherwise, ‘fsetpos’ returns a nonzero
     value and stores an implementation-defined positive value in
     ‘errno’.
 
     When the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a
     32 bit system the function is in fact ‘fsetpos64’.  I.e., the LFS
     interface transparently replaces the old interface.
 
 -- Function: int fsetpos64 (FILE *STREAM, const fpos64_t *POSITION)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function is similar to ‘fsetpos’ but the file position used
     for positioning is provided in a variable of type ‘fpos64_t’ to
     which POSITION points.
 
     If the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a 32
     bits machine this function is available under the name ‘fsetpos’
     and so transparently replaces the old interface.
 
 
File: libc.info,  Node: Stream Buffering,  Next: Other Kinds of Streams,  Prev: Portable Positioning,  Up: I/O on Streams
 
12.20 Stream Buffering
======================
 
Characters that are written to a stream are normally accumulated and
transmitted asynchronously to the file in a block, instead of appearing
as soon as they are output by the application program.  Similarly,
streams often retrieve input from the host environment in blocks rather
than on a character-by-character basis.  This is called "buffering".
 
   If you are writing programs that do interactive input and output
using streams, you need to understand how buffering works when you
design the user interface to your program.  Otherwise, you might find
that output (such as progress or prompt messages) doesn’t appear when
you intended it to, or displays some other unexpected behavior.
 
   This section deals only with controlling when characters are
transmitted between the stream and the file or device, and _not_ with
how things like echoing, flow control, and the like are handled on
specific classes of devices.  For information on common control
operations on terminal devices, see *note Low-Level Terminal
Interface::.
 
   You can bypass the stream buffering facilities altogether by using
the low-level input and output functions that operate on file
descriptors instead.  *Note Low-Level I/O::.
 
* Menu:
 
* Buffering Concepts::          Terminology is defined here.
* Flushing Buffers::            How to ensure that output buffers are flushed.
* Controlling Buffering::       How to specify what kind of buffering to use.
 
 
File: libc.info,  Node: Buffering Concepts,  Next: Flushing Buffers,  Up: Stream Buffering
 
12.20.1 Buffering Concepts
--------------------------
 
There are three different kinds of buffering strategies:
 
   • Characters written to or read from an "unbuffered" stream are
     transmitted individually to or from the file as soon as possible.
 
   • Characters written to a "line buffered" stream are transmitted to
     the file in blocks when a newline character is encountered.
 
   • Characters written to or read from a "fully buffered" stream are
     transmitted to or from the file in blocks of arbitrary size.
 
   Newly opened streams are normally fully buffered, with one exception:
a stream connected to an interactive device such as a terminal is
initially line buffered.  *Note Controlling Buffering::, for information
on how to select a different kind of buffering.  Usually the automatic
selection gives you the most convenient kind of buffering for the file
or device you open.
 
   The use of line buffering for interactive devices implies that output
messages ending in a newline will appear immediately—which is usually
what you want.  Output that doesn’t end in a newline might or might not
show up immediately, so if you want them to appear immediately, you
should flush buffered output explicitly with ‘fflush’, as described in
*note Flushing Buffers::.
 
 
File: libc.info,  Node: Flushing Buffers,  Next: Controlling Buffering,  Prev: Buffering Concepts,  Up: Stream Buffering
 
12.20.2 Flushing Buffers
------------------------
 
"Flushing" output on a buffered stream means transmitting all
accumulated characters to the file.  There are many circumstances when
buffered output on a stream is flushed automatically:
 
   • When you try to do output and the output buffer is full.
 
   • When the stream is closed.  *Note Closing Streams::.
 
   • When the program terminates by calling ‘exit’.  *Note Normal
     Termination::.
 
   • When a newline is written, if the stream is line buffered.
 
   • Whenever an input operation on _any_ stream actually reads data
     from its file.
 
   If you want to flush the buffered output at another time, call
‘fflush’, which is declared in the header file ‘stdio.h’.
 
 -- Function: int fflush (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function causes any buffered output on STREAM to be delivered
     to the file.  If STREAM is a null pointer, then ‘fflush’ causes
     buffered output on _all_ open output streams to be flushed.
 
     This function returns ‘EOF’ if a write error occurs, or zero
     otherwise.
 
 -- Function: int fflush_unlocked (FILE *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
     corrupt | *Note POSIX Safety Concepts::.
 
     The ‘fflush_unlocked’ function is equivalent to the ‘fflush’
     function except that it does not implicitly lock the stream.
 
   The ‘fflush’ function can be used to flush all streams currently
opened.  While this is useful in some situations it does often more than
necessary since it might be done in situations when terminal input is
required and the program wants to be sure that all output is visible on
the terminal.  But this means that only line buffered streams have to be
flushed.  Solaris introduced a function especially for this.  It was
always available in the GNU C Library in some form but never officially
exported.
 
 -- Function: void _flushlbf (void)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     The ‘_flushlbf’ function flushes all line buffered streams
     currently opened.
 
     This function is declared in the ‘stdio_ext.h’ header.
 
   *Compatibility Note:* Some brain-damaged operating systems have been
known to be so thoroughly fixated on line-oriented input and output that
flushing a line buffered stream causes a newline to be written!
Fortunately, this “feature” seems to be becoming less common.  You do
not need to worry about this with the GNU C Library.
 
   In some situations it might be useful to not flush the output pending
for a stream but instead simply forget it.  If transmission is costly
and the output is not needed anymore this is valid reasoning.  In this
situation a non-standard function introduced in Solaris and available in
the GNU C Library can be used.
 
 -- Function: void __fpurge (FILE *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
     corrupt | *Note POSIX Safety Concepts::.
 
     The ‘__fpurge’ function causes the buffer of the stream STREAM to
     be emptied.  If the stream is currently in read mode all input in
     the buffer is lost.  If the stream is in output mode the buffered
     output is not written to the device (or whatever other underlying
     storage) and the buffer is cleared.
 
     This function is declared in ‘stdio_ext.h’.
 
 
File: libc.info,  Node: Controlling Buffering,  Prev: Flushing Buffers,  Up: Stream Buffering
 
12.20.3 Controlling Which Kind of Buffering
-------------------------------------------
 
After opening a stream (but before any other operations have been
performed on it), you can explicitly specify what kind of buffering you
want it to have using the ‘setvbuf’ function.
 
   The facilities listed in this section are declared in the header file
‘stdio.h’.
 
 -- Function: int setvbuf (FILE *STREAM, char *BUF, int MODE, size_t
          SIZE)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function is used to specify that the stream STREAM should have
     the buffering mode MODE, which can be either ‘_IOFBF’ (for full
     buffering), ‘_IOLBF’ (for line buffering), or ‘_IONBF’ (for
     unbuffered input/output).
 
     If you specify a null pointer as the BUF argument, then ‘setvbuf’
     allocates a buffer itself using ‘malloc’.  This buffer will be
     freed when you close the stream.
 
     Otherwise, BUF should be a character array that can hold at least
     SIZE characters.  You should not free the space for this array as
     long as the stream remains open and this array remains its buffer.
     You should usually either allocate it statically, or ‘malloc’
     (*note Unconstrained Allocation::) the buffer.  Using an automatic
     array is not a good idea unless you close the file before exiting
     the block that declares the array.
 
     While the array remains a stream buffer, the stream I/O functions
     will use the buffer for their internal purposes.  You shouldn’t try
     to access the values in the array directly while the stream is
     using it for buffering.
 
     The ‘setvbuf’ function returns zero on success, or a nonzero value
     if the value of MODE is not valid or if the request could not be
     honored.
 
 -- Macro: int _IOFBF
 
     The value of this macro is an integer constant expression that can
     be used as the MODE argument to the ‘setvbuf’ function to specify
     that the stream should be fully buffered.
 
 -- Macro: int _IOLBF
 
     The value of this macro is an integer constant expression that can
     be used as the MODE argument to the ‘setvbuf’ function to specify
     that the stream should be line buffered.
 
 -- Macro: int _IONBF
 
     The value of this macro is an integer constant expression that can
     be used as the MODE argument to the ‘setvbuf’ function to specify
     that the stream should be unbuffered.
 
 -- Macro: int BUFSIZ
 
     The value of this macro is an integer constant expression that is
     good to use for the SIZE argument to ‘setvbuf’.  This value is
     guaranteed to be at least ‘256’.
 
     The value of ‘BUFSIZ’ is chosen on each system so as to make stream
     I/O efficient.  So it is a good idea to use ‘BUFSIZ’ as the size
     for the buffer when you call ‘setvbuf’.
 
     Actually, you can get an even better value to use for the buffer
     size by means of the ‘fstat’ system call: it is found in the
     ‘st_blksize’ field of the file attributes.  *Note Attribute
     Meanings::.
 
     Sometimes people also use ‘BUFSIZ’ as the allocation size of
     buffers used for related purposes, such as strings used to receive
     a line of input with ‘fgets’ (*note Character Input::).  There is
     no particular reason to use ‘BUFSIZ’ for this instead of any other
     integer, except that it might lead to doing I/O in chunks of an
     efficient size.
 
 -- Function: void setbuf (FILE *STREAM, char *BUF)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     If BUF is a null pointer, the effect of this function is equivalent
     to calling ‘setvbuf’ with a MODE argument of ‘_IONBF’.  Otherwise,
     it is equivalent to calling ‘setvbuf’ with BUF, and a MODE of
     ‘_IOFBF’ and a SIZE argument of ‘BUFSIZ’.
 
     The ‘setbuf’ function is provided for compatibility with old code;
     use ‘setvbuf’ in all new programs.
 
 -- Function: void setbuffer (FILE *STREAM, char *BUF, size_t SIZE)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     If BUF is a null pointer, this function makes STREAM unbuffered.
     Otherwise, it makes STREAM fully buffered using BUF as the buffer.
     The SIZE argument specifies the length of BUF.
 
     This function is provided for compatibility with old BSD code.  Use
     ‘setvbuf’ instead.
 
 -- Function: void setlinebuf (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
     | *Note POSIX Safety Concepts::.
 
     This function makes STREAM be line buffered, and allocates the
     buffer for you.
 
     This function is provided for compatibility with old BSD code.  Use
     ‘setvbuf’ instead.
 
   It is possible to query whether a given stream is line buffered or
not using a non-standard function introduced in Solaris and available in
the GNU C Library.
 
 -- Function: int __flbf (FILE *STREAM)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
     Concepts::.
 
     The ‘__flbf’ function will return a nonzero value in case the
     stream STREAM is line buffered.  Otherwise the return value is
     zero.
 
     This function is declared in the ‘stdio_ext.h’ header.
 
   Two more extensions allow to determine the size of the buffer and how
much of it is used.  These functions were also introduced in Solaris.
 
 -- Function: size_t __fbufsize (FILE *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Safe |
     *Note POSIX Safety Concepts::.
 
     The ‘__fbufsize’ function return the size of the buffer in the
     stream STREAM.  This value can be used to optimize the use of the
     stream.
 
     This function is declared in the ‘stdio_ext.h’ header.
 
 -- Function: size_t __fpending (FILE *STREAM)
 
     Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Safe |
     *Note POSIX Safety Concepts::.
 
     The ‘__fpending’ function returns the number of bytes currently in
     the output buffer.  For wide-oriented streams the measuring unit is
     wide characters.  This function should not be used on buffers in
     read mode or opened read-only.
 
     This function is declared in the ‘stdio_ext.h’ header.
 
 
File: libc.info,  Node: Other Kinds of Streams,  Next: Formatted Messages,  Prev: Stream Buffering,  Up: I/O on Streams
 
12.21 Other Kinds of Streams
============================
 
The GNU C Library provides ways for you to define additional kinds of
streams that do not necessarily correspond to an open file.
 
   One such type of stream takes input from or writes output to a
string.  These kinds of streams are used internally to implement the
‘sprintf’ and ‘sscanf’ functions.  You can also create such a stream
explicitly, using the functions described in *note String Streams::.
 
   More generally, you can define streams that do input/output to
arbitrary objects using functions supplied by your program.  This
protocol is discussed in *note Custom Streams::.
 
   *Portability Note:* The facilities described in this section are
specific to GNU. Other systems or C implementations might or might not
provide equivalent functionality.
 
* Menu:
 
* String Streams::              Streams that get data from or put data in
                a string or memory buffer.
* Custom Streams::              Defining your own streams with an arbitrary
                input data source and/or output data sink.
 
 
File: libc.info,  Node: String Streams,  Next: Custom Streams,  Up: Other Kinds of Streams
 
12.21.1 String Streams
----------------------
 
The ‘fmemopen’ and ‘open_memstream’ functions allow you to do I/O to a
string or memory buffer.  These facilities are declared in ‘stdio.h’.
 
 -- Function: FILE * fmemopen (void *BUF, size_t SIZE, const char
          *OPENTYPE)
 
     Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe mem lock |
     *Note POSIX Safety Concepts::.
 
     This function opens a stream that allows the access specified by
     the OPENTYPE argument, that reads from or writes to the buffer
     specified by the argument BUF.  This array must be at least SIZE
     bytes long.
 
     If you specify a null pointer as the BUF argument, ‘fmemopen’
     dynamically allocates an array SIZE bytes long (as with ‘malloc’;
     *note Unconstrained Allocation::).  This is really only useful if
     you are going to write things to the buffer and then read them back
     in again, because you have no way of actually getting a pointer to
     the buffer (for this, try ‘open_memstream’, below).  The buffer is
     freed when the stream is closed.
 
     The argument OPENTYPE is the same as in ‘fopen’ (*note Opening
     Streams::).  If the OPENTYPE specifies append mode, then the
     initial file position is set to the first null character in the
     buffer.  Otherwise the initial file position is at the beginning of
     the buffer.
 
     When a stream open for writing is flushed or closed, a null
     character (zero byte) is written at the end of the buffer if it
     fits.  You should add an extra byte to the SIZE argument to account
     for this.  Attempts to write more than SIZE bytes to the buffer
     result in an error.
 
     For a stream open for reading, null characters (zero bytes) in the
     buffer do not count as “end of file”.  Read operations indicate end
     of file only when the file position advances past SIZE bytes.  So,
     if you want to read characters from a null-terminated string, you
     should supply the length of the string as the SIZE argument.
 
   Here is an example of using ‘fmemopen’ to create a stream for reading
from a string:
 
 
     #include <stdio.h>
 
     static char buffer[] = "foobar";
 
     int
     main (void)
     {
       int ch;
       FILE *stream;
 
       stream = fmemopen (buffer, strlen (buffer), "r");
       while ((ch = fgetc (stream)) != EOF)
         printf ("Got %c\n", ch);
       fclose (stream);
 
       return 0;
     }
 
   This program produces the following output:
 
     Got f
     Got o
     Got o
     Got b
     Got a
     Got r
 
 -- Function: FILE * open_memstream (char **PTR, size_t *SIZELOC)
 
     Preliminary: | MT-Safe | AS-Unsafe heap | AC-Unsafe mem | *Note
     POSIX Safety Concepts::.
 
     This function opens a stream for writing to a buffer.  The buffer
     is allocated dynamically and grown as necessary, using ‘malloc’.
     After you’ve closed the stream, this buffer is your responsibility
     to clean up using ‘free’ or ‘realloc’.  *Note Unconstrained
     Allocation::.
 
     When the stream is closed with ‘fclose’ or flushed with ‘fflush’,
     the locations PTR and SIZELOC are updated to contain the pointer to
     the buffer and its size.  The values thus stored remain valid only
     as long as no further output on the stream takes place.  If you do
     more output, you must flush the stream again to store new values
     before you use them again.
 
     A null character is written at the end of the buffer.  This null
     character is _not_ included in the size value stored at SIZELOC.
 
     You can move the stream’s file position with ‘fseek’ or ‘fseeko’
     (*note File Positioning::).  Moving the file position past the end
     of the data already written fills the intervening space with
     zeroes.
 
   Here is an example of using ‘open_memstream’:
 
 
     #include <stdio.h>
 
     int
     main (void)
     {
       char *bp;
       size_t size;
       FILE *stream;
 
       stream = open_memstream (&bp, &size);
       fprintf (stream, "hello");
       fflush (stream);
       printf ("buf = `%s', size = %zu\n", bp, size);
       fprintf (stream, ", world");
       fclose (stream);
       printf ("buf = `%s', size = %zu\n", bp, size);
 
       return 0;
     }
 
   This program produces the following output:
 
     buf = `hello', size = 5
     buf = `hello, world', size = 12
 
 
File: libc.info,  Node: Custom Streams,  Prev: String Streams,  Up: Other Kinds of Streams
 
12.21.2 Programming Your Own Custom Streams
-------------------------------------------
 
This section describes how you can make a stream that gets input from an
arbitrary data source or writes output to an arbitrary data sink
programmed by you.  We call these "custom streams".  The functions and
types described here are all GNU extensions.
 
* Menu:
 
* Streams and Cookies::         The "cookie" records where to fetch or
                store data that is read or written.
* Hook Functions::              How you should define the four "hook
                functions" that a custom stream needs.
 
 
File: libc.info,  Node: Streams and Cookies,  Next: Hook Functions,  Up: Custom Streams
 
12.21.2.1 Custom Streams and Cookies
....................................
 
Inside every custom stream is a special object called the "cookie".
This is an object supplied by you which records where to fetch or store
the data read or written.  It is up to you to define a data type to use
for the cookie.  The stream functions in the library never refer
directly to its contents, and they don’t even know what the type is;
they record its address with type ‘void *’.
 
   To implement a custom stream, you must specify _how_ to fetch or
store the data in the specified place.  You do this by defining "hook
functions" to read, write, change “file position”, and close the stream.
All four of these functions will be passed the stream’s cookie so they
can tell where to fetch or store the data.  The library functions don’t
know what’s inside the cookie, but your functions will know.
 
   When you create a custom stream, you must specify the cookie pointer,
and also the four hook functions stored in a structure of type
‘cookie_io_functions_t’.
 
   These facilities are declared in ‘stdio.h’.
 
 -- Data Type: cookie_io_functions_t
 
     This is a structure type that holds the functions that define the
     communications protocol between the stream and its cookie.  It has
     the following members:
 
     ‘cookie_read_function_t *read’
          This is the function that reads data from the cookie.  If the
          value is a null pointer instead of a function, then read
          operations on this stream always return ‘EOF’.
 
     ‘cookie_write_function_t *write’
          This is the function that writes data to the cookie.  If the
          value is a null pointer instead of a function, then data
          written to the stream is discarded.
 
     ‘cookie_seek_function_t *seek’
          This is the function that performs the equivalent of file
          positioning on the cookie.  If the value is a null pointer
          instead of a function, calls to ‘fseek’ or ‘fseeko’ on this
          stream can only seek to locations within the buffer; any
          attempt to seek outside the buffer will return an ‘ESPIPE’
          error.
 
     ‘cookie_close_function_t *close’
          This function performs any appropriate cleanup on the cookie
          when closing the stream.  If the value is a null pointer
          instead of a function, nothing special is done to close the
          cookie when the stream is closed.
 
 -- Function: FILE * fopencookie (void *COOKIE, const char *OPENTYPE,
          cookie_io_functions_t IO-FUNCTIONS)
 
     Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe mem lock |
     *Note POSIX Safety Concepts::.
 
     This function actually creates the stream for communicating with
     the COOKIE using the functions in the IO-FUNCTIONS argument.  The
     OPENTYPE argument is interpreted as for ‘fopen’; see *note Opening
     Streams::.  (But note that the “truncate on open” option is
     ignored.)  The new stream is fully buffered.
 
     The ‘fopencookie’ function returns the newly created stream, or a
     null pointer in case of an error.
 
 
File: libc.info,  Node: Hook Functions,  Prev: Streams and Cookies,  Up: Custom Streams
 
12.21.2.2 Custom Stream Hook Functions
......................................
 
Here are more details on how you should define the four hook functions
that a custom stream needs.
 
   You should define the function to read data from the cookie as:
 
     ssize_t READER (void *COOKIE, char *BUFFER, size_t SIZE)
 
   This is very similar to the ‘read’ function; see *note I/O
Primitives::.  Your function should transfer up to SIZE bytes into the
BUFFER, and return the number of bytes read, or zero to indicate
end-of-file.  You can return a value of ‘-1’ to indicate an error.
 
   You should define the function to write data to the cookie as:
 
     ssize_t WRITER (void *COOKIE, const char *BUFFER, size_t SIZE)
 
   This is very similar to the ‘write’ function; see *note I/O
Primitives::.  Your function should transfer up to SIZE bytes from the
buffer, and return the number of bytes written.  You can return a value
of ‘0’ to indicate an error.  You must not return any negative value.
 
   You should define the function to perform seek operations on the
cookie as:
 
     int SEEKER (void *COOKIE, off64_t *POSITION, int WHENCE)
 
   For this function, the POSITION and WHENCE arguments are interpreted
as for ‘fgetpos’; see *note Portable Positioning::.
 
   After doing the seek operation, your function should store the
resulting file position relative to the beginning of the file in
POSITION.  Your function should return a value of ‘0’ on success and
‘-1’ to indicate an error.
 
   You should define the function to do cleanup operations on the cookie
appropriate for closing the stream as:
 
     int CLEANER (void *COOKIE)
 
   Your function should return ‘-1’ to indicate an error, and ‘0’
otherwise.
 
 -- Data Type: cookie_read_function_t
 
     This is the data type that the read function for a custom stream
     should have.  If you declare the function as shown above, this is
     the type it will have.
 
 -- Data Type: cookie_write_function_t
 
     The data type of the write function for a custom stream.
 
 -- Data Type: cookie_seek_function_t
 
     The data type of the seek function for a custom stream.
 
 -- Data Type: cookie_close_function_t
 
     The data type of the close function for a custom stream.
 
 
File: libc.info,  Node: Formatted Messages,  Prev: Other Kinds of Streams,  Up: I/O on Streams
 
12.22 Formatted Messages
========================
 
On systems which are based on System V messages of programs (especially
the system tools) are printed in a strict form using the ‘fmtmsg’
function.  The uniformity sometimes helps the user to interpret messages
and the strictness tests of the ‘fmtmsg’ function ensure that the
programmer follows some minimal requirements.
 
* Menu:
 
* Printing Formatted Messages::   The ‘fmtmsg’ function.
* Adding Severity Classes::       Add more severity classes.
* Example::                       How to use ‘fmtmsg’ and ‘addseverity’.
 
 
File: libc.info,  Node: Printing Formatted Messages,  Next: Adding Severity Classes,  Up: Formatted Messages
 
12.22.1 Printing Formatted Messages
-----------------------------------
 
Messages can be printed to standard error and/or to the console.  To
select the destination the programmer can use the following two values,
bitwise OR combined if wanted, for the CLASSIFICATION parameter of
‘fmtmsg’:
 
‘MM_PRINT’
     Display the message in standard error.
‘MM_CONSOLE’
     Display the message on the system console.
 
   The erroneous piece of the system can be signalled by exactly one of
the following values which also is bitwise ORed with the CLASSIFICATION
parameter to ‘fmtmsg’:
 
‘MM_HARD’
     The source of the condition is some hardware.
‘MM_SOFT’
     The source of the condition is some software.
‘MM_FIRM’
     The source of the condition is some firmware.
 
   A third component of the CLASSIFICATION parameter to ‘fmtmsg’ can
describe the part of the system which detects the problem.  This is done
by using exactly one of the following values:
 
‘MM_APPL’
     The erroneous condition is detected by the application.
‘MM_UTIL’
     The erroneous condition is detected by a utility.
‘MM_OPSYS’
     The erroneous condition is detected by the operating system.
 
   A last component of CLASSIFICATION can signal the results of this
message.  Exactly one of the following values can be used:
 
‘MM_RECOVER’
     It is a recoverable error.
‘MM_NRECOV’
     It is a non-recoverable error.
 
 -- Function: int fmtmsg (long int CLASSIFICATION, const char *LABEL,
          int SEVERITY, const char *TEXT, const char *ACTION, const char
          *TAG)
 
     Preliminary: | MT-Safe | AS-Unsafe lock | AC-Safe | *Note POSIX
     Safety Concepts::.
 
     Display a message described by its parameters on the device(s)
     specified in the CLASSIFICATION parameter.  The LABEL parameter
     identifies the source of the message.  The string should consist of
     two colon separated parts where the first part has not more than 10
     and the second part not more than 14 characters.  The TEXT
     parameter describes the condition of the error, the ACTION
     parameter possible steps to recover from the error and the TAG
     parameter is a reference to the online documentation where more
     information can be found.  It should contain the LABEL value and a
     unique identification number.
 
     Each of the parameters can be a special value which means this
     value is to be omitted.  The symbolic names for these values are:
 
     ‘MM_NULLLBL’
          Ignore LABEL parameter.
     ‘MM_NULLSEV’
          Ignore SEVERITY parameter.
     ‘MM_NULLMC’
          Ignore CLASSIFICATION parameter.  This implies that nothing is
          actually printed.
     ‘MM_NULLTXT’
          Ignore TEXT parameter.
     ‘MM_NULLACT’
          Ignore ACTION parameter.
     ‘MM_NULLTAG’
          Ignore TAG parameter.
 
     There is another way certain fields can be omitted from the output
     to standard error.  This is described below in the description of
     environment variables influencing the behavior.
 
     The SEVERITY parameter can have one of the values in the following
     table:
 
     ‘MM_NOSEV’
          Nothing is printed, this value is the same as ‘MM_NULLSEV’.
     ‘MM_HALT’
          This value is printed as ‘HALT’.
     ‘MM_ERROR’
          This value is printed as ‘ERROR’.
     ‘MM_WARNING’
          This value is printed as ‘WARNING’.
     ‘MM_INFO’
          This value is printed as ‘INFO’.
 
     The numeric value of these five macros are between ‘0’ and ‘4’.
     Using the environment variable ‘SEV_LEVEL’ or using the
     ‘addseverity’ function one can add more severity levels with their
     corresponding string to print.  This is described below (*note
     Adding Severity Classes::).
 
     If no parameter is ignored the output looks like this:
 
          LABEL: SEVERITY-STRING: TEXT
          TO FIX: ACTION TAG
 
     The colons, new line characters and the ‘TO FIX’ string are
     inserted if necessary, i.e., if the corresponding parameter is not
     ignored.
 
     This function is specified in the X/Open Portability Guide.  It is
     also available on all systems derived from System V.
 
     The function returns the value ‘MM_OK’ if no error occurred.  If
     only the printing to standard error failed, it returns ‘MM_NOMSG’.
     If printing to the console fails, it returns ‘MM_NOCON’.  If
     nothing is printed ‘MM_NOTOK’ is returned.  Among situations where
     all outputs fail this last value is also returned if a parameter
     value is incorrect.
 
   There are two environment variables which influence the behavior of
‘fmtmsg’.  The first is ‘MSGVERB’.  It is used to control the output
actually happening on standard error (_not_ the console output).  Each
of the five fields can explicitly be enabled.  To do this the user has
to put the ‘MSGVERB’ variable with a format like the following in the
environment before calling the ‘fmtmsg’ function the first time:
 
     MSGVERB=KEYWORD[:KEYWORD[:…]]
 
   Valid KEYWORDs are ‘label’, ‘severity’, ‘text’, ‘action’, and ‘tag’.
If the environment variable is not given or is the empty string, a not
supported keyword is given or the value is somehow else invalid, no part
of the message is masked out.
 
   The second environment variable which influences the behavior of
‘fmtmsg’ is ‘SEV_LEVEL’.  This variable and the change in the behavior
of ‘fmtmsg’ is not specified in the X/Open Portability Guide.  It is
available in System V systems, though.  It can be used to introduce new
severity levels.  By default, only the five severity levels described
above are available.  Any other numeric value would make ‘fmtmsg’ print
nothing.
 
   If the user puts ‘SEV_LEVEL’ with a format like
 
     SEV_LEVEL=[DESCRIPTION[:DESCRIPTION[:…]]]
 
in the environment of the process before the first call to ‘fmtmsg’,
where DESCRIPTION has a value of the form
 
     SEVERITY-KEYWORD,LEVEL,PRINTSTRING
 
   The SEVERITY-KEYWORD part is not used by ‘fmtmsg’ but it has to be
present.  The LEVEL part is a string representation of a number.  The
numeric value must be a number greater than 4.  This value must be used
in the SEVERITY parameter of ‘fmtmsg’ to select this class.  It is not
possible to overwrite any of the predefined classes.  The PRINTSTRING is
the string printed when a message of this class is processed by ‘fmtmsg’
(see above, ‘fmtsmg’ does not print the numeric value but instead the
string representation).
 
 
File: libc.info,  Node: Adding Severity Classes,  Next: Example,  Prev: Printing Formatted Messages,  Up: Formatted Messages
 
12.22.2 Adding Severity Classes
-------------------------------
 
There is another possibility to introduce severity classes besides using
the environment variable ‘SEV_LEVEL’.  This simplifies the task of
introducing new classes in a running program.  One could use the
‘setenv’ or ‘putenv’ function to set the environment variable, but this
is toilsome.
 
 -- Function: int addseverity (int SEVERITY, const char *STRING)
     Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe lock mem |
     *Note POSIX Safety Concepts::.
 
     This function allows the introduction of new severity classes which
     can be addressed by the SEVERITY parameter of the ‘fmtmsg’
     function.  The SEVERITY parameter of ‘addseverity’ must match the
     value for the parameter with the same name of ‘fmtmsg’, and STRING
     is the string printed in the actual messages instead of the numeric
     value.
 
     If STRING is ‘NULL’ the severity class with the numeric value
     according to SEVERITY is removed.
 
     It is not possible to overwrite or remove one of the default
     severity classes.  All calls to ‘addseverity’ with SEVERITY set to
     one of the values for the default classes will fail.
 
     The return value is ‘MM_OK’ if the task was successfully performed.
     If the return value is ‘MM_NOTOK’ something went wrong.  This could
     mean that no more memory is available or a class is not available
     when it has to be removed.
 
     This function is not specified in the X/Open Portability Guide
     although the ‘fmtsmg’ function is.  It is available on System V
     systems.
 
 
File: libc.info,  Node: Example,  Prev: Adding Severity Classes,  Up: Formatted Messages
 
12.22.3 How to use ‘fmtmsg’ and ‘addseverity’
---------------------------------------------
 
Here is a simple example program to illustrate the use of both functions
described in this section.
 
 
     #include <fmtmsg.h>
 
     int
     main (void)
     {
       addseverity (5, "NOTE2");
       fmtmsg (MM_PRINT, "only1field", MM_INFO, "text2", "action2", "tag2");
       fmtmsg (MM_PRINT, "UX:cat", 5, "invalid syntax", "refer to manual",
               "UX:cat:001");
       fmtmsg (MM_PRINT, "label:foo", 6, "text", "action", "tag");
       return 0;
     }
 
   The second call to ‘fmtmsg’ illustrates a use of this function as it
usually occurs on System V systems, which heavily use this function.  It
seems worthwhile to give a short explanation here of how this system
works on System V. The value of the LABEL field (‘UX:cat’) says that the
error occurred in the Unix program ‘cat’.  The explanation of the error
follows and the value for the ACTION parameter is ‘"refer to manual"’.
One could be more specific here, if necessary.  The TAG field contains,
as proposed above, the value of the string given for the LABEL
parameter, and additionally a unique ID (‘001’ in this case).  For a GNU
environment this string could contain a reference to the corresponding
node in the Info page for the program.
 
Running this program without specifying the ‘MSGVERB’ and ‘SEV_LEVEL’
function produces the following output:
 
     UX:cat: NOTE2: invalid syntax
     TO FIX: refer to manual UX:cat:001
 
   We see the different fields of the message and how the extra glue
(the colons and the ‘TO FIX’ string) is printed.  But only one of the
three calls to ‘fmtmsg’ produced output.  The first call does not print
anything because the LABEL parameter is not in the correct form.  The
string must contain two fields, separated by a colon (*note Printing
Formatted Messages::).  The third ‘fmtmsg’ call produced no output since
the class with the numeric value ‘6’ is not defined.  Although a class
with numeric value ‘5’ is also not defined by default, the call to
‘addseverity’ introduces it and the second call to ‘fmtmsg’ produces the
above output.
 
   When we change the environment of the program to contain
‘SEV_LEVEL=XXX,6,NOTE’ when running it we get a different result:
 
     UX:cat: NOTE2: invalid syntax
     TO FIX: refer to manual UX:cat:001
     label:foo: NOTE: text
     TO FIX: action tag
 
   Now the third call to ‘fmtmsg’ produced some output and we see how
the string ‘NOTE’ from the environment variable appears in the message.
 
   Now we can reduce the output by specifying which fields we are
interested in.  If we additionally set the environment variable
‘MSGVERB’ to the value ‘severity:label:action’ we get the following
output:
 
     UX:cat: NOTE2
     TO FIX: refer to manual
     label:foo: NOTE
     TO FIX: action
 
I.e., the output produced by the TEXT and the TAG parameters to ‘fmtmsg’
vanished.  Please also note that now there is no colon after the ‘NOTE’
and ‘NOTE2’ strings in the output.  This is not necessary since there is
no more output on this line because the text is missing.
 
 
File: libc.info,  Node: Low-Level I/O,  Next: File System Interface,  Prev: I/O on Streams,  Up: Top
 
13 Low-Level Input/Output
*************************
 
This chapter describes functions for performing low-level input/output
operations on file descriptors.  These functions include the primitives
for the higher-level I/O functions described in *note I/O on Streams::,
as well as functions for performing low-level control operations for
which there are no equivalents on streams.
 
   Stream-level I/O is more flexible and usually more convenient;
therefore, programmers generally use the descriptor-level functions only
when necessary.  These are some of the usual reasons:
 
   • For reading binary files in large chunks.
 
   • For reading an entire file into core before parsing it.
 
   • To perform operations other than data transfer, which can only be
     done with a descriptor.  (You can use ‘fileno’ to get the
     descriptor corresponding to a stream.)
 
   • To pass descriptors to a child process.  (The child can create its
     own stream to use a descriptor that it inherits, but cannot inherit
     a stream directly.)
 
* Menu:
 
* Opening and Closing Files::           How to open and close file
                                         descriptors.
* I/O Primitives::                      Reading and writing data.
* File Position Primitive::             Setting a descriptor’s file
                                         position.
* Descriptors and Streams::             Converting descriptor to stream
                                         or vice-versa.
* Stream/Descriptor Precautions::       Precautions needed if you use both
                                         descriptors and streams.
* Scatter-Gather::                      Fast I/O to discontinuous buffers.
* Copying File Data::                   Copying data between files.
* Memory-mapped I/O::                   Using files like memory.
* Waiting for I/O::                     How to check for input or output
                    on multiple file descriptors.
* Synchronizing I/O::                   Making sure all I/O actions completed.
* Asynchronous I/O::                    Perform I/O in parallel.
* Control Operations::                  Various other operations on file
                    descriptors.
* Duplicating Descriptors::             Fcntl commands for duplicating
                                         file descriptors.
* Descriptor Flags::                    Fcntl commands for manipulating
                                         flags associated with file
                                         descriptors.
* File Status Flags::                   Fcntl commands for manipulating
                                         flags associated with open files.
* File Locks::                          Fcntl commands for implementing
                                         file locking.
* Open File Description Locks::         Fcntl commands for implementing
                                         open file description locking.
* Open File Description Locks Example:: An example of open file description lock
                                         usage
* Interrupt Input::                     Getting an asynchronous signal when
                                         input arrives.
* IOCTLs::                              Generic I/O Control operations.
 
 
File: libc.info,  Node: Opening and Closing Files,  Next: I/O Primitives,  Up: Low-Level I/O
 
13.1 Opening and Closing Files
==============================
 
This section describes the primitives for opening and closing files
using file descriptors.  The ‘open’ and ‘creat’ functions are declared
in the header file ‘fcntl.h’, while ‘close’ is declared in ‘unistd.h’.
 
 -- Function: int open (const char *FILENAME, int FLAGS[, mode_t MODE])
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
     Concepts::.
 
     The ‘open’ function creates and returns a new file descriptor for
     the file named by FILENAME.  Initially, the file position indicator
     for the file is at the beginning of the file.  The argument MODE
     (*note Permission Bits::) is used only when a file is created, but
     it doesn’t hurt to supply the argument in any case.
 
     The FLAGS argument controls how the file is to be opened.  This is
     a bit mask; you create the value by the bitwise OR of the
     appropriate parameters (using the ‘|’ operator in C). *Note File
     Status Flags::, for the parameters available.
 
     The normal return value from ‘open’ is a non-negative integer file
     descriptor.  In the case of an error, a value of -1 is returned
     instead.  In addition to the usual file name errors (*note File
     Name Errors::), the following ‘errno’ error conditions are defined
     for this function:
 
     ‘EACCES’
          The file exists but is not readable/writable as requested by
          the FLAGS argument, or the file does not exist and the
          directory is unwritable so it cannot be created.
 
     ‘EEXIST’
          Both ‘O_CREAT’ and ‘O_EXCL’ are set, and the named file
          already exists.
 
     ‘EINTR’
          The ‘open’ operation was interrupted by a signal.  *Note
          Interrupted Primitives::.
 
     ‘EISDIR’
          The FLAGS argument specified write access, and the file is a
          directory.
 
     ‘EMFILE’
          The process has too many files open.  The maximum number of
          file descriptors is controlled by the ‘RLIMIT_NOFILE’ resource
          limit; *note Limits on Resources::.
 
     ‘ENFILE’
          The entire system, or perhaps the file system which contains
          the directory, cannot support any additional open files at the
          moment.  (This problem cannot happen on GNU/Hurd systems.)
 
     ‘ENOENT’
          The named file does not exist, and ‘O_CREAT’ is not specified.
 
     ‘ENOSPC’
          The directory or file system that would contain the new file
          cannot be extended, because there is no disk space left.
 
     ‘ENXIO’
          ‘O_NONBLOCK’ and ‘O_WRONLY’ are both set in the FLAGS
          argument, the file named by FILENAME is a FIFO (*note Pipes
          and FIFOs::), and no process has the file open for reading.
 
     ‘EROFS’
          The file resides on a read-only file system and any of
          ‘O_WRONLY’, ‘O_RDWR’, and ‘O_TRUNC’ are set in the FLAGS
          argument, or ‘O_CREAT’ is set and the file does not already
          exist.
 
     If on a 32 bit machine the sources are translated with
     ‘_FILE_OFFSET_BITS == 64’ the function ‘open’ returns a file
     descriptor opened in the large file mode which enables the file
     handling functions to use files up to 2^63 bytes in size and offset
     from −2^63 to 2^63.  This happens transparently for the user since
     all of the low-level file handling functions are equally replaced.
 
     This function is a cancellation point in multi-threaded programs.
     This is a problem if the thread allocates some resources (like
     memory, file descriptors, semaphores or whatever) at the time
     ‘open’ is called.  If the thread gets canceled these resources stay
     allocated until the program ends.  To avoid this calls to ‘open’
     should be protected using cancellation handlers.
 
     The ‘open’ function is the underlying primitive for the ‘fopen’ and
     ‘freopen’ functions, that create streams.
 
 -- Function: int open64 (const char *FILENAME, int FLAGS[, mode_t
          MODE])
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
     Concepts::.
 
     This function is similar to ‘open’.  It returns a file descriptor
     which can be used to access the file named by FILENAME.  The only
     difference is that on 32 bit systems the file is opened in the
     large file mode.  I.e., file length and file offsets can exceed 31
     bits.
 
     When the sources are translated with ‘_FILE_OFFSET_BITS == 64’ this
     function is actually available under the name ‘open’.  I.e., the
     new, extended API using 64 bit file sizes and offsets transparently
     replaces the old API.
 
 -- Obsolete function: int creat (const char *FILENAME, mode_t MODE)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
     Concepts::.
 
     This function is obsolete.  The call:
 
          creat (FILENAME, MODE)
 
     is equivalent to:
 
          open (FILENAME, O_WRONLY | O_CREAT | O_TRUNC, MODE)
 
     If on a 32 bit machine the sources are translated with
     ‘_FILE_OFFSET_BITS == 64’ the function ‘creat’ returns a file
     descriptor opened in the large file mode which enables the file
     handling functions to use files up to 2^63 in size and offset from
     −2^63 to 2^63.  This happens transparently for the user since all
     of the low-level file handling functions are equally replaced.
 
 -- Obsolete function: int creat64 (const char *FILENAME, mode_t MODE)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
     Concepts::.
 
     This function is similar to ‘creat’.  It returns a file descriptor
     which can be used to access the file named by FILENAME.  The only
     difference is that on 32 bit systems the file is opened in the
     large file mode.  I.e., file length and file offsets can exceed 31
     bits.
 
     To use this file descriptor one must not use the normal operations
     but instead the counterparts named ‘*64’, e.g., ‘read64’.
 
     When the sources are translated with ‘_FILE_OFFSET_BITS == 64’ this
     function is actually available under the name ‘open’.  I.e., the
     new, extended API using 64 bit file sizes and offsets transparently
     replaces the old API.
 
 -- Function: int close (int FILEDES)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe fd | *Note POSIX Safety
     Concepts::.
 
     The function ‘close’ closes the file descriptor FILEDES.  Closing a
     file has the following consequences:
 
        • The file descriptor is deallocated.
 
        • Any record locks owned by the process on the file are
          unlocked.
 
        • When all file descriptors associated with a pipe or FIFO have
          been closed, any unread data is discarded.
 
     This function is a cancellation point in multi-threaded programs.
     This is a problem if the thread allocates some resources (like
     memory, file descriptors, semaphores or whatever) at the time
     ‘close’ is called.  If the thread gets canceled these resources
     stay allocated until the program ends.  To avoid this, calls to
     ‘close’ should be protected using cancellation handlers.
 
     The normal return value from ‘close’ is 0; a value of -1 is
     returned in case of failure.  The following ‘errno’ error
     conditions are defined for this function:
 
     ‘EBADF’
          The FILEDES argument is not a valid file descriptor.
 
     ‘EINTR’
          The ‘close’ call was interrupted by a signal.  *Note
          Interrupted Primitives::.  Here is an example of how to handle
          ‘EINTR’ properly:
 
               TEMP_FAILURE_RETRY (close (desc));
 
     ‘ENOSPC’
     ‘EIO’
     ‘EDQUOT’
          When the file is accessed by NFS, these errors from ‘write’
          can sometimes not be detected until ‘close’.  *Note I/O
          Primitives::, for details on their meaning.
 
     Please note that there is _no_ separate ‘close64’ function.  This
     is not necessary since this function does not determine nor depend
     on the mode of the file.  The kernel which performs the ‘close’
     operation knows which mode the descriptor is used for and can
     handle this situation.
 
   To close a stream, call ‘fclose’ (*note Closing Streams::) instead of
trying to close its underlying file descriptor with ‘close’.  This
flushes any buffered output and updates the stream object to indicate
that it is closed.
 
 
File: libc.info,  Node: I/O Primitives,  Next: File Position Primitive,  Prev: Opening and Closing Files,  Up: Low-Level I/O
 
13.2 Input and Output Primitives
================================
 
This section describes the functions for performing primitive input and
output operations on file descriptors: ‘read’, ‘write’, and ‘lseek’.
These functions are declared in the header file ‘unistd.h’.
 
 -- Data Type: ssize_t
 
     This data type is used to represent the sizes of blocks that can be
     read or written in a single operation.  It is similar to ‘size_t’,
     but must be a signed type.
 
 -- Function: ssize_t read (int FILEDES, void *BUFFER, size_t SIZE)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
     Concepts::.
 
     The ‘read’ function reads up to SIZE bytes from the file with
     descriptor FILEDES, storing the results in the BUFFER.  (This is
     not necessarily a character string, and no terminating null
     character is added.)
 
     The return value is the number of bytes actually read.  This might
     be less than SIZE; for example, if there aren’t that many bytes
     left in the file or if there aren’t that many bytes immediately
     available.  The exact behavior depends on what kind of file it is.
     Note that reading less than SIZE bytes is not an error.
 
     A value of zero indicates end-of-file (except if the value of the
     SIZE argument is also zero).  This is not considered an error.  If
     you keep calling ‘read’ while at end-of-file, it will keep
     returning zero and doing nothing else.
 
     If ‘read’ returns at least one character, there is no way you can
     tell whether end-of-file was reached.  But if you did reach the
     end, the next read will return zero.
 
     In case of an error, ‘read’ returns -1.  The following ‘errno’
     error conditions are defined for this function:
 
     ‘EAGAIN’
          Normally, when no input is immediately available, ‘read’ waits
          for some input.  But if the ‘O_NONBLOCK’ flag is set for the
          file (*note File Status Flags::), ‘read’ returns immediately
          without reading any data, and reports this error.
 
          *Compatibility Note:* Most versions of BSD Unix use a
          different error code for this: ‘EWOULDBLOCK’.  In the GNU C
          Library, ‘EWOULDBLOCK’ is an alias for ‘EAGAIN’, so it doesn’t
          matter which name you use.
 
          On some systems, reading a large amount of data from a
          character special file can also fail with ‘EAGAIN’ if the
          kernel cannot find enough physical memory to lock down the
          user’s pages.  This is limited to devices that transfer with
          direct memory access into the user’s memory, which means it
          does not include terminals, since they always use separate
          buffers inside the kernel.  This problem never happens on
          GNU/Hurd systems.
 
          Any condition that could result in ‘EAGAIN’ can instead result
          in a successful ‘read’ which returns fewer bytes than
          requested.  Calling ‘read’ again immediately would result in
          ‘EAGAIN’.
 
     ‘EBADF’
          The FILEDES argument is not a valid file descriptor, or is not
          open for reading.
 
     ‘EINTR’
          ‘read’ was interrupted by a signal while it was waiting for
          input.  *Note Interrupted Primitives::.  A signal will not
          necessarily cause ‘read’ to return ‘EINTR’; it may instead
          result in a successful ‘read’ which returns fewer bytes than
          requested.
 
     ‘EIO’
          For many devices, and for disk files, this error code
          indicates a hardware error.
 
          ‘EIO’ also occurs when a background process tries to read from
          the controlling terminal, and the normal action of stopping
          the process by sending it a ‘SIGTTIN’ signal isn’t working.
          This might happen if the signal is being blocked or ignored,
          or because the process group is orphaned.  *Note Job
          Control::, for more information about job control, and *note
          Signal Handling::, for information about signals.
 
     ‘EINVAL’
          In some systems, when reading from a character or block
          device, position and size offsets must be aligned to a
          particular block size.  This error indicates that the offsets
          were not properly aligned.
 
     Please note that there is no function named ‘read64’.  This is not
     necessary since this function does not directly modify or handle
     the possibly wide file offset.  Since the kernel handles this state
     internally, the ‘read’ function can be used for all cases.
 
     This function is a cancellation point in multi-threaded programs.
     This is a problem if the thread allocates some resources (like
     memory, file descriptors, semaphores or whatever) at the time
     ‘read’ is called.  If the thread gets canceled these resources stay
     allocated until the program ends.  To avoid this, calls to ‘read’
     should be protected using cancellation handlers.
 
     The ‘read’ function is the underlying primitive for all of the
     functions that read from streams, such as ‘fgetc’.
 
 -- Function: ssize_t pread (int FILEDES, void *BUFFER, size_t SIZE,
          off_t OFFSET)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
     Concepts::.
 
     The ‘pread’ function is similar to the ‘read’ function.  The first
     three arguments are identical, and the return values and error
     codes also correspond.
 
     The difference is the fourth argument and its handling.  The data
     block is not read from the current position of the file descriptor
     ‘filedes’.  Instead the data is read from the file starting at
     position OFFSET.  The position of the file descriptor itself is not
     affected by the operation.  The value is the same as before the
     call.
 
     When the source file is compiled with ‘_FILE_OFFSET_BITS == 64’ the
     ‘pread’ function is in fact ‘pread64’ and the type ‘off_t’ has 64
     bits, which makes it possible to handle files up to 2^63 bytes in
     length.
 
     The return value of ‘pread’ describes the number of bytes read.  In
     the error case it returns -1 like ‘read’ does and the error codes
     are also the same, with these additions:
 
     ‘EINVAL’
          The value given for OFFSET is negative and therefore illegal.
 
     ‘ESPIPE’
          The file descriptor FILEDES is associated with a pipe or a
          FIFO and this device does not allow positioning of the file
          pointer.
 
     The function is an extension defined in the Unix Single
     Specification version 2.
 
 -- Function: ssize_t pread64 (int FILEDES, void *BUFFER, size_t SIZE,
          off64_t OFFSET)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
     Concepts::.
 
     This function is similar to the ‘pread’ function.  The difference
     is that the OFFSET parameter is of type ‘off64_t’ instead of
     ‘off_t’ which makes it possible on 32 bit machines to address files
     larger than 2^31 bytes and up to 2^63 bytes.  The file descriptor
     ‘filedes’ must be opened using ‘open64’ since otherwise the large
     offsets possible with ‘off64_t’ will lead to errors with a
     descriptor in small file mode.
 
     When the source file is compiled with ‘_FILE_OFFSET_BITS == 64’ on
     a 32 bit machine this function is actually available under the name
     ‘pread’ and so transparently replaces the 32 bit interface.
 
 -- Function: ssize_t write (int FILEDES, const void *BUFFER, size_t
          SIZE)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
     Concepts::.
 
     The ‘write’ function writes up to SIZE bytes from BUFFER to the
     file with descriptor FILEDES.  The data in BUFFER is not
     necessarily a character string and a null character is output like
     any other character.
 
     The return value is the number of bytes actually written.  This may
     be SIZE, but can always be smaller.  Your program should always
     call ‘write’ in a loop, iterating until all the data is written.
 
     Once ‘write’ returns, the data is enqueued to be written and can be
     read back right away, but it is not necessarily written out to
     permanent storage immediately.  You can use ‘fsync’ when you need
     to be sure your data has been permanently stored before continuing.
     (It is more efficient for the system to batch up consecutive writes
     and do them all at once when convenient.  Normally they will always
     be written to disk within a minute or less.)  Modern systems
     provide another function ‘fdatasync’ which guarantees integrity
     only for the file data and is therefore faster.  You can use the
     ‘O_FSYNC’ open mode to make ‘write’ always store the data to disk
     before returning; *note Operating Modes::.
 
     In the case of an error, ‘write’ returns -1.  The following ‘errno’
     error conditions are defined for this function:
 
     ‘EAGAIN’
          Normally, ‘write’ blocks until the write operation is
          complete.  But if the ‘O_NONBLOCK’ flag is set for the file
          (*note Control Operations::), it returns immediately without
          writing any data and reports this error.  An example of a
          situation that might cause the process to block on output is
          writing to a terminal device that supports flow control, where
          output has been suspended by receipt of a STOP character.
 
          *Compatibility Note:* Most versions of BSD Unix use a
          different error code for this: ‘EWOULDBLOCK’.  In the GNU C
          Library, ‘EWOULDBLOCK’ is an alias for ‘EAGAIN’, so it doesn’t
          matter which name you use.
 
          On some systems, writing a large amount of data from a
          character special file can also fail with ‘EAGAIN’ if the
          kernel cannot find enough physical memory to lock down the
          user’s pages.  This is limited to devices that transfer with
          direct memory access into the user’s memory, which means it
          does not include terminals, since they always use separate
          buffers inside the kernel.  This problem does not arise on
          GNU/Hurd systems.
 
     ‘EBADF’
          The FILEDES argument is not a valid file descriptor, or is not
          open for writing.
 
     ‘EFBIG’
          The size of the file would become larger than the
          implementation can support.
 
     ‘EINTR’
          The ‘write’ operation was interrupted by a signal while it was
          blocked waiting for completion.  A signal will not necessarily
          cause ‘write’ to return ‘EINTR’; it may instead result in a
          successful ‘write’ which writes fewer bytes than requested.
          *Note Interrupted Primitives::.
 
     ‘EIO’
          For many devices, and for disk files, this error code
          indicates a hardware error.
 
     ‘ENOSPC’
          The device containing the file is full.
 
     ‘EPIPE’
          This error is returned when you try to write to a pipe or FIFO
          that isn’t open for reading by any process.  When this
          happens, a ‘SIGPIPE’ signal is also sent to the process; see
          *note Signal Handling::.
 
     ‘EINVAL’
          In some systems, when writing to a character or block device,
          position and size offsets must be aligned to a particular
          block size.  This error indicates that the offsets were not
          properly aligned.
 
     Unless you have arranged to prevent ‘EINTR’ failures, you should
     check ‘errno’ after each failing call to ‘write’, and if the error
     was ‘EINTR’, you should simply repeat the call.  *Note Interrupted
     Primitives::.  The easy way to do this is with the macro
     ‘TEMP_FAILURE_RETRY’, as follows:
 
          nbytes = TEMP_FAILURE_RETRY (write (desc, buffer, count));
 
     Please note that there is no function named ‘write64’.  This is not
     necessary since this function does not directly modify or handle
     the possibly wide file offset.  Since the kernel handles this state
     internally the ‘write’ function can be used for all cases.
 
     This function is a cancellation point in multi-threaded programs.
     This is a problem if the thread allocates some resources (like
     memory, file descriptors, semaphores or whatever) at the time
     ‘write’ is called.  If the thread gets canceled these resources
     stay allocated until the program ends.  To avoid this, calls to
     ‘write’ should be protected using cancellation handlers.
 
     The ‘write’ function is the underlying primitive for all of the
     functions that write to streams, such as ‘fputc’.
 
 -- Function: ssize_t pwrite (int FILEDES, const void *BUFFER, size_t
          SIZE, off_t OFFSET)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
     Concepts::.
 
     The ‘pwrite’ function is similar to the ‘write’ function.  The
     first three arguments are identical, and the return values and
     error codes also correspond.
 
     The difference is the fourth argument and its handling.  The data
     block is not written to the current position of the file descriptor
     ‘filedes’.  Instead the data is written to the file starting at
     position OFFSET.  The position of the file descriptor itself is not
     affected by the operation.  The value is the same as before the
     call.
 
     However, on Linux, if a file is opened with ‘O_APPEND’, ‘pwrite’
     appends data to the end of the file, regardless of the value of
     ‘offset’.
 
     When the source file is compiled with ‘_FILE_OFFSET_BITS == 64’ the
     ‘pwrite’ function is in fact ‘pwrite64’ and the type ‘off_t’ has 64
     bits, which makes it possible to handle files up to 2^63 bytes in
     length.
 
     The return value of ‘pwrite’ describes the number of written bytes.
     In the error case it returns -1 like ‘write’ does and the error
     codes are also the same, with these additions:
 
     ‘EINVAL’
          The value given for OFFSET is negative and therefore illegal.
 
     ‘ESPIPE’
          The file descriptor FILEDES is associated with a pipe or a
          FIFO and this device does not allow positioning of the file
          pointer.
 
     The function is an extension defined in the Unix Single
     Specification version 2.
 
 -- Function: ssize_t pwrite64 (int FILEDES, const void *BUFFER, size_t
          SIZE, off64_t OFFSET)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
     Concepts::.
 
     This function is similar to the ‘pwrite’ function.  The difference
     is that the OFFSET parameter is of type ‘off64_t’ instead of
     ‘off_t’ which makes it possible on 32 bit machines to address files
     larger than 2^31 bytes and up to 2^63 bytes.  The file descriptor
     ‘filedes’ must be opened using ‘open64’ since otherwise the large
     offsets possible with ‘off64_t’ will lead to errors with a
     descriptor in small file mode.
 
     When the source file is compiled using ‘_FILE_OFFSET_BITS == 64’ on
     a 32 bit machine this function is actually available under the name
     ‘pwrite’ and so transparently replaces the 32 bit interface.
 
 
File: libc.info,  Node: File Position Primitive,  Next: Descriptors and Streams,  Prev: I/O Primitives,  Up: Low-Level I/O
 
13.3 Setting the File Position of a Descriptor
==============================================
 
Just as you can set the file position of a stream with ‘fseek’, you can
set the file position of a descriptor with ‘lseek’.  This specifies the
position in the file for the next ‘read’ or ‘write’ operation.  *Note
File Positioning::, for more information on the file position and what
it means.
 
   To read the current file position value from a descriptor, use ‘lseek
(DESC, 0, SEEK_CUR)’.
 
 -- Function: off_t lseek (int FILEDES, off_t OFFSET, int WHENCE)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
     Concepts::.
 
     The ‘lseek’ function is used to change the file position of the
     file with descriptor FILEDES.
 
     The WHENCE argument specifies how the OFFSET should be interpreted,
     in the same way as for the ‘fseek’ function, and it must be one of
     the symbolic constants ‘SEEK_SET’, ‘SEEK_CUR’, or ‘SEEK_END’.
 
     ‘SEEK_SET’
          Specifies that OFFSET is a count of characters from the
          beginning of the file.
 
     ‘SEEK_CUR’
          Specifies that OFFSET is a count of characters from the
          current file position.  This count may be positive or
          negative.
 
     ‘SEEK_END’
          Specifies that OFFSET is a count of characters from the end of
          the file.  A negative count specifies a position within the
          current extent of the file; a positive count specifies a
          position past the current end.  If you set the position past
          the current end, and actually write data, you will extend the
          file with zeros up to that position.
 
     The return value from ‘lseek’ is normally the resulting file
     position, measured in bytes from the beginning of the file.  You
     can use this feature together with ‘SEEK_CUR’ to read the current
     file position.
 
     If you want to append to the file, setting the file position to the
     current end of file with ‘SEEK_END’ is not sufficient.  Another
     process may write more data after you seek but before you write,
     extending the file so the position you write onto clobbers their
     data.  Instead, use the ‘O_APPEND’ operating mode; *note Operating
     Modes::.
 
     You can set the file position past the current end of the file.
     This does not by itself make the file longer; ‘lseek’ never changes
     the file.  But subsequent output at that position will extend the
     file.  Characters between the previous end of file and the new
     position are filled with zeros.  Extending the file in this way can
     create a “hole”: the blocks of zeros are not actually allocated on
     disk, so the file takes up less space than it appears to; it is
     then called a “sparse file”.
 
     If the file position cannot be changed, or the operation is in some
     way invalid, ‘lseek’ returns a value of -1.  The following ‘errno’
     error conditions are defined for this function:
 
     ‘EBADF’
          The FILEDES is not a valid file descriptor.
 
     ‘EINVAL’
          The WHENCE argument value is not valid, or the resulting file
          offset is not valid.  A file offset is invalid.
 
     ‘ESPIPE’
          The FILEDES corresponds to an object that cannot be
          positioned, such as a pipe, FIFO or terminal device.  (POSIX.1
          specifies this error only for pipes and FIFOs, but on GNU
          systems, you always get ‘ESPIPE’ if the object is not
          seekable.)
 
     When the source file is compiled with ‘_FILE_OFFSET_BITS == 64’ the
     ‘lseek’ function is in fact ‘lseek64’ and the type ‘off_t’ has 64
     bits which makes it possible to handle files up to 2^63 bytes in
     length.
 
     This function is a cancellation point in multi-threaded programs.
     This is a problem if the thread allocates some resources (like
     memory, file descriptors, semaphores or whatever) at the time
     ‘lseek’ is called.  If the thread gets canceled these resources
     stay allocated until the program ends.  To avoid this calls to
     ‘lseek’ should be protected using cancellation handlers.
 
     The ‘lseek’ function is the underlying primitive for the ‘fseek’,
     ‘fseeko’, ‘ftell’, ‘ftello’ and ‘rewind’ functions, which operate
     on streams instead of file descriptors.
 
 -- Function: off64_t lseek64 (int FILEDES, off64_t OFFSET, int WHENCE)
 
     Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
     Concepts::.
 
     This function is similar to the ‘lseek’ function.  The difference
     is that the OFFSET parameter is of type ‘off64_t’ instead of
     ‘off_t’ which makes it possible on 32 bit machines to address files
     larger than 2^31 bytes and up to 2^63 bytes.  The file descriptor
     ‘filedes’ must be opened using ‘open64’ since otherwise the large
     offsets possible with ‘off64_t’ will lead to errors with a
     descriptor in small file mode.
 
     When the source file is compiled with ‘_FILE_OFFSET_BITS == 64’ on
     a 32 bits machine this function is actually available under the
     name ‘lseek’ and so transparently replaces the 32 bit interface.
 
   You can have multiple descriptors for the same file if you open the
file more than once, or if you duplicate a descriptor with ‘dup’.
Descriptors that come from separate calls to ‘open’ have independent
file positions; using ‘lseek’ on one descriptor has no effect on the
other.  For example,
 
     {
       int d1, d2;
       char buf[4];
       d1 = open ("foo", O_RDONLY);
       d2 = open ("foo", O_RDONLY);
       lseek (d1, 1024, SEEK_SET);
       read (d2, buf, 4);
     }
 
will read the first four characters of the file ‘foo’.  (The
error-checking code necessary for a real program has been omitted here
for brevity.)
 
   By contrast, descriptors made by duplication share a common file
position with the original descriptor that was duplicated.  Anything
which alters the file position of one of the duplicates, including
reading or writing data, affects all of them alike.  Thus, for example,
 
     {
       int d1, d2, d3;
       char buf1[4], buf2[4];
       d1 = open ("foo", O_RDONLY);
       d2 = dup (d1);
       d3 = dup (d2);
       lseek (d3, 1024, SEEK_SET);
       read (d1, buf1, 4);
       read (d2, buf2, 4);
     }
 
will read four characters starting with the 1024’th character of ‘foo’,
and then four more characters starting with the 1028’th character.
 
 -- Data Type: off_t
 
     This is a signed integer type used to represent file sizes.  In the
     GNU C Library, this type is no narrower than ‘int’.
 
     If the source is compiled with ‘_FILE_OFFSET_BITS == 64’ this type
     is transparently replaced by ‘off64_t’.
 
 -- Data Type: off64_t
 
     This type is used similar to ‘off_t’.  The difference is that even
     on 32 bit machines, where the ‘off_t’ type would have 32 bits,
     ‘off64_t’ has 64 bits and so is able to address files up to 2^63
     bytes in length.
 
     When compiling with ‘_FILE_OFFSET_BITS == 64’ this type is
     available under the name ‘off_t’.
 
   These aliases for the ‘SEEK_…’ constants exist for the sake of
compatibility with older BSD systems.  They are defined in two different
header files: ‘fcntl.h’ and ‘sys/file.h’.
 
‘L_SET’
     An alias for ‘SEEK_SET’.
 
‘L_INCR’
     An alias for ‘SEEK_CUR’.
 
‘L_XTND’
     An alias for ‘SEEK_END’.