Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 1987, 1988 by MIT Student Information Processing Board |
| 3 | * |
Theodore Ts'o | 06cefee | 1999-10-23 01:16:22 +0000 | [diff] [blame] | 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. |
Theodore Ts'o | 4e9bf7f | 2002-07-07 16:32:46 -0400 | [diff] [blame] | 12 | * |
| 13 | * This quote is just too good to not pass on: |
| 14 | * |
| 15 | * "BTW, I would have rejected the name Story Server because its |
| 16 | * initials are SS, the name of the secret police in Nazi |
| 17 | * Germany, probably the most despised pair of letters in western |
| 18 | * culture." --- http://scriptingnewsarchive.userland.com/1999/12/13 |
| 19 | * |
| 20 | * Let no one say political correctness isn't dead.... |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 21 | */ |
| 22 | |
| 23 | #ifndef _ss_h |
| 24 | #define _ss_h __FILE__ |
| 25 | |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 26 | #include <ss/ss_err.h> |
| 27 | |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 28 | #define __SS_CONST const |
| 29 | #define __SS_PROTO (int, const char * const *, int, void *) |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 30 | |
Theodore Ts'o | 5443492 | 2003-12-07 01:28:50 -0500 | [diff] [blame] | 31 | #ifdef __GNUC__ |
| 32 | #define __SS_ATTR(x) __attribute__(x) |
| 33 | #else |
| 34 | #define __SS_ATTR(x) |
| 35 | #endif |
| 36 | |
| 37 | |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 38 | typedef __SS_CONST struct _ss_request_entry { |
| 39 | __SS_CONST char * __SS_CONST *command_names; /* whatever */ |
| 40 | void (* __SS_CONST function) __SS_PROTO; /* foo */ |
| 41 | __SS_CONST char * __SS_CONST info_string; /* NULL */ |
| 42 | int flags; /* 0 */ |
| 43 | } ss_request_entry; |
| 44 | |
| 45 | typedef __SS_CONST struct _ss_request_table { |
| 46 | int version; |
| 47 | ss_request_entry *requests; |
| 48 | } ss_request_table; |
| 49 | |
| 50 | #define SS_RQT_TBL_V2 2 |
| 51 | |
| 52 | typedef struct _ss_rp_options { /* DEFAULT VALUES */ |
| 53 | int version; /* SS_RP_V1 */ |
| 54 | void (*unknown) __SS_PROTO; /* call for unknown command */ |
| 55 | int allow_suspend; |
| 56 | int catch_int; |
| 57 | } ss_rp_options; |
| 58 | |
| 59 | #define SS_RP_V1 1 |
| 60 | |
| 61 | #define SS_OPT_DONT_LIST 0x0001 |
| 62 | #define SS_OPT_DONT_SUMMARIZE 0x0002 |
| 63 | |
| 64 | void ss_help __SS_PROTO; |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 65 | #if 0 |
| 66 | char *ss_current_request(); /* This is actually a macro */ |
| 67 | #endif |
Theodore Ts'o | 91835c1 | 2003-03-30 22:26:13 -0500 | [diff] [blame] | 68 | |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 69 | char *ss_name(int sci_idx); |
Theodore Ts'o | 5443492 | 2003-12-07 01:28:50 -0500 | [diff] [blame] | 70 | void ss_error (int, long, char const *, ...) |
| 71 | __SS_ATTR((format(printf, 3, 4))); |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 72 | void ss_perror (int, long, char const *); |
Theodore Ts'o | 5443492 | 2003-12-07 01:28:50 -0500 | [diff] [blame] | 73 | |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 74 | int ss_create_invocation(const char *, const char *, void *, |
| 75 | ss_request_table *, int *); |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 76 | void ss_delete_invocation(int); |
| 77 | int ss_listen(int); |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 78 | int ss_execute_line(int, char *); |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 79 | void ss_add_request_table(int, ss_request_table *, int, int *); |
| 80 | void ss_delete_request_table(int, ss_request_table *, int *); |
Theodore Ts'o | f3db356 | 1997-04-26 13:34:30 +0000 | [diff] [blame] | 81 | void ss_abort_subsystem(int sci_idx, int code); |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 82 | void ss_quit(int argc, const char * const *argv, int sci_idx, void *infop); |
| 83 | void ss_self_identify(int argc, const char * const *argv, int sci_idx, void *infop); |
| 84 | void ss_subsystem_name(int argc, const char * const *argv, |
| 85 | int sci_idx, void *infop); |
| 86 | void ss_subsystem_version(int argc, const char * const *argv, |
| 87 | int sci_idx, void *infop); |
| 88 | void ss_unimplemented(int argc, const char * const *argv, |
| 89 | int sci_idx, void *infop); |
Theodore Ts'o | 546a1ff | 2002-03-07 23:52:56 -0500 | [diff] [blame] | 90 | void ss_set_prompt(int sci_idx, char *new_prompt); |
| 91 | char *ss_get_prompt(int sci_idx); |
Theodore Ts'o | 3ae497e | 2003-03-16 06:26:25 -0500 | [diff] [blame] | 92 | void ss_get_readline(int sci_idx); |
JP Abgrall | e0ed740 | 2014-03-19 19:08:39 -0700 | [diff] [blame] | 93 | char *ss_safe_getenv(const char *arg); |
Theodore Ts'o | 91835c1 | 2003-03-30 22:26:13 -0500 | [diff] [blame] | 94 | |
Theodore Ts'o | 3839e65 | 1997-04-26 13:21:57 +0000 | [diff] [blame] | 95 | extern ss_request_table ss_std_requests; |
| 96 | #endif /* _ss_h */ |