X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/e2eebc77cc570f77d906bc0cc6890092068468cb..461317c8fb5ec758fd77d2d7450ca3cd94fc58c2:/sbr/fmt_scan.c diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index 97a4a05a..a47c170e 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -49,24 +49,14 @@ match (char *str, char *sub) char *s1, *s2; while ((c1 = *sub)) { - c1 = (isascii((unsigned char) c1) && isalpha((unsigned char) c1) && - isupper((unsigned char) c1)) ? tolower((unsigned char) c1) : c1; - while ((c2 = *str++) && c1 != ((isascii((unsigned char) c2) && - isalpha((unsigned char) c2) && - isupper((unsigned char) c2)) ? - tolower((unsigned char) c2) : c2)) + c1 = tolower((unsigned char)c1); + while ((c2 = *str++) && c1 != tolower((unsigned char)c2)) ; if (! c2) return 0; s1 = sub + 1; s2 = str; - while ((c1 = *s1++) && ((isascii((unsigned char) c1) && - isalpha((unsigned char) c1) && - isupper((unsigned char) c1)) ? - tolower(c1) : c1) == - ((isascii((unsigned char) (c2 =*s2++)) && - isalpha((unsigned char) c2) && - isupper((unsigned char) c2)) ? - tolower((unsigned char) c2) : c2)) + while ((c1 = *s1++) && + tolower((unsigned char)c1) == tolower((unsigned char)(c2 = *s2++))) ; if (! c1) return 1; @@ -696,7 +686,8 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat, if (str) { char *xp; - strncpy(buffer, str, sizeof(buffer)); + if (str != buffer) + strncpy(buffer, str, sizeof(buffer)); buffer[sizeof(buffer)-1] = '\0'; str = buffer; while (isspace((unsigned char) *str)) @@ -745,6 +736,9 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat, case FT_LV_MINUS_L: value = fmt->f_value - value; break; + case FT_LV_MULTIPLY_L: + value *= fmt->f_value; + break; case FT_LV_DIVIDE_L: if (fmt->f_value) value = value / fmt->f_value; @@ -886,7 +880,8 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat, goto unfriendly; if ((str = mn->m_pers) == NULL) { if ((str = mn->m_note)) { - strncpy (buffer, str, sizeof(buffer)); + if (str != buffer) + strncpy (buffer, str, sizeof(buffer)); buffer[sizeof(buffer)-1] = '\0'; str = buffer; if (*str == '(') @@ -930,7 +925,8 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat, /* UNQUOTEs RFC-2822 quoted-string and quoted-pair */ case FT_LS_UNQUOTE: if (str) { - strncpy(buffer, str, sizeof(buffer)); + if (str != buffer) + strncpy(buffer, str, sizeof(buffer)); /* strncpy doesn't NUL-terminate if it fills the buffer */ buffer[sizeof(buffer)-1] = '\0'; unquote_string(buffer, buffer2); @@ -1179,5 +1175,5 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat, } } - return ((struct format *)0); + return (NULL); }