1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 /* 3 * Copyright 1987, 1988 by MIT Student Information Processing Board 4 * 5 * For copyright information, see copyright.h. 6 */ 7 8 #ifndef _ss_ss_internal_h 9 #define _ss_ss_internal_h __FILE__ 10 #include "k5-platform.h" 11 #include <unistd.h> 12 13 typedef void * pointer; 14 15 #include "ss.h" 16 17 #if defined(__GNUC__) 18 #define LOCAL_ALLOC(x) __builtin_alloca(x) 19 #define LOCAL_FREE(x) 20 #else 21 #if defined(vax) 22 #define LOCAL_ALLOC(x) alloca(x) 23 #define LOCAL_FREE(x) 24 extern pointer alloca (unsigned); 25 #else 26 #if defined(__HIGHC__) /* Barf! */ 27 pragma on(alloca); 28 #define LOCAL_ALLOC(x) alloca(x) 29 #define LOCAL_FREE(x) 30 extern pointer alloca (unsigned); 31 #else 32 /* no alloca? */ 33 #define LOCAL_ALLOC(x) malloc(x) 34 #define LOCAL_FREE(x) free(x) 35 #endif 36 #endif 37 #endif /* LOCAL_ALLOC stuff */ 38 39 typedef char BOOL; 40 41 typedef struct _ss_abbrev_entry { 42 char *name; /* abbrev name */ 43 char **abbrev; /* new tokens to insert */ 44 unsigned int beginning_of_line : 1; 45 } ss_abbrev_entry; 46 47 typedef struct _ss_abbrev_list { 48 int n_abbrevs; 49 ss_abbrev_entry *first_abbrev; 50 } ss_abbrev_list; 51 52 typedef struct { 53 /* char *path; */ 54 ss_abbrev_list abbrevs[127]; 55 } ss_abbrev_info; 56 57 typedef struct _ss_data { /* init values */ 58 /* this subsystem */ 59 char *subsystem_name; 60 char *subsystem_version; 61 /* current request info */ 62 int argc; 63 char **argv; /* arg list */ 64 char const *current_request; /* primary name */ 65 /* info directory for 'help' */ 66 char **info_dirs; 67 /* to be extracted by subroutines */ 68 pointer info_ptr; /* (void *) NULL */ 69 /* for ss_listen processing */ 70 char *prompt; 71 ss_request_table **rqt_tables; 72 ss_abbrev_info *abbrev_info; 73 struct { 74 unsigned int escape_disabled : 1, 75 abbrevs_disabled : 1; 76 } flags; 77 /* to get out */ 78 int abort; /* exit subsystem */ 79 int exit_status; 80 } ss_data; 81 82 #define CURRENT_SS_VERSION 1 83 84 #define ss_info(sci_idx) (_ss_table[sci_idx]) 85 #define ss_current_request(sci_idx,code_ptr) \ 86 (*code_ptr=0,ss_info(sci_idx)->current_request) 87 #ifndef __FreeBSD__ 88 void ss_delete_info_dir(int, char *, int *); 89 #endif 90 char **ss_parse (int, char *, int *); 91 ss_abbrev_info *ss_abbrev_initialize (char *, int *); 92 void ss_page_stdin (void); 93 int ss_pager_create (void); 94 void ss_self_identify __SS_PROTO; 95 void ss_subsystem_name __SS_PROTO; 96 void ss_subsystem_version __SS_PROTO; 97 void ss_unimplemented __SS_PROTO; 98 99 extern ss_data **_ss_table; 100 extern char *ss_et_msgs[]; 101 102 #ifndef HAVE_STDLIB_H 103 extern pointer malloc (unsigned); 104 extern pointer realloc (pointer, unsigned); 105 extern pointer calloc (unsigned, unsigned); 106 #endif 107 108 #if defined(USE_SIGPROCMASK) && !defined(POSIX_SIGNALS) 109 /* fake sigmask, sigblock, sigsetmask */ 110 #include <signal.h> 111 #ifdef sigmask 112 #undef sigmask 113 #endif 114 #define sigmask(x) (1L<<(x)-1) 115 #define sigsetmask(x) sigprocmask(SIG_SETMASK,&x,NULL) 116 static int _fake_sigstore; 117 #define sigblock(x) (_fake_sigstore=x,sigprocmask(SIG_BLOCK,&_fake_sigstore,0)) 118 #endif 119 #endif /* _ss_internal_h */ 120