Message-ID: <34BD2B38.8F094DF5@gmx.net> Date: Wed, 14 Jan 1998 22:16:40 +0100 From: Robert Hoehne Organization: none provided MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: spawn() problem Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Because I haven't the time to analize it, here now my question: Is it a bug or a feature of the spawn... functions, that the called DJGPP program ignores the argv0 value of the stub? (when spawn.. is called directly and not through system() )? Example: (file foo.c) #include int main(int argc, char **argv) { printf("%s\n",argv[0]); return 0; } Compile it with gcc -o foo.exe foo.c and now stubedit foo.exe argv0=bar and now: foo prints .../bar (the dots are the directory). But when doing bash -c foo.exe it prints ./foo.exe and bash uses spawnve() to call foo.exe. I ask this, because in my last uploaded bnu281b.zip I have made for instance ranlib.exe as a symbolic link to ar.exe with argv0=ranlib (NOT ranlib.exe). But when running now a makefile under bash, it fails when running ranlib, since now ar.exe (to which ranlib.exe points to) recognises not that it is called as ranlib because it sees ranlib.exe and not (what I customized in the stub) only ranlib. I ask this also, so that I will include in the bnu281b.zip which I have to upload to DJ (because of the missing nm.exe :-( ) again the full executables ranlib.exe and strip.exe and not only links to ar.exe and objcopy.exe. Please answer me also directly, since I'm not subscribed to djgpp-workers. BTW: Here is another test file, which does all the steps from above itself: /* -------- test.c */ #include #include int main(int argc, char **argv) { FILE *f; f = fopen("foo.c", "w+t"); fprintf(f,"#include \nint main(int argc, char **argv)\n"); fprintf(f,"{printf(\"%cs\\n\",argv[0]);return 0;}\n",'%'); fclose(f); system("gcc -o foo.exe foo.c"); system("stubedit foo.exe argv0=bar"); spawnl(P_WAIT, "foo.exe", "foo.exe", NULL); system("foo.exe"); return 0; } /*--------*/ Robert -- ****************************************************** * email: Robert Hoehne * * Post: Am Berg 3, D-09573 Dittmannsdorf, Germany * * WWW: http://www.tu-chemnitz.de/~sho/rho * ******************************************************