Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ Compiling the server ➜ SWR compile problem, crypt and trunc

SWR compile problem, crypt and trunc

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Jobey5000   (13 posts)  Bio
Date Wed 12 May 2004 03:34 AM (UTC)
Message
first off id like to say that even though this is my first post, this form has helped me alot, i like to make sure my question hasent already been answered befor i post, thanks guys

following is cygwin output, (wow, hey look at that i got all the way to my fisrt make without posting a question, and i only had to download 5 times!)

$ make
make swrip
make[1]: Entering directory `/home/src'
gcc -c -g3 -Wall -DREQUESTS act_wiz.c
In file included from mud.h:264,
from act_wiz.c:32:
alias.h:39:98: warning: no newline at end of file
act_wiz.c:1838: error: conflicting types for `trunc'
/usr/include/math.h:144: error: previous declaration of `trunc'
act_wiz.c: In function `do_form_password':
act_wiz.c:4976: warning: implicit declaration of function `crypt'
make[1]: *** [act_wiz.o] Error 1
make[1]: Leaving directory `/home/src'
make: *** [all] Error 2
$ qdb
BASH: qdb: command not found
$

this is line 1838 of act_wiz.c


void trunc(char *s, int len)
{
if ( strlen(s) > len )
s[len] = '\0';
}


this the function the crypt error is in


/* Online high level immortal command for displaying what the encryption
* of a name/password would be, taking in 2 arguments - the name and the
* password - can still only change the password if you have access to
* pfiles and the correct password
*/
void do_form_password( CHAR_DATA *ch, char *argument)
{
char arg[MAX_STRING_LENGTH];

argument = one_argument(argument, arg);

ch_printf(ch, "Those two arguments encrypted would result in: %s",
crypt(arg, argument)); //this is line 4976
return;
}


my makefile looks like this...


CC = gcc
PROF =
NOCRYPT =
#Uncomment the next line if you want request support
DBUGFLG = -DREQUESTS
C_FLAGS = -g3 -Wall $(PROF) $(NOCRYPT) $(DBUGFLG)
L_FLAGS = $(PROF) -lcrypt

O_FILES = act_comm.o act_info.o act_move.o act_obj.o act_wiz.o boards.o \
build.o clans.o comm.o comments.o const.o db.o fight.o \
handler.o hashstr.o id.o interp.o magic.o makeobjs.o \
misc.o mud_comm.o mud_prog.o newarena.o player.o requests.o \
reset.o save.o shops.o skills.o special.o tables.o track.o update.o \
space.o space2.o bounty.o swskills.o alias.o grub.o mapper.o

C_FILES = act_comm.c act_info.c act_move.c act_obj.c act_wiz.c boards.c \
build.c clans.c comm.c comments.c const.c db.c fight.c \
handler.c hashstr.c id.c interp.c magic.c makeobjs.c \
misc.c mud_comm.c mud_prog.c newarena.c player.c requests.c \
reset.c save.c shops.c skills.c special.c tables.c track.c update.c \
space.c space2.c bounty.c swskills.c alias.c grub.c mapper.c

H_FILES = mud.h bet.h

all:
# co $(H_FILES)
make swrip
# rm -f $(H_FILES)
mv swrip ../bin/swrip

swrip: $(O_FILES)
rm -f swrip
$(CC) $(L_FLAGS) -o swrip $(O_FILES) -lm
chmod g+w swrip
chmod g+w $(O_FILES)

.c.o: mud.h
$(CC) -c $(C_FLAGS) $<

clean:
rm -f $(O_FILES)


any ideas?
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Wed 12 May 2004 03:44 AM (UTC)
Message
Don't know about trunc, but don't you have to add -DNOCRYPT to your NOCRYPT line in the makefile?

Do a search for "crypt" in mud.h and see what you find, that should tell you what exactly you need to define.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Jobey5000   (13 posts)  Bio
Date Reply #2 on Wed 12 May 2004 04:08 AM (UTC)
Message
Thanks, one down one to go.. so far..

cygwin now outputs this:

$ make
make swrip
make[1]: Entering directory `/home/src'
gcc -c -g3 -Wall -DNOCRYPT -DREQUESTS act_wiz.c
In file included from mud.h:264,
from act_wiz.c:32:
alias.h:39:98: warning: no newline at end of file
act_wiz.c:1838: error: conflicting types for `trunc'
/usr/include/math.h:144: error: previous declaration of `trunc'
make[1]: *** [act_wiz.o] Error 1
make[1]: Leaving directory `/home/src'
make: *** [all] Error 2
$


