summaryrefslogtreecommitdiff
path: root/usr.bin/sed/main.c
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2007-03-20 06:07:58 +0000
committerRay Lai <ray@cvs.openbsd.org>2007-03-20 06:07:58 +0000
commit061919b571196225aa964b3cdff1c5a56119e705 (patch)
tree1dd34ada51d99ede53ce7e34b9b48b41f1707059 /usr.bin/sed/main.c
parent05b91e4c37b38750901b5d92041b5c985bbb51d5 (diff)
Add line-buffering flag (-u).
OK deraadt@ and jmc@.
Diffstat (limited to 'usr.bin/sed/main.c')
-rw-r--r--usr.bin/sed/main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c
index 5479917fd71..75fcbbf5e76 100644
--- a/usr.bin/sed/main.c
+++ b/usr.bin/sed/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.10 2006/10/09 00:23:57 tedu Exp $ */
+/* $OpenBSD: main.c,v 1.11 2007/03/20 06:07:57 ray Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
@@ -38,7 +38,7 @@ static const char copyright[] =
"@(#) Copyright (c) 1992, 1993\n\
The Regents of the University of California. All rights reserved.\n";
/* from: static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/3/94"; */
-static const char rcsid[] = "$OpenBSD: main.c,v 1.10 2006/10/09 00:23:57 tedu Exp $";
+static const char rcsid[] = "$OpenBSD: main.c,v 1.11 2007/03/20 06:07:57 ray Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -104,7 +104,7 @@ main(int argc, char *argv[])
int c, fflag;
fflag = 0;
- while ((c = getopt(argc, argv, "ae:f:n")) != -1)
+ while ((c = getopt(argc, argv, "ae:f:nu")) != -1)
switch (c) {
case 'a':
aflag = 1;
@@ -120,10 +120,13 @@ main(int argc, char *argv[])
case 'n':
nflag = 1;
break;
+ case 'u':
+ setlinebuf(stdout);
+ break;
default:
case '?':
(void)fprintf(stderr,
-"usage:\tsed script [-an] [file ...]\n\tsed [-an] [-e script] ... [-f script_file] ... [file ...]\n");
+"usage:\tsed script [-anu] [file ...]\n\tsed [-anu] [-e script] ... [-f script_file] ... [file ...]\n");
exit(1);
}
argc -= optind;