From 377dbe464af53818d863135d9ac90ffb743eb839 Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 10 Mar 2007 18:16:28 +0000 Subject: [PATCH] some gcc 4.1.2pre warning shutup --- edit.c | 17 +++++++++-------- funcs.c | 4 +--- jobs.c | 5 +---- sh.h | 11 +++++++---- shf.c | 6 +++--- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/edit.c b/edit.c index 1e7a1e7..2c874a7 100644 --- a/edit.c +++ b/edit.c @@ -5,7 +5,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.86 2007/03/10 00:36:44 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.87 2007/03/10 18:16:26 tg Exp $"); /* tty driver characters we are interested in */ typedef struct { @@ -1511,11 +1511,11 @@ x_insert(int c) if (Flag(FUTFHACK)) { if (((c & 0xC0) == 0x80) && left) { str[pos++] = c; - left--; - if (!left) { + if (!--left) { str[pos] = '\0'; x_arg = save_arg; - goto x_insert_write; + while (x_arg--) + x_ins(str); } return (KSTD); } @@ -1526,24 +1526,25 @@ x_insert(int c) while (save_arg--) x_ins(str); } - left = 0; } if ((c >= 0xC2) && (c < 0xE0)) left = 1; else if ((c >= 0xE0) && (c < 0xF0)) left = 2; + else if (c > 0x7F) + goto invmbs; + else + left = 0; if (left) { save_arg = x_arg; pos = 1; str[0] = c; return (KSTD); - } else if (c > 0x7F) - goto invmbs; + } } left = 0; str[0] = c; str[1] = '\0'; - x_insert_write: while (x_arg--) x_ins(str); return KSTD; diff --git a/funcs.c b/funcs.c index 900cc81..d166112 100644 --- a/funcs.c +++ b/funcs.c @@ -5,7 +5,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.48 2007/03/04 03:04:25 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.49 2007/03/10 18:16:26 tg Exp $"); int c_cd(const char **wp) @@ -1917,7 +1917,6 @@ c_exitreturn(const char **wp) quitenv(NULL); /* get rid of any i/o redirections */ unwind(how); /* NOTREACHED */ - return 0; } int @@ -2095,7 +2094,6 @@ timex(struct op *t, int f) struct rusage ru0, ru1, cru0, cru1; struct timeval usrtime, systime, tv0, tv1; int tf = 0; - extern struct timeval j_usrtime, j_systime; /* computed by j_wait */ char opts[1]; gettimeofday(&tv0, NULL); diff --git a/jobs.c b/jobs.c index 8f1f94f..bb2663e 100644 --- a/jobs.c +++ b/jobs.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.19 2007/03/04 03:04:25 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.20 2007/03/10 18:16:27 tg Exp $"); /* Order important! */ #define PRUNNING 0 @@ -83,9 +83,6 @@ static const char *const lookup_msgs[] = { NULL }; -/* user and system time of last j_waitjed job */ -struct timeval j_systime, j_usrtime; - static Job *job_list; /* job list */ static Job *last_job; static Job *async_job; diff --git a/sh.h b/sh.h index b725d1e..bf5e889 100644 --- a/sh.h +++ b/sh.h @@ -8,7 +8,7 @@ /* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */ /* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */ -#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.119 2007/03/10 00:42:00 tg Exp $" +#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.120 2007/03/10 18:16:27 tg Exp $" #define MKSH_VERSION "R29 2007/03/10" #if HAVE_SYS_PARAM_H @@ -373,7 +373,7 @@ EXTERN struct env { struct option { const char *name; /* long name of option */ char c; /* character flag (if any) */ - short flags; /* OF_* */ + unsigned char flags; /* OF_* */ }; extern const struct option options[]; @@ -1061,8 +1061,6 @@ struct source { struct tbl *tblp; /* alias (SALIAS) */ char *freeme; /* also for SREREAD */ } u; - char ugbuf[2]; /* buffer for ungetsc() (SREREAD) and - * alias (SALIAS) */ int line; /* line number */ int errline; /* line the error occurred on (0 if not set) */ const char *file; /* input file name */ @@ -1070,6 +1068,8 @@ struct source { Area *areap; XString xs; /* input buffer */ Source *next; /* stacked source */ + char ugbuf[2]; /* buffer for ungetsc() (SREREAD) and + * alias (SALIAS) */ }; /* Source.type values */ @@ -1169,6 +1169,9 @@ EXTERN char **history; /* saved commands */ EXTERN char **histptr; /* last history item */ EXTERN int histsize; /* history size */ +/* user and system time of last j_waitjed job */ +EXTERN struct timeval j_usrtime, j_systime; + /* alloc.c */ Area *ainit(Area *); void afreeall(Area *); diff --git a/shf.c b/shf.c index 7d65d2e..e201256 100644 --- a/shf.c +++ b/shf.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.12 2007/03/04 03:04:27 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.13 2007/03/10 18:16:28 tg Exp $"); /* flags to shf_emptybuf() */ #define EB_READSW 0x01 /* about to switch to reading */ @@ -829,8 +829,8 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args) switch (c) { case 'p': /* pointer */ flags &= ~(FL_LONG | FL_SHORT); - if (sizeof(char *) > sizeof(int)) - flags |= FL_LONG; /* hope it fits.. */ + flags |= (sizeof(char *) > sizeof(int)) ? + /* hope it fits.. */ FL_LONG : 0; /* aaahhh... */ case 'd': case 'i':