This commit is contained in:
tg 2009-08-28 21:07:27 +00:00
parent 7cb17b16a0
commit 1fd4515528
3 changed files with 11 additions and 12 deletions

10
misc.c
View File

@ -29,7 +29,7 @@
#include <grp.h> #include <grp.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.116 2009/08/28 21:04:16 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/misc.c,v 1.117 2009/08/28 21:07:26 tg Exp $");
#undef USE_CHVT #undef USE_CHVT
/* XXX conditions correct? */ /* XXX conditions correct? */
@ -445,11 +445,9 @@ parse_args(const char **argv,
qsort(&argv[go.optind], i - go.optind, sizeof(void *), qsort(&argv[go.optind], i - go.optind, sizeof(void *),
xstrcmp); xstrcmp);
} }
if (arrayset) { if (arrayset)
set_array(array, arrayset > 0 ? true : false, argv + go.optind); go.optind += set_array(array, arrayset > 0 ? true : false,
for (; argv[go.optind]; go.optind++) argv + go.optind);
;
}
return (go.optind); return (go.optind);
} }

4
sh.h
View File

@ -134,7 +134,7 @@
#endif #endif
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.331 2009/08/28 21:04:17 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.332 2009/08/28 21:07:27 tg Exp $");
#endif #endif
#define MKSH_VERSION "R39 2009/08/08" #define MKSH_VERSION "R39 2009/08/08"
@ -1647,7 +1647,7 @@ void change_random(unsigned long);
void change_winsz(void); void change_winsz(void);
int array_ref_len(const char *); int array_ref_len(const char *);
char *arrayname(const char *); char *arrayname(const char *);
void set_array(const char *, bool, const char **); uint32_t set_array(const char *, bool, const char **);
enum Test_op { enum Test_op {
TO_NONOP = 0, /* non-operator */ TO_NONOP = 0, /* non-operator */

9
var.c
View File

@ -22,7 +22,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.83 2009/08/28 21:04:18 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/var.c,v 1.84 2009/08/28 21:07:27 tg Exp $");
/* /*
* Variables * Variables
@ -1315,9 +1315,8 @@ arrayname(const char *str)
return (rv); return (rv);
} }
/* Set (or overwrite, if reset) the array variable var to the values in vals. /* set (or overwrite, if reset) the array variable var to the values in vals */
*/ uint32_t
void
set_array(const char *var, bool reset, const char **vals) set_array(const char *var, bool reset, const char **vals)
{ {
struct tbl *vp, *vq; struct tbl *vp, *vq;
@ -1342,6 +1341,8 @@ set_array(const char *var, bool reset, const char **vals)
/* would be nice to deal with errors here... (see above) */ /* would be nice to deal with errors here... (see above) */
setstr(vq, vals[i], KSH_RETURN_ERROR); setstr(vq, vals[i], KSH_RETURN_ERROR);
} }
return (i);
} }
void void