getconf.c 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338
  1. /* Copyright (C) 1991, 92, 1995-2008, 2009 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published
  5. by the Free Software Foundation; version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  14. #define _GNU_SOURCE 1
  15. #include <unistd.h>
  16. #include <errno.h>
  17. #include <string.h>
  18. #include <stdlib.h>
  19. #include <stdio.h>
  20. #define PACKAGE "getconf regression test"
  21. #define VERSION ""
  22. #ifndef _
  23. # define _
  24. #endif
  25. #define error(status, errnum,...) \
  26. {fprintf(stderr, __VA_ARGS__); exit(status);}
  27. struct conf
  28. {
  29. const char *name;
  30. const int call_name;
  31. const enum { SYSCONF, CONFSTR, PATHCONF } call;
  32. };
  33. static const struct conf vars[] =
  34. {
  35. #ifdef _PC_LINK_MAX
  36. { "LINK_MAX", _PC_LINK_MAX, PATHCONF },
  37. #endif
  38. #ifdef _PC_LINK_MAX
  39. { "_POSIX_LINK_MAX", _PC_LINK_MAX, PATHCONF },
  40. #endif
  41. #ifdef _PC_MAX_CANON
  42. { "MAX_CANON", _PC_MAX_CANON, PATHCONF },
  43. #endif
  44. #ifdef _PC_MAX_CANON
  45. { "_POSIX_MAX_CANON", _PC_MAX_CANON, PATHCONF },
  46. #endif
  47. #ifdef _PC_MAX_INPUT
  48. { "MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
  49. #endif
  50. #ifdef _PC_MAX_INPUT
  51. { "_POSIX_MAX_INPUT", _PC_MAX_INPUT, PATHCONF },
  52. #endif
  53. #ifdef _PC_NAME_MAX
  54. { "NAME_MAX", _PC_NAME_MAX, PATHCONF },
  55. #endif
  56. #ifdef _PC_NAME_MAX
  57. { "_POSIX_NAME_MAX", _PC_NAME_MAX, PATHCONF },
  58. #endif
  59. #ifdef _PC_PATH_MAX
  60. { "PATH_MAX", _PC_PATH_MAX, PATHCONF },
  61. #endif
  62. #ifdef _PC_PATH_MAX
  63. { "_POSIX_PATH_MAX", _PC_PATH_MAX, PATHCONF },
  64. #endif
  65. #ifdef _PC_PIPE_BUF
  66. { "PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
  67. #endif
  68. #ifdef _PC_PIPE_BUF
  69. { "_POSIX_PIPE_BUF", _PC_PIPE_BUF, PATHCONF },
  70. #endif
  71. #ifdef _PC_SOCK_MAXBUF
  72. { "SOCK_MAXBUF", _PC_SOCK_MAXBUF, PATHCONF },
  73. #endif
  74. #ifdef _PC_ASYNC_IO
  75. { "_POSIX_ASYNC_IO", _PC_ASYNC_IO, PATHCONF },
  76. #endif
  77. #ifdef _PC_CHOWN_RESTRICTED
  78. { "_POSIX_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED, PATHCONF },
  79. #endif
  80. #ifdef _PC_NO_TRUNC
  81. { "_POSIX_NO_TRUNC", _PC_NO_TRUNC, PATHCONF },
  82. #endif
  83. #ifdef _PC_PRIO_IO
  84. { "_POSIX_PRIO_IO", _PC_PRIO_IO, PATHCONF },
  85. #endif
  86. #ifdef _PC_SYNC_IO
  87. { "_POSIX_SYNC_IO", _PC_SYNC_IO, PATHCONF },
  88. #endif
  89. #ifdef _PC_VDISABLE
  90. { "_POSIX_VDISABLE", _PC_VDISABLE, PATHCONF },
  91. #endif
  92. #ifdef _SC_ARG_MAX
  93. { "ARG_MAX", _SC_ARG_MAX, SYSCONF },
  94. #endif
  95. #ifdef _SC_ATEXIT_MAX
  96. { "ATEXIT_MAX", _SC_ATEXIT_MAX, SYSCONF },
  97. #endif
  98. #ifdef _SC_CHAR_BIT
  99. { "CHAR_BIT", _SC_CHAR_BIT, SYSCONF },
  100. #endif
  101. #ifdef _SC_CHAR_MAX
  102. { "CHAR_MAX", _SC_CHAR_MAX, SYSCONF },
  103. #endif
  104. #ifdef _SC_CHAR_MIN
  105. { "CHAR_MIN", _SC_CHAR_MIN, SYSCONF },
  106. #endif
  107. #ifdef _SC_CHILD_MAX
  108. { "CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
  109. #endif
  110. #ifdef _SC_CLK_TCK
  111. { "CLK_TCK", _SC_CLK_TCK, SYSCONF },
  112. #endif
  113. #ifdef _SC_INT_MAX
  114. { "INT_MAX", _SC_INT_MAX, SYSCONF },
  115. #endif
  116. #ifdef _SC_INT_MIN
  117. { "INT_MIN", _SC_INT_MIN, SYSCONF },
  118. #endif
  119. #ifdef _SC_UIO_MAXIOV
  120. { "IOV_MAX", _SC_UIO_MAXIOV, SYSCONF },
  121. #endif
  122. #ifdef _SC_LOGIN_NAME_MAX
  123. { "LOGNAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
  124. #endif
  125. #ifdef _SC_LONG_BIT
  126. { "LONG_BIT", _SC_LONG_BIT, SYSCONF },
  127. #endif
  128. #ifdef _SC_MB_LEN_MAX
  129. { "MB_LEN_MAX", _SC_MB_LEN_MAX, SYSCONF },
  130. #endif
  131. #ifdef _SC_NGROUPS_MAX
  132. { "NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
  133. #endif
  134. #ifdef _SC_NL_ARGMAX
  135. { "NL_ARGMAX", _SC_NL_ARGMAX, SYSCONF },
  136. #endif
  137. #ifdef _SC_NL_LANGMAX
  138. { "NL_LANGMAX", _SC_NL_LANGMAX, SYSCONF },
  139. #endif
  140. #ifdef _SC_NL_MSGMAX
  141. { "NL_MSGMAX", _SC_NL_MSGMAX, SYSCONF },
  142. #endif
  143. #ifdef _SC_NL_NMAX
  144. { "NL_NMAX", _SC_NL_NMAX, SYSCONF },
  145. #endif
  146. #ifdef _SC_NL_SETMAX
  147. { "NL_SETMAX", _SC_NL_SETMAX, SYSCONF },
  148. #endif
  149. #ifdef _SC_NL_TEXTMAX
  150. { "NL_TEXTMAX", _SC_NL_TEXTMAX, SYSCONF },
  151. #endif
  152. #ifdef _SC_GETGR_R_SIZE_MAX
  153. { "NSS_BUFLEN_GROUP", _SC_GETGR_R_SIZE_MAX, SYSCONF },
  154. #endif
  155. #ifdef _SC_GETPW_R_SIZE_MAX
  156. { "NSS_BUFLEN_PASSWD", _SC_GETPW_R_SIZE_MAX, SYSCONF },
  157. #endif
  158. #ifdef _SC_NZERO
  159. { "NZERO", _SC_NZERO, SYSCONF },
  160. #endif
  161. #ifdef _SC_OPEN_MAX
  162. { "OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
  163. #endif
  164. #ifdef _SC_PAGESIZE
  165. { "PAGESIZE", _SC_PAGESIZE, SYSCONF },
  166. #endif
  167. #ifdef _SC_PAGESIZE
  168. { "PAGE_SIZE", _SC_PAGESIZE, SYSCONF },
  169. #endif
  170. #ifdef _SC_PASS_MAX
  171. { "PASS_MAX", _SC_PASS_MAX, SYSCONF },
  172. #endif
  173. #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS
  174. { "PTHREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS, SYSCONF },
  175. #endif
  176. #ifdef _SC_THREAD_KEYS_MAX
  177. { "PTHREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX, SYSCONF },
  178. #endif
  179. #ifdef _SC_THREAD_STACK_MIN
  180. { "PTHREAD_STACK_MIN", _SC_THREAD_STACK_MIN, SYSCONF },
  181. #endif
  182. #ifdef _SC_THREAD_THREADS_MAX
  183. { "PTHREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX, SYSCONF },
  184. #endif
  185. #ifdef _SC_SCHAR_MAX
  186. { "SCHAR_MAX", _SC_SCHAR_MAX, SYSCONF },
  187. #endif
  188. #ifdef _SC_SCHAR_MIN
  189. { "SCHAR_MIN", _SC_SCHAR_MIN, SYSCONF },
  190. #endif
  191. #ifdef _SC_SHRT_MAX
  192. { "SHRT_MAX", _SC_SHRT_MAX, SYSCONF },
  193. #endif
  194. #ifdef _SC_SHRT_MIN
  195. { "SHRT_MIN", _SC_SHRT_MIN, SYSCONF },
  196. #endif
  197. #ifdef _SC_SSIZE_MAX
  198. { "SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
  199. #endif
  200. #ifdef _SC_TTY_NAME_MAX
  201. { "TTY_NAME_MAX", _SC_TTY_NAME_MAX, SYSCONF },
  202. #endif
  203. #ifdef _SC_TZNAME_MAX
  204. { "TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
  205. #endif
  206. #ifdef _SC_UCHAR_MAX
  207. { "UCHAR_MAX", _SC_UCHAR_MAX, SYSCONF },
  208. #endif
  209. #ifdef _SC_UINT_MAX
  210. { "UINT_MAX", _SC_UINT_MAX, SYSCONF },
  211. #endif
  212. #ifdef _SC_UIO_MAXIOV
  213. { "UIO_MAXIOV", _SC_UIO_MAXIOV, SYSCONF },
  214. #endif
  215. #ifdef _SC_ULONG_MAX
  216. { "ULONG_MAX", _SC_ULONG_MAX, SYSCONF },
  217. #endif
  218. #ifdef _SC_USHRT_MAX
  219. { "USHRT_MAX", _SC_USHRT_MAX, SYSCONF },
  220. #endif
  221. #ifdef _SC_WORD_BIT
  222. { "WORD_BIT", _SC_WORD_BIT, SYSCONF },
  223. #endif
  224. #ifdef _SC_AVPHYS_PAGES
  225. { "_AVPHYS_PAGES", _SC_AVPHYS_PAGES, SYSCONF },
  226. #endif
  227. #ifdef _SC_NPROCESSORS_CONF
  228. { "_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF, SYSCONF },
  229. #endif
  230. #ifdef _SC_NPROCESSORS_ONLN
  231. { "_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN, SYSCONF },
  232. #endif
  233. #ifdef _SC_PHYS_PAGES
  234. { "_PHYS_PAGES", _SC_PHYS_PAGES, SYSCONF },
  235. #endif
  236. #ifdef _SC_ARG_MAX
  237. { "_POSIX_ARG_MAX", _SC_ARG_MAX, SYSCONF },
  238. #endif
  239. #ifdef _SC_ASYNCHRONOUS_IO
  240. { "_POSIX_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO, SYSCONF },
  241. #endif
  242. #ifdef _SC_CHILD_MAX
  243. { "_POSIX_CHILD_MAX", _SC_CHILD_MAX, SYSCONF },
  244. #endif
  245. #ifdef _SC_FSYNC
  246. { "_POSIX_FSYNC", _SC_FSYNC, SYSCONF },
  247. #endif
  248. #ifdef _SC_JOB_CONTROL
  249. { "_POSIX_JOB_CONTROL", _SC_JOB_CONTROL, SYSCONF },
  250. #endif
  251. #ifdef _SC_MAPPED_FILES
  252. { "_POSIX_MAPPED_FILES", _SC_MAPPED_FILES, SYSCONF },
  253. #endif
  254. #ifdef _SC_MEMLOCK
  255. { "_POSIX_MEMLOCK", _SC_MEMLOCK, SYSCONF },
  256. #endif
  257. #ifdef _SC_MEMLOCK_RANGE
  258. { "_POSIX_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE, SYSCONF },
  259. #endif
  260. #ifdef _SC_MEMORY_PROTECTION
  261. { "_POSIX_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION, SYSCONF },
  262. #endif
  263. #ifdef _SC_MESSAGE_PASSING
  264. { "_POSIX_MESSAGE_PASSING", _SC_MESSAGE_PASSING, SYSCONF },
  265. #endif
  266. #ifdef _SC_NGROUPS_MAX
  267. { "_POSIX_NGROUPS_MAX", _SC_NGROUPS_MAX, SYSCONF },
  268. #endif
  269. #ifdef _SC_OPEN_MAX
  270. { "_POSIX_OPEN_MAX", _SC_OPEN_MAX, SYSCONF },
  271. #endif
  272. #ifdef _SC_PII
  273. { "_POSIX_PII", _SC_PII, SYSCONF },
  274. #endif
  275. #ifdef _SC_PII_INTERNET
  276. { "_POSIX_PII_INTERNET", _SC_PII_INTERNET, SYSCONF },
  277. #endif
  278. #ifdef _SC_PII_INTERNET_DGRAM
  279. { "_POSIX_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM, SYSCONF },
  280. #endif
  281. #ifdef _SC_PII_INTERNET_STREAM
  282. { "_POSIX_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM, SYSCONF },
  283. #endif
  284. #ifdef _SC_PII_OSI
  285. { "_POSIX_PII_OSI", _SC_PII_OSI, SYSCONF },
  286. #endif
  287. #ifdef _SC_PII_OSI_CLTS
  288. { "_POSIX_PII_OSI_CLTS", _SC_PII_OSI_CLTS, SYSCONF },
  289. #endif
  290. #ifdef _SC_PII_OSI_COTS
  291. { "_POSIX_PII_OSI_COTS", _SC_PII_OSI_COTS, SYSCONF },
  292. #endif
  293. #ifdef _SC_PII_OSI_M
  294. { "_POSIX_PII_OSI_M", _SC_PII_OSI_M, SYSCONF },
  295. #endif
  296. #ifdef _SC_PII_SOCKET
  297. { "_POSIX_PII_SOCKET", _SC_PII_SOCKET, SYSCONF },
  298. #endif
  299. #ifdef _SC_PII_XTI
  300. { "_POSIX_PII_XTI", _SC_PII_XTI, SYSCONF },
  301. #endif
  302. #ifdef _SC_POLL
  303. { "_POSIX_POLL", _SC_POLL, SYSCONF },
  304. #endif
  305. #ifdef _SC_PRIORITIZED_IO
  306. { "_POSIX_PRIORITIZED_IO", _SC_PRIORITIZED_IO, SYSCONF },
  307. #endif
  308. #ifdef _SC_PRIORITY_SCHEDULING
  309. { "_POSIX_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING, SYSCONF },
  310. #endif
  311. #ifdef _SC_REALTIME_SIGNALS
  312. { "_POSIX_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS, SYSCONF },
  313. #endif
  314. #ifdef _SC_SAVED_IDS
  315. { "_POSIX_SAVED_IDS", _SC_SAVED_IDS, SYSCONF },
  316. #endif
  317. #ifdef _SC_SELECT
  318. { "_POSIX_SELECT", _SC_SELECT, SYSCONF },
  319. #endif
  320. #ifdef _SC_SEMAPHORES
  321. { "_POSIX_SEMAPHORES", _SC_SEMAPHORES, SYSCONF },
  322. #endif
  323. #ifdef _SC_SHARED_MEMORY_OBJECTS
  324. { "_POSIX_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS, SYSCONF },
  325. #endif
  326. #ifdef _SC_SSIZE_MAX
  327. { "_POSIX_SSIZE_MAX", _SC_SSIZE_MAX, SYSCONF },
  328. #endif
  329. #ifdef _SC_STREAM_MAX
  330. { "_POSIX_STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
  331. #endif
  332. #ifdef _SC_SYNCHRONIZED_IO
  333. { "_POSIX_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO, SYSCONF },
  334. #endif
  335. #ifdef _SC_THREADS
  336. { "_POSIX_THREADS", _SC_THREADS, SYSCONF },
  337. #endif
  338. #ifdef _SC_THREAD_ATTR_STACKADDR
  339. { "_POSIX_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR, SYSCONF },
  340. #endif
  341. #ifdef _SC_THREAD_ATTR_STACKSIZE
  342. { "_POSIX_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE, SYSCONF },
  343. #endif
  344. #ifdef _SC_THREAD_PRIORITY_SCHEDULING
  345. { "_POSIX_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING, SYSCONF },
  346. #endif
  347. #ifdef _SC_THREAD_PRIO_INHERIT
  348. { "_POSIX_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT, SYSCONF },
  349. #endif
  350. #ifdef _SC_THREAD_PRIO_PROTECT
  351. { "_POSIX_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT, SYSCONF },
  352. #endif
  353. #ifdef _SC_THREAD_ROBUST_PRIO_INHERIT
  354. { "_POSIX_THREAD_ROBUST_PRIO_INHERIT", _SC_THREAD_ROBUST_PRIO_INHERIT,
  355. SYSCONF },
  356. #endif
  357. #ifdef _SC_THREAD_ROBUST_PRIO_PROTECT
  358. { "_POSIX_THREAD_ROBUST_PRIO_PROTECT", _SC_THREAD_ROBUST_PRIO_PROTECT,
  359. SYSCONF },
  360. #endif
  361. #ifdef _SC_THREAD_PROCESS_SHARED
  362. { "_POSIX_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED, SYSCONF },
  363. #endif
  364. #ifdef _SC_THREAD_SAFE_FUNCTIONS
  365. { "_POSIX_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS, SYSCONF },
  366. #endif
  367. #ifdef _SC_TIMERS
  368. { "_POSIX_TIMERS", _SC_TIMERS, SYSCONF },
  369. #endif
  370. #ifdef _SC_TIMER_MAX
  371. { "TIMER_MAX", _SC_TIMER_MAX, SYSCONF },
  372. #endif
  373. #ifdef _SC_TZNAME_MAX
  374. { "_POSIX_TZNAME_MAX", _SC_TZNAME_MAX, SYSCONF },
  375. #endif
  376. #ifdef _SC_VERSION
  377. { "_POSIX_VERSION", _SC_VERSION, SYSCONF },
  378. #endif
  379. #ifdef _SC_T_IOV_MAX
  380. { "_T_IOV_MAX", _SC_T_IOV_MAX, SYSCONF },
  381. #endif
  382. #ifdef _SC_XOPEN_CRYPT
  383. { "_XOPEN_CRYPT", _SC_XOPEN_CRYPT, SYSCONF },
  384. #endif
  385. #ifdef _SC_XOPEN_ENH_I18N
  386. { "_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N, SYSCONF },
  387. #endif
  388. #ifdef _SC_XOPEN_LEGACY
  389. { "_XOPEN_LEGACY", _SC_XOPEN_LEGACY, SYSCONF },
  390. #endif
  391. #ifdef _SC_XOPEN_REALTIME
  392. { "_XOPEN_REALTIME", _SC_XOPEN_REALTIME, SYSCONF },
  393. #endif
  394. #ifdef _SC_XOPEN_REALTIME_THREADS
  395. { "_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS, SYSCONF },
  396. #endif
  397. #ifdef _SC_XOPEN_SHM
  398. { "_XOPEN_SHM", _SC_XOPEN_SHM, SYSCONF },
  399. #endif
  400. #ifdef _SC_XOPEN_UNIX
  401. { "_XOPEN_UNIX", _SC_XOPEN_UNIX, SYSCONF },
  402. #endif
  403. #ifdef _SC_XOPEN_VERSION
  404. { "_XOPEN_VERSION", _SC_XOPEN_VERSION, SYSCONF },
  405. #endif
  406. #ifdef _SC_XOPEN_XCU_VERSION
  407. { "_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION, SYSCONF },
  408. #endif
  409. #ifdef _SC_XOPEN_XPG2
  410. { "_XOPEN_XPG2", _SC_XOPEN_XPG2, SYSCONF },
  411. #endif
  412. #ifdef _SC_XOPEN_XPG3
  413. { "_XOPEN_XPG3", _SC_XOPEN_XPG3, SYSCONF },
  414. #endif
  415. #ifdef _SC_XOPEN_XPG4
  416. { "_XOPEN_XPG4", _SC_XOPEN_XPG4, SYSCONF },
  417. #endif
  418. /* POSIX.2 */
  419. #ifdef _SC_BC_BASE_MAX
  420. { "BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
  421. #endif
  422. #ifdef _SC_BC_DIM_MAX
  423. { "BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
  424. #endif
  425. #ifdef _SC_BC_SCALE_MAX
  426. { "BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
  427. #endif
  428. #ifdef _SC_BC_STRING_MAX
  429. { "BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
  430. #endif
  431. { "CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX, SYSCONF },
  432. #ifdef _SC_COLL_WEIGHTS_MAX
  433. { "COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
  434. #endif
  435. #ifdef _SC_EQUIV_CLASS_MAX
  436. { "EQUIV_CLASS_MAX", _SC_EQUIV_CLASS_MAX, SYSCONF },
  437. #endif
  438. #ifdef _SC_EXPR_NEST_MAX
  439. { "EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
  440. #endif
  441. #ifdef _SC_LINE_MAX
  442. { "LINE_MAX", _SC_LINE_MAX, SYSCONF },
  443. #endif
  444. #ifdef _SC_BC_BASE_MAX
  445. { "POSIX2_BC_BASE_MAX", _SC_BC_BASE_MAX, SYSCONF },
  446. #endif
  447. #ifdef _SC_BC_DIM_MAX
  448. { "POSIX2_BC_DIM_MAX", _SC_BC_DIM_MAX, SYSCONF },
  449. #endif
  450. #ifdef _SC_BC_SCALE_MAX
  451. { "POSIX2_BC_SCALE_MAX", _SC_BC_SCALE_MAX, SYSCONF },
  452. #endif
  453. #ifdef _SC_BC_STRING_MAX
  454. { "POSIX2_BC_STRING_MAX", _SC_BC_STRING_MAX, SYSCONF },
  455. #endif
  456. #ifdef _SC_2_CHAR_TERM
  457. { "POSIX2_CHAR_TERM", _SC_2_CHAR_TERM, SYSCONF },
  458. #endif
  459. #ifdef _SC_COLL_WEIGHTS_MAX
  460. { "POSIX2_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX, SYSCONF },
  461. #endif
  462. #ifdef _SC_2_C_BIND
  463. { "POSIX2_C_BIND", _SC_2_C_BIND, SYSCONF },
  464. #endif
  465. #ifdef _SC_2_C_DEV
  466. { "POSIX2_C_DEV", _SC_2_C_DEV, SYSCONF },
  467. #endif
  468. #ifdef _SC_2_C_VERSION
  469. { "POSIX2_C_VERSION", _SC_2_C_VERSION, SYSCONF },
  470. #endif
  471. #ifdef _SC_EXPR_NEST_MAX
  472. { "POSIX2_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX, SYSCONF },
  473. #endif
  474. #ifdef _SC_2_FORT_DEV
  475. { "POSIX2_FORT_DEV", _SC_2_FORT_DEV, SYSCONF },
  476. #endif
  477. #ifdef _SC_2_FORT_RUN
  478. { "POSIX2_FORT_RUN", _SC_2_FORT_RUN, SYSCONF },
  479. #endif
  480. #ifdef _SC_LINE_MAX
  481. { "_POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
  482. { "POSIX2_LINE_MAX", _SC_LINE_MAX, SYSCONF },
  483. #endif
  484. #ifdef _SC_2_LOCALEDEF
  485. { "POSIX2_LOCALEDEF", _SC_2_LOCALEDEF, SYSCONF },
  486. #endif
  487. #ifdef _SC_RE_DUP_MAX
  488. { "POSIX2_RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
  489. #endif
  490. #ifdef _SC_2_SW_DEV
  491. { "POSIX2_SW_DEV", _SC_2_SW_DEV, SYSCONF },
  492. #endif
  493. #ifdef _SC_2_UPE
  494. { "POSIX2_UPE", _SC_2_UPE, SYSCONF },
  495. #endif
  496. #ifdef _SC_2_VERSION
  497. { "POSIX2_VERSION", _SC_2_VERSION, SYSCONF },
  498. #endif
  499. #ifdef _SC_RE_DUP_MAX
  500. { "RE_DUP_MAX", _SC_RE_DUP_MAX, SYSCONF },
  501. #endif
  502. #ifdef _CS_PATH
  503. { "PATH", _CS_PATH, CONFSTR },
  504. { "CS_PATH", _CS_PATH, CONFSTR },
  505. #endif
  506. /* LFS */
  507. #ifdef _CS_LFS_CFLAGS
  508. { "LFS_CFLAGS", _CS_LFS_CFLAGS, CONFSTR },
  509. #endif
  510. #ifdef _CS_LFS_LDFLAGS
  511. { "LFS_LDFLAGS", _CS_LFS_LDFLAGS, CONFSTR },
  512. #endif
  513. #ifdef _CS_LFS_LIBS
  514. { "LFS_LIBS", _CS_LFS_LIBS, CONFSTR },
  515. #endif
  516. #ifdef _CS_LFS_LINTFLAGS
  517. { "LFS_LINTFLAGS", _CS_LFS_LINTFLAGS, CONFSTR },
  518. #endif
  519. #ifdef _CS_LFS64_CFLAGS
  520. { "LFS64_CFLAGS", _CS_LFS64_CFLAGS, CONFSTR },
  521. #endif
  522. #ifdef _CS_LFS64_LDFLAGS
  523. { "LFS64_LDFLAGS", _CS_LFS64_LDFLAGS, CONFSTR },
  524. #endif
  525. #ifdef _CS_LFS64_LIBS
  526. { "LFS64_LIBS", _CS_LFS64_LIBS, CONFSTR },
  527. #endif
  528. #ifdef _CS_LFS64_LINTFLAGS
  529. { "LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS, CONFSTR },
  530. #endif
  531. /* Programming environments. */
  532. #ifdef _CS_V5_WIDTH_RESTRICTED_ENVS
  533. { "_XBS5_WIDTH_RESTRICTED_ENVS", _CS_V5_WIDTH_RESTRICTED_ENVS, CONFSTR },
  534. { "XBS5_WIDTH_RESTRICTED_ENVS", _CS_V5_WIDTH_RESTRICTED_ENVS, CONFSTR },
  535. #endif
  536. #ifdef _SC_XBS5_ILP32_OFF32
  537. { "_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32, SYSCONF },
  538. #endif
  539. #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS
  540. { "XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS, CONFSTR },
  541. #endif
  542. #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS
  543. { "XBS5_ILP32_OFF32_LDFLAGS", _CS_XBS5_ILP32_OFF32_LDFLAGS, CONFSTR },
  544. #endif
  545. #ifdef _CS_XBS5_ILP32_OFF32_LIBS
  546. { "XBS5_ILP32_OFF32_LIBS", _CS_XBS5_ILP32_OFF32_LIBS, CONFSTR },
  547. #endif
  548. #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS
  549. { "XBS5_ILP32_OFF32_LINTFLAGS", _CS_XBS5_ILP32_OFF32_LINTFLAGS, CONFSTR },
  550. #endif
  551. #ifdef _SC_XBS5_ILP32_OFFBIG
  552. { "_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG, SYSCONF },
  553. #endif
  554. #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS
  555. { "XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS, CONFSTR },
  556. #endif
  557. #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS
  558. { "XBS5_ILP32_OFFBIG_LDFLAGS", _CS_XBS5_ILP32_OFFBIG_LDFLAGS, CONFSTR },
  559. #endif
  560. #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS
  561. { "XBS5_ILP32_OFFBIG_LIBS", _CS_XBS5_ILP32_OFFBIG_LIBS, CONFSTR },
  562. #endif
  563. #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS
  564. { "XBS5_ILP32_OFFBIG_LINTFLAGS", _CS_XBS5_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
  565. #endif
  566. #ifdef _SC_XBS5_LP64_OFF64
  567. { "_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64, SYSCONF },
  568. #endif
  569. #ifdef _CS_XBS5_LP64_OFF64_CFLAGS
  570. { "XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS, CONFSTR },
  571. #endif
  572. #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS
  573. { "XBS5_LP64_OFF64_LDFLAGS", _CS_XBS5_LP64_OFF64_LDFLAGS, CONFSTR },
  574. #endif
  575. #ifdef _CS_XBS5_LP64_OFF64_LIBS
  576. { "XBS5_LP64_OFF64_LIBS", _CS_XBS5_LP64_OFF64_LIBS, CONFSTR },
  577. #endif
  578. #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS
  579. { "XBS5_LP64_OFF64_LINTFLAGS", _CS_XBS5_LP64_OFF64_LINTFLAGS, CONFSTR },
  580. #endif
  581. #ifdef _SC_XBS5_LPBIG_OFFBIG
  582. { "_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG, SYSCONF },
  583. #endif
  584. #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS
  585. { "XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS, CONFSTR },
  586. #endif
  587. #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS
  588. { "XBS5_LPBIG_OFFBIG_LDFLAGS", _CS_XBS5_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
  589. #endif
  590. #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS
  591. { "XBS5_LPBIG_OFFBIG_LIBS", _CS_XBS5_LPBIG_OFFBIG_LIBS, CONFSTR },
  592. #endif
  593. #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
  594. { "XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
  595. #endif
  596. #ifdef _SC_V6_ILP32_OFF32
  597. { "_POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32, SYSCONF },
  598. #endif
  599. #ifdef _CS_POSIX_V6_ILP32_OFF32_CFLAGS
  600. { "POSIX_V6_ILP32_OFF32_CFLAGS", _CS_POSIX_V6_ILP32_OFF32_CFLAGS, CONFSTR },
  601. #endif
  602. #ifdef _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
  603. { "POSIX_V6_ILP32_OFF32_LDFLAGS", _CS_POSIX_V6_ILP32_OFF32_LDFLAGS, CONFSTR },
  604. #endif
  605. #ifdef _CS_POSIX_V6_ILP32_OFF32_LIBS
  606. { "POSIX_V6_ILP32_OFF32_LIBS", _CS_POSIX_V6_ILP32_OFF32_LIBS, CONFSTR },
  607. #endif
  608. #ifdef _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS
  609. { "POSIX_V6_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS, CONFSTR },
  610. #endif
  611. #ifdef _CS_V6_WIDTH_RESTRICTED_ENVS
  612. { "_POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
  613. { "POSIX_V6_WIDTH_RESTRICTED_ENVS", _CS_V6_WIDTH_RESTRICTED_ENVS, CONFSTR },
  614. #endif
  615. #ifdef _SC_V6_ILP32_OFFBIG
  616. { "_POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG, SYSCONF },
  617. #endif
  618. #ifdef _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
  619. { "POSIX_V6_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, CONFSTR },
  620. #endif
  621. #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
  622. { "POSIX_V6_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, CONFSTR },
  623. #endif
  624. #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LIBS
  625. { "POSIX_V6_ILP32_OFFBIG_LIBS", _CS_POSIX_V6_ILP32_OFFBIG_LIBS, CONFSTR },
  626. #endif
  627. #ifdef _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS
  628. { "POSIX_V6_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
  629. #endif
  630. #ifdef _SC_V6_LP64_OFF64
  631. { "_POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64, SYSCONF },
  632. #endif
  633. #ifdef _CS_POSIX_V6_LP64_OFF64_CFLAGS
  634. { "POSIX_V6_LP64_OFF64_CFLAGS", _CS_POSIX_V6_LP64_OFF64_CFLAGS, CONFSTR },
  635. #endif
  636. #ifdef _CS_POSIX_V6_LP64_OFF64_LDFLAGS
  637. { "POSIX_V6_LP64_OFF64_LDFLAGS", _CS_POSIX_V6_LP64_OFF64_LDFLAGS, CONFSTR },
  638. #endif
  639. #ifdef _CS_POSIX_V6_LP64_OFF64_LIBS
  640. { "POSIX_V6_LP64_OFF64_LIBS", _CS_POSIX_V6_LP64_OFF64_LIBS, CONFSTR },
  641. #endif
  642. #ifdef _CS_POSIX_V6_LP64_OFF64_LINTFLAGS
  643. { "POSIX_V6_LP64_OFF64_LINTFLAGS", _CS_POSIX_V6_LP64_OFF64_LINTFLAGS, CONFSTR },
  644. #endif
  645. #ifdef _SC_V6_LPBIG_OFFBIG
  646. { "_POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG, SYSCONF },
  647. #endif
  648. #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
  649. { "POSIX_V6_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, CONFSTR },
  650. #endif
  651. #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
  652. { "POSIX_V6_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
  653. #endif
  654. #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
  655. { "POSIX_V6_LPBIG_OFFBIG_LIBS", _CS_POSIX_V6_LPBIG_OFFBIG_LIBS, CONFSTR },
  656. #endif
  657. #ifdef _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS
  658. { "POSIX_V6_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
  659. #endif
  660. #ifdef _SC_V7_ILP32_OFF32
  661. { "_POSIX_V7_ILP32_OFF32", _SC_V7_ILP32_OFF32, SYSCONF },
  662. #endif
  663. #ifdef _CS_POSIX_V7_ILP32_OFF32_CFLAGS
  664. { "POSIX_V7_ILP32_OFF32_CFLAGS", _CS_POSIX_V7_ILP32_OFF32_CFLAGS, CONFSTR },
  665. #endif
  666. #ifdef _CS_POSIX_V7_ILP32_OFF32_LDFLAGS
  667. { "POSIX_V7_ILP32_OFF32_LDFLAGS", _CS_POSIX_V7_ILP32_OFF32_LDFLAGS, CONFSTR },
  668. #endif
  669. #ifdef _CS_POSIX_V7_ILP32_OFF32_LIBS
  670. { "POSIX_V7_ILP32_OFF32_LIBS", _CS_POSIX_V7_ILP32_OFF32_LIBS, CONFSTR },
  671. #endif
  672. #ifdef _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS
  673. { "POSIX_V7_ILP32_OFF32_LINTFLAGS", _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS, CONFSTR },
  674. #endif
  675. #ifdef _CS_V7_WIDTH_RESTRICTED_ENVS
  676. { "_POSIX_V7_WIDTH_RESTRICTED_ENVS", _CS_V7_WIDTH_RESTRICTED_ENVS, CONFSTR },
  677. { "POSIX_V7_WIDTH_RESTRICTED_ENVS", _CS_V7_WIDTH_RESTRICTED_ENVS, CONFSTR },
  678. #endif
  679. #ifdef _SC_V7_ILP32_OFFBIG
  680. { "_POSIX_V7_ILP32_OFFBIG", _SC_V7_ILP32_OFFBIG, SYSCONF },
  681. #endif
  682. #ifdef _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
  683. { "POSIX_V7_ILP32_OFFBIG_CFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS, CONFSTR },
  684. #endif
  685. #ifdef _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
  686. { "POSIX_V7_ILP32_OFFBIG_LDFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS, CONFSTR },
  687. #endif
  688. #ifdef _CS_POSIX_V7_ILP32_OFFBIG_LIBS
  689. { "POSIX_V7_ILP32_OFFBIG_LIBS", _CS_POSIX_V7_ILP32_OFFBIG_LIBS, CONFSTR },
  690. #endif
  691. #ifdef _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS
  692. { "POSIX_V7_ILP32_OFFBIG_LINTFLAGS", _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS, CONFSTR },
  693. #endif
  694. #ifdef _SC_V7_LP64_OFF64
  695. { "_POSIX_V7_LP64_OFF64", _SC_V7_LP64_OFF64, SYSCONF },
  696. #endif
  697. #ifdef _CS_POSIX_V7_LP64_OFF64_CFLAGS
  698. { "POSIX_V7_LP64_OFF64_CFLAGS", _CS_POSIX_V7_LP64_OFF64_CFLAGS, CONFSTR },
  699. #endif
  700. #ifdef _CS_POSIX_V7_LP64_OFF64_LDFLAGS
  701. { "POSIX_V7_LP64_OFF64_LDFLAGS", _CS_POSIX_V7_LP64_OFF64_LDFLAGS, CONFSTR },
  702. #endif
  703. #ifdef _CS_POSIX_V7_LP64_OFF64_LIBS
  704. { "POSIX_V7_LP64_OFF64_LIBS", _CS_POSIX_V7_LP64_OFF64_LIBS, CONFSTR },
  705. #endif
  706. #ifdef _CS_POSIX_V7_LP64_OFF64_LINTFLAGS
  707. { "POSIX_V7_LP64_OFF64_LINTFLAGS", _CS_POSIX_V7_LP64_OFF64_LINTFLAGS, CONFSTR },
  708. #endif
  709. #ifdef _SC_V7_LPBIG_OFFBIG
  710. { "_POSIX_V7_LPBIG_OFFBIG", _SC_V7_LPBIG_OFFBIG, SYSCONF },
  711. #endif
  712. #ifdef _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
  713. { "POSIX_V7_LPBIG_OFFBIG_CFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS, CONFSTR },
  714. #endif
  715. #ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
  716. { "POSIX_V7_LPBIG_OFFBIG_LDFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS, CONFSTR },
  717. #endif
  718. #ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
  719. { "POSIX_V7_LPBIG_OFFBIG_LIBS", _CS_POSIX_V7_LPBIG_OFFBIG_LIBS, CONFSTR },
  720. #endif
  721. #ifdef _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
  722. { "POSIX_V7_LPBIG_OFFBIG_LINTFLAGS", _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS, CONFSTR },
  723. #endif
  724. #ifdef _SC_ADVISORY_INFO
  725. { "_POSIX_ADVISORY_INFO", _SC_ADVISORY_INFO, SYSCONF },
  726. #endif
  727. #ifdef _SC_BARRIERS
  728. { "_POSIX_BARRIERS", _SC_BARRIERS, SYSCONF },
  729. #endif
  730. #ifdef _SC_BASE
  731. { "_POSIX_BASE", _SC_BASE, SYSCONF },
  732. #endif
  733. #ifdef _SC_C_LANG_SUPPORT
  734. { "_POSIX_C_LANG_SUPPORT", _SC_C_LANG_SUPPORT, SYSCONF },
  735. #endif
  736. #ifdef _SC_C_LANG_SUPPORT_R
  737. { "_POSIX_C_LANG_SUPPORT_R", _SC_C_LANG_SUPPORT_R, SYSCONF },
  738. #endif
  739. #ifdef _SC_CLOCK_SELECTION
  740. { "_POSIX_CLOCK_SELECTION", _SC_CLOCK_SELECTION, SYSCONF },
  741. #endif
  742. #ifdef _SC_CPUTIME
  743. { "_POSIX_CPUTIME", _SC_CPUTIME, SYSCONF },
  744. #endif
  745. #ifdef _SC_THREAD_CPUTIME
  746. { "_POSIX_THREAD_CPUTIME", _SC_THREAD_CPUTIME, SYSCONF },
  747. #endif
  748. #ifdef _SC_DEVICE_SPECIFIC
  749. { "_POSIX_DEVICE_SPECIFIC", _SC_DEVICE_SPECIFIC, SYSCONF },
  750. #endif
  751. #ifdef _SC_DEVICE_SPECIFIC_R
  752. { "_POSIX_DEVICE_SPECIFIC_R", _SC_DEVICE_SPECIFIC_R, SYSCONF },
  753. #endif
  754. #ifdef _SC_FD_MGMT
  755. { "_POSIX_FD_MGMT", _SC_FD_MGMT, SYSCONF },
  756. #endif
  757. #ifdef _SC_FIFO
  758. { "_POSIX_FIFO", _SC_FIFO, SYSCONF },
  759. #endif
  760. #ifdef _SC_PIPE
  761. { "_POSIX_PIPE", _SC_PIPE, SYSCONF },
  762. #endif
  763. #ifdef _SC_FILE_ATTRIBUTES
  764. { "_POSIX_FILE_ATTRIBUTES", _SC_FILE_ATTRIBUTES, SYSCONF },
  765. #endif
  766. #ifdef _SC_FILE_LOCKING
  767. { "_POSIX_FILE_LOCKING", _SC_FILE_LOCKING, SYSCONF },
  768. #endif
  769. #ifdef _SC_FILE_SYSTEM
  770. { "_POSIX_FILE_SYSTEM", _SC_FILE_SYSTEM, SYSCONF },
  771. #endif
  772. #ifdef _SC_MONOTONIC_CLOCK
  773. { "_POSIX_MONOTONIC_CLOCK", _SC_MONOTONIC_CLOCK, SYSCONF },
  774. #endif
  775. #ifdef _SC_MULTI_PROCESS
  776. { "_POSIX_MULTI_PROCESS", _SC_MULTI_PROCESS, SYSCONF },
  777. #endif
  778. #ifdef _SC_SINGLE_PROCESS
  779. { "_POSIX_SINGLE_PROCESS", _SC_SINGLE_PROCESS, SYSCONF },
  780. #endif
  781. #ifdef _SC_NETWORKING
  782. { "_POSIX_NETWORKING", _SC_NETWORKING, SYSCONF },
  783. #endif
  784. #ifdef _SC_READER_WRITER_LOCKS
  785. { "_POSIX_READER_WRITER_LOCKS", _SC_READER_WRITER_LOCKS, SYSCONF },
  786. #endif
  787. #ifdef _SC_SPIN_LOCKS
  788. { "_POSIX_SPIN_LOCKS", _SC_SPIN_LOCKS, SYSCONF },
  789. #endif
  790. #ifdef _SC_REGEXP
  791. { "_POSIX_REGEXP", _SC_REGEXP, SYSCONF },
  792. #endif
  793. #ifdef _SC_REGEX_VERSION
  794. { "_REGEX_VERSION", _SC_REGEX_VERSION, SYSCONF },
  795. #endif
  796. #ifdef _SC_SHELL
  797. { "_POSIX_SHELL", _SC_SHELL, SYSCONF },
  798. #endif
  799. #ifdef _SC_SIGNALS
  800. { "_POSIX_SIGNALS", _SC_SIGNALS, SYSCONF },
  801. #endif
  802. #ifdef _SC_SPAWN
  803. { "_POSIX_SPAWN", _SC_SPAWN, SYSCONF },
  804. #endif
  805. #ifdef _SC_SPORADIC_SERVER
  806. { "_POSIX_SPORADIC_SERVER", _SC_SPORADIC_SERVER, SYSCONF },
  807. #endif
  808. #ifdef _SC_THREAD_SPORADIC_SERVER
  809. { "_POSIX_THREAD_SPORADIC_SERVER", _SC_THREAD_SPORADIC_SERVER, SYSCONF },
  810. #endif
  811. #ifdef _SC_SYSTEM_DATABASE
  812. { "_POSIX_SYSTEM_DATABASE", _SC_SYSTEM_DATABASE, SYSCONF },
  813. #endif
  814. #ifdef _SC_SYSTEM_DATABASE_R
  815. { "_POSIX_SYSTEM_DATABASE_R", _SC_SYSTEM_DATABASE_R, SYSCONF },
  816. #endif
  817. #ifdef _SC_TIMEOUTS
  818. { "_POSIX_TIMEOUTS", _SC_TIMEOUTS, SYSCONF },
  819. #endif
  820. #ifdef _SC_TYPED_MEMORY_OBJECTS
  821. { "_POSIX_TYPED_MEMORY_OBJECTS", _SC_TYPED_MEMORY_OBJECTS, SYSCONF },
  822. #endif
  823. #ifdef _SC_USER_GROUPS
  824. { "_POSIX_USER_GROUPS", _SC_USER_GROUPS, SYSCONF },
  825. #endif
  826. #ifdef _SC_USER_GROUPS_R
  827. { "_POSIX_USER_GROUPS_R", _SC_USER_GROUPS_R, SYSCONF },
  828. #endif
  829. #ifdef _SC_2_PBS
  830. { "POSIX2_PBS", _SC_2_PBS, SYSCONF },
  831. #endif
  832. #ifdef _SC_2_PBS_ACCOUNTING
  833. { "POSIX2_PBS_ACCOUNTING", _SC_2_PBS_ACCOUNTING, SYSCONF },
  834. #endif
  835. #ifdef _SC_2_PBS_LOCATE
  836. { "POSIX2_PBS_LOCATE", _SC_2_PBS_LOCATE, SYSCONF },
  837. #endif
  838. #ifdef _SC_2_PBS_TRACK
  839. { "POSIX2_PBS_TRACK", _SC_2_PBS_TRACK, SYSCONF },
  840. #endif
  841. #ifdef _SC_2_PBS_MESSAGE
  842. { "POSIX2_PBS_MESSAGE", _SC_2_PBS_MESSAGE, SYSCONF },
  843. #endif
  844. #ifdef _SC_SYMLOOP_MAX
  845. { "SYMLOOP_MAX", _SC_SYMLOOP_MAX, SYSCONF },
  846. #endif
  847. #ifdef _SC_STREAM_MAX
  848. { "STREAM_MAX", _SC_STREAM_MAX, SYSCONF },
  849. #endif
  850. #ifdef _SC_AIO_LISTIO_MAX
  851. { "AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX, SYSCONF },
  852. #endif
  853. #ifdef _SC_AIO_MAX
  854. { "AIO_MAX", _SC_AIO_MAX, SYSCONF },
  855. #endif
  856. #ifdef _SC_AIO_PRIO_DELTA_MAX
  857. { "AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX, SYSCONF },
  858. #endif
  859. #ifdef _SC_DELAYTIMER_MAX
  860. { "DELAYTIMER_MAX", _SC_DELAYTIMER_MAX, SYSCONF },
  861. #endif
  862. #ifdef _SC_HOST_NAME_MAX
  863. { "HOST_NAME_MAX", _SC_HOST_NAME_MAX, SYSCONF },
  864. #endif
  865. #ifdef _SC_LOGIN_NAME_MAX
  866. { "LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX, SYSCONF },
  867. #endif
  868. #ifdef _SC_MQ_OPEN_MAX
  869. { "MQ_OPEN_MAX", _SC_MQ_OPEN_MAX, SYSCONF },
  870. #endif
  871. #ifdef _SC_MQ_PRIO_MAX
  872. { "MQ_PRIO_MAX", _SC_MQ_PRIO_MAX, SYSCONF },
  873. #endif
  874. #ifdef _SC_DEVICE_IO
  875. { "_POSIX_DEVICE_IO", _SC_DEVICE_IO, SYSCONF },
  876. #endif
  877. #ifdef _SC_TRACE
  878. { "_POSIX_TRACE", _SC_TRACE, SYSCONF },
  879. #endif
  880. #ifdef _SC_TRACE_EVENT_FILTER
  881. { "_POSIX_TRACE_EVENT_FILTER", _SC_TRACE_EVENT_FILTER, SYSCONF },
  882. #endif
  883. #ifdef _SC_TRACE_INHERIT
  884. { "_POSIX_TRACE_INHERIT", _SC_TRACE_INHERIT, SYSCONF },
  885. #endif
  886. #ifdef _SC_TRACE_LOG
  887. { "_POSIX_TRACE_LOG", _SC_TRACE_LOG, SYSCONF },
  888. #endif
  889. #ifdef _SC_RTSIG_MAX
  890. { "RTSIG_MAX", _SC_RTSIG_MAX, SYSCONF },
  891. #endif
  892. #ifdef _SC_SEM_NSEMS_MAX
  893. { "SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX, SYSCONF },
  894. #endif
  895. #ifdef _SC_SEM_VALUE_MAX
  896. { "SEM_VALUE_MAX", _SC_SEM_VALUE_MAX, SYSCONF },
  897. #endif
  898. #ifdef _SC_SIGQUEUE_MAX
  899. { "SIGQUEUE_MAX", _SC_SIGQUEUE_MAX, SYSCONF },
  900. #endif
  901. #ifdef _PC_FILESIZEBITS
  902. { "FILESIZEBITS", _PC_FILESIZEBITS, PATHCONF },
  903. #endif
  904. #ifdef _PC_ALLOC_SIZE_MIN
  905. { "POSIX_ALLOC_SIZE_MIN", _PC_ALLOC_SIZE_MIN, PATHCONF },
  906. #endif
  907. #ifdef _PC_REC_INCR_XFER_SIZE
  908. { "POSIX_REC_INCR_XFER_SIZE", _PC_REC_INCR_XFER_SIZE, PATHCONF },
  909. #endif
  910. #ifdef _PC_REC_MAX_XFER_SIZE
  911. { "POSIX_REC_MAX_XFER_SIZE", _PC_REC_MAX_XFER_SIZE, PATHCONF },
  912. #endif
  913. #ifdef _PC_REC_MIN_XFER_SIZE
  914. { "POSIX_REC_MIN_XFER_SIZE", _PC_REC_MIN_XFER_SIZE, PATHCONF },
  915. #endif
  916. #ifdef _PC_REC_XFER_ALIGN
  917. { "POSIX_REC_XFER_ALIGN", _PC_REC_XFER_ALIGN, PATHCONF },
  918. #endif
  919. #ifdef _PC_SYMLINK_MAX
  920. { "SYMLINK_MAX", _PC_SYMLINK_MAX, PATHCONF },
  921. #endif
  922. #ifdef _CS_GNU_LIBC_VERSION
  923. { "GNU_LIBC_VERSION", _CS_GNU_LIBC_VERSION, CONFSTR },
  924. #endif
  925. #ifdef _CS_GNU_LIBPTHREAD_VERSION
  926. { "GNU_LIBPTHREAD_VERSION", _CS_GNU_LIBPTHREAD_VERSION, CONFSTR },
  927. #endif
  928. #ifdef _PC_2_SYMLINKS
  929. { "POSIX2_SYMLINKS", _PC_2_SYMLINKS, PATHCONF },
  930. #endif
  931. #ifdef _SC_LEVEL1_ICACHE_SIZE
  932. { "LEVEL1_ICACHE_SIZE", _SC_LEVEL1_ICACHE_SIZE, SYSCONF },
  933. #endif
  934. #ifdef _SC_LEVEL1_ICACHE_ASSOC
  935. { "LEVEL1_ICACHE_ASSOC", _SC_LEVEL1_ICACHE_ASSOC, SYSCONF },
  936. #endif
  937. #ifdef _SC_LEVEL1_ICACHE_LINESIZE
  938. { "LEVEL1_ICACHE_LINESIZE", _SC_LEVEL1_ICACHE_LINESIZE, SYSCONF },
  939. #endif
  940. #ifdef _SC_LEVEL1_DCACHE_SIZE
  941. { "LEVEL1_DCACHE_SIZE", _SC_LEVEL1_DCACHE_SIZE, SYSCONF },
  942. #endif
  943. #ifdef _SC_LEVEL1_DCACHE_ASSOC
  944. { "LEVEL1_DCACHE_ASSOC", _SC_LEVEL1_DCACHE_ASSOC, SYSCONF },
  945. #endif
  946. #ifdef _SC_LEVEL1_DCACHE_LINESIZE
  947. { "LEVEL1_DCACHE_LINESIZE", _SC_LEVEL1_DCACHE_LINESIZE, SYSCONF },
  948. #endif
  949. #ifdef _SC_LEVEL2_CACHE_SIZE
  950. { "LEVEL2_CACHE_SIZE", _SC_LEVEL2_CACHE_SIZE, SYSCONF },
  951. #endif
  952. #ifdef _SC_LEVEL2_CACHE_ASSOC
  953. { "LEVEL2_CACHE_ASSOC", _SC_LEVEL2_CACHE_ASSOC, SYSCONF },
  954. #endif
  955. #ifdef _SC_LEVEL2_CACHE_LINESIZE
  956. { "LEVEL2_CACHE_LINESIZE", _SC_LEVEL2_CACHE_LINESIZE, SYSCONF },
  957. #endif
  958. #ifdef _SC_LEVEL3_CACHE_SIZE
  959. { "LEVEL3_CACHE_SIZE", _SC_LEVEL3_CACHE_SIZE, SYSCONF },
  960. #endif
  961. #ifdef _SC_LEVEL3_CACHE_ASSOC
  962. { "LEVEL3_CACHE_ASSOC", _SC_LEVEL3_CACHE_ASSOC, SYSCONF },
  963. #endif
  964. #ifdef _SC_LEVEL3_CACHE_LINESIZE
  965. { "LEVEL3_CACHE_LINESIZE", _SC_LEVEL3_CACHE_LINESIZE, SYSCONF },
  966. #endif
  967. #ifdef _SC_LEVEL4_CACHE_SIZE
  968. { "LEVEL4_CACHE_SIZE", _SC_LEVEL4_CACHE_SIZE, SYSCONF },
  969. #endif
  970. #ifdef _SC_LEVEL4_CACHE_ASSOC
  971. { "LEVEL4_CACHE_ASSOC", _SC_LEVEL4_CACHE_ASSOC, SYSCONF },
  972. #endif
  973. #ifdef _SC_LEVEL4_CACHE_LINESIZE
  974. { "LEVEL4_CACHE_LINESIZE", _SC_LEVEL4_CACHE_LINESIZE, SYSCONF },
  975. #endif
  976. #ifdef _SC_IPV6
  977. { "IPV6", _SC_IPV6, SYSCONF },
  978. #endif
  979. #ifdef _SC_RAW_SOCKETS
  980. { "RAW_SOCKETS", _SC_RAW_SOCKETS, SYSCONF },
  981. #endif
  982. { NULL, 0, SYSCONF }
  983. };
  984. static const struct { const char *name; int num; } specs[] =
  985. {
  986. #ifdef _SC_XBS5_ILP32_OFF32
  987. { "XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32 },
  988. #endif
  989. #ifdef _SC_XBS5_ILP32_OFFBIG
  990. { "XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG },
  991. #endif
  992. #ifdef _SC_XBS5_LP64_OFF64
  993. { "XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64 },
  994. #endif
  995. #ifdef _SC_XBS5_LPBIG_OFFBIG
  996. { "XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG },
  997. #endif
  998. #ifdef _SC_V6_ILP32_OFF32
  999. { "POSIX_V6_ILP32_OFF32", _SC_V6_ILP32_OFF32 },
  1000. #endif
  1001. #ifdef _SC_V6_ILP32_OFFBIG
  1002. { "POSIX_V6_ILP32_OFFBIG", _SC_V6_ILP32_OFFBIG },
  1003. #endif
  1004. #ifdef _SC_V6_LP64_OFF64
  1005. { "POSIX_V6_LP64_OFF64", _SC_V6_LP64_OFF64 },
  1006. #endif
  1007. #ifdef _SC_V6_LPBIG_OFFBIG
  1008. { "POSIX_V6_LPBIG_OFFBIG", _SC_V6_LPBIG_OFFBIG },
  1009. #endif
  1010. #ifdef _SC_V7_ILP32_OFF32
  1011. { "POSIX_V7_ILP32_OFF32", _SC_V7_ILP32_OFF32 },
  1012. #endif
  1013. #ifdef _SC_V7_ILP32_OFFBIG
  1014. { "POSIX_V7_ILP32_OFFBIG", _SC_V7_ILP32_OFFBIG },
  1015. #endif
  1016. #ifdef _SC_V7_LP64_OFF64
  1017. { "POSIX_V7_LP64_OFF64", _SC_V7_LP64_OFF64 },
  1018. #endif
  1019. #ifdef _SC_V7_LPBIG_OFFBIG
  1020. { "POSIX_V7_LPBIG_OFFBIG", _SC_V7_LPBIG_OFFBIG },
  1021. #endif
  1022. };
  1023. static const int nspecs = sizeof (specs) / sizeof (specs[0]);
  1024. #ifdef __UCLIBC_HAS___PROGNAME__
  1025. extern const char *__progname;
  1026. #else
  1027. #define __progname "foo"
  1028. #endif
  1029. static void
  1030. usage (void)
  1031. {
  1032. fprintf (stderr,
  1033. _("Usage: %s [-v specification] variable_name [pathname]\n"),
  1034. __progname);
  1035. fprintf (stderr,
  1036. _(" %s -a [pathname]\n"), __progname);
  1037. exit (2);
  1038. }
  1039. static void
  1040. print_all (const char *path)
  1041. {
  1042. register const struct conf *c;
  1043. size_t clen;
  1044. long int value;
  1045. char *cvalue;
  1046. for (c = vars; c->name != NULL; ++c) {
  1047. printf("%-35s", c->name);
  1048. switch (c->call) {
  1049. case PATHCONF:
  1050. value = pathconf (path, c->call_name);
  1051. if (value != -1) {
  1052. printf("%ld", value);
  1053. }
  1054. printf("\n");
  1055. break;
  1056. case SYSCONF:
  1057. value = sysconf (c->call_name);
  1058. if (value == -1l) {
  1059. if (c->call_name == _SC_UINT_MAX
  1060. || c->call_name == _SC_ULONG_MAX)
  1061. printf ("%lu", value);
  1062. }
  1063. else {
  1064. printf ("%ld", value);
  1065. }
  1066. printf ("\n");
  1067. break;
  1068. case CONFSTR:
  1069. clen = confstr (c->call_name, (char *) NULL, 0);
  1070. cvalue = (char *) malloc (clen);
  1071. if (cvalue == NULL)
  1072. error (3, 0, _("memory exhausted"));
  1073. if (confstr (c->call_name, cvalue, clen) != clen)
  1074. error (3, errno, "confstr");
  1075. printf ("%.*s\n", (int) clen, cvalue);
  1076. free (cvalue);
  1077. break;
  1078. }
  1079. }
  1080. exit (0);
  1081. }
  1082. int
  1083. main (int argc, char *argv[])
  1084. {
  1085. register const struct conf *c;
  1086. /* Set locale. Do not set LC_ALL because the other categories must
  1087. not be affected (according to POSIX.2). */
  1088. /* Initialize the message catalog. */
  1089. if (argc > 1 && strcmp (argv[1], "--version") == 0)
  1090. {
  1091. printf ("getconf (GNU %s) %s\n", PACKAGE, VERSION);
  1092. printf ("\
  1093. Copyright (C) %s Free Software Foundation, Inc.\n\
  1094. This is free software; see the source for copying conditions. There is NO\n\
  1095. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
  1096. ", "2009");
  1097. printf ("Written by %s.\n", "Roland McGrath");
  1098. return 0;
  1099. }
  1100. if (argc > 1 && strcmp (argv[1], "--help") == 0)
  1101. {
  1102. printf ("\
  1103. Usage: getconf [-v SPEC] VAR\n\
  1104. or: getconf [-v SPEC] PATH_VAR PATH\n\
  1105. \n\
  1106. Get the configuration value for variable VAR, or for variable PATH_VAR\n\
  1107. for path PATH. If SPEC is given, give values for compilation\n\
  1108. environment SPEC.\n\n");
  1109. fputs ("For bug reporting instructions, please see:\n\
  1110. <http://www.gnu.org/software/libc/bugs.html>.\n", stdout);
  1111. return 0;
  1112. }
  1113. const char *getconf_dir = getenv ("GETCONF_DIR") ?: GETCONF_DIR;
  1114. size_t getconf_dirlen = strlen (getconf_dir);
  1115. const char *spec = NULL;
  1116. char buf[sizeof "POSIX_V6_LPBIG_OFFBIG"];
  1117. char *argv0 = argv[0];
  1118. if (argc > 1 && strncmp (argv[1], "-v", 2) == 0)
  1119. {
  1120. if (argv[1][2] == '\0')
  1121. {
  1122. if (argc < 3)
  1123. usage ();
  1124. spec = argv[2];
  1125. argv += 2;
  1126. argc -= 2;
  1127. }
  1128. else
  1129. {
  1130. spec = &argv[1][2];
  1131. argv += 1;
  1132. argc += 1;
  1133. }
  1134. }
  1135. else
  1136. {
  1137. char default_name[getconf_dirlen + sizeof "/default"];
  1138. memcpy (mempcpy (default_name, getconf_dir, getconf_dirlen),
  1139. "/default", sizeof "/default");
  1140. int len = readlink (default_name, buf, sizeof buf - 1);
  1141. if (len > 0)
  1142. {
  1143. buf[len] = '\0';
  1144. spec = buf;
  1145. }
  1146. }
  1147. /* Check for the specifications we know. */
  1148. if (spec != NULL)
  1149. {
  1150. int i;
  1151. for (i = 0; i < nspecs; ++i)
  1152. if (strcmp (spec, specs[i].name) == 0)
  1153. break;
  1154. if (i == nspecs)
  1155. error (2, 0, _("unknown specification \"%s\""), spec);
  1156. switch (specs[i].num)
  1157. {
  1158. #if !defined(_XBS5_ILP32_OFF32) && defined(_SC_XBS5_ILP32_OFF32)
  1159. case _SC_XBS5_ILP32_OFF32:
  1160. #endif
  1161. #if !defined(_XBS5_ILP32_OFFBIG) && defined(_SC_XBS5_ILP32_OFFBIG)
  1162. case _SC_XBS5_ILP32_OFFBIG:
  1163. #endif
  1164. #if !defined(_XBS5_LP64_OFF64) && defined(_SC_XBS5_LP64_OFF64)
  1165. case _SC_XBS5_LP64_OFF64:
  1166. #endif
  1167. #if !defined(_XBS5_LPBIG_OFFBIG) && defined(_SC_XBS5_LPBIG_OFFBIG)
  1168. case _SC_XBS5_LPBIG_OFFBIG:
  1169. #endif
  1170. #if !defined(_POSIX_V6_ILP32_OFF32) && defined(_SC_V6_ILP32_OFF32)
  1171. case _SC_V6_ILP32_OFF32:
  1172. #endif
  1173. #if !defined(_POSIX_V6_ILP32_OFFBIG) && defined(_SC_V6_ILP32_OFFBIG)
  1174. case _SC_V6_ILP32_OFFBIG:
  1175. #endif
  1176. #if !defined(_POSIX_V6_LP64_OFF64) && defined(_SC_V6_LP64_OFF64)
  1177. case _SC_V6_LP64_OFF64:
  1178. #endif
  1179. #if !defined(_POSIX_V6_LPBIG_OFFBIG) && defined(_SC_V6_LPBIG_OFFBIG)
  1180. case _SC_V6_LPBIG_OFFBIG:
  1181. #endif
  1182. #if !defined(_POSIX_V7_ILP32_OFF32) && defined(_SC_V7_ILP32_OFF32)
  1183. case _SC_V7_ILP32_OFF32:
  1184. #endif
  1185. #if !defined(_POSIX_V7_ILP32_OFFBIG) && defined(_SC_V7_ILP32_OFFBIG)
  1186. case _SC_V7_ILP32_OFFBIG:
  1187. #endif
  1188. #if !defined(_POSIX_V7_LP64_OFF64) && defined(_SC_V7_LP64_OFF64)
  1189. case _SC_V7_LP64_OFF64:
  1190. #endif
  1191. #if !defined(_POSIX_V7_LPBIG_OFFBIG) && defined(_SC_V7_LPBIG_OFFBIG)
  1192. case _SC_V7_LPBIG_OFFBIG:
  1193. #endif
  1194. {
  1195. const char *args[argc + 3];
  1196. size_t spec_len = strlen (spec);
  1197. char getconf_name[getconf_dirlen + 1 + spec_len + 1];
  1198. memcpy (mempcpy (mempcpy (getconf_name, getconf_dir,
  1199. getconf_dirlen),
  1200. "/", 1), spec, spec_len + 1);
  1201. args[0] = argv0;
  1202. args[1] = "-v";
  1203. args[2] = spec;
  1204. memcpy (&args[3], &argv[1], argc * sizeof (argv[1]));
  1205. execv (getconf_name, (char * const *) args);
  1206. error (4, errno, _("Couldn't execute %s"), getconf_name);
  1207. }
  1208. default:
  1209. break;
  1210. }
  1211. }
  1212. if (argc > 1 && strcmp (argv[1], "-a") == 0)
  1213. {
  1214. if (argc == 2)
  1215. print_all ("/");
  1216. else if (argc == 3)
  1217. print_all (argv[2]);
  1218. else
  1219. usage ();
  1220. }
  1221. int ai = 1;
  1222. if (argc > ai && strcmp (argv[ai], "--") == 0)
  1223. ++ai;
  1224. if (argc - ai < 1 || argc - ai > 2)
  1225. usage ();
  1226. for (c = vars; c->name != NULL; ++c)
  1227. if (strcmp (c->name, argv[ai]) == 0
  1228. || (strncmp (c->name, "_POSIX_", 7) == 0
  1229. && strcmp (c->name + 7, argv[ai]) == 0))
  1230. {
  1231. long int value;
  1232. size_t clen;
  1233. char *cvalue;
  1234. switch (c->call)
  1235. {
  1236. case PATHCONF:
  1237. if (argc - ai < 2)
  1238. usage ();
  1239. errno = 0;
  1240. value = pathconf (argv[ai + 1], c->call_name);
  1241. if (value == -1)
  1242. {
  1243. if (errno) {
  1244. error (3, errno, "pathconf: %s", argv[ai + 1]);
  1245. } else
  1246. puts (_("undefined"));
  1247. }
  1248. else
  1249. printf ("%ld\n", value);
  1250. exit (0);
  1251. case SYSCONF:
  1252. if (argc - ai > 1)
  1253. usage ();
  1254. value = sysconf (c->call_name);
  1255. if (value == -1l)
  1256. {
  1257. if (c->call_name == _SC_UINT_MAX
  1258. || c->call_name == _SC_ULONG_MAX)
  1259. printf ("%lu\n", value);
  1260. else
  1261. puts (_("undefined"));
  1262. }
  1263. else
  1264. printf ("%ld\n", value);
  1265. exit (0);
  1266. case CONFSTR:
  1267. if (argc - ai > 1)
  1268. usage ();
  1269. clen = confstr (c->call_name, (char *) NULL, 0);
  1270. cvalue = (char *) malloc (clen);
  1271. if (cvalue == NULL)
  1272. error (3, 0, _("memory exhausted"));
  1273. if (confstr (c->call_name, cvalue, clen) != clen)
  1274. error (3, errno, "confstr");
  1275. printf ("%.*s\n", (int) clen, cvalue);
  1276. exit (0);
  1277. }
  1278. }
  1279. error (2, 0, _("Unrecognized variable `%s'"), argv[ai]);
  1280. /* NOTREACHED */
  1281. return 2;
  1282. }