summaryrefslogtreecommitdiff
path: root/bin/csh/func.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-12-16 17:46:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-12-16 17:46:07 +0000
commit1cbd9c3b064373014ca5055ceff6f2e1611d4b1f (patch)
treea4664d71def5af74c59ee8ed95bfee4590db4b54 /bin/csh/func.c
parentc3b1d5632df83e1754768d92a6f9247af9ecf581 (diff)
fix built-in printf argument expansion (ie. printf '%d\n' `echo 23`);
gjm11@dpmms.cam.ac.uk
Diffstat (limited to 'bin/csh/func.c')
-rw-r--r--bin/csh/func.c17
1 files changed, 15 insertions, 2 deletions
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);