Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #23970

Re: Wrapping existing UNIX commands in C

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: Wrapping existing UNIX commands in C
Date 2012-07-30 13:34 -0400
Organization A noiseless patient Spider
Message-ID <5016C58C.5070802@verizon.net> (permalink)
References <jv3jqk$r1t$1@speranza.aioe.org> <jv3q1s$c09$1@dont-email.me> <jv6f6j$c9n$1@speranza.aioe.org>

Show all headers | View raw


On 07/30/2012 01:10 PM, Chicken McNuggets wrote:
> On 29/07/2012 17:57, Stephen Sprunk wrote:
> 
>> If you've already decided to limit portability to POSIX systems, pipes
>> are the general solution for what you're trying to do, but may not be
>> the optimal solution.  For instance, in the case of "ls", why not just
>> call the functions in <dirent.h> yourself rather than opening a pipe to
>> a program that calls them for you and then writing an enormous amount of
>> code to parse its output to extract the same data?
>>
>> S
>>
> 
> Because the "ls" command was an example. I really want to process the 
> output of things like "iostat", "/proc/loadavg", "sar" and "tcpdump".
> 
> dirent.h would be great if I needed to analyse information about 
> directories but since I don't need that functionality (and I have 
> already used it in the past) it is a rather pointless suggestion.

