home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume20 / scan / part01 / config.h next >
Encoding:
C/C++ Source or Header  |  1991-05-21  |  7.1 KB  |  305 lines

  1. /*
  2.  *    configuration file for scan program
  3.  */
  4.  
  5.  
  6. /* maximum number of users we can cache */
  7. #define MAXLID        128
  8.  
  9. /* maximum number of groups we can cache */
  10. #define MAXGID        64
  11.  
  12. /*    if RM_BREAKPOINT is defined, it is the maximum number of files that
  13.  *    may be deleted at one time before the rm_verify is forced "on".
  14.  */
  15. #define RM_BREAKPOINT    10
  16.  
  17. /* defaults editor and file viewer */
  18. #define DEFAULT_EDITOR    "vi"
  19. #define DEFAULT_PAGER    "less"
  20.  
  21. /*
  22.  * SYSTEM_RCFILE will be processed before the user's .scanrc,
  23.  * allowing site wide defaults
  24.  */
  25. #define SYSTEM_RCFILE "/usr/local/lib/scan.rc"
  26.  
  27. /*
  28.  *    Define "SIGTYPE" to the type of the value returned by the "signal"
  29.  *    system call.  On BSD 4.2 systems, it's "void".  On BSD 4.3 and SVR3
  30.  *    systems, it's "int".
  31.  *
  32.  *    Define "VOIDPTR" if your C compiler can handle void pointers.  The
  33.  *    portable C compiler that comes with many systems cannot.  Most modern
  34.  *    C compilers can.
  35.  *
  36.  *    Define "NEED_TSTP" if your curses library uses "_tstp()" instead of
  37.  *    "tstp()".  If you need this, you'll find the link fails with an
  38.  *    unresolved reference to _tstp.
  39.  *
  40.  *    Defining "System5" is the same as defining ALL of the following:
  41.  *
  42.  *        Define "SYSVmemcpy" to use memcpy instead of bcopy.
  43.  *        Define "SYSVcurses" if your system has System V curses.
  44.  *        Define "SYSVdirent" if your system uses the "dirent" directory
  45.  *            access (get Doug Gwyn's library if your System V
  46.  *            system doesn't support this).
  47.  *        Define "SYSVgetcwd" to use getcwd instead of getwd.
  48.  *
  49.  *    If you have one of the ever more popular mixture operating systems,
  50.  *    just pick the features you need out of the above list.
  51.  *
  52.  *    Here's some known values:
  53.  */
  54.  
  55. /* HP/UX V7 and later */
  56. #ifdef hpux
  57. #define SIGTYPE    void
  58. #define System5
  59. #define VOIDPTR
  60. #define NEED_TSTP
  61. #else
  62.  
  63. /* SGI Irix 3.3 */
  64. #ifdef sgi
  65. #define SYSVcurses
  66. #define SYSVdirent
  67. #define SYSVmemcpy
  68. #define SIGTYPE    void
  69. /*
  70. #define VOIDPTR
  71. */
  72. #define NEED_TSTP
  73. #else
  74.  
  75. /* Sequent Dynix V3 */
  76. #ifdef sequent
  77. #define SIGTYPE int
  78. #ifndef LINT
  79. #define VOIDPTR
  80. #endif
  81. #else
  82.  
  83. /* Esix (AT&T Unix) System V Release 3.2 Rev D */
  84. #ifdef i386
  85. #define System5
  86. #define SIGTYPE    void
  87. #define NEEDTIMEH
  88. #define VOIDPTR
  89. #else
  90.  
  91. /*
  92.  * Concurrent RTU 5.0
  93.  */
  94. #ifdef mc700
  95. #define SIGTYPE    void
  96. #define NEED_TSTP
  97. #define System5
  98. #ifdef _UCB
  99. DANGER Will Robinson
  100.     scan will not link in the ucb universe on RTU V5
  101.     because the curses include file is broken!
  102.     The _rawmode routine does not exist!
  103.     compile in the ATT universe instead!
  104. #endif
  105. #else
  106.  
  107. /* Alliant Concentrix V5.5 */
  108. #ifdef alliant
  109. #define SIGTYPE void
  110. #else
  111.  
  112. /* HP/Apollo Domain/OS SR 10.3 */
  113. #ifdef apollo
  114. #define SIGTYPE int
  115. #define VOIDPTR
  116.  
  117. #endif /* apollo */
  118. #endif /* alliant */
  119. #endif /* rtu */
  120. #endif /* i386 */
  121. #endif /* sequent */
  122. #endif /* sgi */
  123. #endif /* hpux */
  124.  
  125. #ifdef System5
  126. #define SYSVcurses
  127. #define SYSVmemcpy
  128. #define SYSVdirent
  129. #define SYSVgetcwd
  130. #endif /* System5 */
  131.  
  132. #ifdef VOIDPTR
  133. typedef void *voidptr;
  134. #else
  135. typedef int *voidptr;
  136. #endif
  137.  
  138. #ifndef SIGTYPE
  139. #define SIGTYPE    void
  140. #endif
  141.  
  142. #include <curses.h>
  143. #include <sys/types.h>
  144. #include <sys/wait.h>
  145. #include <sys/stat.h>
  146. #ifdef NEEDTIMEH
  147. #include <time.h>
  148. #endif
  149. #include <sys/time.h>
  150. #include <pwd.h>
  151. #include <grp.h>
  152. #include <signal.h>
  153. #include <ctype.h>
  154. #include <errno.h>
  155.  
  156. #ifdef SYSVdirent
  157. #include "dirent.h"
  158. #define NAMELEN(x) strlen(x->d_name)
  159. #define direct dirent
  160. #else
  161. #include <sys/dir.h>
  162. #define NAMELEN(x) x->d_namlen
  163. #endif /* SYSVdirent */
  164.  
  165. #ifdef sequent
  166. #include <sys/universe.h>
  167. #endif /* sequent */
  168.  
  169. #include "getch.h"
  170.  
  171. #ifdef SYSVmemcpy
  172. #define BCOPY(source,dest,len) memcpy(dest,source,len)
  173. #else
  174. #define BCOPY(source,dest,len) bcopy(source,dest,len)
  175. #endif
  176.  
  177. #define beep()  fprintf (stderr, "\007");
  178.  
  179. #define PGM_VERSION    "Scan V4.0"    /* for informational purposes */
  180. extern int PAGESIZE;
  181.  
  182. /* maximum length any filename can be */
  183. #define MAXPATHLEN    1024
  184. /* maximum number of command line arguments we will handle */
  185. #define MAXARGS        512
  186.  
  187. /* how much memory to allocate in each name buffer block */
  188. #define BUFSIZE    256 * 1024
  189.  
  190. struct    namelist {    /* used to cache login id and group information */
  191.     int    number;
  192.     char    name[9];
  193.     };
  194.  
  195. /* largest number of files we will handle */
  196. #define MAXDIRSIZE    512
  197. struct    dblock    {        /* used to store file information */
  198.     int    size,        /* filesize in bytes */
  199.         owner,        /* index into lidlist */
  200.         group,        /* index into gidlist */
  201.         selected,    /* flag to indicate selected status */
  202.         type;        /* file type */
  203.     time_t    ctime;        /* time of last modification */
  204.     char    perms[13];    /* file permissions */
  205.     char    modtime[13];    /* last modification time */
  206.     char    *name;        /* file name */
  207.     char    *link;        /* name pointed to, for symbolic links */
  208.     };
  209.  
  210. #ifndef TRUE
  211. #define TRUE 1
  212. #endif
  213. #ifndef FALSE
  214. #define FALSE 0
  215. #endif
  216. #define ONERROR 2
  217.  
  218. struct option_entry {
  219.     char    *name;
  220.     int    *variable;
  221.     char    **value_table;
  222.     short    default_value;
  223.     };
  224.  
  225. /* shorthand names for option values */
  226. #define DOT_FIRST 0
  227. #define DOT_LAST 1
  228. #define DOT_HIDE 2
  229.  
  230. #define DIR_FIRST 0
  231. #define DIR_LAST 1
  232. #define DIR_SORT 2
  233.  
  234. #define WITH_DOT 0
  235. #define WITH_DIR 1
  236.  
  237. #define OPT_FALSE 0
  238. #define OPT_TRUE 1
  239.  
  240. typedef int Function ();
  241.  
  242. #define NILL (Function *)0x0
  243. #define SIZEKEYTAB 512
  244.  
  245. #define KEY_UNDEF 0
  246. #define KEY_FUNC 1
  247. #define KEY_CMD 2
  248.  
  249. #define OPT_TAGALL    00010000
  250. #define OPT_TAGCUR    00001000
  251. #define OPT_VERIFY    00000100
  252. #define OPT_WAITERR    00000010
  253. #define OPT_WAIT    00000001
  254. #define OPT_NONE       00000000
  255.  
  256. struct funcname_entry {
  257.     char *name;
  258.     int (*kfunc) ();
  259.     };
  260.  
  261. struct key_entry {
  262.     short    type;    /* KEY_UNDEF = undefined, KEY_FUNC = built in function, KEY_CMD = command string */
  263.     short    options;
  264.     voidptr    pntr;
  265.     };
  266.  
  267. struct keydef_entry {
  268.     char *name;
  269.     int value;
  270.     };
  271.  
  272. extern int bottom_line(), cd_back(), cd_dot(), cd_dotdot(), cd_file(),
  273.     cd_home(), cd_or_edit(), cd_or_view(), cd_prompt(), cd_root(),
  274.     command_file(), command_tagged(), edit_file(), edit_tagged(),
  275.     execute_file(), exec_file(), exit_pgm(), first_page(), fork_shell(),
  276.     help_screen(), last_page(), middle_line(), next_halfpage(),
  277.     next_line(), next_page(), prev_halfpage(), prev_line(), prev_page(),
  278.     redraw_menu(), rm_file(), rm_tagged(), setup_menu(), tag_all(),
  279.     toggle_tag(), top_line(), untag_all(), view_file(), view_tagged();
  280.  
  281. /*
  282.  * This software is Copyright (c) 1989, 1990, 1991 by Patrick J. Wolfe.
  283.  *
  284.  * Permission is hereby granted to copy, distribute or otherwise 
  285.  * use any part of this package as long as you do not try to make 
  286.  * money from it or pretend that you wrote it.  This copyright 
  287.  * notice must be maintained in any copy made.
  288.  *
  289.  * Use of this software constitutes acceptance for use in an AS IS 
  290.  * condition. There are NO warranties with regard to this software.  
  291.  * In no event shall the author be liable for any damages whatsoever 
  292.  * arising out of or in connection with the use or performance of this 
  293.  * software.  Any use of this software is at the user's own risk.
  294.  *
  295.  * If you make modifications to this software that you feel 
  296.  * increases it usefulness for the rest of the community, please 
  297.  * email the changes, enhancements, bug fixes as well as any and 
  298.  * all ideas to me. This software is going to be maintained and 
  299.  * enhanced as deemed necessary by the community.
  300.  *              
  301.  *              Patrick J. Wolfe
  302.  *              uunet!uiucuxc!kailand!pwolfe
  303.  *              pwolfe@kailand.kai.com
  304.  */
  305.