d2x can now handle any line ending when reading d2x.ini
This commit is contained in:
parent
9971224604
commit
f71f6dd653
15
ChangeLog
15
ChangeLog
|
@ -1,12 +1,17 @@
|
|||
2004-07-22 Chris Taylor <c.taylor@student.curtin.edu.au>
|
||||
2004-08-06 Chris Taylor <c.taylor@student.curtin.edu.au>
|
||||
|
||||
* include/ogl_init.h: Include glu.h for Mac OS X, it is sometimes necessary
|
||||
* include/strio.h, include/strutil.h, misc/args.c, misc/strio.c,
|
||||
misc/strutil.c: d2x can now handle any line ending when reading d2x.ini
|
||||
|
||||
2004-07-02 Martin Schaffner <maschaffner@gmx.ch>
|
||||
2004-08-04 Chris Taylor <c.taylor@student.curtin.edu.au>
|
||||
|
||||
* include/pstypes.h: This time, I correctly applied Chris Taylor's patch
|
||||
* include/ogl_init.h: Include glu.h on OS X, it is sometimes necessary
|
||||
|
||||
2004-07-01 Chris Taylor <c.taylor@student.curtin.edu.au>
|
||||
2004-08-02 Martin Schaffner <maschaffner@gmx.ch>
|
||||
|
||||
* include/pstypes.h: Now, I correctly applied Chris Taylor's patch
|
||||
|
||||
2004-08-01 Chris Taylor <c.taylor@student.curtin.edu.au>
|
||||
|
||||
* 2d/font.c, arch/ogl/gr.c, arch/ogl/ogl.c, mem/mem.c,
|
||||
include/d_io.h, include/pstypes.h, include/u_dpmi.h,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#ifndef _STRIO_H
|
||||
#define _STRIO_H
|
||||
|
||||
char *fsplitword(CFILE *f, char splitchar);
|
||||
char* fgets_unlimited(CFILE *f);
|
||||
char *splitword(char *s, char splitchar);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: strutil.h,v 1.12 2004-08-01 14:01:23 schaffner Exp $ */
|
||||
/* $Id: strutil.h,v 1.13 2004-08-06 20:28:57 schaffner Exp $ */
|
||||
/*
|
||||
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||
|
@ -16,8 +16,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#define _STRUTILS_H
|
||||
|
||||
#if defined(macintosh)
|
||||
extern int stricmp(char *str1, char *str2);
|
||||
extern int strnicmp(char *str1, char *str2, int n);
|
||||
extern int stricmp(const char *str1, const char *str2);
|
||||
extern int strnicmp(const char *str1, const char *str2, int n);
|
||||
#elif !defined(_WIN32)
|
||||
# include <string.h>
|
||||
# define stricmp(a,b) strcasecmp(a,b)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: args.c,v 1.12 2004-05-19 22:28:08 btb Exp $ */
|
||||
/* $Id: args.c,v 1.13 2004-08-06 20:28:57 schaffner Exp $ */
|
||||
/*
|
||||
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||
|
@ -57,7 +57,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#endif
|
||||
|
||||
#ifdef RCS
|
||||
static char rcsid[] = "$Id: args.c,v 1.12 2004-05-19 22:28:08 btb Exp $";
|
||||
static char rcsid[] = "$Id: args.c,v 1.13 2004-08-06 20:28:57 schaffner Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -140,7 +140,7 @@ void InitArgs( int argc,char **argv )
|
|||
if(f) {
|
||||
while(!cfeof(f))
|
||||
{
|
||||
line=fsplitword(f,'\n');
|
||||
line=fgets_unlimited(f);
|
||||
word=splitword(line,' ');
|
||||
|
||||
Args[Num_args++] = d_strdup(word);
|
||||
|
|
48
misc/strio.c
48
misc/strio.c
|
@ -1,4 +1,4 @@
|
|||
/* $Id: strio.c,v 1.4 2003-06-16 06:57:34 btb Exp $ */
|
||||
/* $Id: strio.c,v 1.5 2004-08-06 20:28:57 schaffner Exp $ */
|
||||
/*
|
||||
* strio.c: string/file manipulation functions by Victor Rachels
|
||||
*/
|
||||
|
@ -8,6 +8,7 @@
|
|||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cfile.h"
|
||||
#include "strio.h"
|
||||
|
@ -15,32 +16,27 @@
|
|||
#include "u_mem.h"
|
||||
//end additions - adb
|
||||
|
||||
char* fsplitword(CFILE *f, char splitchar)
|
||||
char *fgets_unlimited(CFILE *f)
|
||||
{
|
||||
int x,y,mem,memx;
|
||||
char *word,*buf;
|
||||
memx=1;
|
||||
mem=memx*256;
|
||||
word=(char *) d_malloc(sizeof(char) * mem);
|
||||
x=0;
|
||||
word[x] = cfgetc(f);
|
||||
while(word[x] != splitchar && !cfeof(f))
|
||||
{
|
||||
x++;
|
||||
if(x==mem)
|
||||
{
|
||||
buf=word;
|
||||
memx*=2;
|
||||
mem=memx*256;
|
||||
word=(char *) d_malloc(sizeof(char) * mem);
|
||||
for(y=0;y<x;y++)
|
||||
word[y]=buf[y];
|
||||
d_free(buf);
|
||||
}
|
||||
word[x] = cfgetc(f);
|
||||
}
|
||||
word[x]=0;
|
||||
return word;
|
||||
int mem = 256;
|
||||
char *word, *buf, *p;
|
||||
|
||||
MALLOC(word, char, mem);
|
||||
p = word;
|
||||
|
||||
while (word && cfgets(p, mem, f) == word + mem) {
|
||||
int i;
|
||||
|
||||
// Make a bigger buffer, because it read to the end of the buffer.
|
||||
buf = word;
|
||||
mem *= 2;
|
||||
MALLOC(word, char, mem);
|
||||
for (i = 0; i < mem/2; i++)
|
||||
word[i] = buf[i];
|
||||
d_free(buf);
|
||||
p = word + mem/2;
|
||||
}
|
||||
return word;
|
||||
}
|
||||
|
||||
char* splitword(char *s, char splitchar)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: strutil.c,v 1.10 2004-08-01 13:28:32 schaffner Exp $ */
|
||||
/* $Id: strutil.c,v 1.11 2004-08-06 20:28:57 schaffner Exp $ */
|
||||
/*
|
||||
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||
|
@ -27,7 +27,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#ifdef macintosh
|
||||
// string compare without regard to case
|
||||
|
||||
int stricmp( char *s1, char *s2 )
|
||||
int stricmp( const char *s1, const char *s2 )
|
||||
{
|
||||
while( *s1 && *s2 ) {
|
||||
if ( tolower(*s1) != tolower(*s2) ) return 1;
|
||||
|
@ -38,7 +38,7 @@ int stricmp( char *s1, char *s2 )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int strnicmp( char *s1, char *s2, int n )
|
||||
int strnicmp( const char *s1, const char *s2, int n )
|
||||
{
|
||||
while( *s1 && *s2 && n) {
|
||||
if ( tolower(*s1) != tolower(*s2) ) return 1;
|
||||
|
|
Loading…
Reference in a new issue