diff --git a/exec.c b/exec.c index affc23b..e01aacc 100644 --- a/exec.c +++ b/exec.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.152 2015/04/29 18:32:43 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.153 2015/07/05 14:43:05 tg Exp $"); #ifndef MKSH_DEFAULT_EXECSHELL #define MKSH_DEFAULT_EXECSHELL "/bin/sh" @@ -41,8 +41,8 @@ static const char *dbteste_getopnd(Test_env *, Test_op, bool); static void dbteste_error(Test_env *, int, const char *); static int search_access(const char *, int); /* XXX: horrible kludge to fit within the framework */ -static char *plain_fmt_entry(char *, size_t, unsigned int, const void *); -static char *select_fmt_entry(char *, size_t, unsigned int, const void *); +static void plain_fmt_entry(char *, size_t, unsigned int, const void *); +static void select_fmt_entry(char *, size_t, unsigned int, const void *); /* * execute command tree @@ -1610,7 +1610,7 @@ struct select_menu_info { }; /* format a single select menu item */ -static char * +static void select_fmt_entry(char *buf, size_t buflen, unsigned int i, const void *arg) { const struct select_menu_info *smi = @@ -1618,7 +1618,6 @@ select_fmt_entry(char *buf, size_t buflen, unsigned int i, const void *arg) shf_snprintf(buf, buflen, "%*u) %s", smi->num_width, i + 1, smi->args[i]); - return (buf); } /* @@ -1664,11 +1663,10 @@ pr_menu(const char * const *ap) true); } -static char * +static void plain_fmt_entry(char *buf, size_t buflen, unsigned int i, const void *arg) { strlcpy(buf, ((const char * const *)arg)[i], buflen); - return (buf); } void diff --git a/funcs.c b/funcs.c index 177530a..573e9f6 100644 --- a/funcs.c +++ b/funcs.c @@ -38,7 +38,7 @@ #endif #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.273 2015/06/28 14:57:24 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.274 2015/07/05 14:43:06 tg Exp $"); #if HAVE_KILLPG /* @@ -224,7 +224,7 @@ static int test_primary(Test_env *, bool); static Test_op ptest_isa(Test_env *, Test_meta); static const char *ptest_getopnd(Test_env *, Test_op, bool); static void ptest_error(Test_env *, int, const char *); -static char *kill_fmt_entry(char *, size_t, unsigned int, const void *); +static void kill_fmt_entry(char *, size_t, unsigned int, const void *); static void p_time(struct shf *, bool, long, int, int, const char *, const char *); @@ -1307,7 +1307,7 @@ c_fgbg(const char **wp) #endif /* format a single kill item */ -static char * +static void kill_fmt_entry(char *buf, size_t buflen, unsigned int i, const void *arg) { const struct kill_info *ki = (const struct kill_info *)arg; @@ -1317,7 +1317,6 @@ kill_fmt_entry(char *buf, size_t buflen, unsigned int i, const void *arg) ki->num_width, i, ki->name_width, sigtraps[i].name, sigtraps[i].mess); - return (buf); } int diff --git a/misc.c b/misc.c index fca40d6..0a3227b 100644 --- a/misc.c +++ b/misc.c @@ -30,7 +30,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.233 2015/07/05 14:33:21 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.234 2015/07/05 14:43:07 tg Exp $"); #define KSH_CHVT_FLAG #ifdef MKSH_SMALL @@ -173,11 +173,11 @@ struct options_info { int opts[NELEM(options)]; }; -static char *options_fmt_entry(char *, size_t, unsigned int, const void *); +static void options_fmt_entry(char *, size_t, unsigned int, const void *); static void printoptions(bool); /* format a single select menu item */ -static char * +static void options_fmt_entry(char *buf, size_t buflen, unsigned int i, const void *arg) { const struct options_info *oi = (const struct options_info *)arg; @@ -185,7 +185,6 @@ options_fmt_entry(char *buf, size_t buflen, unsigned int i, const void *arg) shf_snprintf(buf, buflen, "%-*s %s", oi->opt_width, OFN(oi->opts[i]), Flag(oi->opts[i]) ? "on" : "off"); - return (buf); } static void @@ -1227,7 +1226,7 @@ print_value_quoted(struct shf *shf, const char *s) */ void print_columns(struct shf *shf, unsigned int n, - char *(*func)(char *, size_t, unsigned int, const void *), + void (*func)(char *, size_t, unsigned int, const void *), const void *arg, size_t max_oct, size_t max_colz, bool prefcol) { unsigned int i, r, c, rows, cols, nspace, max_col; @@ -1264,9 +1263,11 @@ print_columns(struct shf *shf, unsigned int n, /* if we can only print one column anyway, skip the goo */ if (cols < 2) { - for (i = 0; i < n; ++i) - shf_fprintf(shf, "%s\n", - (*func)(str, max_oct, i, arg)); + for (i = 0; i < n; ++i) { + (*func)(str, max_oct, i, arg); + shf_puts(str, shf); + shf_putc('\n', shf); + } goto out; } @@ -1284,8 +1285,8 @@ print_columns(struct shf *shf, unsigned int n, for (c = 0; c < cols; c++) { i = c * rows + r; if (i < n) { - shf_fprintf(shf, "%*s", max_col, - (*func)(str, max_oct, i, arg)); + (*func)(str, max_oct, i, arg); + shf_fprintf(shf, "%*s", max_col, str); if (i + rows < n) shf_fprintf(shf, "%*s", nspace, null); } diff --git a/sh.h b/sh.h index 131dea6..5ab4d16 100644 --- a/sh.h +++ b/sh.h @@ -169,7 +169,7 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.731 2015/06/28 16:23:24 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.732 2015/07/05 14:43:08 tg Exp $"); #endif #define MKSH_VERSION "R51 2015/06/28" @@ -1894,7 +1894,7 @@ int ksh_getopt(const char **, Getopt *, const char *); void print_value_quoted(struct shf *, const char *); char *quote_value(const char *); void print_columns(struct shf *, unsigned int, - char *(*)(char *, size_t, unsigned int, const void *), + void (*)(char *, size_t, unsigned int, const void *), const void *, size_t, size_t, bool); void strip_nuls(char *, size_t) MKSH_A_BOUNDED(__string__, 1, 2);