Browse Source

cmPgmOpt.c: Changed _cmPgmOptInsertArg() to add args to the end of the option and mater lists.

master
kevin 11 years ago
parent
commit
79fde062cd
1 changed files with 16 additions and 4 deletions
  1. 16
    4
      cmPgmOpts.c

+ 16
- 4
cmPgmOpts.c View File

@@ -479,11 +479,23 @@ _cmPoArg_t* _cmPgmOptInsertArg( _cmPo_t* p,  _cmPoOpt_t* r )
479 479
   a->opt        = r;
480 480
   a->valStr     = NULL;
481 481
 
482
-  a->link       = p->args;  // link into master arg list
483
-  p->args       = a;
482
+  // link onto the end of the  master arg list
483
+  _cmPoArg_t* ap = p->args;
484
+  while( ap!=NULL && ap->link != NULL )
485
+    ap=ap->link;
486
+  if( ap == NULL )
487
+    p->args = a;
488
+  else
489
+    ap->link = a;
484 490
   
485
-  a->inst       = r->inst;  // link into opt recd list
486
-  r->inst       = a;
491
+   // link onto the end of the opt recd list
492
+  ap = r->inst;
493
+  while( ap!=NULL && ap->inst!=NULL)
494
+    ap=ap->inst;
495
+  if( ap==NULL)
496
+    r->inst = a;
497
+  else
498
+    ap->inst = a;
487 499
 
488 500
   // if no parm. type flag was given then the arg is implicitely a bool and the value is true.
489 501
   //if( (r->flags & kTypeMaskPoFl) == 0 )

Loading…
Cancel
Save