Oh please god help me

Posted by Nick Gammon on Fri 08 Mar 2002 03:38 AM — 8 posts, 23,912 views.

Australia Forum Administrator #0
I did reply, but it took longer than usual because I had to fix the forum code to allow for a change that the web site host made - without warning - to the way PHP behaved. :)

Try using this version, I'm not sure where I got it from:

ftp://ftp.gammon.com.au/smaug/swr-2.0a2.tar.gz

I see that I previously had to make some minor changes to get it to compile under Cygwin. Below is a diff of the changes, just copy between the lines, put into a file called "swr.diff", and then change to the "src" directory (in the above download), and type:


patch < swr.diff


You should see this:


patching file `Makefile'
patching file `fight.c'
patching file `interp.c'
patching file `save.c'


Then you can type "make" to compile it.


Only in swr-2.0.old/bin: swr.exe
diff -c -r --exclude=*.o --exclude=*~ swr-2.0/src/Makefile swr-2.0.old/src/Makefile
*** swr-2.0/src/Makefile	Sat May 22 23:41:30 1999
--- swr-2.0.old/src/Makefile	Thu Mar 29 05:13:07 2001
***************
*** 1,6 ****
  CC      = gcc
  PROF    = 
! NOCRYPT =
  #Uncomment the next line if you want request support
  #DBUGFLG = -DREQUESTS
  C_FLAGS = -g3 -Wall $(PROF) $(NOCRYPT) $(DBUGFLG)
--- 1,6 ----
  CC      = gcc
  PROF    = 
! NOCRYPT = -DNOCRYPT
  #Uncomment the next line if you want request support
  #DBUGFLG = -DREQUESTS
  C_FLAGS = -g3 -Wall $(PROF) $(NOCRYPT) $(DBUGFLG)
diff -c -r --exclude=*.o --exclude=*~ swr-2.0/src/fight.c swr-2.0.old/src/fight.c
*** swr-2.0/src/fight.c	Wed May 19 13:47:13 1999
--- swr-2.0.old/src/fight.c	Thu Mar 29 05:15:58 2001
***************
*** 5,11 ****
  #include <time.h>
  #include <unistd.h>
  #include <sys/stat.h>
! #include <sys/dir.h>
  #include "mud.h"
  
  extern char		lastplayercmd[MAX_INPUT_LENGTH];
--- 5,11 ----
  #include <time.h>
  #include <unistd.h>
  #include <sys/stat.h>
! //#include <sys/dir.h>
  #include "mud.h"
  
  extern char		lastplayercmd[MAX_INPUT_LENGTH];
diff -c -r --exclude=*.o --exclude=*~ swr-2.0/src/interp.c swr-2.0.old/src/interp.c
*** swr-2.0/src/interp.c	Wed May 19 02:31:23 1999
--- swr-2.0.old/src/interp.c	Thu Mar 29 07:06:32 2001
***************
*** 3,9 ****
  #include <ctype.h>
  #include <stdio.h>
  #include <string.h>
