- while (isspace(buf[buflen-1])) {
- buf[buflen-1] = 0;
- buflen --;
- }
- soft_line_break = 0;
-
- while (buflen > 0) {
- if ((buf[0] == '=') && (buf[1] == '\0')) {
- soft_line_break = 1;
- buf[0] = '\0';
- buflen = 0;
- } else if ((buflen>=3) && (buf[0]=='=')) {
- sscanf(&buf[1], "%02x", &ch);
- decoded[decoded_length++] = ch;
- strcpy(buf, &buf[3]);
- buflen -=3;
- } else {
- decoded[decoded_length++] = buf[0];
- strcpy(buf, &buf[1]);
- buflen --;
- }
- }
- if (soft_line_break == 0) {
- decoded[decoded_length++] = '\r';
- decoded[decoded_length++] = '\n';
- }
- buf_length = 0;
- /*** end -- process one line ***/