1*6a54128fSAndroid Build Coastguard Worker /* 2*6a54128fSAndroid Build Coastguard Worker * Copyright 1987, 1988 by MIT Student Information Processing Board 3*6a54128fSAndroid Build Coastguard Worker * 4*6a54128fSAndroid Build Coastguard Worker * Permission to use, copy, modify, and distribute this software and 5*6a54128fSAndroid Build Coastguard Worker * its documentation for any purpose is hereby granted, provided that 6*6a54128fSAndroid Build Coastguard Worker * the names of M.I.T. and the M.I.T. S.I.P.B. not be used in 7*6a54128fSAndroid Build Coastguard Worker * advertising or publicity pertaining to distribution of the software 8*6a54128fSAndroid Build Coastguard Worker * without specific, written prior permission. M.I.T. and the 9*6a54128fSAndroid Build Coastguard Worker * M.I.T. S.I.P.B. make no representations about the suitability of 10*6a54128fSAndroid Build Coastguard Worker * this software for any purpose. It is provided "as is" without 11*6a54128fSAndroid Build Coastguard Worker * express or implied warranty. 12*6a54128fSAndroid Build Coastguard Worker * 13*6a54128fSAndroid Build Coastguard Worker * This quote is just too good to not pass on: 14*6a54128fSAndroid Build Coastguard Worker * 15*6a54128fSAndroid Build Coastguard Worker * "BTW, I would have rejected the name Story Server because its 16*6a54128fSAndroid Build Coastguard Worker * initials are SS, the name of the secret police in Nazi 17*6a54128fSAndroid Build Coastguard Worker * Germany, probably the most despised pair of letters in western 18*6a54128fSAndroid Build Coastguard Worker * culture." --- http://scriptingnewsarchive.userland.com/1999/12/13 19*6a54128fSAndroid Build Coastguard Worker * 20*6a54128fSAndroid Build Coastguard Worker * Let no one say political correctness isn't dead.... 21*6a54128fSAndroid Build Coastguard Worker */ 22*6a54128fSAndroid Build Coastguard Worker 23*6a54128fSAndroid Build Coastguard Worker #ifndef _ss_h 24*6a54128fSAndroid Build Coastguard Worker #define _ss_h __FILE__ 25*6a54128fSAndroid Build Coastguard Worker 26*6a54128fSAndroid Build Coastguard Worker #include <ss/ss_err.h> 27*6a54128fSAndroid Build Coastguard Worker 28*6a54128fSAndroid Build Coastguard Worker #define __SS_CONST const 29*6a54128fSAndroid Build Coastguard Worker #define __SS_PROTO (int, const char * const *, int, void *) 30*6a54128fSAndroid Build Coastguard Worker 31*6a54128fSAndroid Build Coastguard Worker #ifdef __GNUC__ 32*6a54128fSAndroid Build Coastguard Worker #define __SS_ATTR(x) __attribute__(x) 33*6a54128fSAndroid Build Coastguard Worker #else 34*6a54128fSAndroid Build Coastguard Worker #define __SS_ATTR(x) 35*6a54128fSAndroid Build Coastguard Worker #endif 36*6a54128fSAndroid Build Coastguard Worker 37*6a54128fSAndroid Build Coastguard Worker 38*6a54128fSAndroid Build Coastguard Worker typedef __SS_CONST struct _ss_request_entry { 39*6a54128fSAndroid Build Coastguard Worker __SS_CONST char * __SS_CONST *command_names; /* whatever */ 40*6a54128fSAndroid Build Coastguard Worker void (* __SS_CONST function) __SS_PROTO; /* foo */ 41*6a54128fSAndroid Build Coastguard Worker __SS_CONST char * __SS_CONST info_string; /* NULL */ 42*6a54128fSAndroid Build Coastguard Worker int flags; /* 0 */ 43*6a54128fSAndroid Build Coastguard Worker } ss_request_entry; 44*6a54128fSAndroid Build Coastguard Worker 45*6a54128fSAndroid Build Coastguard Worker typedef __SS_CONST struct _ss_request_table { 46*6a54128fSAndroid Build Coastguard Worker int version; 47*6a54128fSAndroid Build Coastguard Worker ss_request_entry *requests; 48*6a54128fSAndroid Build Coastguard Worker } ss_request_table; 49*6a54128fSAndroid Build Coastguard Worker 50*6a54128fSAndroid Build Coastguard Worker #define SS_RQT_TBL_V2 2 51*6a54128fSAndroid Build Coastguard Worker 52*6a54128fSAndroid Build Coastguard Worker typedef struct _ss_rp_options { /* DEFAULT VALUES */ 53*6a54128fSAndroid Build Coastguard Worker int version; /* SS_RP_V1 */ 54*6a54128fSAndroid Build Coastguard Worker void (*unknown) __SS_PROTO; /* call for unknown command */ 55*6a54128fSAndroid Build Coastguard Worker int allow_suspend; 56*6a54128fSAndroid Build Coastguard Worker int catch_int; 57*6a54128fSAndroid Build Coastguard Worker } ss_rp_options; 58*6a54128fSAndroid Build Coastguard Worker 59*6a54128fSAndroid Build Coastguard Worker #define SS_RP_V1 1 60*6a54128fSAndroid Build Coastguard Worker 61*6a54128fSAndroid Build Coastguard Worker #define SS_OPT_DONT_LIST 0x0001 62*6a54128fSAndroid Build Coastguard Worker #define SS_OPT_DONT_SUMMARIZE 0x0002 63*6a54128fSAndroid Build Coastguard Worker 64*6a54128fSAndroid Build Coastguard Worker void ss_help __SS_PROTO; 65*6a54128fSAndroid Build Coastguard Worker #if 0 66*6a54128fSAndroid Build Coastguard Worker char *ss_current_request(); /* This is actually a macro */ 67*6a54128fSAndroid Build Coastguard Worker #endif 68*6a54128fSAndroid Build Coastguard Worker 69*6a54128fSAndroid Build Coastguard Worker char *ss_name(int sci_idx); 70*6a54128fSAndroid Build Coastguard Worker void ss_error (int, long, char const *, ...) 71*6a54128fSAndroid Build Coastguard Worker __SS_ATTR((format(printf, 3, 4))); 72*6a54128fSAndroid Build Coastguard Worker void ss_perror (int, long, char const *); 73*6a54128fSAndroid Build Coastguard Worker 74*6a54128fSAndroid Build Coastguard Worker int ss_create_invocation(const char *, const char *, void *, 75*6a54128fSAndroid Build Coastguard Worker ss_request_table *, int *); 76*6a54128fSAndroid Build Coastguard Worker void ss_delete_invocation(int); 77*6a54128fSAndroid Build Coastguard Worker int ss_listen(int); 78*6a54128fSAndroid Build Coastguard Worker int ss_execute_line(int, char *); 79*6a54128fSAndroid Build Coastguard Worker void ss_add_request_table(int, ss_request_table *, int, int *); 80*6a54128fSAndroid Build Coastguard Worker void ss_delete_request_table(int, ss_request_table *, int *); 81*6a54128fSAndroid Build Coastguard Worker void ss_abort_subsystem(int sci_idx, int code); 82*6a54128fSAndroid Build Coastguard Worker void ss_quit(int argc, const char * const *argv, int sci_idx, void *infop); 83*6a54128fSAndroid Build Coastguard Worker void ss_self_identify(int argc, const char * const *argv, int sci_idx, void *infop); 84*6a54128fSAndroid Build Coastguard Worker void ss_subsystem_name(int argc, const char * const *argv, 85*6a54128fSAndroid Build Coastguard Worker int sci_idx, void *infop); 86*6a54128fSAndroid Build Coastguard Worker void ss_subsystem_version(int argc, const char * const *argv, 87*6a54128fSAndroid Build Coastguard Worker int sci_idx, void *infop); 88*6a54128fSAndroid Build Coastguard Worker void ss_unimplemented(int argc, const char * const *argv, 89*6a54128fSAndroid Build Coastguard Worker int sci_idx, void *infop); 90*6a54128fSAndroid Build Coastguard Worker void ss_set_prompt(int sci_idx, char *new_prompt); 91*6a54128fSAndroid Build Coastguard Worker char *ss_get_prompt(int sci_idx); 92*6a54128fSAndroid Build Coastguard Worker void ss_get_readline(int sci_idx); 93*6a54128fSAndroid Build Coastguard Worker char *ss_safe_getenv(const char *arg); 94*6a54128fSAndroid Build Coastguard Worker 95*6a54128fSAndroid Build Coastguard Worker extern ss_request_table ss_std_requests; 96*6a54128fSAndroid Build Coastguard Worker #endif /* _ss_h */ 97