| 1 | /**CHeaderFile***************************************************************** | 
|---|
| 2 |  | 
|---|
| 3 | FileName    [cmdInt.h] | 
|---|
| 4 |  | 
|---|
| 5 | PackageName [cmd] | 
|---|
| 6 |  | 
|---|
| 7 | Synopsis    [Internal declarations for command package.] | 
|---|
| 8 |  | 
|---|
| 9 | Author      [Originated from SIS] | 
|---|
| 10 |  | 
|---|
| 11 | Copyright   [Copyright (c) 1994-1996 The Regents of the Univ. of California. | 
|---|
| 12 | All rights reserved. | 
|---|
| 13 |  | 
|---|
| 14 | Permission is hereby granted, without written agreement and without license | 
|---|
| 15 | or royalty fees, to use, copy, modify, and distribute this software and its | 
|---|
| 16 | documentation for any purpose, provided that the above copyright notice and | 
|---|
| 17 | the following two paragraphs appear in all copies of this software. | 
|---|
| 18 |  | 
|---|
| 19 | IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR | 
|---|
| 20 | DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT | 
|---|
| 21 | OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF | 
|---|
| 22 | CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
|---|
| 23 |  | 
|---|
| 24 | THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, | 
|---|
| 25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | 
|---|
| 26 | FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN | 
|---|
| 27 | "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE | 
|---|
| 28 | MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.] | 
|---|
| 29 |  | 
|---|
| 30 | Revision    [$Id: cmdInt.h,v 1.6 1998/09/18 17:08:00 rbloem Exp $] | 
|---|
| 31 |  | 
|---|
| 32 | ******************************************************************************/ | 
|---|
| 33 |  | 
|---|
| 34 | #ifndef _CMDINT | 
|---|
| 35 | #define _CMDINT | 
|---|
| 36 |  | 
|---|
| 37 | #include "ntk.h" | 
|---|
| 38 | #include "cmd.h" | 
|---|
| 39 |  | 
|---|
| 40 | #if STDC_HEADERS | 
|---|
| 41 | #  include <string.h> | 
|---|
| 42 | #  include <stdlib.h> | 
|---|
| 43 | #else | 
|---|
| 44 | extern void free(); | 
|---|
| 45 | extern char *strncpy(); | 
|---|
| 46 | extern char *strstr(); | 
|---|
| 47 | extern char *strrchr(); | 
|---|
| 48 | #endif | 
|---|
| 49 |  | 
|---|
| 50 | /* | 
|---|
| 51 | * This is for Solaris -- it needs to be convinced that we're actually | 
|---|
| 52 | * using BSD-style calls in sys/ioctl.h, otherwise it doesn't find | 
|---|
| 53 | * "ECHO" "CRMOD" and "TIOCSTI" when compiling cmdFile.c | 
|---|
| 54 | */ | 
|---|
| 55 | #define BSD_COMP | 
|---|
| 56 |  | 
|---|
| 57 | #if IOCTL_WITH_TERMIOS | 
|---|
| 58 | #  include <sys/ioctl.h> | 
|---|
| 59 | #  include <sys/termios.h> | 
|---|
| 60 | #else | 
|---|
| 61 | #  if HAVE_SYS_IOCTL_H | 
|---|
| 62 | #    include <sys/ioctl.h> | 
|---|
| 63 | #  else | 
|---|
| 64 | #    if HAVE_SYS_TERMIOS_H | 
|---|
| 65 | #      include <sys/termios.h> | 
|---|
| 66 | #    endif | 
|---|
| 67 | #  endif | 
|---|
| 68 | #endif | 
|---|
| 69 |  | 
|---|
| 70 | /* Linux and its wacky header files... */ | 
|---|
| 71 | #if HAVE_BSD_SGTTY_H | 
|---|
| 72 | #  include <bsd/sgtty.h> | 
|---|
| 73 | #endif | 
|---|
| 74 |  | 
|---|
| 75 | /* RB: include this header file on irix machines to get def of ttchars */ | 
|---|
| 76 | #if NEED_TTOLD | 
|---|
| 77 | #  include <sys/ttold.h> | 
|---|
| 78 | #endif | 
|---|
| 79 |  | 
|---|
| 80 | #if HAVE_SYS_SIGNAL_h | 
|---|
| 81 | #  include <sys/signal.h> | 
|---|
| 82 | #endif | 
|---|
| 83 | #if HAVE_SIGNAL_H | 
|---|
| 84 | #  include <signal.h> | 
|---|
| 85 | #endif | 
|---|
| 86 |  | 
|---|
| 87 | /* | 
|---|
| 88 | * No unix system seems to be able to agree on how to access directories, | 
|---|
| 89 | * which cmdFile.c needs to do.  This solution, suggested by the autoconf | 
|---|
| 90 | * distribution, seems to handle most of the nonsense. | 
|---|
| 91 | */ | 
|---|
| 92 |  | 
|---|
| 93 | #if HAVE_DIRENT_H | 
|---|
| 94 | #  include <dirent.h> | 
|---|
| 95 | #  define NAMLEN(dirent) strlen((dirent)->d_name) | 
|---|
| 96 | #else | 
|---|
| 97 | #  define dirent direct | 
|---|
| 98 | #  define NAMLEN(dirent) (dirent)->d_namlen | 
|---|
| 99 | #  if HAVE_SYS_NDIR_H | 
|---|
| 100 | #    include <sys/ndir.h> | 
|---|
| 101 | #  endif | 
|---|
| 102 | #  if HAVE_SYS_DIR_H | 
|---|
| 103 | #    include <sys/dir.h> | 
|---|
| 104 | #  endif | 
|---|
| 105 | #  if HAVE_NDIR_H | 
|---|
| 106 | #    include <ndir.h> | 
|---|
| 107 | #  endif | 
|---|
| 108 | #endif | 
|---|
| 109 |  | 
|---|
| 110 | /*---------------------------------------------------------------------------*/ | 
|---|
| 111 | /* Stucture declarations                                                     */ | 
|---|
| 112 | /*---------------------------------------------------------------------------*/ | 
|---|
| 113 | typedef struct CmdAliasDescrStruct { | 
|---|
| 114 | char *name; | 
|---|
| 115 | int argc; | 
|---|
| 116 | char **argv; | 
|---|
| 117 | } CmdAliasDescr_t; | 
|---|
| 118 |  | 
|---|
| 119 |  | 
|---|
| 120 |  | 
|---|
| 121 | /*---------------------------------------------------------------------------*/ | 
|---|
| 122 | /* Variable declarations                                                     */ | 
|---|
| 123 | /*---------------------------------------------------------------------------*/ | 
|---|
| 124 | extern avl_tree *cmdCommandTable; | 
|---|
| 125 | extern avl_tree *cmdFlagTable; | 
|---|
| 126 | extern avl_tree *cmdAliasTable; | 
|---|
| 127 | extern Hrc_Manager_t *cmdBackupHmgr; | 
|---|
| 128 |  | 
|---|
| 129 |  | 
|---|
| 130 | /**AutomaticStart*************************************************************/ | 
|---|
| 131 |  | 
|---|
| 132 | /*---------------------------------------------------------------------------*/ | 
|---|
| 133 | /* Function prototypes                                                       */ | 
|---|
| 134 | /*---------------------------------------------------------------------------*/ | 
|---|
| 135 |  | 
|---|
| 136 | EXTERN void CmdCommandFree(char * value); | 
|---|
| 137 | EXTERN char * CmdFgetsFilec(char * buf, int size, FILE * stream, char * prompt); | 
|---|
| 138 | EXTERN char * CmdFgetsFilec(char * buf, int size, FILE * stream, char * prompt); | 
|---|
| 139 | EXTERN char * CmdHistorySubstitution(char * line, int * changed); | 
|---|
| 140 | EXTERN void CmdFreeArgv(int argc, char ** argv); | 
|---|
| 141 | EXTERN void CmdAliasFree(char * value); | 
|---|
| 142 |  | 
|---|
| 143 | /**AutomaticEnd***************************************************************/ | 
|---|
| 144 |  | 
|---|
| 145 | #endif /* _CMDINT */ | 
|---|