home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / glibc-1.06 / sysdeps / unix / mk-local_lim.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-05  |  2.5 KB  |  118 lines

  1. /* Copyright (C) 1993 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
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. #include <sys/types.h>
  20.  
  21. #ifdef HAVE_SYS_PARAM_H
  22. #include <sys/param.h>
  23. #endif
  24.  
  25. #ifdef HAVE_LIMITS_H
  26. #include <limits.h>
  27. #endif
  28.  
  29. #ifdef HAVE_SYS_LIMITS_H
  30. #include <sys/limits.h>
  31. #endif
  32.  
  33. /* Generate local_lim.h from the values defined in the system's headers.  */
  34.  
  35. struct param
  36.   {
  37.     char *name;
  38.     int value;
  39.   };
  40.  
  41. static struct param params[] =
  42.   {
  43.  
  44. #if !defined (ARG_MAX) && defined (NCARGS)
  45. #define ARG_MAX NCARGS
  46. #endif
  47. #ifdef ARG_MAX
  48.     { "ARG_MAX", ARG_MAX },
  49. #endif
  50.  
  51. #if !defined (CHILD_MAX) && defined (MAXUPRC)
  52. #define CHILD_MAX MAXUPRC
  53. #endif
  54. #ifdef CHILD_MAX
  55.     { "CHILD_MAX", CHILD_MAX },
  56. #endif
  57.  
  58. #if !defined (LINK_MAX) && defined (MAXLINK)
  59. #define LINK_MAX MAXLINK
  60. #endif
  61. #ifdef LINK_MAX
  62.     { "LINK_MAX", LINK_MAX },
  63. #endif
  64.  
  65. #if !defined (OPEN_MAX) && defined (NOFILE)
  66. #define OPEN_MAX NOFILE
  67. #endif
  68. #ifdef OPEN_MAX
  69.     { "OPEN_MAX", OPEN_MAX },
  70. #endif
  71.  
  72. #if !defined (MAX_CANON) && defined (CANBSIZ)
  73. #define MAX_CANON CANBSIZ
  74. #endif
  75. #ifdef MAX_CANON
  76.     { "MAX_CANON", MAX_CANON },
  77. #endif
  78.  
  79. #if !defined (NAME_MAX) && defined (MAXNAMLEN)
  80. #define NAME_MAX MAXNAMLEN
  81. #endif
  82. #ifndef NAME_MAX
  83. #define NAME_MAX    255    /* XXX ? */
  84. #endif
  85.     { "NAME_MAX", NAME_MAX },
  86.  
  87. #if !defined (PATH_MAX) && defined (MAXPATHLEN)
  88. #define PATH_MAX MAXPATHLEN
  89. #endif
  90. #ifdef PATH_MAX
  91.     { "PATH_MAX", PATH_MAX },
  92. #endif
  93.  
  94.     { NULL, 0 }
  95.   };
  96.  
  97. int
  98. main()
  99. {
  100.   extern char *ctime ();
  101.   extern time_t time ();
  102.   time_t now = time ((time_t *) NULL);
  103.   register struct param *p;
  104.  
  105.   if (! params[0].name)
  106.     /* We have no information to give, so let the caller know.  */
  107.     exit (1);
  108.  
  109.   printf ("\
  110. /* Implementation-specific limits.\n\
  111.    Generated at %.24s.  */\n\n", ctime (&now));
  112.  
  113.   for (p = params; p->name != NULL; ++p)
  114.     printf ("#define %s %d\n", p->name, p->value);
  115.  
  116.   exit (0);
  117. }
  118.