home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / k / ksh48.zip / sh / stdh.h < prev    next >
C/C++ Source or Header  |  1992-05-03  |  2KB  |  87 lines

  1. /* NAME:
  2.  *      stdh.h - standard headers
  3.  *
  4.  * SYNOPSIS:
  5.  *      #include "stdh.h"
  6.  *
  7.  * DESCRIPTION:
  8.  *      We use this header to encapsulate all the stddef et al
  9.  *      inclusion so that most of the source can ignore the
  10.  *      problems that their lack might cause.
  11.  *
  12.  * SEE ALSO:
  13.  *
  14.  *
  15.  * AMENDED:
  16.  *      91/11/25  13:33:12  (sjg)
  17.  *
  18.  * RELEASED:
  19.  *      91/11/25  13:33:17  v1.3
  20.  *
  21.  * SCCSID:
  22.  *      @(#)stdh.h  1.3  91/11/25  13:33:12  (sjg)
  23.  *
  24.  */
  25.  
  26. #ifndef ARGS
  27. # ifdef __STDC__
  28. #   define ARGS(args) args
  29. # else
  30. #   define ARGS(args) ()
  31. #   ifdef VOID
  32. #     define void VOID
  33. #   endif
  34. #   define const
  35. #   define volatile
  36. # endif
  37. #endif
  38.  
  39. #include <stdio.h>
  40. /* if we have std headers then include them here
  41.  * otherwise make allowances
  42.  */
  43. #ifndef NOSTDHDRS
  44. # include <stddef.h>
  45. # include <stdlib.h>
  46. # include <string.h>
  47. # include <sys/types.h>
  48. #else
  49. # ifdef HAVE_SYS_STDTYPES
  50. #   include <sys/stdtypes.h>
  51. # else
  52. #   include <sys/types.h>
  53. /* just in case they have sys/stdtypes and don't know it
  54.  */
  55. #   ifndef    __sys_stdtypes_h
  56. #define _PID_T
  57. #define _CLOCK_T
  58. typedef int pid_t;
  59. typedef long clock_t;
  60. #   endif
  61. # endif
  62. # ifdef _SYSV
  63. #   include <string.h>
  64. # else
  65. #   include <strings.h>
  66. #   define strchr index
  67. #   define strrchr rindex
  68. # endif
  69. /* just a useful subset of what stdlib.h would have
  70.  */
  71. extern char * getenv  ARGS((const char *));
  72. extern void * malloc  ARGS((size_t));
  73. extern int    free    ARGS((void *));
  74. extern int    exit    ARGS((int));
  75.  
  76. /* these _should_ match ANSI */
  77. extern char * strstr  ARGS((const char *, const char *));
  78. extern void * memmove ARGS((void *, const void *, size_t));
  79. extern void * memcpy  ARGS((void *, const void *, size_t));
  80. #endif /* NOSTDHDRS */
  81.  
  82.  
  83. #ifndef offsetof
  84. #define    offsetof(type,id) ((size_t)&((type*)NULL)->id)
  85. #endif
  86.  
  87.