Date: Sun, 29 Jun 2014 18:54:42 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r268019 - stable/10/usr.bin/sed Message-ID: <201406291854.s5TIsgeu077034@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Sun Jun 29 18:54:41 2014 New Revision: 268019 URL: http://svnweb.freebsd.org/changeset/base/268019 Log: MFC r267692, r267703: Add -u (unbuffered output) after GNU sed. Obtained from: NetBSD Modified: stable/10/usr.bin/sed/main.c stable/10/usr.bin/sed/sed.1 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/sed/main.c ============================================================================== --- stable/10/usr.bin/sed/main.c Sun Jun 29 18:53:15 2014 (r268018) +++ stable/10/usr.bin/sed/main.c Sun Jun 29 18:54:41 2014 (r268019) @@ -132,7 +132,7 @@ main(int argc, char *argv[]) fflag = 0; inplace = NULL; - while ((c = getopt(argc, argv, "EI:ae:f:i:lnr")) != -1) + while ((c = getopt(argc, argv, "EI:ae:f:i:lnru")) != -1) switch (c) { case 'r': /* Gnu sed compat */ case 'E': @@ -162,12 +162,16 @@ main(int argc, char *argv[]) ispan = 0; /* don't span across input files */ break; case 'l': - if(setlinebuf(stdout) != 0) - warnx("setlinebuf() failed"); + if(setvbuf(stdout, NULL, _IOLBF, 0) != 0) + warnx("setting line buffered output failed"); break; case 'n': nflag = 1; break; + case 'u': + if(setvbuf(stdout, NULL, _IONBF, 0) != 0) + warnx("setting unbuffered output failed"); + break; default: case '?': usage(); @@ -199,9 +203,10 @@ main(int argc, char *argv[]) static void usage(void) { - (void)fprintf(stderr, "%s\n%s\n", - "usage: sed script [-Ealn] [-i extension] [file ...]", - " sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]"); + (void)fprintf(stderr, + "usage: %s script [-Ealnru] [-i[<extension>]] [file ...]\n" + "\t%s [-Ealnu] [-i[<extension>]] [-e script] ... [-f script_file]" + " ... [file ...]\n", getprogname(), getprogname()); exit(1); } Modified: stable/10/usr.bin/sed/sed.1 ============================================================================== --- stable/10/usr.bin/sed/sed.1 Sun Jun 29 18:53:15 2014 (r268018) +++ stable/10/usr.bin/sed/sed.1 Sun Jun 29 18:54:41 2014 (r268019) @@ -31,7 +31,7 @@ .\" @(#)sed.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd December 9, 2013 +.Dd June 20, 2014 .Dt SED 1 .Os .Sh NAME @@ -39,7 +39,7 @@ .Nd stream editor .Sh SYNOPSIS .Nm -.Op Fl Ealnr +.Op Fl Ealnru .Ar command .Op Ar .Nm @@ -148,6 +148,8 @@ option suppresses this behavior. Same as .Fl E for compatibility with GNU sed. +.It Fl u +Make output unbuffered. .El .Pp The form of a
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406291854.s5TIsgeu077034>