TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Argument parsing is broken in 1.97.8

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
blah



Joined: 17 Jan 2008
Posts: 5

PostPosted: Thu Jan 17, 2008 12:10 pm    Post subject: Argument parsing is broken in 1.97.8 Reply with quote

main.c, line 203:
char c;
while ((c = getopt(argc, argv, "e: h r: t: v")) != EOF)

EOF is an int type, not a char type. It can't and won't fit into char. So on my system the comparison is always false. So I get an infinite loop.
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3844

PostPosted: Thu Jan 17, 2008 6:25 pm    Post subject: Reply with quote

Does it work if you replace EOF with -1 ?
Back to top
View user's profile Send private message Send e-mail
blah



Joined: 17 Jan 2008
Posts: 5

PostPosted: Fri Jan 18, 2008 4:11 am    Post subject: Reply with quote

Getopt manual says
int getopt(int argc, char * const argv[], const char *optstring);
You should not truncate that int into char, anyway.

I tested it: no, it doesn't work when you compare it with -1.
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3844

PostPosted: Fri Jan 18, 2008 7:42 am    Post subject: Reply with quote

True, replacing char c; with int c; should do the trick I hope.
Back to top
View user's profile Send private message Send e-mail
blah



Joined: 17 Jan 2008
Posts: 5

PostPosted: Fri Jan 18, 2008 2:47 pm    Post subject: Reply with quote

It indeed does.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group