Whamcloud - gitweb
libext2fs: handle inline data in read/write function
[tools/e2fsprogs.git] / lib / ss / ss_internal.h
index 4b9ea23..19a6be7 100644 (file)
@@ -1,52 +1,27 @@
 /*
  * Copyright 1987, 1988 by MIT Student Information Processing Board
  *
- * For copyright information, see copyright.h.
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose is hereby granted, provided that
+ * the names of M.I.T. and the M.I.T. S.I.P.B. not be used in
+ * advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission.  M.I.T. and the
+ * M.I.T. S.I.P.B. make no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without
+ * express or implied warranty.
  */
 
 #ifndef _ss_ss_internal_h
 #define _ss_ss_internal_h __FILE__
 #include <stdio.h>
 #include <string.h>
-
-#ifdef __STDC__
+#include <stdlib.h>
 
 #define PROTOTYPE(p) p
 typedef void * pointer;
 
-#else
-
-#define const
-#define volatile
-#define PROTOTYPE(p) ()
-typedef char * pointer;
-
-#endif /* not __STDC__ */
-
 #include "ss.h"
 
-#if defined(__GNUC__)
-#define LOCAL_ALLOC(x) __builtin_alloca(x)
-#define LOCAL_FREE(x)
-#else
-#if defined(vax)
-#define LOCAL_ALLOC(x) alloca(x)
-#define LOCAL_FREE(x)
-extern pointer alloca PROTOTYPE((unsigned));
-#else
-#if defined(__HIGHC__) /* Barf! */
-pragma on(alloca);
-#define LOCAL_ALLOC(x) alloca(x)
-#define LOCAL_FREE(x)
-extern pointer alloca PROTOTYPE((unsigned));
-#else
-/* no alloca? */
-#define LOCAL_ALLOC(x) malloc(x)
-#define LOCAL_FREE(x) free(x)
-#endif
-#endif
-#endif                         /* LOCAL_ALLOC stuff */
-
 typedef char BOOL;
 
 typedef struct _ss_abbrev_entry {
@@ -67,8 +42,8 @@ typedef struct {
 
 typedef struct _ss_data {      /* init values */
     /* this subsystem */
-    char *subsystem_name;
-    char *subsystem_version;
+    const char *subsystem_name;
+    const char *subsystem_version;
     /* current request info */
     int argc;
     char **argv;               /* arg list */
@@ -85,6 +60,16 @@ typedef struct _ss_data {    /* init values */
        unsigned int  escape_disabled : 1,
                      abbrevs_disabled : 1;
     } flags;
+    /*
+     * Dynamic usage of readline library if present
+     */
+    void *readline_handle;
+    void (*readline_shutdown)(struct _ss_data *info);
+    char *(*readline)(const char *);
+    void (*add_history)(const char *);
+    void (*redisplay)(void);
+    char **(*rl_completion_matches)(const char *,
+                                   char *(*completer)(const char *, int));
     /* to get out */
     int abort;                 /* exit subsystem */
     int exit_status;
@@ -95,19 +80,21 @@ typedef struct _ss_data {   /* init values */
 #define        ss_info(sci_idx)        (_ss_table[sci_idx])
 #define        ss_current_request(sci_idx,code_ptr)    \
      (*code_ptr=0,ss_info(sci_idx)->current_request)
-void ss_unknown_function();
-void ss_delete_info_dir();
-int ss_execute_line();
-char **ss_parse();
-ss_abbrev_info *ss_abbrev_initialize PROTOTYPE((char *, int *));
-void ss_page_stdin();
+void ss_add_info_dir (int sci_idx, char *info_dir, int *code_ptr);
+void ss_delete_info_dir (int sci_idx, char *info_dir, int *code_ptr);
+int ss_execute_line(int sci_idx, char *line_ptr);
+char **ss_parse(int sci_idx, char *line_ptr, int *argc_ptr);
+ss_abbrev_info *ss_abbrev_initialize(char *, int *);
+void ss_page_stdin(void);
+void ss_list_requests(int, char const * const *, int, pointer);
+int ss_execute_command(int sci_idx, char *argv[]);
+int ss_pager_create(void);
+char *ss_safe_getenv(const char *arg);
+char **ss_rl_completion(const char *text, int start, int end);
 
 extern ss_data **_ss_table;
 extern char *ss_et_msgs[];
-
-extern pointer malloc PROTOTYPE((unsigned));
-extern pointer realloc PROTOTYPE((pointer, unsigned));
-extern pointer calloc PROTOTYPE((unsigned, unsigned));
+extern char *_ss_pager_name;
 
 #ifdef USE_SIGPROCMASK
 /* fake sigmask, sigblock, sigsetmask */