** Output the given string as a quoted according to C or TCL quoting rules. */
| 16947 | ** Output the given string as a quoted according to C or TCL quoting rules. |
| 16948 | */ |
| 16949 | static void output_c_string(FILE *out, const char *z){ |
| 16950 | unsigned int c; |
| 16951 | fputc('"', out); |
| 16952 | while( (c = *(z++))!=0 ){ |
| 16953 | if( c=='\\' ){ |
| 16954 | fputc(c, out); |
| 16955 | fputc(c, out); |
| 16956 | }else if( c=='"' ){ |
| 16957 | fputc('\\', out); |
| 16958 | fputc('"', out); |
| 16959 | }else if( c=='\t' ){ |
| 16960 | fputc('\\', out); |
| 16961 | fputc('t', out); |
| 16962 | }else if( c=='\n' ){ |
| 16963 | fputc('\\', out); |
| 16964 | fputc('n', out); |
| 16965 | }else if( c=='\r' ){ |
| 16966 | fputc('\\', out); |
| 16967 | fputc('r', out); |
| 16968 | }else if( !isprint(c&0xff) ){ |
| 16969 | raw_printf(out, "\\%03o", c&0xff); |
| 16970 | }else{ |
| 16971 | fputc(c, out); |
| 16972 | } |
| 16973 | } |
| 16974 | fputc('"', out); |
| 16975 | } |
| 16976 | |
| 16977 | /* |
| 16978 | ** Output the given string as a quoted according to JSON quoting rules. |
no outgoing calls
no test coverage detected