Fix 1985/applin under macOS
The solution is a curious one that I should have known. It wasn't even a change in the code itself; rather in macOS one needs to include unistd.h as with macOS without a proper prototype at least some functions do not work right. This showed itself in 1984/anonymous as well though I had to do a bit more to fix that one - provide a prototype in the code (including the header file did not work - this was documented at one point in the README.md and possibly bugs.md) and change the code slightly as well. Ironically this was figured out through linux! See bugs.md as I updated the on warnings section - this was an example entry where some warnings are worth fixing.
This commit is contained in:
1 parent
3f2b5097e9
commit
0c12a6e6a1
3 files changed
+28
-18
No files matched your search
@@ -61,7 +61,7 @@ CDEFINE=
|
||||
|
||||
# Include files that are needed to compile
|
||||
#
|
||||
CINCLUDE=
|
||||
CINCLUDE= -include unistd.h
|
||||
|
||||
# Optimization
|
||||
#
|
||||
|
||||
@@ -16,9 +16,14 @@ make all
|
||||
```
|
||||
|
||||
NOTE: [Yusuke Endoh](/winners.html#Yusuke_Endoh) provided a patch to get this to
|
||||
not issue a bus error. Thank you Yusuke! [Cody Boone
|
||||
Ferguson](/winners.html#Cody_Boone_Ferguson) noted that this entry does not work
|
||||
under macOS. Try it out and see for yourself what happens!
|
||||
not issue crash and [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson)
|
||||
fixed this to work with macOS. The problem with the crash is that it
|
||||
destructively rewrites string literals but with `strdup()` it's safe. For macOS
|
||||
it's because there was no prototype for `execlp()` and macOS has problems with
|
||||
missing prototypes for some functions (this was also seen when Cody fixed
|
||||
[1984/anonymous](/1984/anonymous/anonymous.c) for macOS as well though that fix
|
||||
was more complicated). Ironically this fix was discovered through linux! Thank
|
||||
you Yusuke and Cody for your help!
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
Reference in new issue
Block a user