You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
607 B
41 lines
607 B
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
int i;
|
|
int j;
|
|
char c;
|
|
char *path = getenv("PATH");
|
|
i = 0;
|
|
j = 0;
|
|
if(!path)
|
|
{
|
|
write(1, "PATH non recuperee, abort\n", 26);
|
|
exit(1);
|
|
}
|
|
while (i < argc)
|
|
{
|
|
c = i + '0';
|
|
write(1, "arg[", 4);
|
|
write(1, &c, 1);
|
|
write(1, "]=", 2);
|
|
j = 0;
|
|
while (argv[i][j])
|
|
j++;
|
|
write(1, argv[i], j);
|
|
write(1, "\n", 1);
|
|
i++;
|
|
}
|
|
write(1, "--------------------------------------------------\n", 51);
|
|
i = 0;
|
|
write(1, "PATH => ", 8);
|
|
while(path[i])
|
|
{
|
|
write(1, &path[i], 1);
|
|
i++;
|
|
}
|
|
write(1, "\n", 1);
|
|
return 0;
|
|
}
|