FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 03-23-2009, 07:48 AM
Tiziano Müller
 
Default newins "-" for standard input?

Am Montag, den 23.03.2009, 09:22 +0100 schrieb Ulrich Mueller:
> Now that "dosed" is going to be banned, what would people think of
> "newins" (and the other "new*" commands) accepting "-" as the first
> argument? I don't know how many usage cases there are, but the
> following are obvious:
>
> sed 's/quux/quuux/' foo | newins - foo
>
> It would allow for here documents:
>
> newins - bar <<-EOF
> # configuration file (for example)
> EOF
>
> or even:
>
> newins - baz <<<$'# a short
# file'
>

I like it :-)
 
Old 03-23-2009, 10:35 AM
Nirbheek Chauhan
 
Default newins "-" for standard input?

On Mon, Mar 23, 2009 at 1:52 PM, Ulrich Mueller <ulm@gentoo.org> wrote:
> Now that "dosed" is going to be banned, what would people think of

I wouldn't call it banned, rather "useless" since everyone directly
uses sed instead.


--
~Nirbheek Chauhan
 
Old 03-23-2009, 01:24 PM
Ciaran McCreesh
 
Default newins "-" for standard input?

On Mon, 23 Mar 2009 09:22:06 +0100
Ulrich Mueller <ulm@gentoo.org> wrote:
> Now that "dosed" is going to be banned, what would people think of
> "newins" (and the other "new*" commands) accepting "-" as the first
> argument?

There's a slightly different variation in exheres-0: as well as do* and
new*, there's also here*, which you use like this:

hereins foo <<'END'
stuff
END

It magically barfs, rather than hanging indefinitely, if you forget to
give it some input.

The rationale for giving it a new name rather than overloading an
existing one is that some of the existing do* utilities don't take just
a single simple filename, so overloading would make the command line
somewhat convoluted.

--
Ciaran McCreesh
 
Old 03-23-2009, 02:41 PM
Ulrich Mueller
 
Default newins "-" for standard input?

>>>>> On Mon, 23 Mar 2009, Ciaran McCreesh wrote:

>> Now that "dosed" is going to be banned, what would people think of
>> "newins" (and the other "new*" commands) accepting "-" as the first
>> argument?

> There's a slightly different variation in exheres-0: as well as do*
> and new*, there's also here*, which you use like this:

> hereins foo <<'END'
> stuff
> END

Why would we need a new command for this? The minus sign denoting
standard input is fairly common with other utilities.

> It magically barfs, rather than hanging indefinitely, if you forget
> to give it some input.

I guess the same could be done for "newins -", if you think that it is
necessary (test for stdin being a terminal?). But I don't really see
the point of it, since such a mistake would be noticed immediately
when testing the ebuild.

> The rationale for giving it a new name rather than overloading an
> existing one is that some of the existing do* utilities don't take
> just a single simple filename, so overloading would make the command
> line somewhat convoluted.

It doesn't make much sense to specify "-" as an argument for "do*",
because the command would not know under which name the file should be
installed. OTOH, all "new*" commands have exactly two arguments, so we
could allow "-" for the first argument.

Ulrich
 
Old 03-23-2009, 03:11 PM
Timothy Redaelli
 
Default newins "-" for standard input?

On Monday 23 March 2009 09:22:06 Ulrich Mueller wrote:
> Now that "dosed" is going to be banned, what would people think of
> "newins" (and the other "new*" commands) accepting "-" as the first
> argument? I don't know how many usage cases there are, but the
> following are obvious:
>
> sed 's/quux/quuux/' foo | newins - foo
>
> It would allow for here documents:
>
> newins - bar <<-EOF
> # configuration file (for example)
> EOF
>
> or even:
>
> newins - baz <<<$'# a short
# file'

Why can't you use "newins /dev/stdin foo" that it works out of the box?

--
Timothy `Drizzt` Redaelli
FreeSBIE Developer, Gentoo Developer, GUFI Staff
There are two major products that come out of Berkeley: LSD and UNIX.
We don't believe this to be a coincidence. -- Jeremy S. Anderson
 
Old 03-23-2009, 03:24 PM
Michael Haubenwallner
 
Default newins "-" for standard input?

On Mon, 2009-03-23 at 17:11 +0100, Timothy Redaelli wrote:
> On Monday 23 March 2009 09:22:06 Ulrich Mueller wrote:

> >
> > newins - baz <<<$'# a short
# file'
>
> Why can't you use "newins /dev/stdin foo" that it works out of the box?

Nope, /dev/stdin isn't portable.

While Linux and Solaris have it, AIX and HP-UX do not
provide /dev/stdin. Unsure about Interix and MacOSX.

Using '-' sounds familiar for me too.

/haubi/
 
Old 03-23-2009, 04:01 PM
Alec Warner
 
Default newins "-" for standard input?

On Mon, Mar 23, 2009 at 8:41 AM, Ulrich Mueller <ulm@gentoo.org> wrote:
>>>>>> On Mon, 23 Mar 2009, Ciaran McCreesh wrote:
>
>>> Now that "dosed" is going to be banned, what would people think of
>>> "newins" (and the other "new*" commands) accepting "-" as the first
>>> argument?
>
>> There's a slightly different variation in exheres-0: as well as do*
>> and new*, there's also here*, which you use like this:
>
>> hereins foo <<'END'
>> stuff
>> END
>
> Why would we need a new command for this? The minus sign denoting
> standard input is fairly common with other utilities.
>
>> It magically barfs, rather than hanging indefinitely, if you forget
>> to give it some input.
>
> I guess the same could be done for "newins -", if you think that it is
> necessary (test for stdin being a terminal?). But I don't really see
> the point of it, since such a mistake would be noticed immediately
> when testing the ebuild.

No, they aren't 'noticed immediately'. The ebuild hangs and then the
author spends 10 minutes trying to figure out why. If its trivial to
implement..I don't see a downside to such a feature.

>
>> The rationale for giving it a new name rather than overloading an
>> existing one is that some of the existing do* utilities don't take
>> just a single simple filename, so overloading would make the command
>> line somewhat convoluted.
>
> It doesn't make much sense to specify "-" as an argument for "do*",
> because the command would not know under which name the file should be
> installed. OTOH, all "new*" commands have exactly two arguments, so we
> could allow "-" for the first argument.
>
> Ulrich
>
>
 
Old 03-24-2009, 05:55 AM
Ulrich Mueller
 
Default newins "-" for standard input?

>>>>> On Mon, 23 Mar 2009, Tiziano Müller wrote:

>> what would people think of "newins" (and the other "new*" commands)
>> accepting "-" as the first argument?

> I like it :-)

Bug 263565 now.

Ulrich
 

Thread Tools




All times are GMT. The time now is 08:28 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org