Update.
[glibc.git] / sysdeps / posix / mk-stdiolim.c
blobec482dee968a66f0ab573c0c962ccd4dc7a2f2b9
1 /* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #include <bits/posix1_lim.h>
21 int
22 main()
24 /* Print copyright message. */
25 printf ("\
26 /* Stdio limits for POSIX systems.\n\
27 Copyright (C) 1994, 1997 Free Software Foundation, Inc.\n\
28 This file is part of the GNU C Library.\n\
29 \n\
30 The GNU C Library is free software; you can redistribute it and/or\n\
31 modify it under the terms of the GNU Library General Public License as\n\
32 published by the Free Software Foundation; either version 2 of the\n\
33 License, or (at your option) any later version.\n\
34 \n\
35 The GNU C Library is distributed in the hope that it will be useful,\n\
36 but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
37 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n\
38 Library General Public License for more details.\n\
39 \n\
40 You should have received a copy of the GNU Library General Publicn\n\
41 License along with the GNU C Library; see the file COPYING.LIB. If not,\n\
42 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n\
43 Boston, MA 02111-1307, USA. */\n\
44 \n\
45 #if !defined _STDIO_H && !defined __need_FOPEN_MAX\n\
46 # error \"Never include <bits/stdio_lim.h> directly; use <stdio.h> instead.\"\n\
47 #endif\n\
48 \n");
50 /* These values correspond to the code in sysdeps/posix/tempname.c.
51 Change the values here if you change that code. */
52 puts ("#ifdef _STDIO_H");
53 printf ("# define L_tmpnam %u\n", sizeof ("/usr/tmp/") + 9);
54 printf ("# define TMP_MAX %u\n", 62 * 62 * 62);
56 puts ("# ifdef __USE_POSIX");
57 printf ("# define L_ctermid %u\n", sizeof ("/dev/tty"));
58 printf ("# define L_cuserid 9\n");
59 puts ("# endif");
61 printf (" #define FILENAME_MAX %u\n",
62 #ifdef PATH_MAX
63 PATH_MAX
64 #else
65 /* This is supposed to be the size needed to hold the longest file
66 name string the implementation guarantees can be opened.
67 PATH_MAX not being defined means the actual limit on the length
68 of a file name is runtime-variant (or it is unlimited). ISO
69 says in such a case FILENAME_MAX should be a good size to
70 allocate for a file name string. POSIX.1 guarantees that a
71 file name up to _POSIX_PATH_MAX chars long can be opened, so
72 this value must be at least that. */
73 1024 /* _POSIX_PATH_MAX is 255. */
74 #endif
77 puts ("# undef __need_FOPEN_MAX");
78 puts ("# define __need_FOPEN_MAX 1");
79 puts ("#endif\n");
81 /* POSIX does not require that OPEN_MAX and PATH_MAX be defined, so
82 <bits/local_lim.h> will not define them if they are run-time
83 variant (which is the case in the Hurd). ISO still requires
84 that FOPEN_MAX and FILENAME_MAX be defined, however. */
86 puts ("#if defined __need_FOPEN_MAX && !defined __defined_FOPEN_MAX");
87 puts ("# define __defined_FOPEN_MAX");
88 printf ("# define FOPEN_MAX %u\n",
89 #ifdef OPEN_MAX
91 OPEN_MAX
92 #else
93 /* This is the minimum number of files that the implementation
94 guarantees can be open simultaneously. OPEN_MAX not being
95 defined means the maximum is run-time variant; but POSIX.1
96 requires that it never be less than _POSIX_OPEN_MAX, so that is
97 a good minimum to use. */
98 _POSIX_OPEN_MAX
99 #endif
102 puts ("#endif");
103 puts ("#undef __need_FOPEN_MAX");
105 exit (0);