2 * Copyright 1987, 1988 by MIT Student Information Processing Board
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose is hereby granted, provided that
6 * the names of M.I.T. and the M.I.T. S.I.P.B. not be used in
7 * advertising or publicity pertaining to distribution of the software
8 * without specific, written prior permission. M.I.T. and the
9 * M.I.T. S.I.P.B. make no representations about the suitability of
10 * this software for any purpose. It is provided "as is" without
11 * express or implied warranty.
14 #ifndef _ss_ss_internal_h
15 #define _ss_ss_internal_h __FILE__
20 #define PROTOTYPE(p) p
21 typedef void * pointer;
27 typedef struct _ss_abbrev_entry {
28 char *name; /* abbrev name */
29 char **abbrev; /* new tokens to insert */
30 unsigned int beginning_of_line : 1;
33 typedef struct _ss_abbrev_list {
35 ss_abbrev_entry *first_abbrev;
40 ss_abbrev_list abbrevs[127];
43 typedef struct _ss_data { /* init values */
45 const char *subsystem_name;
46 const char *subsystem_version;
47 /* current request info */
49 char **argv; /* arg list */
50 char const *current_request; /* primary name */
51 /* info directory for 'help' */
53 /* to be extracted by subroutines */
54 pointer info_ptr; /* (void *) NULL */
55 /* for ss_listen processing */
57 ss_request_table **rqt_tables;
58 ss_abbrev_info *abbrev_info;
60 unsigned int escape_disabled : 1,
64 * Dynamic usage of readline library if present
66 void *readline_handle;
67 void (*readline_shutdown)(struct _ss_data *info);
68 char *(*readline)(const char *);
69 void (*add_history)(const char *);
70 void (*redisplay)(void);
71 char **(*rl_completion_matches)(const char *,
72 char *(*completer)(const char *, int));
74 int abort; /* exit subsystem */
78 #define CURRENT_SS_VERSION 1
80 #define ss_info(sci_idx) (_ss_table[sci_idx])
81 #define ss_current_request(sci_idx,code_ptr) \
82 (*code_ptr=0,ss_info(sci_idx)->current_request)
83 void ss_add_info_dir (int sci_idx, char *info_dir, int *code_ptr);
84 void ss_delete_info_dir (int sci_idx, char *info_dir, int *code_ptr);
85 int ss_execute_line(int sci_idx, char *line_ptr);
86 char **ss_parse(int sci_idx, char *line_ptr, int *argc_ptr);
87 ss_abbrev_info *ss_abbrev_initialize(char *, int *);
88 void ss_page_stdin(void);
89 void ss_list_requests(int, char const * const *, int, pointer);
90 int ss_execute_command(int sci_idx, char *argv[]);
91 int ss_pager_create(void);
92 char *ss_safe_getenv(const char *arg);
93 char **ss_rl_completion(const char *text, int start, int end);
95 extern ss_data **_ss_table;
96 extern char *ss_et_msgs[];
98 #ifdef USE_SIGPROCMASK
99 /* fake sigmask, sigblock, sigsetmask */
101 #define sigmask(x) (1L<<(x)-1)
102 #define sigsetmask(x) sigprocmask(SIG_SETMASK,&x,NULL)
103 static int _fake_sigstore;
104 #define sigblock(x) (_fake_sigstore=x,sigprocmask(SIG_BLOCK,&_fake_sigstore,0))
106 #endif /* _ss_internal_h */