All pastes #400561 Raw Edit

Untitled

public c v1 · immutable
·published 2007-03-18 19:37 UTC
rendered paste body
#include <stdio.h>#include <string.h>#define _GNU_SOURCE#include <strings.h>#define SIZE 8192/* * kill the first reference to the x-mac-ce content-type * * */int main(int argc, char *argv[]) {        char buf[SIZE];        int again = 1;        /*if ((buf = (char*)malloc(SIZE)) == NULL) {                return -1;        }*/        while (!feof(stdin)) {                if (fgets(buf, SIZE, stdin) == NULL)                        break;                if (again && (strncasecmp(buf, "Content-Type", strlen("Content-Type")) == 0)) {                        again = 0;                        if ((strcasestr(buf, "charset") != NULL)                                && (strcasestr(buf, "x-mac-ce") != NULL)) {                                /* filter out the header */                                fputs("Content-Type: text/plain\r\n"                                        "X-Content-Type-Converted: x-mac-ce nuked by pstros.basa.flaska.net\r\n", stdout);                        } else {                                fputs(buf, stdout);                        }                } else {                        fputs(buf, stdout);                }        }        return 0;}