! #include <time.h>
  #include "mud.h"
  
  /*
--- 3,9 ----
  #include <ctype.h>
  #include <stdio.h>
  #include <string.h>
! //#include <time.h>
  #include "mud.h"
  
  /*
diff -c -r --exclude=*.o --exclude=*~ swr-2.0/src/save.c swr-2.0.old/src/save.c
*** swr-2.0/src/save.c	Sun May 23 17:40:19 1999
--- swr-2.0.old/src/save.c	Thu Mar 29 07:48:38 2001
***************
*** 3,11 ****
  #include <stdio.h>
  #include <string.h>
  #include <time.h>
! #include <unistd.h>
  #include <sys/stat.h>
! #include <sys/dir.h>
  #include "mud.h"
  
  /*
--- 3,11 ----
  #include <stdio.h>
  #include <string.h>
  #include <time.h>
! //#include <unistd.h>
  #include <sys/stat.h>
! #include <dirent.h>
  #include "mud.h"
  
  /*
***************
*** 1774,1780 ****
  void load_corpses( void )
  {
    DIR *dp;
!   struct direct *de;
    extern FILE *fpArea;
    extern char strArea[MAX_INPUT_LENGTH];
    extern int falling;
--- 1774,1780 ----
  void load_corpses( void )
  {
    DIR *dp;
!   struct dirent *de;
    extern FILE *fpArea;
    extern char strArea[MAX_INPUT_LENGTH];
    extern int falling;



Have fun. If you can't get patch to work, just manually change the lines with a "!" in front of them, there are not that many.

Amended on Fri 08 Mar 2002 03:40 AM by Nick Gammon
USA #1
Bah, i had to reinstall Cygwin cause i didnt install the PATCH command. so after all that i put the swr.diff file into the src directory, open cygwin and type

patch < swr.diff, and i get this error...

$ patch < swr.diff
patching file `Makefile'
patching file `fight.c'
Hunk #1 FAILED at 5.
1 out of 1 hunk FAILED -- saving rejects to fight.c.rej
patching file `interp.c'
Hunk #1 FAILED at 3.
1 out of 1 hunk FAILED -- saving rejects to interp.c.rej
patching file `save.c'
Hunk #1 FAILED at 3.
patch unexpectedly ends in middle of line
1 out of 2 hunks FAILED -- saving rejects to save.c.rej
Australia Forum Administrator #2
Sounds like you don't have the same source. Did you do the patch on the file I mentioned, or the file(s) you already had?
USA #3
Im using the exact same source as what you posted above.
After i downloaded from the FTP, i extracted it. then made a swr.diff file and put it in the SRC directory.

i opened cygwin, changed to the src directory and typed patch < swr.diff

and got the exact same error. did you edit your source at all? i dont know why we would have diffrent results if we have the same source, and are doing the exact same thing

p.s.- really sorry for buggin ya with this, and thanks for your help
Australia Forum Administrator #4
I deleted the directory and started from scratch. Here are my results, from unzipping to compiling. The final error message in the compile doesn't matter, it is just that the file name ends in .exe which the Makefile doesn't allow for ...


nick ~
$ tar xzf  swr-2.0a2.tar.gz

nick ~
$ cd swr-2.0

nick ~/swr-2.0
$ ls
README  backup  boards  corpses  log      player      spacecraft  system
area    bin     clans   doc      planets  prototypes  src

nick ~/swr-2.0
$ cd src

nick ~/swr-2.0/src
$ patch  < ~/swr.diff
patching file `Makefile'
patching file `fight.c'
patching file `interp.c'
patching file `save.c'

nick ~/swr-2.0/src
$ make
make ../bin/swr
make[1]: Entering directory `/home/nick/swr-2.0/src'
gcc -c -g3 -Wall  -DNOCRYPT  act_comm.c
gcc -c -g3 -Wall  -DNOCRYPT  act_info.c
gcc -c -g3 -Wall  -DNOCRYPT  act_move.c
gcc -c -g3 -Wall  -DNOCRYPT  act_obj.c
act_obj.c: In function `can_layer':
act_obj.c:1024: warning: suggest explicit braces to avoid ambiguous `else'
act_obj.c: In function `do_auction':
act_obj.c:1850: warning: suggest explicit braces to avoid ambiguous `else'
act_obj.c:1874: warning: suggest explicit braces to avoid ambiguous `else'
gcc -c -g3 -Wall  -DNOCRYPT  act_wiz.c
gcc -c -g3 -Wall  -DNOCRYPT  boards.c
gcc -c -g3 -Wall  -DNOCRYPT  build.c
build.c: In function `do_goto':
build.c:662: warning: suggest explicit braces to avoid ambiguous `else'
build.c:678: warning: suggest explicit braces to avoid ambiguous `else'
gcc -c -g3 -Wall  -DNOCRYPT  clans.c
gcc -c -g3 -Wall  -DNOCRYPT  comm.c
comm.c: In function `new_descriptor':
comm.c:632: warning: unused variable `pban'
comm.c: In function `nanny':
comm.c:1273: warning: unused variable `sn'
gcc -c -g3 -Wall  -DNOCRYPT  const.c
gcc -c -g3 -Wall  -DNOCRYPT  db.c
gcc -c -g3 -Wall  -DNOCRYPT  fight.c
fight.c: In function `damage':
fight.c:1048: warning: unused variable `dampmod'
gcc -c -g3 -Wall  -DNOCRYPT  handler.c
handler.c: In function `get_eq_char':
handler.c:874: warning: suggest explicit braces to avoid ambiguous `else'
handler.c: In function `extract_char':
handler.c:1292: warning: suggest explicit braces to avoid ambiguous `else'
handler.c: At top level:
handler.c:2359: warning: type defaults to `int' in declaration of `top_reset'
gcc -c -g3 -Wall  -DNOCRYPT  hashstr.c
gcc -c -g3 -Wall  -DNOCRYPT  id.c
gcc -c -g3 -Wall  -DNOCRYPT  interp.c
gcc -c -g3 -Wall  -DNOCRYPT  magic.c
magic.c: In function `process_spell_components':
magic.c:675: warning: suggest explicit braces to avoid ambiguous `else'
magic.c:693: warning: suggest explicit braces to avoid ambiguous `else'
gcc -c -g3 -Wall  -DNOCRYPT  makeobjs.c
gcc -c -g3 -Wall  -DNOCRYPT  misc.c
gcc -c -g3 -Wall  -DNOCRYPT  mud_comm.c
gcc -c -g3 -Wall  -DNOCRYPT  mud_prog.c
gcc -c -g3 -Wall  -DNOCRYPT  player.c
gcc -c -g3 -Wall  -DNOCRYPT  requests.c
gcc -c -g3 -Wall  -DNOCRYPT  reset.c
gcc -c -g3 -Wall  -DNOCRYPT  save.c
save.c: In function `save_home':
save.c:43: warning: unused variable `templvl'
save.c: In function `load_char_obj':
save.c:778: warning: suggest explicit braces to avoid ambiguous `else'
save.c: In function `set_alarm':
save.c:1697: warning: implicit declaration of function `alarm'
gcc -c -g3 -Wall  -DNOCRYPT  shops.c
shops.c: In function `appraise_all':
shops.c:700: warning: suggest explicit braces to avoid ambiguous `else'
gcc -c -g3 -Wall  -DNOCRYPT  skills.c
gcc -c -g3 -Wall  -DNOCRYPT  special.c
gcc -c -g3 -Wall  -DNOCRYPT  tables.c
gcc -c -g3 -Wall  -DNOCRYPT  track.c
gcc -c -g3 -Wall  -DNOCRYPT  update.c
gcc -c -g3 -Wall  -DNOCRYPT  space.c
space.c: In function `destroy_ship':
space.c:2743: warning: suggest explicit braces to avoid ambiguous `else'
gcc -c -g3 -Wall  -DNOCRYPT  morespace.c
morespace.c: In function `do_designship':
morespace.c:1386: warning: unused variable `layout'
gcc -c -g3 -Wall  -DNOCRYPT  swskills.c
gcc -c -g3 -Wall  -DNOCRYPT  planets.c
gcc -c -g3 -Wall  -DNOCRYPT  vote.c
vote.c: In function `save_poll':
vote.c:45: warning: unused variable `buf'
rm -f ../bin/swr
gcc  -o ../bin/swr act_comm.o act_info.o act_move.o act_obj.o act_wiz.o boards.o
 build.o clans.o comm.o const.o db.o fight.o handler.o hashstr.o id.o interp.o m
agic.o makeobjs.o misc.o mud_comm.o mud_prog.o player.o requests.o reset.o save.
o shops.o skills.o special.o tables.o track.o update.o space.o morespace.o swski
lls.o planets.o vote.o -lm     # -lcrypt
chmod g+w ../bin/swr
chmod: ../bin/swr: No such file or directory
make[1]: *** [../bin/swr] Error 1
make[1]: Leaving directory `/home/nick/swr-2.0/src'
make: *** [all] Error 2

nick ~/swr-2.0/src
$
Australia Forum Administrator #5
Just in case you had trouble making the patch file, I have uploaded it too, it will be at:

ftp://ftp.gammon.com.au/smaug/swr.diff
USA #6
Wow thats weird... IT WORKED! lol, but i've never seen a swr like this before, i dont know any commands lol. know how to fix the swr 1.0 u got on your site?

keeps giving some timeval errors, well you seen it, i posted on the post below this one.
Australia Forum Administrator #7
I don't know much about swr - I only did the other one on request for someone who no longer uses it. I can't explain why it doesn't compile, nor do I know how to use either one.

Sorry.