From f71f6dd653fb47346935e3b060822acb9aab8401 Mon Sep 17 00:00:00 2001 From: Martin Schaffner Date: Fri, 6 Aug 2004 20:28:57 +0000 Subject: [PATCH] d2x can now handle any line ending when reading d2x.ini --- ChangeLog | 15 ++++++++++----- include/strio.h | 2 +- include/strutil.h | 6 +++--- misc/args.c | 6 +++--- misc/strio.c | 48 ++++++++++++++++++++++------------------------- misc/strutil.c | 6 +++--- 6 files changed, 42 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0536ae6b..c98df414 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,17 @@ -2004-07-22 Chris Taylor +2004-08-06 Chris Taylor - * 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 +2004-08-04 Chris Taylor - * 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 +2004-08-02 Martin Schaffner + + * include/pstypes.h: Now, I correctly applied Chris Taylor's patch + +2004-08-01 Chris Taylor * 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, diff --git a/include/strio.h b/include/strio.h index a81bc483..175c5560 100644 --- a/include/strio.h +++ b/include/strio.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 diff --git a/include/strutil.h b/include/strutil.h index e0f3a7ae..cb90721f 100644 --- a/include/strutil.h +++ b/include/strutil.h @@ -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 # define stricmp(a,b) strcasecmp(a,b) diff --git a/misc/args.c b/misc/args.c index 84c7dc6c..f19e3086 100644 --- a/misc/args.c +++ b/misc/args.c @@ -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 @@ -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); diff --git a/misc/strio.c b/misc/strio.c index 4727e71b..d90989be 100644 --- a/misc/strio.c +++ b/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 +#include #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