home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume6 / copt / cset.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-07  |  2.9 KB  |  76 lines

  1. /* $Header: cset.h,v 1.1 89/03/03 12:53:23 np Exp $
  2.  * $Log:    cset.h,v $
  3.  * Revision 1.1  89/03/03  12:53:23  np
  4.  * Initial revision
  5.  * 
  6.  */
  7.  
  8. /*
  9.  * Copyright (C) 1985-1989 Nigel Perry
  10.  *
  11.  * This program is distributed without any warranty.
  12.  * The author and and distributors accept no resposibility
  13.  * to anyone for the consequence of using this program or
  14.  * whether it serves any particular purpose or works at all,
  15.  * unless they say so in writing.
  16.  *
  17.  * Everyone is granted permission to copy, modify and
  18.  * redistribute this program, but only provided that:
  19.  *
  20.  * 1) They do so without financial or material gain.
  21.  *
  22.  * 2) The copyright notice and this notice are preserved on
  23.  *    all copies.
  24.  *
  25.  * 3) The original source is preserved in any redistribution.
  26.  *
  27.  * I hope you find this program useful!
  28.  *
  29.  */
  30.  
  31. /* a type definition for the options table */
  32. typedef struct { char *_opt_pat; int _opt_types; char *_opt_help } _opt_entry;
  33. #define OPTIONS _opt_entry _optable[] =
  34. /* the end of list marker for above defn */
  35. #define OPT_END { (char *)0, 0, (char *)0 }
  36. /* end of list marker including details of an info file */
  37. #define OPT_HELP(act, str) { (char *)0, act, str }
  38. /* empty help message constant */
  39. #define NOHELP (char *)0
  40. /* 'actions' for OPT_HELP, must be != 0 */
  41. #define OPT_LIST 1
  42. #define OPT_EXEC 2
  43.  
  44. /* the option types */
  45. #define BLNK_KWD 0x00100 /*  keyword                                     */
  46. #define PLUS_KWD 0x00200 /* +keyword                                     */
  47. #define DASH_KWD 0x00400 /* -keyword                                     */
  48. #define COMM_KWD 0x00800 /*  keyword - only recognised if command (first)*/
  49. #define SVAL_KWD 0x01000 /*  keyword=string                              */
  50. #define NVAL_KWD 0x02000 /*  keyword=number - 0ddd => oct, 0xddd => hex  */
  51. #define MVAL_KWD 0x06000 /*  keyword=number,...,number                   */
  52. #define DVAL_KWD 0x0200a /*  keyword=decimal                             */
  53. #define MDVL_KWD 0x0600a /*  keyword=decimal,...,decimal                 */
  54. #define OVAL_KWD 0x02008 /*  keyword=octal                               */
  55. #define MOVL_KWD 0x06008 /*  keyword=octal,...,octal                     */
  56. #define HVAL_KWD 0x02010 /*  keyword=hex                                 */
  57. #define MHVL_KWD 0x06010 /*  keyword=hex,...,hex                         */
  58. #define HIDE_KWD 0x10000 /*  Hidden keyword - not shown by d_optable()   */
  59. #define PRIV_KWD 0x30000 /*  Priviledged keyword - only for su's         */
  60.  
  61. /* _cset() returns a pointer to an array of... */
  62. typedef struct { int _opt_num;
  63.          char _opt_type;
  64.          union { int nval; /* numeric value */
  65.              int *mval; /* ptr to vec of values */
  66.              char *sval; /* string value */
  67.                } _opt;
  68.           } _opt_desc;
  69.  
  70. extern _opt_desc *_cset();
  71.  
  72. /* defn for environ var to control use of keyword arguments */
  73. #define AS_ENVAR "ArgStyle"
  74. #define AS_KWD   "keyword"    /* arg style is keyword */
  75. #define AS_ORG   "original"   /* arg style as supplied */
  76.