浏览代码

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

master
kevin 11 年前
父节点
当前提交
79fde062cd
共有 1 个文件被更改,包括 16 次插入4 次删除
  1. 16
    4
      cmPgmOpts.c

+ 16
- 4
cmPgmOpts.c 查看文件

@@ -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 )

正在加载...
取消
保存