*** mimetex.c 2004-03-02 05:27:33.000000000 +0800 --- mimetex.c.moodle 2004-03-07 13:31:02.000000000 +0800 *************** *** 1283,1290 **** /* --- underbrace, overbrace request --- */ case UNDERBRACE: case OVERBRACE: ! if ( accent == UNDERBRACE ) strcpy(brace,"}"); /* start with } brace */ ! if ( accent == OVERBRACE ) strcpy(brace,"{"); /* start with { brace */ if ( (accsp=get_delim(brace,width,CMEX10)) /* use width for height */ != NULL ) /* found desired brace */ { rp = rastrot(accsp->image); /* rotate 90 degrees clockwise */ --- 1283,1290 ---- /* --- underbrace, overbrace request --- */ case UNDERBRACE: case OVERBRACE: ! if ( accent == UNDERBRACE ) strncpy(brace,"}",16); /* start with } brace */ ! if ( accent == OVERBRACE ) strncpy(brace,"{",16); /* start with { brace */ if ( (accsp=get_delim(brace,width,CMEX10)) /* use width for height */ != NULL ) /* found desired brace */ { rp = rastrot(accsp->image); /* rotate 90 degrees clockwise */ *************** *** 1292,1298 **** break; /* --- hat request --- */ case HATACCENT: ! if ( accent == HATACCENT ) strcpy(brace,"<"); /* start with < */ if ( (accsp=get_delim(brace,width,CMEX10)) /* use width for height */ != NULL ) /* found desired brace */ { rp = rastrot(accsp->image); /* rotate 90 degrees clockwise */ --- 1292,1298 ---- break; /* --- hat request --- */ case HATACCENT: ! if ( accent == HATACCENT ) strncpy(brace,"<",16); /* start with < */ if ( (accsp=get_delim(brace,width,CMEX10)) /* use width for height */ != NULL ) /* found desired brace */ { rp = rastrot(accsp->image); /* rotate 90 degrees clockwise */ *************** *** 2725,2731 **** else /* check against caller's symbol */ if ( family<0 || symdefs[idef].family == family ) /*if in caller's family*/ { ! strcpy(lcsymbol,symdefs[idef].symbol); /*local copy of symdefs[] symbol*/ if ( 0 ) /* don't ignore case */ for ( symptr=lcsymbol; *symptr!='\000'; symptr++ ) /*for each symbol ch*/ if ( isalpha(*symptr) ) *symptr=tolower(*symptr); /*lowercase the char*/ --- 2725,2731 ---- else /* check against caller's symbol */ if ( family<0 || symdefs[idef].family == family ) /*if in caller's family*/ { ! strncpy(lcsymbol,symdefs[idef].symbol,99); /*local copy of symdefs[] symbol*/ if ( 0 ) /* don't ignore case */ for ( symptr=lcsymbol; *symptr!='\000'; symptr++ ) /*for each symbol ch*/ if ( isalpha(*symptr) ) *symptr=tolower(*symptr); /*lowercase the char*/ *************** *** 3327,3333 **** *size = (isdelta? *size+sizevalue : sizevalue); /* so reset size */ /* --- finally, set flag and shift size parameter out of preamble --- */ issize = 1; /* set flag showing size present */ ! if ( comma != NULL ) strcpy(pretext,comma+1);/*leading size param gone*/ } /* --- end-of-if(comma!=NULL||etc) --- */ /* --- copy any preamble params following size to caller's subexpr --- */ if ( comma != NULL || !issize ) /*preamb contains params past size*/ --- 3327,3333 ---- *size = (isdelta? *size+sizevalue : sizevalue); /* so reset size */ /* --- finally, set flag and shift size parameter out of preamble --- */ issize = 1; /* set flag showing size present */ ! if ( comma != NULL ) strncpy(pretext,comma+1,512);/*leading size param gone*/ } /* --- end-of-if(comma!=NULL||etc) --- */ /* --- copy any preamble params following size to caller's subexpr --- */ if ( comma != NULL || !issize ) /*preamb contains params past size*/ *************** *** 5978,5984 **** *pream = '\000'; /* init preamble as empty string */ if ( (putptr=strchr(putexpr,'$')) != NULL ) /*check for $ pream terminator*/ { *putptr++ = '\000'; /* replace $ by '\0', bump past $ */ ! strcpy(pream,putexpr); } /* copy leading preamble from put */ else /* look for any non-digit preamble */ { for ( preptr=pream,putptr=putexpr; ; putptr++ ) if ( *putptr == '\000' /* end-of-putdata signalled */ --- 5978,5984 ---- *pream = '\000'; /* init preamble as empty string */ if ( (putptr=strchr(putexpr,'$')) != NULL ) /*check for $ pream terminator*/ { *putptr++ = '\000'; /* replace $ by '\0', bump past $ */ ! strncpy(pream,putexpr,64); } /* copy leading preamble from put */ else /* look for any non-digit preamble */ { for ( preptr=pream,putptr=putexpr; ; putptr++ ) if ( *putptr == '\000' /* end-of-putdata signalled */ *************** *** 7275,7281 **** * ------------------------------------------------------------------- */ if ( query != NULL ) /* check query string from environ */ if ( strlen(query) >= 1 ) /* caller gave us a query string */ ! { strcpy(expression,query); /* so use it as expression */ isquery = 1; } /* and set isquery flag */ /* --- * process command-line input args (if not a query) --- 7275,7281 ---- * ------------------------------------------------------------------- */ if ( query != NULL ) /* check query string from environ */ if ( strlen(query) >= 1 ) /* caller gave us a query string */ ! { strncpy(expression,query,16385); /* so use it as expression */ isquery = 1; } /* and set isquery flag */ /* --- * process command-line input args (if not a query) *************** *** 7320,7326 **** && infilearg <= 0 ) /* and not given in input file */ if ( !isquery /* no conflict if no query_string */ || nswitches > 0 ) /* explicit -switch(es) also given */ ! { strcpy(expression,argv[exprarg]); /* expression from command-line */ isquery = 0; } /* and not from a query_string */ /* --- * read input file for expression --- 7320,7326 ---- && infilearg <= 0 ) /* and not given in input file */ if ( !isquery /* no conflict if no query_string */ || nswitches > 0 ) /* explicit -switch(es) also given */ ! { strncpy(expression,argv[exprarg],16385); /* expression from command-line */ isquery = 0; } /* and not from a query_string */ /* --- * read input file for expression *************** *** 7344,7350 **** if ( !memcmp(expression,"formdata",8) ) /*must be */ { char *delim=strchr(expression,'='); /* find equal following formdata */ if ( delim != (char *)NULL ) /* found unescaped equal sign */ ! strcpy(expression,delim+1); /* so shift name= out of expression*/ while ( (delim=strchr(expression,'+')) != NULL ) /*unescaped plus sign*/ *delim = ' '; /* is "shorthand" for blank space */ unescape_url(expression,1); /* convert unescaped %xx's to chars */ --- 7344,7350 ---- if ( !memcmp(expression,"formdata",8) ) /*must be */ { char *delim=strchr(expression,'='); /* find equal following formdata */ if ( delim != (char *)NULL ) /* found unescaped equal sign */ ! strncpy(expression,delim+1,16385); /* so shift name= out of expression*/ while ( (delim=strchr(expression,'+')) != NULL ) /*unescaped plus sign*/ *delim = ' '; /* is "shorthand" for blank space */ unescape_url(expression,1); /* convert unescaped %xx's to chars */ *************** *** 7363,7376 **** if ( delim != (char *)NULL ) /* check that we found delim */ { *delim = '\000'; /* replace delim with null */ msglevel = atoi(expression+9); /* interpret ### in msglevel###$ */ ! strcpy(expression,delim+1); } } /* shift out prefix and delim */ /* --- next check for logfile=xxx$ prefix (must follow msglevel) --- */ if ( !memcmp(expression,"logfile=",8) ) /* query has logfile= prefix */ { char *delim=strchr(expression,'$'); /* find $ delim following logfile=*/ if ( delim != (char *)NULL ) /* check that we found delim */ { *delim = '\000'; /* replace delim with null */ ! strcpy(logfile,expression+8); /* interpret xxx in logfile=xxx$ */ ! strcpy(expression,delim+1); } } /* shift out prefix and delim */ } /* --- end-of-if(isquery) --- */ /* --- * log query (e.g., for debugging) --- 7363,7376 ---- if ( delim != (char *)NULL ) /* check that we found delim */ { *delim = '\000'; /* replace delim with null */ msglevel = atoi(expression+9); /* interpret ### in msglevel###$ */ ! strncpy(expression,delim+1,16385); } } /* shift out prefix and delim */ /* --- next check for logfile=xxx$ prefix (must follow msglevel) --- */ if ( !memcmp(expression,"logfile=",8) ) /* query has logfile= prefix */ { char *delim=strchr(expression,'$'); /* find $ delim following logfile=*/ if ( delim != (char *)NULL ) /* check that we found delim */ { *delim = '\000'; /* replace delim with null */ ! strncpy(logfile,expression+8,255); /* interpret xxx in logfile=xxx$ */ ! strncpy(expression,delim+1,16385); } } /* shift out prefix and delim */ } /* --- end-of-if(isquery) --- */ /* --- * log query (e.g., for debugging) *************** *** 7587,7593 **** initialization -------------------------------------------------------------------------- */ /* --- copy string and lowercase it if case-insensitive --- */ ! strcpy(stringcp,string); /* local copy of string */ if ( !iscase ) /* want case-insensitive compares */ for ( cp=stringcp; *cp != '\000'; cp++ ) /* so for each string char */ if ( isupper(*cp) ) *cp = tolower(*cp); /*lowercase any uppercase chars*/ --- 7587,7593 ---- initialization -------------------------------------------------------------------------- */ /* --- copy string and lowercase it if case-insensitive --- */ ! strncpy(stringcp,string,999); /* local copy of string */ if ( !iscase ) /* want case-insensitive compares */ for ( cp=stringcp; *cp != '\000'; cp++ ) /* so for each string char */ if ( isupper(*cp) ) *cp = tolower(*cp); /*lowercase any uppercase chars*/ *************** *** 7599,7605 **** /* --- extract next snippet --- */ if ( (delimptr = strchr(snipptr,delim)) /* locate next comma delim */ == NULL ) /*not found following last snippet*/ ! { strcpy(snip,snipptr); /* local copy of last snippet */ snipptr = NULL; } /* signal end-of-string */ else /* snippet ends just before delim */ { int sniplen = (int)(delimptr-snipptr) - 1; /* #chars in snippet */ --- 7599,7605 ---- /* --- extract next snippet --- */ if ( (delimptr = strchr(snipptr,delim)) /* locate next comma delim */ == NULL ) /*not found following last snippet*/ ! { strncpy(snip,snipptr,99); /* local copy of last snippet */ snipptr = NULL; } /* signal end-of-string */ else /* snippet ends just before delim */ { int sniplen = (int)(delimptr-snipptr) - 1; /* #chars in snippet */