diff --git a/Build.sh b/Build.sh index d5884be..1468c7f 100644 --- a/Build.sh +++ b/Build.sh @@ -1,9 +1,9 @@ #!/bin/sh -srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.689 2015/07/10 17:16:23 tg Exp $' +srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.690 2015/09/05 19:18:59 tg Exp $' #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013, 2014, 2015 -# Thorsten “mirabilos” Glaser +# mirabilos # # Provided that these terms and disclaimer and all copyright notices # are retained or reproduced in an accompanying document, permission @@ -2414,7 +2414,7 @@ cat >test.sh <<-EOF args[\${#args[*]}]=\$TMPDIR fi print Testing mksh for conformance: - fgrep -e MirOS: -e MIRBSD "\$sflag" + fgrep -e Mir''OS: -e MIRBSD "\$sflag" print "This shell is actually:\\n\\t\$KSH_VERSION" print 'test.sh built for mksh $dstversion' cstr='\$os = defined \$^O ? \$^O : "unknown";' diff --git a/Makefile b/Makefile index db6e767..993fe5f 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ -# $MirOS: src/bin/mksh/Makefile,v 1.142 2015/07/09 20:52:36 tg Exp $ +# $MirOS: src/bin/mksh/Makefile,v 1.143 2015/09/05 19:19:00 tg Exp $ #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012, 2013, 2014, 2015 -# Thorsten “mirabilos” Glaser +# mirabilos # # Provided that these terms and disclaimer and all copyright notices # are retained or reproduced in an accompanying document, permission @@ -154,7 +154,7 @@ cats: ${MANALL} ${MANALL:S/.cat/.ps/} .endif .for _m _n in mksh 1 x=$$(ident ${SRCDIR:Q}/${_m}.${_n} | \ - awk '/MirOS:/ { print $$4$$5; }' | \ + awk '/Mir''OS:/ { print $$4$$5; }' | \ tr -dc 0-9); (( $${#x} == 14 )) || exit 1; exec \ ${MKSH} ${BSDSRCDIR:Q}/contrib/hosted/tg/ps2pdfmir -c \ -o ${_m}.${_n}.pdf '[' /Author '(The MirOS Project)' \ diff --git a/check.pl b/check.pl index 4417f82..fd9fa0f 100644 --- a/check.pl +++ b/check.pl @@ -1,9 +1,9 @@ -# $MirOS: src/bin/mksh/check.pl,v 1.40 2015/07/10 19:36:31 tg Exp $ +# $MirOS: src/bin/mksh/check.pl,v 1.41 2015/09/05 19:19:01 tg Exp $ # $OpenBSD: th,v 1.1 2013/12/02 20:39:44 millert Exp $ #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, # 2012, 2013, 2014, 2015 -# Thorsten Glaser +# mirabilos # # Provided that these terms and disclaimer and all copyright notices # are retained or reproduced in an accompanying document, permission diff --git a/edit.c b/edit.c index 4578647..a836c43 100644 --- a/edit.c +++ b/edit.c @@ -1,12 +1,12 @@ -/* $OpenBSD: edit.c,v 1.40 2015/03/12 10:20:30 sthen Exp $ */ +/* $OpenBSD: edit.c,v 1.41 2015/09/01 13:12:31 tedu Exp $ */ /* $OpenBSD: edit.h,v 1.9 2011/05/30 17:14:35 martynas Exp $ */ -/* $OpenBSD: emacs.c,v 1.50 2015/03/25 12:10:52 jca Exp $ */ -/* $OpenBSD: vi.c,v 1.28 2013/12/18 16:45:46 deraadt Exp $ */ +/* $OpenBSD: emacs.c,v 1.51 2015/09/01 13:12:31 tedu Exp $ */ +/* $OpenBSD: vi.c,v 1.29 2015/09/01 13:12:31 tedu Exp $ */ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, - * 2011, 2012, 2013, 2014 - * Thorsten Glaser + * 2011, 2012, 2013, 2014, 2015 + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -28,7 +28,7 @@ #ifndef MKSH_NO_CMDLINE_EDITING -__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.290 2015/07/10 19:36:34 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.291 2015/09/05 19:19:01 tg Exp $"); /* * in later versions we might use libtermcap for this, but since external @@ -2262,12 +2262,8 @@ x_kill(int c MKSH_A_UNUSED) static void x_push(int nchars) { - char *cp; - - strndupx(cp, xcp, nchars, AEDIT); - if (killstack[killsp]) - afree(killstack[killsp], AEDIT); - killstack[killsp] = cp; + afree(killstack[killsp], AEDIT); + strndupx(killstack[killsp], xcp, nchars, AEDIT); killsp = (killsp + 1) % KILLSIZE; } diff --git a/eval.c b/eval.c index 0b585bc..1956e32 100644 --- a/eval.c +++ b/eval.c @@ -3,7 +3,7 @@ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, * 2011, 2012, 2013, 2014, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.170 2015/07/06 17:45:33 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.171 2015/09/05 19:19:02 tg Exp $"); /* * string expansion diff --git a/exec.c b/exec.c index 276da83..9297d6b 100644 --- a/exec.c +++ b/exec.c @@ -3,7 +3,7 @@ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, * 2011, 2012, 2013, 2014, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.161 2015/09/05 17:20:18 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.162 2015/09/05 19:19:03 tg Exp $"); #ifndef MKSH_DEFAULT_EXECSHELL #define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh" diff --git a/expr.c b/expr.c index ef544df..a883906 100644 --- a/expr.c +++ b/expr.c @@ -3,7 +3,7 @@ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, * 2011, 2012, 2013, 2014 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.77 2014/12/15 23:26:36 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.78 2015/09/05 19:19:03 tg Exp $"); /* the order of these enums is constrained by the order of opinfo[] */ enum token { diff --git a/funcs.c b/funcs.c index a408bb0..1c021f8 100644 --- a/funcs.c +++ b/funcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_ksh.c,v 1.34 2013/12/17 16:37:05 deraadt Exp $ */ +/* $OpenBSD: c_ksh.c,v 1.35 2015/09/01 13:12:31 tedu Exp $ */ /* $OpenBSD: c_sh.c,v 1.46 2015/07/20 20:46:24 guenther Exp $ */ /* $OpenBSD: c_test.c,v 1.18 2009/03/01 20:11:06 otto Exp $ */ /* $OpenBSD: c_ulimit.c,v 1.19 2013/11/28 10:33:37 sobrado Exp $ */ @@ -6,7 +6,7 @@ /*- * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, * 2010, 2011, 2012, 2013, 2014, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -38,7 +38,7 @@ #endif #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.282 2015/08/13 21:38:17 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.283 2015/09/05 19:19:04 tg Exp $"); #if HAVE_KILLPG /* diff --git a/histrap.c b/histrap.c index 7a96aa8..8b5cc9a 100644 --- a/histrap.c +++ b/histrap.c @@ -1,10 +1,10 @@ -/* $OpenBSD: history.c,v 1.40 2014/11/20 15:22:39 tedu Exp $ */ +/* $OpenBSD: history.c,v 1.41 2015/09/01 13:12:31 tedu Exp $ */ /* $OpenBSD: trap.c,v 1.23 2010/05/19 17:36:08 jasper Exp $ */ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, * 2011, 2012, 2014, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -27,7 +27,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.149 2015/07/09 20:52:40 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.150 2015/09/05 19:19:05 tg Exp $"); Trap sigtraps[ksh_NSIG + 1]; static struct sigaction Sigact_ign; @@ -898,8 +898,7 @@ histload(Source *s, unsigned char *base, size_t bytes) if (lno >= s->line - (histptr - history) && lno <= s->line) { hp = &histptr[lno - s->line]; - if (*hp) - afree(*hp, APERM); + afree(*hp, APERM); strdupx(*hp, (char *)(base + 4), APERM); } } else { @@ -1376,8 +1375,7 @@ settrap(Trap *p, const char *s) { sig_t f; - if (p->trap) - afree(p->trap, APERM); + afree(p->trap, APERM); /* handles s == NULL */ strdupx(p->trap, s, APERM); p->flags |= TF_CHANGED; diff --git a/jobs.c b/jobs.c index ce66813..919a88b 100644 --- a/jobs.c +++ b/jobs.c @@ -3,7 +3,7 @@ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, * 2012, 2013, 2014, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.114 2015/09/05 17:20:19 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.115 2015/09/05 19:19:05 tg Exp $"); #if HAVE_KILLPG #define mksh_killpg killpg diff --git a/lalloc.c b/lalloc.c index f943365..32bed3c 100644 --- a/lalloc.c +++ b/lalloc.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2009, 2010, 2011, 2013, 2014 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -20,7 +20,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/lalloc.c,v 1.21 2014/11/25 20:00:39 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/lalloc.c,v 1.22 2015/09/05 19:19:06 tg Exp $"); /* build with CPPFLAGS+= -DUSE_REALLOC_MALLOC=0 on ancient systems */ #if defined(USE_REALLOC_MALLOC) && (USE_REALLOC_MALLOC == 0) diff --git a/lex.c b/lex.c index f5f38f7..cd7b0b4 100644 --- a/lex.c +++ b/lex.c @@ -3,7 +3,7 @@ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, * 2011, 2012, 2013, 2014, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.205 2015/08/13 21:04:12 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.206 2015/09/05 19:19:06 tg Exp $"); /* * states while lexing word diff --git a/lksh.1 b/lksh.1 index a13d7a0..2c65121 100644 --- a/lksh.1 +++ b/lksh.1 @@ -1,7 +1,7 @@ -.\" $MirOS: src/bin/mksh/lksh.1,v 1.10 2015/04/12 22:32:12 tg Exp $ +.\" $MirOS: src/bin/mksh/lksh.1,v 1.11 2015/09/05 19:19:06 tg Exp $ .\"- .\" Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015 -.\" Thorsten “mirabilos” Glaser +.\" mirabilos .\" .\" Provided that these terms and disclaimer and all copyright notices .\" are retained or reproduced in an accompanying document, permission @@ -72,7 +72,7 @@ .\" with -mandoc, it might implement .Mx itself, but we want to .\" use our own definition. And .Dd must come *first*, always. .\" -.Dd $Mdocdate: April 12 2015 $ +.Dd $Mdocdate: September 5 2015 $ .\" .\" Check which macro package we use, and do other -mdoc setup. .\" diff --git a/main.c b/main.c index dad2619..572c732 100644 --- a/main.c +++ b/main.c @@ -1,12 +1,12 @@ -/* $OpenBSD: main.c,v 1.55 2015/02/09 09:09:30 jsg Exp $ */ +/* $OpenBSD: main.c,v 1.56 2015/09/01 17:46:31 tedu Exp $ */ /* $OpenBSD: tty.c,v 1.10 2014/08/10 02:44:26 guenther Exp $ */ /* $OpenBSD: io.c,v 1.25 2014/08/11 20:28:47 guenther Exp $ */ -/* $OpenBSD: table.c,v 1.15 2012/02/19 07:52:30 otto Exp $ */ +/* $OpenBSD: table.c,v 1.16 2015/09/01 13:12:31 tedu Exp $ */ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, * 2011, 2012, 2013, 2014, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -34,7 +34,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.301 2015/08/13 22:06:22 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.302 2015/09/05 19:19:06 tg Exp $"); extern char **environ; @@ -202,7 +202,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp) /* do things like getpgrp() et al. */ chvt_reinit(); - /* make sure argv[] is sane */ + /* make sure argv[] is sane, for weird OSes */ if (!*argv) { argv = empty_argv; argc = 1; diff --git a/mirhash.h b/mirhash.h index df4a9dc..7836aee 100644 --- a/mirhash.h +++ b/mirhash.h @@ -1,6 +1,6 @@ /*- * Copyright © 2011, 2014, 2015 - * Thorsten “mirabilos” Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -44,7 +44,7 @@ #include -__RCSID("$MirOS: src/bin/mksh/mirhash.h,v 1.4 2015/05/30 22:14:06 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/mirhash.h,v 1.5 2015/09/05 19:19:07 tg Exp $"); /*- * BAFH itself is defined by the following primitives: diff --git a/misc.c b/misc.c index deb95c3..f0924df 100644 --- a/misc.c +++ b/misc.c @@ -1,10 +1,10 @@ /* $OpenBSD: misc.c,v 1.40 2015/03/18 15:12:36 tedu Exp $ */ -/* $OpenBSD: path.c,v 1.12 2005/03/30 17:16:37 deraadt Exp $ */ +/* $OpenBSD: path.c,v 1.13 2015/09/05 09:47:08 jsg Exp $ */ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, * 2011, 2012, 2013, 2014, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -30,7 +30,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.238 2015/07/10 19:36:36 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.239 2015/09/05 19:19:07 tg Exp $"); #define KSH_CHVT_FLAG #ifdef MKSH_SMALL @@ -1570,16 +1570,14 @@ do_realpath(const char *upath) } /* return target path */ - if (ldest != NULL) - afree(ldest, ATEMP); + afree(ldest, ATEMP); afree(ipath, ATEMP); return (Xclose(xs, xp)); notfound: /* save; freeing memory might trash it */ llen = errno; - if (ldest != NULL) - afree(ldest, ATEMP); + afree(ldest, ATEMP); afree(ipath, ATEMP); Xfree(xs, xp); errno = llen; diff --git a/mksh.1 b/mksh.1 index 5734081..60b6e09 100644 --- a/mksh.1 +++ b/mksh.1 @@ -1,9 +1,9 @@ -.\" $MirOS: src/bin/mksh/mksh.1,v 1.379 2015/08/13 22:09:10 tg Exp $ +.\" $MirOS: src/bin/mksh/mksh.1,v 1.380 2015/09/05 19:19:08 tg Exp $ .\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $ .\"- .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, .\" 2010, 2011, 2012, 2013, 2014, 2015 -.\" Thorsten “mirabilos” Glaser +.\" mirabilos .\" .\" Provided that these terms and disclaimer and all copyright notices .\" are retained or reproduced in an accompanying document, permission @@ -74,7 +74,7 @@ .\" with -mandoc, it might implement .Mx itself, but we want to .\" use our own definition. And .Dd must come *first*, always. .\" -.Dd $Mdocdate: August 13 2015 $ +.Dd $Mdocdate: September 5 2015 $ .\" .\" Check which macro package we use, and do other -mdoc setup. .\" @@ -6394,7 +6394,7 @@ contains the system and suid profile. .An -nosplit .Nm "The MirBSD Korn Shell" is developed by -.An Thorsten Glaser Aq tg@mirbsd.org +.An mirabilos Aq tg@mirbsd.org and currently maintained as part of The MirOS Project. This shell is based on the public domain 7th edition Bourne shell clone by .An Charles Forsyth , @@ -6427,10 +6427,11 @@ The complete legalese is at: .Pa https://www.mirbsd.org/TaC\-mksh.txt .\" .\" This boils down to: feel free to use mksh.ico as application icon -.\" or shortcut for mksh or mksh/Win32; distro patches are ok (but we -.\" request they amend $KSH_VERSION when modifying mksh). Authors are -.\" Marshall Kirk McKusick (UCB), Rick Collette (ekkoBSD), Thorsten -.\" Glaser, Benny Siegert (MirBSD), Michael Langguth (mksh/Win32). +.\" or shortcut for mksh or mksh/Win32 or OS/2; distro patches are ok +.\" (but we request they amend $KSH_VERSION when modifying mksh). +.\" Authors are Marshall Kirk McKusick (UCB), Rick Collette (ekkoBSD), +.\" mirabilos, Benny Siegert (MirBSD), Michael Langguth (mksh/Win32), +.\" KO Myung-Hun (mksh for OS/2). .\" .\" As far as MirBSD is concerned, the files themselves are free .\" to modification and distribution under BSD/MirOS Licence, the diff --git a/sh.h b/sh.h index 27d5c0a..303756e 100644 --- a/sh.h +++ b/sh.h @@ -2,7 +2,7 @@ /* $OpenBSD: shf.h,v 1.6 2005/12/11 18:53:51 deraadt Exp $ */ /* $OpenBSD: table.h,v 1.8 2012/02/19 07:52:30 otto Exp $ */ /* $OpenBSD: tree.h,v 1.10 2005/03/28 21:28:22 deraadt Exp $ */ -/* $OpenBSD: expand.h,v 1.6 2005/03/30 17:16:37 deraadt Exp $ */ +/* $OpenBSD: expand.h,v 1.7 2015/09/01 13:12:31 tedu Exp $ */ /* $OpenBSD: lex.h,v 1.13 2013/03/03 19:11:34 guenther Exp $ */ /* $OpenBSD: proto.h,v 1.35 2013/09/04 15:49:19 millert Exp $ */ /* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */ @@ -11,7 +11,7 @@ /*- * Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, * 2011, 2012, 2013, 2014, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -172,7 +172,7 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.741 2015/08/13 22:06:23 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.742 2015/09/05 19:19:10 tg Exp $"); #endif #define MKSH_VERSION "R51 2015/08/13" diff --git a/shf.c b/shf.c index 1c9e3d5..433da75 100644 --- a/shf.c +++ b/shf.c @@ -3,7 +3,7 @@ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, * 2012, 2013, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -25,7 +25,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.66 2015/07/09 20:52:43 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.67 2015/09/05 19:19:11 tg Exp $"); /* flags to shf_emptybuf() */ #define EB_READSW 0x01 /* about to switch to reading */ diff --git a/strlcpy.c b/strlcpy.c index c0ebfd5..991e3ed 100644 --- a/strlcpy.c +++ b/strlcpy.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006, 2008, 2009, 2013 - * Thorsten Glaser + * mirabilos * Copyright (c) 1998 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any @@ -18,7 +18,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/strlcpy.c,v 1.8 2013/11/05 22:10:15 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/strlcpy.c,v 1.9 2015/09/05 19:19:11 tg Exp $"); /* * Copy src to string dst of size siz. At most siz-1 characters diff --git a/syn.c b/syn.c index 778476f..d567fff 100644 --- a/syn.c +++ b/syn.c @@ -1,9 +1,9 @@ -/* $OpenBSD: syn.c,v 1.29 2013/06/03 18:40:05 jca Exp $ */ +/* $OpenBSD: syn.c,v 1.30 2015/09/01 13:12:31 tedu Exp $ */ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, * 2011, 2012, 2013, 2014, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.102 2015/09/05 17:17:47 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.103 2015/09/05 19:19:11 tg Exp $"); struct nesting_state { int start_token; /* token than began nesting (eg, FOR) */ diff --git a/tree.c b/tree.c index 6a983a3..59dc7c6 100644 --- a/tree.c +++ b/tree.c @@ -1,9 +1,9 @@ -/* $OpenBSD: tree.c,v 1.20 2012/06/27 07:17:19 otto Exp $ */ +/* $OpenBSD: tree.c,v 1.21 2015/09/01 13:12:31 tedu Exp $ */ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, * 2011, 2012, 2013, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.74 2015/08/13 20:54:03 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.75 2015/09/05 19:19:11 tg Exp $"); #define INDENT 8 @@ -696,8 +696,7 @@ tfree(struct op *t, Area *ap) if (t == NULL) return; - if (t->str != NULL) - afree(t->str, ap); + afree(t->str, ap); if (t->vars != NULL) { for (w = t->vars; *w != NULL; w++) @@ -732,12 +731,9 @@ iofree(struct ioword **iow, Area *ap) iop = iow; while ((p = *iop++) != NULL) { - if (p->name != NULL) - afree(p->name, ap); - if (p->delim != NULL) - afree(p->delim, ap); - if (p->heredoc != NULL) - afree(p->heredoc, ap); + afree(p->name, ap); + afree(p->delim, ap); + afree(p->heredoc, ap); afree(p, ap); } afree(iow, ap); diff --git a/var.c b/var.c index 428192c..6c0165b 100644 --- a/var.c +++ b/var.c @@ -1,9 +1,9 @@ -/* $OpenBSD: var.c,v 1.41 2015/04/17 17:20:41 deraadt Exp $ */ +/* $OpenBSD: var.c,v 1.43 2015/09/01 13:12:31 tedu Exp $ */ /*- * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, * 2011, 2012, 2013, 2014, 2015 - * Thorsten Glaser + * mirabilos * * Provided that these terms and disclaimer and all copyright notices * are retained or reproduced in an accompanying document, permission @@ -28,7 +28,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/var.c,v 1.193 2015/07/10 19:36:38 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/var.c,v 1.194 2015/09/05 19:19:12 tg Exp $"); /*- * Variables @@ -710,8 +710,7 @@ exportprep(struct tbl *vp, const char *val) /* offset to value */ vp->type = xp - vp->val.s; memcpy(xp, val, vallen); - if (op != NULL) - afree(op, vp->areap); + afree(op, vp->areap); } /* @@ -949,8 +948,7 @@ typeset(const char *var, uint32_t set, uint32_t clr, int field, int base) t->type = 0; } } - if (free_me) - afree(free_me, t->areap); + afree(free_me, t->areap); } } if (!ok) @@ -976,8 +974,7 @@ typeset(const char *var, uint32_t set, uint32_t clr, int field, int base) /* setstr can't fail (readonly check already done) */ setstr(vp, val, KSH_RETURN_ERROR | 0x4); - if (tval != NULL) - afree(tval, ATEMP); + afree(tval, ATEMP); } /* only x[0] is ever exported, so use vpbase */ @@ -1260,18 +1257,15 @@ setspec(struct tbl *vp) ifs0 = *s; return; case V_PATH: - if (path) - afree(path, APERM); + afree(path, APERM); s = str_val(vp); strdupx(path, s, APERM); /* clear tracked aliases */ flushcom(true); return; case V_TMPDIR: - if (tmpdir) { - afree(tmpdir, APERM); - tmpdir = NULL; - } + afree(tmpdir, APERM); + tmpdir = NULL; /* * Use tmpdir iff it is an absolute path, is writable * and searchable and is a directory... @@ -1380,8 +1374,7 @@ unsetspec(struct tbl *vp) ifs0 = ' '; break; case V_PATH: - if (path) - afree(path, APERM); + afree(path, APERM); strdupx(path, def_path, APERM); /* clear tracked aliases */ flushcom(true);