Increased the diesel parser stringlength

This commit is contained in:
Michiel Broek 2005-02-03 20:44:17 +00:00
parent 7d2e269c05
commit 9f38169b56
3 changed files with 32 additions and 29 deletions

View File

@ -7,6 +7,9 @@ v0.71.2 16-Jan-2005
Changed rfc-2045 name x-mac to mac. Changed x-ibmpc to cp437. Changed rfc-2045 name x-mac to mac. Changed x-ibmpc to cp437.
This allows rfc mime headers to show official names. This allows rfc mime headers to show official names.
libdiesel.a:
Changed the maximum string length from 2560 to 4096 characters.
mbcico: mbcico:
Added protection during binkp receive for zero bytes compressed Added protection during binkp receive for zero bytes compressed
data frames, this will case uncompress error -5 because zero data frames, this will case uncompress error -5 because zero

View File

@ -24,7 +24,7 @@ int tracing = TRUE; /* Trace macro evalution */
/* Local variables. */ /* Local variables. */
#define MAXARGS 10 /* Maximum arguments to a macro */ #define MAXARGS 10 /* Maximum arguments to a macro */
#define MAXSTR 2560 /* Maximum string length */ #define MAXSTR 4096 /* Maximum string length */ /* Was 2560 */
#define MAXDEPTH 32 /* Maximum recursion depth for eval */ #define MAXDEPTH 32 /* Maximum recursion depth for eval */
#define MACROCHAR '@' /* Macro trigger character */ #define MACROCHAR '@' /* Macro trigger character */

View File

@ -4,7 +4,7 @@
* Purpose ...............: MBSE BBS functions for TURBODIESEL * Purpose ...............: MBSE BBS functions for TURBODIESEL
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -38,48 +38,48 @@ static int firstrandom = TRUE;
void MacroVars( const char *codes, const char *fmt, ...) void MacroVars( const char *codes, const char *fmt, ...)
{ {
char *tmp1, *tmp2; char *tmp1, *tmp2, *vs, vc;
va_list ap; va_list ap;
int j; int j, dieselrc, vd;
int dieselrc; double vf;
char *vs;
int vd;
char vc;
double vf;
tmp1=calloc(MAXSTR, sizeof(char)); tmp1 = calloc(MAXSTR, sizeof(char));
tmp2=calloc(MAXSTR, sizeof(char)); tmp2 = calloc(MAXSTR, sizeof(char));
va_start(ap,fmt); va_start(ap,fmt);
for ( j=0; (codes[j] != '\0') && (fmt[j] != '\0') ; j++ ){ for (j = 0; (codes[j] != '\0') && (fmt[j] != '\0') ; j++ ){
tmp1[0]='\0'; tmp1[0] = '\0';
switch(fmt[j]) { switch (fmt[j]) {
case 's': /* string */ case 's': /* string */
vs = va_arg(ap, char *); vs = va_arg(ap, char *);
sprintf(tmp1,"@(setvar,%c,\"%s\")",codes[j],vs); sprintf(tmp1,"@(setvar,%c,\"%s\")",codes[j],vs);
break; break;
case 'd': /* int */ case 'd': /* int */
vd = va_arg(ap, int); vd = va_arg(ap, int);
sprintf(tmp1,"@(setvar,%c,%d)",codes[j],vd); sprintf(tmp1,"@(setvar,%c,%d)",codes[j],vd);
break; break;
case 'c': /* char */ case 'c': /* char */
vc = va_arg(ap, int); vc = va_arg(ap, int);
sprintf(tmp1,"@(setvar,%c,%c)",codes[j],vc); sprintf(tmp1,"@(setvar,%c,%c)",codes[j],vc);
break; break;
case 'f': /* char */ case 'f': /* char */
vf = va_arg(ap, double); vf = va_arg(ap, double);
sprintf(tmp1,"@(setvar,%c,%f)",codes[j],vf); sprintf(tmp1,"@(setvar,%c,%f)",codes[j],vf);
break; break;
} }
dieselrc=diesel(tmp1,tmp2); dieselrc = diesel(tmp1,tmp2);
if (dieselrc) { if (dieselrc) {
Syslog('!', "MacroVars error %d argument %d, macro %c type %c", dieselrc, j, codes[j], fmt[j]); Syslog('!', "MacroVars error %d argument %d, macro %c type %c", dieselrc, j, codes[j], fmt[j]);
} if (fmt[j] == 's')
} Syslogp('!', printable(va_arg(ap, char *), 0));
va_end(ap); Syslogp('!', printable(tmp1, 0));
Syslogp('!', printable(tmp2, 0));
}
}
va_end(ap);
free(tmp1); free(tmp1);
free(tmp2); free(tmp2);
} }