libs-base/config/config.proccmd.c
Richard Frith-Macdonald 526a6985a6 Fixes for command line arguments coming from /proc/$$/cmdline.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9649 72102866-910b-0410-8b05-ffd578937521
2001-04-21 05:55:16 +00:00

28 lines
447 B
C

/*
* Check to see if the final cmdline arg recorded in the /proc filesystem
* is terminated by a nul.
*/
#include <stdio.h>
int main()
{
char buf[32];
FILE *fptr;
int result = 1;
int c;
sprintf(buf, "/proc/%d/cmdline", getpid());
fptr = fopen(buf, "r");
if (fptr != 0)
{
while ((c = fgetc(fptr)) != EOF)
{
result = c;
}
fclose(fptr);
}
if (result != 0)
{
result = 1;
}
return result;
}