We can only comment on the questions you actually ask. The only specific
example you gave was for "ls", for which there are utilities from
section 2 of the Unix manual that provide the same information in a form
that's easier to deal with from inside a program than parsing the output
of "ls". There's lots of other POSIX command line utilities for which
that's also true. The fact that you were interested in utilities for
which it's not true was not at all obvious.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Wrapping existing UNIX commands in C Chicken McNuggets <chicken@mcnuggets.com> - 2012-07-29 16:11 +0100
  Re: Wrapping existing UNIX commands in C Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-29 11:18 -0400
    Re: Wrapping existing UNIX commands in C Chicken McNuggets <chicken@mcnuggets.com> - 2012-07-29 16:24 +0100
    Re: Wrapping existing UNIX commands in C "China Blue [Tor], Meersburg" <chine.bleu@yahoo.com> - 2012-07-29 08:34 -0700
      Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-07-29 12:05 -0700
        Re: Wrapping existing UNIX commands in C "China Blue [Tor], Meersburg" <chine.bleu@yahoo.com> - 2012-07-29 14:00 -0700
          Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-07-29 15:19 -0700
          Re: Wrapping existing UNIX commands in C Rui Maciel <rui.maciel@gmail.com> - 2012-07-30 00:35 +0100
            Re: Wrapping existing UNIX commands in C Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-07-30 14:54 +0000
              Re: Wrapping existing UNIX commands in C Chicken McNuggets <chicken@mcnuggets.com> - 2012-07-30 17:15 +0100
              Re: Wrapping existing UNIX commands in C James Kuyper <jameskuyper@verizon.net> - 2012-07-30 12:44 -0400
                Re: Wrapping existing UNIX commands in C Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-08-02 13:51 +0000
          Re: Wrapping existing UNIX commands in C jacob navia <jacob@spamsink.net> - 2012-07-30 11:13 +0200
          Re: Wrapping existing UNIX commands in C Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-07-30 01:59 -0700
    Re: Wrapping existing UNIX commands in C gazelle@shell.xmission.com (Kenny McCormack) - 2012-07-29 17:10 +0000
      Re: Wrapping existing UNIX commands in C tom st denis <tom@iahu.ca> - 2012-07-31 14:55 -0700
        Re: Wrapping existing UNIX commands in C jacob navia <jacob@spamsink.net> - 2012-08-01 00:24 +0200
          Re: Wrapping existing UNIX commands in C tom st denis <tom@iahu.ca> - 2012-08-02 06:12 -0700
  Re: Wrapping existing UNIX commands in C "Heinrich Wolf" <invalid@invalid.invalid> - 2012-07-29 17:20 +0200
    Re: Wrapping existing UNIX commands in C Chicken McNuggets <chicken@mcnuggets.com> - 2012-07-29 16:24 +0100
    Re: Wrapping existing UNIX commands in C Ike Naar <ike@sverige.freeshell.org> - 2012-07-29 21:41 +0000
      Re: Wrapping existing UNIX commands in C "Heinrich Wolf" <invalid@invalid.invalid> - 2012-07-30 06:46 +0200
    Re: Wrapping existing UNIX commands in C "Heinrich Wolf" <invalid@invalid.invalid> - 2012-07-30 06:49 +0200
  Re: Wrapping existing UNIX commands in C "China Blue [Tor], Meersburg" <chine.bleu@yahoo.com> - 2012-07-29 08:31 -0700
    Re: Wrapping existing UNIX commands in C Ike Naar <ike@sverige.freeshell.org> - 2012-07-29 21:46 +0000
  Re: Wrapping existing UNIX commands in C Stephen Sprunk <stephen@sprunk.org> - 2012-07-29 11:57 -0500
    Re: Wrapping existing UNIX commands in C Nobody <nobody@nowhere.com> - 2012-07-30 12:13 +0100
      Re: Wrapping existing UNIX commands in C jacob navia <jacob@spamsink.net> - 2012-07-30 13:26 +0200
        Re: Wrapping existing UNIX commands in C Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-07-30 12:39 +0100
          Re: Wrapping existing UNIX commands in C Mark Bluemel <mark_bluemel@pobox.com> - 2012-07-30 13:16 +0100
            Re: Wrapping existing UNIX commands in C BGB <cr88192@hotmail.com> - 2012-07-30 12:39 -0500
          Re: Wrapping existing UNIX commands in C Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-07-30 15:02 +0000
        Re: Wrapping existing UNIX commands in C Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-07-30 15:18 +0000
        Re: Wrapping existing UNIX commands in C Nobody <nobody@nowhere.com> - 2012-07-31 14:53 +0100
        Re: Wrapping existing UNIX commands in C tom st denis <tom@iahu.ca> - 2012-08-02 06:21 -0700
    Re: Wrapping existing UNIX commands in C Chicken McNuggets <chicken@mcnuggets.com> - 2012-07-30 18:10 +0100
      Re: Wrapping existing UNIX commands in C Paul <nospam@needed.com> - 2012-07-30 13:30 -0400
      Re: Wrapping existing UNIX commands in C James Kuyper <jameskuyper@verizon.net> - 2012-07-30 13:34 -0400
        Re: Wrapping existing UNIX commands in C gazelle@shell.xmission.com (Kenny McCormack) - 2012-08-15 21:21 +0000
          Re: Wrapping existing UNIX commands in C Stephen Sprunk <stephen@sprunk.org> - 2012-08-15 17:17 -0500
      Re: Wrapping existing UNIX commands in C Stephen Sprunk <stephen@sprunk.org> - 2012-07-30 13:18 -0500
      Re: Wrapping existing UNIX commands in C Cal Dershowitz <cal@example.invalid> - 2012-08-01 21:08 -0600
        Re: Wrapping existing UNIX commands in C gazelle@shell.xmission.com (Kenny McCormack) - 2012-08-02 12:20 +0000
          Re: Wrapping existing UNIX commands in C tom st denis <tom@iahu.ca> - 2012-08-02 06:15 -0700
            Re: Wrapping existing UNIX commands in C gazelle@shell.xmission.com (Kenny McCormack) - 2012-08-02 14:16 +0000
              Re: Wrapping existing UNIX commands in C Kenneth Brody <kenbrody@spamcop.net> - 2012-08-02 11:33 -0400
              Re: Wrapping existing UNIX commands in C tom st denis <tom@iahu.ca> - 2012-08-02 11:51 -0700
                Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-08-02 15:03 -0700
                Re: Wrapping existing UNIX commands in C tom st denis <tom@iahu.ca> - 2012-08-02 18:46 -0700
                Re: Wrapping existing UNIX commands in C gazelle@shell.xmission.com (Kenny McCormack) - 2012-08-03 02:18 +0000
                Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-08-02 21:07 -0700
                Re: Wrapping existing UNIX commands in C Chicken McNuggets <chicken@mcnuggets.com> - 2012-08-04 10:40 +0100
                Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-08-04 03:22 -0700
                Re: Wrapping existing UNIX commands in C "Heinrich Wolf" <invalid@invalid.invalid> - 2012-08-04 12:34 +0200
                Re: Wrapping existing UNIX commands in C gazelle@shell.xmission.com (Kenny McCormack) - 2012-08-04 13:25 +0000
                Re: Wrapping existing UNIX commands in C Kenneth Brody <kenbrody@spamcop.net> - 2012-08-15 13:52 -0400
                Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-08-04 16:26 -0700
                Re: Wrapping existing UNIX commands in C Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-08-05 03:27 -0700
                Re: Wrapping existing UNIX commands in C gwowen <gwowen@gmail.com> - 2012-08-06 01:50 -0700
                Re: Wrapping existing UNIX commands in C James Kuyper <jameskuyper@verizon.net> - 2012-08-06 07:15 -0400
                Re: Wrapping existing UNIX commands in C gwowen <gwowen@gmail.com> - 2012-08-06 04:25 -0700
                Re: Wrapping existing UNIX commands in C James Kuyper <jameskuyper@verizon.net> - 2012-08-06 09:14 -0400
                Re: Wrapping existing UNIX commands in C gazelle@shell.xmission.com (Kenny McCormack) - 2012-08-06 14:14 +0000
                Re: Wrapping existing UNIX commands in C gwowen <gwowen@gmail.com> - 2012-08-06 07:43 -0700
                Re: Wrapping existing UNIX commands in C James Kuyper <jameskuyper@verizon.net> - 2012-08-06 11:52 -0400
                Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-08-06 11:37 -0700
                Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-08-06 11:34 -0700
                Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-08-06 11:53 -0700
                Re: Wrapping existing UNIX commands in C gwowen <gwowen@gmail.com> - 2012-08-07 00:33 -0700
                Re: Wrapping existing UNIX commands in C James Kuyper <jameskuyper@verizon.net> - 2012-08-07 06:44 -0400
                Re: Wrapping existing UNIX commands in C gwowen <gwowen@gmail.com> - 2012-08-07 05:15 -0700
                Re: Wrapping existing UNIX commands in C James Kuyper <jameskuyper@verizon.net> - 2012-08-07 08:37 -0400
                Re: Wrapping existing UNIX commands in C Neil Cerutti <neilc@norwich.edu> - 2012-08-07 13:04 +0000
                Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-08-07 12:57 -0700
                Re: Wrapping existing UNIX commands in C gazelle@shell.xmission.com (Kenny McCormack) - 2012-08-07 21:24 +0000
                Re: Wrapping existing UNIX commands in C Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-08-08 00:58 -0700
                Re: Wrapping existing UNIX commands in C "BartC" <bc@freeuk.com> - 2012-08-06 18:04 +0100
                Re: Wrapping existing UNIX commands in C gazelle@shell.xmission.com (Kenny McCormack) - 2012-08-06 18:24 +0000
                Re: Wrapping existing UNIX commands in C jgk@panix.com (Joe keane) - 2012-08-22 17:08 +0000
                Re: Wrapping existing UNIX commands in C James Kuyper <jameskuyper@verizon.net> - 2012-08-06 14:46 -0400
                Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-08-06 11:55 -0700
                Re: Wrapping existing UNIX commands in C James Kuyper <jameskuyper@verizon.net> - 2012-08-06 19:13 -0400
                Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-08-06 11:50 -0700
                Re: Wrapping existing UNIX commands in C "BartC" <bc@freeuk.com> - 2012-08-06 20:28 +0100
                Re: Wrapping existing UNIX commands in C James Kuyper <jameskuyper@verizon.net> - 2012-08-06 15:44 -0400
                Re: Wrapping existing UNIX commands in C Robert Miles <milesrf@Usenet-News.net> - 2012-09-09 22:46 -0500
                Re: Wrapping existing UNIX commands in C Kaz Kylheku <kaz@kylheku.com> - 2012-09-10 04:29 +0000
                Re: Wrapping existing UNIX commands in C Keith Thompson <kst-u@mib.org> - 2012-09-09 22:42 -0700
                Re: Wrapping existing UNIX commands in C Kaz Kylheku <kaz@kylheku.com> - 2012-09-10 19:15 +0000
                Re: Wrapping existing UNIX commands in C pete <pfiland@mindspring.com> - 2012-09-10 22:25 -0400
                Re: Wrapping existing UNIX commands in C Öö Tiib <ootiib@hot.ee> - 2012-09-10 03:10 -0700
                Re: Wrapping existing UNIX commands in C James Kuyper <jameskuyper@verizon.net> - 2012-09-10 08:01 -0400
                Re: Wrapping existing UNIX commands in C "io_x" <a@b.c.invalid> - 2012-08-07 10:22 +0200
                Re: Wrapping existing UNIX commands in C "China Blue [Tor], Meersburg" <chine.bleu@yahoo.com> - 2012-08-07 01:55 -0700
                Re: Wrapping existing UNIX commands in C gazelle@shell.xmission.com (Kenny McCormack) - 2012-08-07 21:26 +0000
                Re: Wrapping existing UNIX commands in C Rui Maciel <rui.maciel@gmail.com> - 2012-08-08 08:47 +0100
                Re: Wrapping existing UNIX commands in C "Ansel" <tinker454@trytospammenowloser.com> - 2012-08-10 21:58 -0600
                Re: Wrapping existing UNIX commands in C Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-08-07 00:07 -0700
          Re: Wrapping existing UNIX commands in C Kenneth Brody <kenbrody@spamcop.net> - 2012-08-02 11:27 -0400
      Re: Wrapping existing UNIX commands in C Rui Maciel <rui.maciel@gmail.com> - 2012-08-16 09:43 +0100

csiph-web