MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / output_c_string

Function output_c_string

modules/dasSQLITE/sqlite/shell.c:16949–16975  ·  view source on GitHub ↗

** Output the given string as a quoted according to C or TCL quoting rules. */

Source from the content-addressed store, hash-verified

16947** Output the given string as a quoted according to C or TCL quoting rules.
16948*/
16949static 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.

Callers 3

shellAuthFunction · 0.85
shell_callbackFunction · 0.85
do_meta_commandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected