X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Ffmt_scan.c;h=6cfc17657d02291b100412022256a221d542ee64;hp=1f55a65105410a5cc9dab5557faf4fb82983e817;hb=4112940aea5591648b03a81907408752c08b33aa;hpb=db62cda50055368e5f4ac51df787053f70706c30 diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index 1f55a65..6cfc176 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -14,6 +14,8 @@ #include #include #include +#include +#include #ifdef HAVE_SYS_TIME_H # include @@ -322,7 +324,7 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat) cptrimmed(&cp, str, fmt->f_width, fmt->f_fill, ep - cp); break; case FT_STRFW: - adios(NULL, "internal error (FT_STRFW)"); + adios(EX_SOFTWARE, NULL, "internal error (FT_STRFW)"); case FT_NUM: n = snprintf(cp, ep - cp + 1, "%d", value); @@ -686,32 +688,10 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat) /* UNQUOTEs RFC-2822 quoted-string and quoted-pair */ case FT_LS_UNQUOTE: if (str) { - int m; strncpy(buffer, str, sizeof(buffer)); /* strncpy doesn't NUL-terminate if it fills the buffer */ buffer[sizeof(buffer)-1] = '\0'; - str = buffer; - - /* we will parse from buffer to buffer2 */ - n = 0; /* n is the input position in str */ - m = 0; /* m is the ouput position in buffer2 */ - - while ( str[n] != '\0') { - switch ( str[n] ) { - case '\\': - n++; - if ( str[n] != '\0') - buffer2[m++] = str[n++]; - break; - case '"': - n++; - break; - default: - buffer2[m++] = str[n++]; - break; - } - } - buffer2[m] = '\0'; + unquote_string(buffer, buffer2); str = buffer2; } break; @@ -774,7 +754,7 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat) indent = strlen(sp); wid -= indent; if (wid <= 0) { - adios(NULL, "putaddr -- num register (%d) " + adios(EX_SOFTWARE, NULL, "putaddr -- num register (%d) " "must be greater than label " "width (%d)", value, indent); }