| 77 | #define MAX_COLUMN 16000 |
| 78 | |
| 79 | static void print_query(FILE *out, const char *query) |
| 80 | { |
| 81 | const char *ptr= query; |
| 82 | int column= 0; |
| 83 | |
| 84 | fprintf(out, "\""); |
| 85 | while (*ptr) |
| 86 | { |
| 87 | if (column >= MAX_COLUMN) |
| 88 | { |
| 89 | /* Wrap to the next line, tabulated. */ |
| 90 | fprintf(out, "\"\n \""); |
| 91 | column= 2; |
| 92 | } |
| 93 | switch(*ptr) |
| 94 | { |
| 95 | case '\n': |
| 96 | /* |
| 97 | Preserve the \n character in the query text, |
| 98 | and wrap to the next line, tabulated. |
| 99 | */ |
| 100 | fprintf(out, "\\n\"\n \""); |
| 101 | column= 2; |
| 102 | break; |
| 103 | case '\r': |
| 104 | /* Skipped */ |
| 105 | break; |
| 106 | case '\"': |
| 107 | fprintf(out, "\\\""); |
| 108 | column+=2; |
| 109 | break; |
| 110 | case '\\': |
| 111 | fprintf(out, "\\\\"); |
| 112 | column+=2; |
| 113 | break; |
| 114 | default: |
| 115 | putc(*ptr, out); |
| 116 | column++; |
| 117 | break; |
| 118 | } |
| 119 | ptr++; |
| 120 | } |
| 121 | fprintf(out, "\\n\",\n"); |
| 122 | } |
| 123 | |
| 124 | static char query[MAX_BOOTSTRAP_QUERY_SIZE]; |
| 125 | |