From e49d7bc3c6444a4e84c62b514bc456452fca5b27 Mon Sep 17 00:00:00 2001 From: tg Date: Sun, 4 Jan 2015 21:08:10 +0000 Subject: [PATCH] better --- check.t | 6 +++--- funcs.c | 30 +++++++++++++++++++----------- sh.h | 4 ++-- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/check.t b/check.t index 51807e4..0a5c948 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.675 2015/01/04 20:23:51 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.676 2015/01/04 21:08:08 tg Exp $ # -*- mode: sh -*- #- # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, @@ -30,7 +30,7 @@ # (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date expected-stdout: - @(#)MIRBSD KSH R50 2015/01/02 + @(#)MIRBSD KSH R50 2015/01/04 description: Check version of shell. stdin: @@ -39,7 +39,7 @@ name: KSH_VERSION category: shell:legacy-no --- expected-stdout: - @(#)LEGACY KSH R50 2015/01/02 + @(#)LEGACY KSH R50 2015/01/04 description: Check version of legacy shell. stdin: diff --git a/funcs.c b/funcs.c index 6a7323b..825b9ca 100644 --- a/funcs.c +++ b/funcs.c @@ -5,7 +5,7 @@ /*- * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - * 2010, 2011, 2012, 2013, 2014 + * 2010, 2011, 2012, 2013, 2014, 2015 * Thorsten Glaser * * Provided that these terms and disclaimer and all copyright notices @@ -38,7 +38,7 @@ #endif #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.263 2015/01/04 20:37:59 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.264 2015/01/04 21:08:09 tg Exp $"); #if HAVE_KILLPG /* @@ -550,7 +550,7 @@ c_whence(const char **wp) if (vflag || (tp->type != CALIAS && tp->type != CEXEC && tp->type != CTALIAS)) shf_puts(id, shl_stdout); - if (vflag) + if (vflag) { switch (tp->type) { case CKEYWD: case CALIAS: @@ -559,11 +559,20 @@ c_whence(const char **wp) shf_puts(" is a", shl_stdout); break; } + switch (tp->type) { + case CKEYWD: + case CSHELL: + case CTALIAS: + case CEXEC: + shf_putc(' ', shl_stdout); + break; + } + } switch (tp->type) { case CKEYWD: if (vflag) - shf_puts(" reserved word", shl_stdout); + shf_puts("reserved word", shl_stdout); break; case CALIAS: if (vflag) @@ -590,15 +599,14 @@ c_whence(const char **wp) } break; case CSHELL: - if (vflag) - shprintf("%s %s %s", - (tp->flag & SPEC_BI) ? " special" : null, - "shell", Tbuiltin); + if (vflag) { + if (tp->flag & SPEC_BI) + shf_puts("special ", shl_stdout); + shprintf("%s %s", "shell", Tbuiltin); + } break; case CTALIAS: case CEXEC: - if (vflag) - shf_putc(' ', shl_stdout); if (tp->flag & ISSET) { if (vflag) { shf_puts("is ", shl_stdout); @@ -616,7 +624,7 @@ c_whence(const char **wp) } break; default: - shprintf("%s is *GOK*", id); + shf_puts(" is *GOK*", shl_stdout); break; } if (vflag || !rv) diff --git a/sh.h b/sh.h index 3adcdd2..ba890ec 100644 --- a/sh.h +++ b/sh.h @@ -169,9 +169,9 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.707 2015/01/02 13:21:28 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.708 2015/01/04 21:08:10 tg Exp $"); #endif -#define MKSH_VERSION "R50 2015/01/02" +#define MKSH_VERSION "R50 2015/01/04" /* arithmetic types: C implementation */ #if !HAVE_CAN_INTTYPES