Mail Archives: djgpp/1992/11/25/10:59:32
We try to use the execl call to get another programming running.
Whatever we try for pathnames, it fails. From the documentation
we expected it to work. Are we overlooking something?
program: (t.c)
main()
{
char *args[3];
args[2] = args[1] = (char *) 0;
execl( "go32", "ci30", (char *) 0 );
execl( "ls", "ls", (char *) 0 );
printf( "c:\\ubin\\ls.exe\n" );
execl( "c:\\ubin\\ls.exe\n", "ls", (char *) 0 );
printf( "c:\\ubin\\ls\n" );
execl( "c:\\ubin\\ls\n", "ls", (char *) 0 );
printf( "c:/ubin/ls.exe\n" );
execl( "c:/ubin/ls.exe\n", "ls", (char *) 0 );
printf( "c:/ubin/ls\n" );
execl( "c:/ubin/ls\n", "ls", (char *) 0 );
printf( "a.out\n" );
execl( "a.out", "a.out", (char *) 0 );
printf( "go32 a.out\n" );
execl( "go32", "a.out", (char *) 0 );
printf( "a.exe\n" );
execl( "a.exe", "a.exe", (char *) 0 );
args[0] = "ci30";
printf( "execv %s\n", args[0] );
execv( args[0], args );
args[0] = "a.exe";
printf( "execv %s\n", args[0] );
execv( args[0], args );
args[0] = "a.out";
printf( "execv %s\n", args[0] );
execv( args[0], args );
printf( "exec failure\n" );
}
Compiled with
gcc t.c
Run with
go32 a.out
We also tried to stub it with copy <..>stub.exe/b+a.out a.exe to get an
executable a.exe
What are we doing wrong??
Jos Jansen
jj AT bouw DOT tno DOT nl
- Raw text -