Re: are there some function in C to notify about the OS used?

2005-11-27 Thread Louis LeBlanc
On 11/27/05 07:22 PM, Roland Smith sat at the `puter and typed:
> On Sun, Nov 27, 2005 at 07:16:21PM +0100, Javier Matos wrote:
> 
> > I was programming an application to work with system process that can
> > be found in /proc path and now I must to migrate my application to a
> > linux OS but the structure of status file is different. I made two
> > procedures to take information about status files, one for FreeBSD and
> > another for Linux... , now I need some function in C to notify about
> > the OS used to run the application to select between two
> > procedures... but I can?t find it, can anyone help me?
> 
> FILE *f = popen("uname", "r");
> 
> Read the name from the pipe f, and then pclose(f);

There's also the direct API: UNAME(3) (man 3 uname).

Lou
-- 
Louis LeBlanc  FreeBSD-at-keyslapper-DOT-net
Fully Funded Hobbyist,   KeySlapper Extrordinaire :)
Please send off-list email to: leblanc at keyslapper d.t net
Key fingerprint = C5E7 4762 F071 CE3B ED51  4FB8 AF85 A2FE 80C8 D9A2

Two wrights don't make a rong, they make an airplane.  Or bicycles.


pgpHjW1WoIK0p.pgp
Description: PGP signature


Re: are there some function in C to notify about the OS used?

2005-11-27 Thread Roland Smith
On Sun, Nov 27, 2005 at 07:16:21PM +0100, Javier Matos wrote:

> I was programming an application to work with system process that can
> be found in /proc path and now I must to migrate my application to a
> linux OS but the structure of status file is different. I made two
> procedures to take information about status files, one for FreeBSD and
> another for Linux... , now I need some function in C to notify about
> the OS used to run the application to select between two
> procedures... but I can?t find it, can anyone help me?

FILE *f = popen("uname", "r");

Read the name from the pipe f, and then pclose(f);

-- 
R.F.Smith (http://www.xs4all.nl/~rsmith/) Please send e-mail as plain text.
public key: http://www.xs4all.nl/~rsmith/pubkey.txt


pgpey3R5TXohd.pgp
Description: PGP signature