Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #172172
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Piping to stdin |
| Date | 2023-08-13 20:53 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87zg2uiur8.fsf@bsb.me.uk> (permalink) |
| References | <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com> <U4x2oQwlZ0Kk8WwnO@bongo-ra.co> <f2044b26-5a38-493d-9ab9-906bf73b0499n@googlegroups.com> |
Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:
> On Sunday, 13 August 2023 at 14:55:57 UTC+1, Spiros Bousbouras wrote:
>> [ Followup-To: comp.unix.programmer ]
>> On Sun, 13 Aug 2023 06:42:17 -0700 (PDT)
>> Malcolm McLean <malcolm.ar...@gmail.com> wrote:
>> > On Unix-lke systems, what is the convention for putting a program into a
>> > mode where it accepts input from stdin?
>> > Where the user invokes it directly, he'll normally want input from a file. So
>> > the normal invocation would be
>> >
>> > myprogram myinput.txt
>> >
>> > But if he just types "myprogram" it should display brief help text. So we
>> > can't omit the filename to make the program read from stdin.
>> I would use a -h option for help text and with no arguments it should read
>> from stdin .
>>
> That's unacceptable to me. My users will expect that when they see a program
> and type the name, it will either launch a GUI or print out. a brief message
> saying what the program is and what it does.
(Context: an XML to CSV converter.)
Your Unix/Linux users probably expect something else. When I install
program xxx, my first action is "man xxx". Failing that, I try "xxx -h"
(or --help).
I have a few useful programs that clearly come from the world of Windows
and demand a file name either for input or for output. Fortunately,
Linux can deal with this situation because it offers /dev/stdin and
/dev/stout so pretty much any program can forced play nice in a
pipeline.
But to help things along, I'd suggest you (a) provide a -h (and/or
--help) flag that prints to stderr and then exits reading no input; (b)
interpret - as stdin (in an input position) and as stdout (where you
program expects an output file) as not everyone know about (or can
access) /dev/std{in,out}. I'd consider a -p (or --pipeline) flag that
turns off your default message and reads stdin and writes stdout.
--
Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Piping to stdin Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-08-13 06:42 -0700
Re: Piping to stdin Spiros Bousbouras <spibou@gmail.com> - 2023-08-13 13:55 +0000
Re: Piping to stdin Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-08-13 07:07 -0700
Re: Piping to stdin Bart <bc@freeuk.com> - 2023-08-13 15:21 +0100
Re: Piping to stdin Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-08-13 07:31 -0700
Re: Piping to stdin Bart <bc@freeuk.com> - 2023-08-13 16:40 +0100
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-13 16:08 +0000
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-13 16:07 +0000
Re: Piping to stdin Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2023-08-13 17:26 +0000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-13 19:09 +0000
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-13 20:45 +0000
Re: Piping to stdin Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-08-13 20:53 +0100
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-13 20:47 +0000
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-14 00:59 +0000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-14 03:07 +0000
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-14 03:12 +0000
Re: Piping to stdin kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-08-14 15:14 +0000
Re: Piping to stdin "Gary R. Schmidt" <grschmidt@acm.org> - 2023-08-15 12:50 +1000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-15 04:59 +0000
Re: Piping to stdin Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-08-14 23:15 -0700
Re: Piping to stdin Richard Kettlewell <invalid@invalid.invalid> - 2023-08-15 08:50 +0100
Dealing with weird filenames (Was: Piping to stdin) gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-15 08:10 +0000
Re: Piping to stdin David Brown <david.brown@hesbynett.no> - 2023-08-15 15:34 +0200
Re: Piping to stdin Richard Harnden <richard.nospam@gmail.com> - 2023-08-15 19:50 +0100
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-15 20:16 +0000
Re: Piping to stdin vallor <vallor@cultnix.org> - 2023-08-16 06:34 +0000
Re: Piping to stdin Richard Kettlewell <invalid@invalid.invalid> - 2023-08-16 17:39 +0100
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-16 17:37 +0000
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-16 17:43 +0000
Re: Piping to stdin Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-08-16 13:35 -0700
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-17 14:51 +0300
Re: Piping to stdin James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-08-16 01:37 -0400
Re: Piping to stdin David Brown <david.brown@hesbynett.no> - 2023-08-16 13:14 +0200
Re: Piping to stdin Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2023-08-15 12:08 -0600
Re: Piping to stdin Richard Harnden <richard.nospam@gmail.com> - 2023-08-16 09:32 +0100
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-16 17:27 +0300
Re: Piping to stdin kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-08-15 14:30 +0000
Re: Piping to stdin Giovanni <lsodgf0@home.net.it> - 2023-08-15 17:14 +0200
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-15 15:48 +0000
Re: Piping to stdin kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-08-15 16:12 +0000
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-15 16:15 +0000
Re: Piping to stdin kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-08-15 16:22 +0000
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-17 10:26 +0000
Re: Piping to stdin kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-08-17 14:23 +0000
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-17 15:25 +0000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-15 17:33 +0000
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-15 23:32 +0300
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-17 10:32 +0000
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-17 14:57 +0300
Re: Piping to stdin Michael S <already5chosen@yahoo.com> - 2023-08-17 05:14 -0700
Wrecking a good thing? (Was: Piping to stdin) gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-17 14:09 +0000
Re: Wrecking a good thing? Phil Carmody <pc+usenet@asdf.org> - 2023-08-18 00:39 +0300
Re: Wrecking a good thing? (Was: Piping to stdin) David Brown <david.brown@hesbynett.no> - 2023-08-18 11:17 +0200
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-17 15:14 +0000
Re: Piping to stdin Öö Tiib <ootiib@hot.ee> - 2023-08-17 08:58 -0700
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-17 13:52 +0000
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-17 15:20 +0000
Re: Piping to stdin Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-08-17 13:43 -0700
Re: Piping to stdin David Brown <david.brown@hesbynett.no> - 2023-08-18 11:28 +0200
Re: Piping to stdin Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-08-17 21:52 +0100
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-19 13:33 +0300
Re: Piping to stdin Oğuz <oguzismailuysal@gmail.com> - 2023-08-19 16:15 +0300
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-19 14:48 +0000
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-20 17:24 +0000
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-20 19:21 +0000
Re: Piping to stdin Rainer Weikusat <rweikusat@talktalk.net> - 2023-08-20 21:57 +0100
What language is this? (Was: Piping to stdin) gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-20 22:33 +0000
Re: What language is this? (Was: Piping to stdin) scott@slp53.sl.home (Scott Lurndal) - 2023-08-21 01:26 +0000
Re: What language is this? (Was: Piping to stdin) gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-21 02:57 +0000
Re: What language is this? Rainer Weikusat <rweikusat@talktalk.net> - 2023-08-21 17:16 +0100
Re: What language is this? gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-21 19:10 +0000
Re: What language is this? Rainer Weikusat <rweikusat@talktalk.net> - 2023-08-21 20:31 +0100
Re: What language is this? gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-21 20:29 +0000
Re: What language is this? Rainer Weikusat <rweikusat@talktalk.net> - 2023-08-21 21:48 +0100
Re: What language is this? (Was: Piping to stdin) Muttley@dastardlyhq.com - 2023-08-21 06:50 +0000
Re: Piping to stdin Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-08-19 21:14 +0100
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-15 23:24 +0300
Re: Piping to stdin Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2023-08-15 20:50 +0000
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-16 17:11 +0300
Re: Piping to stdin Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2023-08-16 15:25 +0000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-16 19:29 +0000
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-17 14:49 +0300
Re: Piping to stdin Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-08-16 03:20 +0100
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-15 18:33 +0300
Re: Piping to stdin "Nuno Silva" <nunojsilva@invalid.invalid> - 2023-08-14 09:45 +0100
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-13 16:06 +0000
Re: Piping to stdin Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-08-13 17:09 -0700
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-14 01:03 +0000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-14 04:00 +0000
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-14 12:20 +0300
Re: Piping to stdin Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-08-14 02:44 -0700
Re: Piping to stdin Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-08-14 03:54 -0700
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-14 11:22 +0000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-14 15:49 +0000
Re: Piping to stdin Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-08-14 17:19 +0100
Re: Piping to stdin Jim Jackson <jj@franjam.org.uk> - 2023-08-14 17:21 +0000
Re: Piping to stdin Michael S <already5chosen@yahoo.com> - 2023-08-15 08:02 -0700
Re: Piping to stdin John Forkosh <forkosh@panix.com> - 2023-08-14 03:15 +0000
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-14 11:28 +0000
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-14 15:41 +0000
Re: Piping to stdin Richard Harnden <richard.nospam@gmail.com> - 2023-08-14 22:02 +0100
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-14 21:14 +0000
csiph-web