[lug] C(++) library to detect file type (a la 'file')

Tkil tkil at scrye.com
Thu Oct 31 22:53:18 MST 2002


>>>>> "Scott" == Scott A Herod <herod at dimensional.com> writes:

Scott> Yes, like the perl system call (you would probably want 'popen'
Scott> which creates a return pipe for you).

You have to be pretty careful about the phrasing of that, to control
how people parenthesize it when they read it.  On Unix derivatives,
there is a very precise meaning of "system call": namely, something
that invokes the kernel, and is typically described in section 2 of
the man pages.

As you explain above, you were really talking about "system", the perl
builtin function, which is really most similar to fork + exec + wait
(all of which are system calls).

If you want the output from a command in perl, you really want qx() or
magic pipe opens.  Described in the "perlop" and "perlopentut" man
pages, respectively.

I think everyone here knew what was being said, but it's worth
clarifying, and remember that some people read it as

   like the perl "system call"

and others read it as

   like the perl "system" call.

(Note that perl does offer a "syscall" interface where one can go
directly to those system calls, assuming you know their proper
numbers.)

t.




More information about the LUG mailing list