#include #include #include void foo(void) { write(2, "Hello world!\n", 13); } int main(void) { // One of the comments must be present in the main function char *src = "#include \n#include \n#include \n\nvoid\nfoo(void)\n{\n\twrite(2, \"Hello world!\\n\", 13);\n}\n\nint\nmain(void)\n{\n\t// One of the comments must be present in the main function\n\tchar\t*src = \"$\";\n\tchar\tbuff[1024];\n\tsize_t\tlen = 0;\n\tsize_t\tbuff_max = sizeof(buff) - 1;\n\tfor (size_t i = 0; src[i]; ++i)\n\t{\n\t\tif (36 == src[i])\n\t\t{\n\t\t\tfor (size_t j = 0; src[j]; ++j)\n\t\t\t{\n\t\t\t\tif (len + 2 > buff_max) { write(1, buff, len); len = 0; }\n\t\t\t\tswitch (src[j])\n\t\t\t\t{\n\t\t\t\t\tcase 10:\tmemcpy(buff + len, \"\\\\n\", 2); len += 2; break;\n\t\t\t\t\tcase 9:\t\tmemcpy(buff + len, \"\\\\t\", 2); len += 2; break;\n\t\t\t\t\tcase '\\\\':\tmemcpy(buff + len, \"\\\\\\\\\", 2); len += 2; break;\n\t\t\t\t\tcase '\"':\tmemcpy(buff + len, \"\\\\\\\"\", 2); len += 2; break;\n\t\t\t\t\tdefault:\tbuff[len++] = src[j]; break;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (len + 1 > buff_max) { write(1, buff, len); len = 0; }\n\t\t\tbuff[len++] = src[i];\n\t\t}\n\t}\n\tif (len > 0) write(1, buff, len);\n\n\tfoo();\n\treturn 0;\n}\n// One of the comments must be present outside of your program.\n"; char buff[1024]; size_t len = 0; size_t buff_max = sizeof(buff) - 1; for (size_t i = 0; src[i]; ++i) { if (36 == src[i]) { for (size_t j = 0; src[j]; ++j) { if (len + 2 > buff_max) { write(1, buff, len); len = 0; } switch (src[j]) { case 10: memcpy(buff + len, "\\n", 2); len += 2; break; case 9: memcpy(buff + len, "\\t", 2); len += 2; break; case '\\': memcpy(buff + len, "\\\\", 2); len += 2; break; case '"': memcpy(buff + len, "\\\"", 2); len += 2; break; default: buff[len++] = src[j]; break; } } } else { if (len + 1 > buff_max) { write(1, buff, len); len = 0; } buff[len++] = src[i]; } } if (len > 0) write(1, buff, len); foo(); return 0; } // One of the comments must be present outside of your program.