PageRenderTime 38ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/cde/programs/dtksh/ksh93/src/lib/libast/feature/unistd.c

https://bitbucket.org/tifan/cde
C | 327 lines | 241 code | 26 blank | 60 comment | 28 complexity | 8b17d96df7fd5848a9bfc0da711312b4 MD5 | raw file
Possible License(s): LGPL-2.1, IPL-1.0, 0BSD
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these librararies and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: unistd.c /main/3 1995/11/01 17:26:56 rswiston $ */
  24. /***************************************************************
  25. * *
  26. * AT&T - PROPRIETARY *
  27. * *
  28. * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
  29. * AT&T BELL LABORATORIES *
  30. * AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
  31. * ACCORDANCE WITH APPLICABLE AGREEMENTS *
  32. * *
  33. * Copyright (c) 1994 AT&T Bell Laboratories *
  34. * Unpublished & Not for Publication *
  35. * All Rights Reserved *
  36. * *
  37. * The copyright notice above does not evidence any *
  38. * actual or intended publication of such source code *
  39. * *
  40. * This software was created by the *
  41. * Software Engineering Research Department *
  42. * AT&T Bell Laboratories *
  43. * *
  44. * For further information contact *
  45. * advsoft@research.att.com *
  46. * Randy Hackbarth 908-582-5245 *
  47. * Dave Belanger 908-582-7427 *
  48. * *
  49. ***************************************************************/
  50. /* : : generated by proto : : */
  51. #line 1
  52. /*
  53. * Glenn Fowler
  54. * AT&T Bell Laboratories
  55. *
  56. * generate unistd.h definitions for posix sysconf() args
  57. */
  58. #ifndef _POSIX_SOURCE
  59. #if !defined(__PROTO__)
  60. #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
  61. #if defined(__cplusplus)
  62. #define __MANGLE__ "C"
  63. #else
  64. #define __MANGLE__
  65. #endif
  66. #define __STDARG__
  67. #define __PROTO__(x) x
  68. #define __OTORP__(x)
  69. #define __PARAM__(n,o) n
  70. #if !defined(__STDC__) && !defined(__cplusplus)
  71. #if !defined(c_plusplus)
  72. #define const
  73. #endif
  74. #define signed
  75. #define void int
  76. #define volatile
  77. #define __V_ char
  78. #else
  79. #define __V_ void
  80. #endif
  81. #else
  82. #define __PROTO__(x) ()
  83. #define __OTORP__(x) x
  84. #define __PARAM__(n,o) o
  85. #define __MANGLE__
  86. #define __V_ char
  87. #define const
  88. #define signed
  89. #define void int
  90. #define volatile
  91. #endif
  92. #if defined(__cplusplus) || defined(c_plusplus)
  93. #define __VARARG__ ...
  94. #else
  95. #define __VARARG__
  96. #endif
  97. #if defined(__STDARG__)
  98. #define __VA_START__(p,a) va_start(p,a)
  99. #else
  100. #define __VA_START__(p,a) va_start(p)
  101. #endif
  102. #endif
  103. #line 9
  104. #define _POSIX_SOURCE
  105. #endif
  106. #if defined(__STDPP__directive) && defined(__STDPP__hide)
  107. __STDPP__directive pragma pp:hide printf
  108. #else
  109. #define printf ______printf
  110. #endif
  111. #include <sys/types.h>
  112. #include "FEATURE/types"
  113. #include "FEATURE/lcl.unistd"
  114. #include <ast_lib.h>
  115. #if defined(__STDPP__directive) && defined(__STDPP__hide)
  116. __STDPP__directive pragma pp:nohide printf
  117. #endif
  118. #if defined(__STDPP__hide) || defined(printf)
  119. #undef printf
  120. extern __MANGLE__ int printf __PROTO__((const char*, ...));
  121. #endif
  122. main()
  123. {
  124. int sep = 0;
  125. long val;
  126. /*
  127. * some systems (could it beee aix) think empty definitions
  128. * constitute symbolic constants
  129. */
  130. #ifdef _POSIX_VERSION
  131. {
  132. static long x[] = { 0, _POSIX_VERSION };
  133. if ((sizeof(x)/sizeof(x[0])) == 1)
  134. {
  135. printf("#undef _POSIX_VERSION\n");
  136. val = 199009L;
  137. }
  138. else val = x[1];
  139. }
  140. #else
  141. val = 199009L;
  142. #endif
  143. printf("#define _POSIX_VERSION %ldL\n", val);
  144. #ifndef _POSIX_JOB_CONTROL
  145. #ifdef WUNTRACED
  146. #define _POSIX_JOB_CONTROL 1
  147. #endif
  148. #endif
  149. #ifdef _POSIX_JOB_CONTROL
  150. {
  151. static long x[] = { 0, _POSIX_JOB_CONTROL };
  152. if ((sizeof(x)/sizeof(x[0])) == 1)
  153. {
  154. printf("#undef _POSIX_JOB_CONTROL\n");
  155. val = 1;
  156. }
  157. else val = x[1];
  158. }
  159. printf("#define _POSIX_JOB_CONTROL %ld\n", val);
  160. #endif
  161. #ifndef _POSIX_SAVED_IDS
  162. #if _lib_setuid && !_lib_setreuid
  163. #define _POSIX_SAVED_IDS 1
  164. #endif
  165. #endif
  166. #ifdef _POSIX_SAVED_IDS
  167. {
  168. static long x[] = { 0, _POSIX_SAVED_IDS };
  169. if ((sizeof(x)/sizeof(x[0])) == 1)
  170. {
  171. printf("#undef _POSIX_SAVED_IDS\n");
  172. val = 1;
  173. }
  174. else val = x[1];
  175. }
  176. printf("#define _POSIX_SAVED_IDS %ld\n", val);
  177. #endif
  178. printf("\n");
  179. #ifdef _POSIX_CHOWN_RESTRICTED
  180. {
  181. static long x[] = { 0, _POSIX_CHOWN_RESTRICTED };
  182. if ((sizeof(x)/sizeof(x[0])) == 1)
  183. {
  184. printf("#undef _POSIX_CHOWN_RESTRICTED\n");
  185. val = 1;
  186. }
  187. else val = x[1];
  188. }
  189. printf("#define _POSIX_CHOWN_RESTRICTED %ld\n", val);
  190. sep = 1;
  191. #endif
  192. #ifdef _POSIX_NO_TRUNC
  193. {
  194. static long x[] = { 0, _POSIX_NO_TRUNC };
  195. if ((sizeof(x)/sizeof(x[0])) == 1)
  196. {
  197. printf("#undef _POSIX_NO_TRUNC\n");
  198. val = 1;
  199. }
  200. else val = x[1];
  201. }
  202. printf("#define _POSIX_NO_TRUNC %ld\n", val);
  203. sep = 1;
  204. #endif
  205. #ifdef _POSIX_VDISABLE
  206. {
  207. static long x[] = { 0, _POSIX_VDISABLE };
  208. if ((sizeof(x)/sizeof(x[0])) == 1)
  209. {
  210. printf("#undef _POSIX_VDISABLE\n");
  211. val = 1;
  212. }
  213. else val = x[1];
  214. }
  215. printf("#define _POSIX_VDISABLE %ld\n", val);
  216. sep = 1;
  217. #endif
  218. if (sep)
  219. {
  220. sep = 0;
  221. printf("\n");
  222. }
  223. #ifndef _SC_ARG_MAX
  224. #define _SC_ARG_MAX (-1)
  225. #endif
  226. printf("#define _SC_ARG_MAX %ld\n", (long)_SC_ARG_MAX);
  227. #ifndef _SC_CHILD_MAX
  228. #define _SC_CHILD_MAX (-2)
  229. #endif
  230. printf("#define _SC_CHILD_MAX %ld\n", (long)_SC_CHILD_MAX);
  231. #ifndef _SC_CLK_TCK
  232. #define _SC_CLK_TCK (-3)
  233. #endif
  234. printf("#define _SC_CLK_TCK %ld\n", (long)_SC_CLK_TCK);
  235. #ifndef _SC_NGROUPS_MAX
  236. #define _SC_NGROUPS_MAX (-4)
  237. #endif
  238. printf("#define _SC_NGROUPS_MAX %ld\n", (long)_SC_NGROUPS_MAX);
  239. #ifndef _SC_OPEN_MAX
  240. #define _SC_OPEN_MAX (-5)
  241. #endif
  242. printf("#define _SC_OPEN_MAX %ld\n", (long)_SC_OPEN_MAX);
  243. #ifndef _SC_JOB_CONTROL
  244. #define _SC_JOB_CONTROL (-6)
  245. #endif
  246. printf("#define _SC_JOB_CONTROL %ld\n", (long)_SC_JOB_CONTROL);
  247. #ifndef _SC_SAVED_IDS
  248. #define _SC_SAVED_IDS (-7)
  249. #endif
  250. printf("#define _SC_SAVED_IDS %ld\n", (long)_SC_SAVED_IDS);
  251. #ifndef _SC_TZNAME_MAX
  252. #define _SC_TZNAME_MAX (-8)
  253. #endif
  254. printf("#define _SC_TZNAME_MAX %ld\n", (long)_SC_TZNAME_MAX);
  255. #ifndef _SC_VERSION
  256. #define _SC_VERSION (-9)
  257. #endif
  258. printf("#define _SC_VERSION %ld\n", (long)_SC_VERSION);
  259. printf("\n");
  260. #ifndef _PC_LINK_MAX
  261. #define _PC_LINK_MAX (-1)
  262. #endif
  263. printf("#define _PC_LINK_MAX %ld\n", (long)_PC_LINK_MAX);
  264. #ifndef _PC_MAX_CANON
  265. #define _PC_MAX_CANON (-2)
  266. #endif
  267. printf("#define _PC_MAX_CANON %ld\n", (long)_PC_MAX_CANON);
  268. #ifndef _PC_MAX_INPUT
  269. #define _PC_MAX_INPUT (-3)
  270. #endif
  271. printf("#define _PC_MAX_INPUT %ld\n", (long)_PC_MAX_INPUT);
  272. #ifndef _PC_NAME_MAX
  273. #define _PC_NAME_MAX (-4)
  274. #endif
  275. printf("#define _PC_NAME_MAX %ld\n", (long)_PC_NAME_MAX);
  276. #ifndef _PC_PATH_MAX
  277. #define _PC_PATH_MAX (-5)
  278. #endif
  279. printf("#define _PC_PATH_MAX %ld\n", (long)_PC_PATH_MAX);
  280. #ifndef _PC_PIPE_BUF
  281. #define _PC_PIPE_BUF (-6)
  282. #endif
  283. printf("#define _PC_PIPE_BUF %ld\n", (long)_PC_PIPE_BUF);
  284. #ifndef _PC_CHOWN_RESTRICTED
  285. #define _PC_CHOWN_RESTRICTED (-7)
  286. #endif
  287. printf("#define _PC_CHOWN_RESTRICTED %ld\n", (long)_PC_CHOWN_RESTRICTED);
  288. #ifndef _PC_NO_TRUNC
  289. #define _PC_NO_TRUNC (-8)
  290. #endif
  291. printf("#define _PC_NO_TRUNC %ld\n", (long)_PC_NO_TRUNC);
  292. #ifndef _PC_VDISABLE
  293. #define _PC_VDISABLE (-9)
  294. #endif
  295. printf("#define _PC_VDISABLE %ld\n", (long)_PC_VDISABLE);
  296. #ifndef _PC_LAST
  297. #define _PC_LAST (-10)
  298. #endif
  299. printf("#define _PC_LAST %ld\n", (long)_PC_LAST);
  300. return(0);
  301. }