home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / packages / gnuserv / gnuserv.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-23  |  2.5 KB  |  103 lines

  1. /* -*-C-*-
  2.  Header file for the GNU Emacs server and client C code.
  3.  
  4.  This file is part of GNU Emacs.
  5.  
  6.  Copying is permitted under those conditions described by the GNU
  7.  General Public License.
  8.  
  9.  Copyright (C) 1989 Free Software Foundation, Inc.
  10.  
  11.  Author: Andy Norman (ange@hplb.hpl.hp.com), based on 
  12.          'etc/server.c' and 'etc/emacsclient.c' from the 18.52 GNU
  13.          Emacs distribution.
  14.  
  15.  Please mail bugs and suggestions to the author at the above address.
  16. */
  17.  
  18. static char header_rcsid [] = "$Header: gnuserv.h,v 1.9 90/01/31 10:37:41 ange Exp $";
  19.  
  20. #define NO_SHORTNAMES
  21.  
  22. #define PATCHLEVEL 2
  23.  
  24. #include "../src/config.h"
  25. #undef read
  26. #undef write
  27. #undef open
  28. #undef close
  29.  
  30. /* Define the communication method between server and clients */
  31.  
  32. #define INTERNET_DOMAIN_SOCKETS
  33. #define UNIX_DOMAIN_SOCKETS
  34. /* #define SYSV_IPC */
  35.  
  36. #if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && !defined(INTERNET_DOMAIN_SOCKETS)
  37.  
  38. #ifdef HAVE_SYSVIPC
  39. #define SYSV_IPC        /* SYSV systems use SYSV IPC by default */
  40. #endif /* HAVE_SYSVIPC */
  41.  
  42. #ifdef BSD
  43. #define UNIX_DOMAIN_SOCKETS    /* BSD systems use Unix Domain sockets by default */
  44. #endif /* BSD */
  45.  
  46. #endif /* No communication method pre-defined */
  47.  
  48. #include <sys/types.h>
  49. #include <sys/param.h>
  50. #include <stdio.h>
  51. #include <signal.h>
  52.  
  53. #ifdef SYSV_IPC
  54. #include <sys/ipc.h>
  55. #include <sys/msg.h>
  56.  
  57. #define send_string(s,str) \
  58.   if (strlen(msgp->mtext) + strlen(str) < BUFSIZ) \
  59.      strcat(msgp->mtext,str); \
  60.   else \
  61.   { \
  62.     fprintf(stderr,"%s: not enough message buffer space\n",progname); \
  63.      exit(1); \
  64.   } \
  65.  
  66. #endif /* SYSV_IPC */
  67.  
  68. #if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS)
  69. #include <sys/socket.h>
  70. #endif /* INTERNET_DOMAIN_SOCKETS || UNIX_DOMAIN_SOCKETS */
  71.  
  72. #ifdef INTERNET_DOMAIN_SOCKETS
  73. #include <netinet/in.h>
  74. #include <netdb.h>
  75. #define TABLE_SIZE 101        /* The number of entries in the hash table */
  76. #define HASH(host) host        /* Rather simplistic hash function */
  77. #define DEFAULT_PORT 21490    /* default port number to use */
  78. #endif /* INTERNET_DOMAIN_SOCKETS */
  79.  
  80. #ifdef UNIX_DOMAIN_SOCKETS
  81. #include <sys/un.h>
  82. #endif /* UNIX_DOMAIN_SOCKETS */
  83.  
  84. #define HOSTNAMSZ 255        /* max size of a hostname */
  85. #define REPLYSIZ 300        /* max size of reply from server to client */
  86. #define FALSE 0
  87. #define TRUE 1
  88.  
  89. extern char *getenv();
  90. extern char *optarg;
  91. extern int optind;
  92. extern char *progname;
  93.  
  94. #ifndef BSD
  95. extern char *getcwd();
  96. #endif
  97.  
  98. #define max2(x,y) (((x) > (y)) ? (x) : (y))
  99.  
  100. #ifndef _NFILE            /* rough guess at maximum number of open files */
  101. #define _NFILE 20
  102. #endif
  103.