#include int main(int argc, char** argv) { char* literals; int val; /* Provide any parameter to percentify most any character */ if (argc == 1) literals = ",./':1234567890-=_+|!#$^abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n"; else literals = "/?=\n"; while ((val = fgetc(stdin)), !feof(stdin)) if (strchr(literals, val)) fputc(val, stdout); else fprintf(stdout, "%%%02X", val); return 0; }