Skip to content

Commit

Permalink
2007-01-24 Pace Willisson <[email protected]>
Browse files Browse the repository at this point in the history
	* V109

	* various portability tweaks to get it to compile on Fedora core 5
	again

	* it turns out strcasecmp is not all that standard, so convered
	uses of it, strncasecmp, strcmpi and strncmpi to xstrcasecmp
	and xstrncasecmp, written explicitly in pace.c

	* strdup is also not in c99, so changed implementation of xstrdup
	to avoid it

	* add note about how to run aclocal in DEVELOPER
  • Loading branch information
pace committed Jan 25, 2007
1 parent db71e5e commit 53ed10d
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 32 deletions.
16 changes: 16 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
2007-01-24 Pace Willisson <[email protected]>

* V109

* various portability tweaks to get it to compile on Fedora core 5
again

* it turns out strcasecmp is not all that standard, so convered
uses of it, strncasecmp, strcmpi and strncmpi to xstrcasecmp
and xstrncasecmp, written explicitly in pace.c

* strdup is also not in c99, so changed implementation of xstrdup
to avoid it

* add note about how to run aclocal in DEVELOPER

2007-01-23 Krzysztof Kosciuszkiewicz <[email protected]>

* V108
Expand Down
8 changes: 5 additions & 3 deletions DEVELOPER
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
compiling on linux:

$ aclocal -I m4
$ autoconf
$ configure
$ make
Expand Down Expand Up @@ -30,9 +31,10 @@ extract SDL.dll from this and put it in raceintospace source directory

4. compile

run "autoconf" as a normal linux program
run "cross-configure.sh"
run "cross-make.sh"
run "aclocal -I m4"
run "autoconf"
run "./mingw-configure"
run "./mingw-make"

