summaryrefslogtreecommitdiff
path: root/usr.bin/sort/sort.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-01-26 00:02:26 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-01-26 00:02:26 +0000
commit73ffb493165b21f21c676c41810a95284bd3669b (patch)
tree97ea035b5d3c6a5a656498d50c77136da6262032 /usr.bin/sort/sort.c
parentc34517b5762e139dcbb1bbb97dc79e82c733338e (diff)
for implied stdin, do not corrupt argv[0]
Diffstat (limited to 'usr.bin/sort/sort.c')
-rw-r--r--usr.bin/sort/sort.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c
index 1e5e22baaaf..1df1d5f8688 100644
--- a/usr.bin/sort/sort.c
+++ b/usr.bin/sort/sort.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sort.c,v 1.2 1997/01/22 06:53:16 millert Exp $ */
+/* $OpenBSD: sort.c,v 1.3 1997/01/26 00:02:25 deraadt Exp $ */
/*-
* Copyright (c) 1993
@@ -46,7 +46,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)sort.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: sort.c,v 1.2 1997/01/22 06:53:16 millert Exp $";
+static char rcsid[] = "$OpenBSD: sort.c,v 1.3 1997/01/26 00:02:25 deraadt Exp $";
#endif
#endif /* not lint */
@@ -217,9 +217,15 @@ main(argc, argv)
settables(fldtab[0].flags);
num_init();
fldtab->weights = gweights;
- if (optind == argc)
- argv[--optind] = devstdin;
- filelist.names = argv+optind;
+ if (optind == argc) {
+ static char *names[2];
+
+ names[0] = devstdin;
+ names[1] = NULL;
+ filelist.names = names;
+ optind--;
+ } else
+ filelist.names = argv+optind;
if (SINGL_FLD)
get = makeline;
else