]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/posix/mk-stdiolim.c
Update.
[thirdparty/glibc.git] / sysdeps / posix / mk-stdiolim.c
1 /* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3
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.
8
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.
13
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. */
18
19 #include <bits/posix1_lim.h>
20
21 int
22 main()
23 {
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 #ifndef _STDIO_H\n\
46 # error \"Never include <bits/stdio_lim.h> directly; use <stdio.h> instead.\"\n\
47 #endif\n\
48 \n");
49
50 /* These values correspond to the code in sysdeps/posix/tempname.c.
51 Change the values here if you change that code. */
52 printf ("#define L_tmpnam %u\n", sizeof ("/usr/tmp/") + 9);
53 printf ("#define TMP_MAX %u\n", 62 * 62 * 62);
54
55 puts ("#ifdef __USE_POSIX");
56 printf ("# define L_ctermid %u\n", sizeof ("/dev/tty"));
57 printf ("# define L_cuserid 9\n");
58 puts ("#endif");
59
60 /* POSIX does not require that OPEN_MAX and PATH_MAX be defined, so
61 <bits/local_lim.h> will not define them if they are run-time
62 variant (which is the case in the Hurd). ISO still requires
63 that FOPEN_MAX and FILENAME_MAX be defined, however. */
64
65 printf ("#define FOPEN_MAX %u\n",
66 #ifdef OPEN_MAX
67
68 OPEN_MAX
69 #else
70 /* This is the minimum number of files that the implementation
71 guarantees can be open simultaneously. OPEN_MAX not being
72 defined means the maximum is run-time variant; but POSIX.1
73 requires that it never be less than _POSIX_OPEN_MAX, so that is
74 a good minimum to use. */
75 _POSIX_OPEN_MAX
76 #endif
77
78 );
79
80 printf ("#define FILENAME_MAX %u\n",
81 #ifdef PATH_MAX
82 PATH_MAX
83 #else
84 /* This is supposed to be the size needed to hold the longest file
85 name string the implementation guarantees can be opened.
86 PATH_MAX not being defined means the actual limit on the length
87 of a file name is runtime-variant (or it is unlimited). ISO
88 says in such a case FILENAME_MAX should be a good size to
89 allocate for a file name string. POSIX.1 guarantees that a
90 file name up to _POSIX_PATH_MAX chars long can be opened, so
91 this value must be at least that. */
92 1024 /* _POSIX_PATH_MAX is 255. */
93 #endif
94 );
95
96 exit(0);
97 }