-
Notifications
You must be signed in to change notification settings - Fork 2
Claude/upgrade ape c library mm z gd #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,13 +61,15 @@ void | |
| main(int argc, char *argv[]) | ||
| { | ||
| char *s, *suf, *ccpath, *lib; | ||
| char *oname; | ||
| char *oname, *objext; | ||
| int haveoname = 0; | ||
| int i, cppn, ccn; | ||
| Objtype *ot; | ||
|
|
||
| ot = findoty(); | ||
| oname = "a.out"; | ||
| /* cc produces .o (for configure compat); pcc uses arch-native .$O */ | ||
| objext = (strcmp(argv[0], "cc") == 0) ? "o" : ot->o; | ||
| append(&cpp, "cpp"); | ||
| append(&cpp, "-D__STDC__=1"); /* ANSI says so */ | ||
| append(&cpp, "-D_POSIX_SOURCE="); | ||
|
|
@@ -187,7 +189,7 @@ main(int argc, char *argv[]) | |
| cppn = cpp.n; | ||
| ccn = cc.n; | ||
| if(gflag) | ||
| putenv("_DWTYPES=1"); | ||
| putenv("_DWTYPES", "1"); | ||
| for(i = 0; i < srcs.n; i++) { | ||
| append(&cpp, srcs.strings[i]); | ||
| if(Eflag) | ||
|
|
@@ -200,15 +202,15 @@ main(int argc, char *argv[]) | |
| if (haveoname && cflag) | ||
| append(&cc, oname); | ||
| else | ||
| append(&cc, changeext(srcs.strings[i], "o")); | ||
| append(&cc, changeext(srcs.strings[i], objext)); | ||
| } | ||
| dopipe("/bin/cpp", &cpp, ccpath, &cc); | ||
| } | ||
| cpp.n = cppn; | ||
| cc.n = ccn; | ||
| } | ||
| if(gflag) | ||
| unsetenv("_DWTYPES"); | ||
| putenv("_DWTYPES", ""); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the Plan 9 environment (which the 2-argument putenv("_DWTYPES", (char*)0); |
||
| if(!cflag) { | ||
| List dw2elf_cmd; | ||
| append(&ld, "-o"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check
strcmp(argv[0], "cc")is fragile becauseargv[0]may contain the full or relative path to the executable (e.g.,/bin/ccor./cc). In such cases, the condition will fail, and the driver will use the architecture-native extension instead of.o, which defeats the purpose of the "configure compat" mode when the tool is invoked via its path. It is more robust to check the base name of the command (e.g., usingstrrchr(argv[0], '/')).