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

Function process_sqliterc

lib-src/sqlite/shell.c:20811–20845  ·  view source on GitHub ↗

** Read input from the file given by sqliterc_override. Or if that ** parameter is NULL, take input from ~/.sqliterc ** ** Returns the number of errors. */

Source from the content-addressed store, hash-verified

20809** Returns the number of errors.
20810*/
20811static void process_sqliterc(
20812 ShellState *p, /* Configuration data */
20813 const char *sqliterc_override /* Name of config file. NULL to use default */
20814){
20815 char *home_dir = NULL;
20816 const char *sqliterc = sqliterc_override;
20817 char *zBuf = 0;
20818 FILE *inSaved = p->in;
20819 int savedLineno = p->lineno;
20820
20821 if (sqliterc == NULL) {
20822 home_dir = find_home_dir(0);
20823 if( home_dir==0 ){
20824 raw_printf(stderr, "-- warning: cannot find home directory;"
20825 " cannot read ~/.sqliterc\n");
20826 return;
20827 }
20828 zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
20829 sqliterc = zBuf;
20830 }
20831 p->in = fopen(sqliterc,"rb");
20832 if( p->in ){
20833 if( stdin_is_interactive ){
20834 utf8_printf(stderr,"-- Loading resources from %s\n",sqliterc);
20835 }
20836 if( process_input(p) && bail_on_error ) exit(1);
20837 fclose(p->in);
20838 }else if( sqliterc_override!=0 ){
20839 utf8_printf(stderr,"cannot open: \"%s\"\n", sqliterc);
20840 if( bail_on_error ) exit(1);
20841 }
20842 p->in = inSaved;
20843 p->lineno = savedLineno;
20844 sqlite3_free(zBuf);
20845}
20846
20847/*
20848** Show available command line options

Callers 1

wmainFunction · 0.85

Calls 3

find_home_dirFunction · 0.85
utf8_printfFunction · 0.85
process_inputFunction · 0.85

Tested by

no test coverage detected