and this was supposed to be F.U.S.S.

(p.s. Nick Gammon, id pay money for you to be a coder on my staff.)
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #3 on Wed 12 May 2004 05:11 AM (UTC)

Amended on Wed 12 May 2004 06:07 AM (UTC) by Greven

Message
Heh, good luck with that last bit.

Anyways, I just downloaded the SWR1FUSS.tgz file available in Nick's download section, and it compiled almost cleanly. However, never saw that problem that you have. I did a grep in my src directory, and here is what I got
Quote:
$ grep trunc *.c
i3.c: * Returns strlen(src); if retval >= siz, truncation occurred.
i3.c: * truncation occurred.
imc.c: * Returns strlen(src); if retval >= siz, truncation occurred.
imc.c: * truncation occurred.
$
I assume that you added the trunc function your self? It looks like your using it to keep the size of string under control. If thats the case you could use snprintf/strncat/strncpy to do this. Just remember that these do NOT null the end string, if you have it, use strlcpy/strlcat, much better function.

Either way, looks like you just happen to be infringing on a math function name, if you want to keep it, just rename the functionm should cure all your problem.

P.S.
Quote:
and this was supposed to be F.U.S.S.
The fuss packages work fine when they are released, but when you modify it, its not going to stay fixed up nessecarily. Not refering to you specifically, but it looks like a few people seem to have this misconception about the ability and extent of the fuss code.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Jobey5000   (13 posts)  Bio
Date Reply #4 on Wed 12 May 2004 06:02 AM (UTC)
Message
Well, This isent SWR FUSS. Its SWRiP, a verry long lived and highly edited game, i got the download from swrip.betterbox.net i think its in the information page.

SWRIP has many things SWR dose not.

also, i have the binary for the basic FUSS SWR, it loads up in dos but is not complatible with SWRiP files. Thats ok, but when i try to gcc the same file in cygwin i got a popup error:

The CYGICONV-2.DLL file is linked to missing export CYGWIN1.DLL:_mb_cur_max

i hope this is just becase its a dos binary...

i looked in Math.h on line 144

extern double trunc _PARAMS((double));

i dont know what this is supposed to do... can i comment this out in math.h without having major problems?
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #5 on Wed 12 May 2004 06:09 AM (UTC)

Amended on Wed 12 May 2004 06:10 AM (UTC) by Greven

Message
No, you do not want to touch any of the system directories. If your using SWRip why did you say it was fuss? Either way, they probably never compiled it on cygwin. You will have to change the trunc function within the code, not the library ones. As to the other error form windows, I got the same thing when running it, just do a windows search for the file, it should be in /cygwin/bin, and copy it into the directory your .exe file is being ran from, same with cygwin1.dll, I think.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #6 on Wed 12 May 2004 06:10 AM (UTC)
Message
Don't touch math.h. Very, Very, VERY bad idea.

Figure out what it's doing in the code, and either make a work-around or comment it out if it's not necessary.

Quote:
Thats ok, but when i try to gcc the same file in cygwin i got a popup error:

What does "gccing a file" mean?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Jobey5000   (13 posts)  Bio
Date Reply #7 on Wed 12 May 2004 06:27 AM (UTC)
Message

i changed it all to trunc1, making a clean compile now, all fixxed.

ksilyan: you use make to compile, then use the gcc command to run the program you just compiled..

as for cygwin1.dll it is was in the directory of the application, but cygiconv-2.dll .. do they both need to be in the directory of the app?

bah, a directory bug in fight.c ... im halfway there baby!
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #8 on Wed 12 May 2004 06:37 AM (UTC)
Message
Heh. I know exactly what gcc does. Gcc is a *compiler*, it doesn't run programs. What you are saying is just not making any sense. Makefiles don't compile things. Makefiles organize your compiling process, and are used to tell gcc what to compile.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #9 on Wed 12 May 2004 08:58 PM (UTC)

Amended on Wed 12 May 2004 09:00 PM (UTC) by Nick Cash

Message
Lets clarify. gcc is the compiler called from the Makefile when you use the command make. Make is simply the command that compiles the program to the specifications set within the makefile, as well as the files included.

Anyways, I guess I'm a little confused. You are trying to run SWRiP on a Windows box? Was it ported for that? Or are you just trying to compile it on your own computer without having to log into the shell and the like?

Also, what other errors besides the cygwin pop are you having? You mentioned a "directory" error within fight.c.

~Nick Cash
http://www.nick-cash.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


28,119 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.