From 1cbd9c3b064373014ca5055ceff6f2e1611d4b1f Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 16 Dec 1998 17:46:07 +0000 Subject: fix built-in printf argument expansion (ie. printf '%d\n' `echo 23`); gjm11@dpmms.cam.ac.uk --- bin/csh/func.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'bin/csh/func.c') diff --git a/bin/csh/func.c b/bin/csh/func.c index 0b356bbdd2e..4d79a8ca2ee 100644 --- a/bin/csh/func.c +++ b/bin/csh/func.c @@ -1,4 +1,4 @@ -/* $OpenBSD: func.c,v 1.7 1997/11/15 21:51:30 todd Exp $ */ +/* $OpenBSD: func.c,v 1.8 1998/12/16 17:46:06 deraadt Exp $ */ /* $NetBSD: func.c,v 1.11 1996/02/09 02:28:29 christos Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)func.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: func.c,v 1.7 1997/11/15 21:51:30 todd Exp $"; +static char rcsid[] = "$OpenBSD: func.c,v 1.8 1998/12/16 17:46:06 deraadt Exp $"; #endif #endif /* not lint */ @@ -1512,10 +1512,23 @@ doprintf(v, t) Char **v; struct command *t; { + Char **newv; char **c; extern int progprintf __P((int, char **)); int ret; + gflag = 0; + tglob(v); + if (gflag) { + newv = globall(v); + if (newv == 0) { + stderror(ERR_NAME | ERR_NOMATCH); + return; + } + v = newv; + gargv=0; + } + ret = progprintf(blklen(v), c = short2blk(v)); (void) fflush(cshout); (void) fflush(csherr); -- cgit v1.2.3