Created
October 26, 2013 04:06
-
-
Save aji/7165161 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char *f="char *f=\"$\";\n" | |
"char buf[65536];\n" | |
"char in[65536];\n" | |
"char *sub_copy(char *b){\n" | |
"char *a=f;\n" | |
"for(;*a;a++)switch(*a){\n" | |
"case 10:*b++=92;*b++=110;*b++=34;*b++=10;*b++=34; break;\n" | |
"case 34:\n" | |
"case 92:*b++=92;\n" | |
"default:*b++=*a;\n" | |
"}return b;}\n" | |
"void copy_to_buf(void) {\n" | |
"char*a=f,*b=buf;\n" | |
"for(;*a;a++)switch(*a){\n" | |
"case 36:b=sub_copy(b); break;\n" | |
"default:*b++=*a;break;\n" | |
"}}\n" | |
"#include <stdio.h>\n" | |
"#include <string.h>\n" | |
"int main(int c,char *argv[]){\n" | |
"char *a;\n" | |
"copy_to_buf();\n" | |
"fread(in,1,65536,stdin);\n" | |
"printf(\"%smatch\\n\", strcmp(in,buf)?\"no \":\"\");\n" | |
"}\n" | |
""; | |
char buf[65536]; | |
char in[65536]; | |
char *sub_copy(char *b){ | |
char *a=f; | |
for(;*a;a++)switch(*a){ | |
case 10:*b++=92;*b++=110;*b++=34;*b++=10;*b++=34; break; | |
case 34: | |
case 92:*b++=92; | |
default:*b++=*a; | |
}return b;} | |
void copy_to_buf(void) { | |
char*a=f,*b=buf; | |
for(;*a;a++)switch(*a){ | |
case 36:b=sub_copy(b); break; | |
default:*b++=*a;break; | |
}} | |
#include <stdio.h> | |
#include <string.h> | |
int main(int c,char *argv[]){ | |
char *a; | |
copy_to_buf(); | |
fread(in,1,65536,stdin); | |
printf("%smatch\n", strcmp(in,buf)?"no ":""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That is quite amusing. Cheers for the chuckle :o)