home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume39 / cmdline / patch02 / PATCH02
Encoding:
Text File  |  1993-08-21  |  8.8 KB  |  353 lines

  1. *** README.OLD    Thu Aug 19 16:31:18 1993
  2. --- README    Thu Aug 19 16:01:35 1993
  3. ***************
  4. *** 187,189 ****
  5. --- 187,193 ----
  6.    - Added the ability to allow (at run-time) the use of "+" as the long-option
  7.      prefix (this could be done only at compile-time until now).
  8.      
  9. +  08/19/93        Brad Appleton        <brad@ssd.csd.harris.com>
  10. +  -----------------------------------------------------------------------------
  11. +  - Fixed a problem that some machines/compilers had with the contructor
  12. +    ignoring the first CmdArg.
  13. *** src/lib/cmdline.c.OLD    Thu Aug 19 16:31:41 1993
  14. --- src/lib/cmdline.c    Thu Aug 19 15:58:06 1993
  15. ***************
  16. *** 130,135 ****
  17. --- 130,137 ----
  18.   filebasename(const char * filename)
  19.   {
  20.   
  21. +    if (filename == NULL)  return  filename ;
  22.   #if (defined(vms) || defined(msdos) || defined(os2))
  23.      const char * start, * p1, * p2 ;
  24.      char * str, * ext;
  25. ***************
  26. *** 199,205 ****
  27.   }
  28.   
  29.      // Constructor with a name and CmdArgs
  30. ! CmdLine::CmdLine(const char * cmdname, CmdArg * ...)
  31.      : cmd_parse_state(cmd_START_STATE),
  32.        cmd_state(cmd_START_STATE),
  33.        cmd_flags(DEFAULT_CMDFLAGS),
  34. --- 201,207 ----
  35.   }
  36.   
  37.      // Constructor with a name and CmdArgs
  38. ! CmdLine::CmdLine(const char * cmdname, CmdArg * cmdarg1 ...)
  39.      : cmd_parse_state(cmd_START_STATE),
  40.        cmd_state(cmd_START_STATE),
  41.        cmd_flags(DEFAULT_CMDFLAGS),
  42. ***************
  43. *** 219,226 ****
  44.      CmdArgList * arg_list = iter();
  45.   
  46.      va_list  ap;
  47. !    va_start(ap, cmdname);
  48. !    for (CmdArg * cmdarg = va_CmdArgP(ap) ; cmdarg ; cmdarg = va_CmdArgP(ap)) {
  49.         arg_list->add(cmdarg);
  50.      }
  51.      va_end(ap);
  52. --- 221,228 ----
  53.      CmdArgList * arg_list = iter();
  54.   
  55.      va_list  ap;
  56. !    va_start(ap, cmdarg1);
  57. !    for (CmdArg * cmdarg = cmdarg1 ; cmdarg ; cmdarg = va_CmdArgP(ap)) {
  58.         arg_list->add(cmdarg);
  59.      }
  60.      va_end(ap);
  61. ***************
  62. *** 228,234 ****
  63.   
  64.   
  65.      // Constructor with CmdArgs
  66. ! CmdLine::CmdLine(CmdArg * cmdarg, CmdArg * ...)
  67.      : cmd_parse_state(cmd_START_STATE),
  68.        cmd_state(cmd_START_STATE),
  69.        cmd_flags(DEFAULT_CMDFLAGS),
  70. --- 230,236 ----
  71.   
  72.   
  73.      // Constructor with CmdArgs
  74. ! CmdLine::CmdLine(CmdArg * cmdarg1 ...)
  75.      : cmd_parse_state(cmd_START_STATE),
  76.        cmd_state(cmd_START_STATE),
  77.        cmd_flags(DEFAULT_CMDFLAGS),
  78. ***************
  79. *** 241,257 ****
  80.        cmd_err(NULL),
  81.        cmd_quit_handler(NULL)
  82.   {
  83. !    if (cmdarg == NULL)  return;
  84.      ::init_args(cmd_args);
  85.   
  86.      CmdArgListListIter  iter(cmd_args);
  87.      CmdArgList * arg_list = iter();
  88.   
  89. -    arg_list->add(cmdarg);
  90.      va_list  ap;
  91. !    va_start(ap, cmdarg);
  92. !    for (cmdarg = va_CmdArgP(ap) ; cmdarg ; cmdarg = va_CmdArgP(ap)) {
  93.         arg_list->add(cmdarg);
  94.      }
  95.      va_end(ap);
  96. --- 243,257 ----
  97.        cmd_err(NULL),
  98.        cmd_quit_handler(NULL)
  99.   {
  100. !    if (cmdarg1 == NULL)  return;
  101.      ::init_args(cmd_args);
  102.   
  103.      CmdArgListListIter  iter(cmd_args);
  104.      CmdArgList * arg_list = iter();
  105.   
  106.      va_list  ap;
  107. !    va_start(ap, cmdarg1);
  108. !    for (CmdArg * cmdarg = cmdarg1 ; cmdarg ; cmdarg = va_CmdArgP(ap)) {
  109.         arg_list->add(cmdarg);
  110.      }
  111.      va_end(ap);
  112. ***************
  113. *** 273,282 ****
  114.   void
  115.   CmdLine::name(const char * progname)
  116.   {
  117.   #if (defined(vms) || defined(msdos) || defined(os2))
  118.      delete [] cmd_name;
  119.   #endif
  120. !    cmd_name = ::filebasename(progname);
  121.   }
  122.   
  123.   
  124. --- 273,284 ----
  125.   void
  126.   CmdLine::name(const char * progname)
  127.   {
  128. +    static  const char unknown_progname[] = "<unknown-program>" ;
  129.   #if (defined(vms) || defined(msdos) || defined(os2))
  130.      delete [] cmd_name;
  131.   #endif
  132. !    cmd_name = ::filebasename((progname) ? progname : unknown_progname);
  133.   }
  134.   
  135.   
  136. ***************
  137. *** 347,352 ****
  138.   CmdArg *
  139.   CmdLineCmdArgIter::operator()(void)
  140.   {
  141. !    return  (iter) ? (*iter)() : NULL ;
  142.   }
  143.   
  144. --- 349,354 ----
  145.   CmdArg *
  146.   CmdLineCmdArgIter::operator()(void)
  147.   {
  148. !    return  (iter) ? iter->operator()() : NULL ;
  149.   }
  150.   
  151. *** src/lib/cmdline.h.OLD    Thu Aug 19 16:31:44 1993
  152. --- src/lib/cmdline.h    Wed Aug 18 09:22:11 1993
  153. ***************
  154. *** 506,514 ****
  155.         //
  156.      CmdLine(const char * name =0);
  157.   
  158. !    CmdLine(const char * name, CmdArg * ...);   // last arg should be NULL
  159.   
  160. !    CmdLine(CmdArg * cmdarg, CmdArg * ...);     // last arg should be NULL
  161.   
  162.      virtual ~CmdLine(void);
  163.   
  164. --- 506,514 ----
  165.         //
  166.      CmdLine(const char * name =0);
  167.   
  168. !    CmdLine(const char * name, CmdArg * cmdarg1 ...); // last arg should be NULL
  169.   
  170. !    CmdLine(CmdArg * cmdarg1 ...);  // last arg should be NULL
  171.   
  172.      virtual ~CmdLine(void);
  173.   
  174. *** src/lib/fifolist.h.OLD    Thu Aug 19 16:31:49 1993
  175. --- src/lib/fifolist.h    Mon Apr 19 11:15:48 1993
  176. ***************
  177. *** 57,68 ****
  178.      GenericFifoListNode * head;
  179.      GenericFifoListNode * tail;
  180.   
  181. - public:
  182.      GenericFifoList(void)
  183.         : head(0), tail(0), num_items(0), del_items(0), mod(0) {}
  184.   
  185. -    virtual  ~GenericFifoList(void);
  186.      // Remove the first item from the list
  187.      void *
  188.      remove(void);
  189. --- 57,65 ----
  190. ***************
  191. *** 71,76 ****
  192. --- 68,76 ----
  193.      void
  194.      add(void * item);
  195.   
  196. + public:
  197. +    virtual  ~GenericFifoList(void);
  198.      // Was the list modified since the last time we checked?
  199.      int
  200.      modified(void) { return (mod) ? (mod = 0, 1) : 0 ; }
  201. ***************
  202. *** 101,107 ****
  203.   private:
  204.      GenericFifoList::GenericFifoListNode * current;
  205.   
  206. ! public:
  207.      GenericFifoListIter(GenericFifoList & fifo_list)
  208.         : current(fifo_list.head) {}
  209.   
  210. --- 101,107 ----
  211.   private:
  212.      GenericFifoList::GenericFifoListNode * current;
  213.   
  214. ! protected:
  215.      GenericFifoListIter(GenericFifoList & fifo_list)
  216.         : current(fifo_list.head) {}
  217.   
  218. ***************
  219. *** 108,120 ****
  220.      GenericFifoListIter(GenericFifoList * fifo_list)
  221.         : current(fifo_list->head) {}
  222.   
  223. -    virtual  ~GenericFifoListIter(void);
  224.      // Return the current item in the list and advance to the next item.
  225.      // returns NULL if at end-of-list
  226.      //
  227.      void *
  228.      operator()(void);
  229.   } ;
  230.   
  231.   
  232. --- 108,122 ----
  233.      GenericFifoListIter(GenericFifoList * fifo_list)
  234.         : current(fifo_list->head) {}
  235.   
  236.      // Return the current item in the list and advance to the next item.
  237.      // returns NULL if at end-of-list
  238.      //
  239.      void *
  240.      operator()(void);
  241. + public:
  242. +    virtual  ~GenericFifoListIter(void);
  243.   } ;
  244.   
  245.   
  246. ***************
  247. *** 125,131 ****
  248.      unsigned           index;
  249.      GenericFifoList::GenericFifoListNode * current;
  250.   
  251. ! public:
  252.      GenericFifoListArray(GenericFifoList & fifo_list)
  253.         : list(fifo_list), index(0), current(fifo_list.head) {}
  254.   
  255. --- 127,133 ----
  256.      unsigned           index;
  257.      GenericFifoList::GenericFifoListNode * current;
  258.   
  259. ! protected:
  260.      GenericFifoListArray(GenericFifoList & fifo_list)
  261.         : list(fifo_list), index(0), current(fifo_list.head) {}
  262.   
  263. ***************
  264. *** 132,139 ****
  265.      GenericFifoListArray(GenericFifoList * fifo_list)
  266.         : list(*fifo_list), index(0), current(fifo_list->head) {}
  267.   
  268. -    virtual  ~GenericFifoListArray(void);
  269.      // How many items are in the array?
  270.      unsigned  count(void) const  { return  list.count(); }
  271.   
  272. --- 134,139 ----
  273. ***************
  274. *** 147,152 ****
  275. --- 147,156 ----
  276.      //
  277.      void *
  278.      operator[](unsigned  ndx);
  279. + public:
  280. +    virtual  ~GenericFifoListArray(void);
  281.   } ;
  282.   
  283.   #ifdef TEMPLATES
  284. ***************
  285. *** 187,198 ****
  286.   
  287.      Type &
  288.      operator[](unsigned  ndx)
  289. !       { return  *((Type *) GenericFifoListArray::operator[](ndx)) }
  290.   } ;
  291.   
  292.   #define  DECLARE_FIFO_LIST(Name,Type) \
  293.      typedef  FifoList<Type> Name; \
  294. !    typedef  FifoListIter<Type>  name2(Name,Iter) \
  295.      typedef  FifoListArray<Type> name2(Name,Array)
  296.   
  297.   #else  /* dont have templates -- have to fake it */
  298. --- 191,202 ----
  299.   
  300.      Type &
  301.      operator[](unsigned  ndx)
  302. !       { return  *((Type *) GenericFifoListArray::operator[](ndx)); }
  303.   } ;
  304.   
  305.   #define  DECLARE_FIFO_LIST(Name,Type) \
  306.      typedef  FifoList<Type> Name; \
  307. !    typedef  FifoListIter<Type>  name2(Name,Iter); \
  308.      typedef  FifoListArray<Type> name2(Name,Array)
  309.   
  310.   #else  /* dont have templates -- have to fake it */
  311. *** src/lib/patchlevel.c.OLD    Thu Aug 19 16:31:52 1993
  312. --- src/lib/patchlevel.c    Wed Jul 14 10:55:42 1993
  313. ***************
  314. *** 24,36 ****
  315.      // file that makes up this version of the project.
  316.      //
  317.   static const char ident[] =
  318. !    "@(#)SMS  task: cmdline-1.01" ;
  319.   
  320.   
  321.      // Release and patchlevel information
  322.   #define  CMDLINE_RELEASE     1
  323. ! #define  CMDLINE_PATCHLEVEL  1
  324. ! #define  CMDLINE_IDENT       "@(#)CmdLine    1.01"
  325.   
  326.   unsigned
  327.   CmdLine::release(void)  { return  CMDLINE_RELEASE; }
  328. --- 24,36 ----
  329.      // file that makes up this version of the project.
  330.      //
  331.   static const char ident[] =
  332. !    "@(#)SMS  task: cmdline-1.02" ;
  333.   
  334.   
  335.      // Release and patchlevel information
  336.   #define  CMDLINE_RELEASE     1
  337. ! #define  CMDLINE_PATCHLEVEL  2
  338. ! #define  CMDLINE_IDENT       "@(#)CmdLine    1.02"
  339.   
  340.   unsigned
  341.   CmdLine::release(void)  { return  CMDLINE_RELEASE; }
  342.