MCPcopy Create free account
hub / github.com/audacity/audacity / output_c_string

Function output_c_string

lib-src/sqlite/shell.c:11731–11757  ·  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

11729** Output the given string as a quoted according to C or TCL quoting rules.
11730*/
11731static void output_c_string(FILE *out, const char *z){
11732 unsigned int c;
11733 fputc('"', out);
11734 while( (c = *(z++))!=0 ){
11735 if( c=='\\' ){
11736 fputc(c, out);
11737 fputc(c, out);
11738 }else if( c=='"' ){
11739 fputc('\\', out);
11740 fputc('"', out);
11741 }else if( c=='\t' ){
11742 fputc('\\', out);
11743 fputc('t', out);
11744 }else if( c=='\n' ){
11745 fputc('\\', out);
11746 fputc('n', out);
11747 }else if( c=='\r' ){
11748 fputc('\\', out);
11749 fputc('r', out);
11750 }else if( !isprint(c&0xff) ){
11751 raw_printf(out, "\\%03o", c&0xff);
11752 }else{
11753 fputc(c, out);
11754 }
11755 }
11756 fputc('"', out);
11757}
11758
11759/*
11760** 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