Quote:> Hi,
> any one knows if there is a way to find out if a file is excutable
> without using the command 'file'?
> I don't mean just simply accessing the status info and look at the
> file mode. Is there a c function or some sort that can actually
> enable us to know if the file is executable.
No, you have to do what the file command does, which is to read a
small portion of the beginning of the file, and guess what type of
file it is. For executables, different versions of Unix have a
different "magic numbers", as they are called, at a specific byte
offset in the file.
There's no portable way to tell. (FYI, IBM's AIX can't even tell
the difference between an executable and an object file - they have
the same magic number.)
See the file /etc/magic or the magic man page if you have one.
Hope this helps,
Dave
BTW, email failed (for obvious reasons):
----- Transcript of session follows -----
550 droopy (tcp)... Host unknown
--
------------------------------------------------------///--------------------
Dave Plonka ARS:N9HZF Amiga - 68040 - /// 486DLC-33 running
- Lead Systems Programmer, McHugh Freeman ------- \\X/- Waukesha, Wisconsin -