Fix 1992/westley to compile with clang

Since the third and fourth args of main() were being used as ints I have
made them ints inside main() as clang does not allow the second, third
or fourth args to main() to be anything but char **. An important note
(which the author noted but which I put in the Makefile as well as under
the 'To run:' section) is that the terminal must wrap at 80 columns in
order for this to work right. I had to shrink down the terminal size to
get to show that this change worked okay - it was the simplest way I
could think of to do it.
This commit is contained in:
Cody Boone Ferguson committed 2023-03-17 11:12:45 -07:00
1 parent ada4d41f37
commit 9ac70905d3
4 files changed
+23 -6

No files matched your search

+1
View File
@@ -1 +1,2 @@
westley westley
whereami
+1 -1
View File
@@ -183,7 +183,7 @@ all: data ${TARGET}
supernova deep_magic magic charon pluto supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c ${PROG}: ${PROG}.c
@echo "NOTE: This entry might not compile when using modern compilers." @echo "NOTE: your terminal must wrap at 80 columns for this to work right!"
${CC} ${CFLAGS} $< -o $@ ${LIBS} ${CC} ${CFLAGS} $< -o $@ ${LIBS}
whereami: ${PROG} whereami: ${PROG}
+20 -4
View File
@@ -10,7 +10,12 @@
make all make all
NOTE: This entry might not compile when using modern compilers.
NOTE: [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to
work with clang by changing the third and fourth arg of main() to be ints inside
main(); clang requires args 2 - 4 to be `char **`. Thank you Cody for your
assistance!
### To run ### To run
@@ -22,14 +27,25 @@
./whereami lat long ./whereami lat long
## Judges' comments Where lat and long correspond to your latitude and longitude.
Where lat and long correspond to your latitude and longitude. NOTE: you must have a terminal that wraps at 80 columns (!) in order for this to
show correctly!
To find the approximate place where this entry was judged, type:
## Try:
./whereami 47 -122 (- means west of meridian)
./whereami 47 122
## Judges' comments:
To find the approximate place where this entry was judged, type:
./whereami 37 -122 (- means west of meridian) ./whereami 37 -122 (- means west of meridian)
## Author's comments ## Author's comments
Run the program with your latitude & longitude as integer Run the program with your latitude & longitude as integer
+1 -1
View File
@@ -1,5 +1,5 @@
main(l main(l
,a,n,d)char**a;{ ,a)char**a;{int n;int d;
for(d=atoi(a[1])/10*80- for(d=atoi(a[1])/10*80-
atoi(a[2])/5-596;n="@NKA\ atoi(a[2])/5-596;n="@NKA\
CLCCGZAAQBEAADAFaISADJABBA^\ CLCCGZAAQBEAADAFaISADJABBA^\