5. run (I'm using wine-0.9.27 on Fedora core 5)

Expand Down
7 changes: 2 additions & 5 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ clean:
rm -f *.o *~
rm -f raceintospace imgsplit sdltest decode getport
rm -f getvab mkmovie mtest vtest
rm -f raceintospace.exe
rm -f raceintospace.tar.gz

distclean: clean
rm -f config.log config.status Makefile race.h
Expand All @@ -133,8 +135,3 @@ distclean: clean
tar:
rm -f raceintospace.tar raceintospace.tar.gz
tar -czf raceintospace.tar.gz Makefile ChangeLog *.[ch] domount .gdbinit $(EXTRA_SOURCES)





9 changes: 9 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
note: some of the wait_??.frm movies are 14 frames per second instead of 8

for i in *; do (cd $i; for j in *.ppm; do cjpeg -optimize -quality 30 $j > $j.jpeg; echo $i/$j; done) done

mjpeg compressing all the movies: 50 megabytes

ueva_08


autosave

on a mission failure, replay mission doesn't show the explosion
Expand Down
2 changes: 1 addition & 1 deletion admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ int GenerateTables(SaveGameType saveType)
{
for (j=i+1;j<tFiles;j++)
{
if (stricmp(FList[j].Title,FList[i].Title)<0)
if (xstrcasecmp(FList[j].Title,FList[i].Title)<0)
{
memcpy(&FList[tFiles],&FList[i],sizeof(SFInfo));
memcpy(&FList[i],&FList[j],sizeof(SFInfo));
Expand Down
1 change: 0 additions & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ CYGWIN*)
;;
esac


AC_SUBST(PROG_NAME)

AC_CONFIG_HEADER(race.h)
Expand Down
7 changes: 4 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
//****************************************************************

#include "Buzz_inc.h"
#include <getopt.h>

#ifdef MACOSX
// SDL.h needs to be included here to replace the original main() with
Expand Down Expand Up @@ -194,9 +195,9 @@ env_setup (void)
if (keyword[0] == '#')
continue;

if (strcasecmp (keyword, "cdrom") == 0) {
if (xstrcasecmp (keyword, "cdrom") == 0) {
strcpy (cdrom_dir, value);
} else if (strcasecmp (keyword, "music") == 0) {
} else if (xstrcasecmp (keyword, "music") == 0) {
strcpy (music_dir, value);
} else {
printf ("unknown keyword \"%s\" in config file\n", keyword);
Expand Down Expand Up @@ -286,7 +287,7 @@ open_gamedat (char *raw_name)
}

for (gp = gamedat_files; gp; gp = gp->next) {
if (strcasecmp (gp->filename, cooked_name) == 0) {
if (xstrcasecmp (gp->filename, cooked_name) == 0) {
f = fopen (gp->fullname, "rb");

printf ("open_gamedat (\"%s\") => %s\n",
Expand Down
4 changes: 2 additions & 2 deletions mis_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ void DoPack(char plr,FILE *ffin,char mode,char *cde,char *fName)
try=0;which=0;
while (try<SCND_TABLE)
{
if (strncmpi(fName,Mob2[try].Name,strlen(Mob2[try].Name))==0) break;
if (xstrncasecmp(fName,Mob2[try].Name,strlen(Mob2[try].Name))==0) break;
else try++;
};
if (try>=SCND_TABLE) which=415+random(25);
Expand Down Expand Up @@ -676,7 +676,7 @@ void DoPack(char plr,FILE *ffin,char mode,char *cde,char *fName)
while (try<CLIF_TABLE)
{
strcpy(Val2,&Mob[try].Code[0]);
if (strncmpi(Val1,Val2,strlen(Val1))==0) break;
if (xstrncasecmp(Val1,Val2,strlen(Val1))==0) break;
else try++;
};
if (try>=CLIF_TABLE) which=415+random(25);
Expand Down
2 changes: 1 addition & 1 deletion mis_m.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void GetFailStat(struct XFails *Now,char *FName,int rnum)
Swap32bit(Pul.offset);
Swap16bit(Pul.size);
i=0;
while (strncmpi(Pul.Code,FName,4)!=0 && i<count) {
while (xstrncasecmp(Pul.Code,FName,4)!=0 && i<count) {
fread(&Pul,sizeof Pul,1,fin);
Swap32bit(Pul.offset);
Swap16bit(Pul.size);
Expand Down
2 changes: 1 addition & 1 deletion mtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ get_music (char *filetype, int idx, void *buf, int bufsize)
len = strlen (filetype);

for (i = 0, dp = dirs; i < MDIRS; i++, dp++) {
if (strncasecmp (dp->dir.ID, filetype, len) == 0)
if (xstrncasecmp (dp->dir.ID, filetype, len) == 0)
break;
}

Expand Down
2 changes: 1 addition & 1 deletion music.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ get_music_file (char *name)
int chop;

for (mp = music_files; mp; mp = mp->next) {
if (strcasecmp (name, mp->name) == 0)
if (xstrcasecmp (name, mp->name) == 0)
return (mp);
}

Expand Down
37 changes: 29 additions & 8 deletions pace.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ next_saved_game (struct ffblk *ffblk)
len = strlen (dp->d_name);
if (len < 4)
continue;
if (strncasecmp (dp->d_name + len - 4, ".SAV", 4) != 0)
if (xstrncasecmp (dp->d_name + len - 4, ".SAV", 4) != 0)
continue;

strncpy (ffblk->ff_name, dp->d_name, sizeof ffblk->ff_name);
Expand Down Expand Up @@ -727,14 +727,10 @@ xcalloc (size_t a, size_t b)
char *
xstrdup (char const *s)
{
void *p = strdup(s);

if (!p)
{
perror("strdup");
exit(EXIT_FAILURE);
}
void *p;

p = xmalloc (strlen (s) + 1);
strcpy (p, s);
return (p);
}

Expand Down Expand Up @@ -863,3 +859,28 @@ gettimeofday (struct timeval *tv, struct timezone *tz)
return (0);
}
#endif

int
xstrcasecmp (char const *a, char const *b)
{
while (*a) {
if (tolower (*a & 0xff) != tolower (*b & 0xff))
break;
a++;
b++;
}
return (*a - *b);
}

int
xstrncasecmp (char const *a, char const *b, int n)
{
while (n && *a) {
if (tolower (*a & 0xff) != tolower (*b & 0xff))
break;
a++;
b++;
n--;
}
return (*a - *b);
}
7 changes: 4 additions & 3 deletions pace.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#include "av.h"

#define stricmp strcasecmp
#define strncmpi strncasecmp

typedef struct {
unsigned char *vptr;
int x1, y1, x2, y2;
Expand Down Expand Up @@ -170,4 +167,8 @@ struct timezone;
int gettimeofday (struct timeval *tv, struct timezone *tz);
#endif

int xstrcasecmp (char const *a, char const *b);
int xstrncasecmp (char const *a, char const *b, int len);


#endif /* __PACE_H__ */
2 changes: 1 addition & 1 deletion place.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ int Help(char *FName)
Swap32bit(count);

i=0;
while (strncmpi(Pul.Code,FName,4)!=0 && i<count) {
while (xstrncasecmp(Pul.Code,FName,4)!=0 && i<count) {
fread(&Pul,sizeof Pul,1,fin);
i++;
}
Expand Down
2 changes: 1 addition & 1 deletion sdltest.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ get_music_file (char *name)
int chop;

for (mp = music_files; mp; mp = mp->next) {
if (strcasecmp (name, mp->name) == 0)
if (xstrcasecmp (name, mp->name) == 0)
return (mp);
}

Expand Down
2 changes: 1 addition & 1 deletion version.c
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
108
109

0 comments on commit 53ed10d

Please sign in to comment.