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

Function do_meta_command

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

** If an input line begins with "." then invoke this routine to ** process that line. ** ** Return 1 on error, 2 to exit, and 0 otherwise. */

Source from the content-addressed store, hash-verified

17541** Return 1 on error, 2 to exit, and 0 otherwise.
17542*/
17543static int do_meta_command(char *zLine, ShellState *p){
17544 int h = 1;
17545 int nArg = 0;
17546 int n, c;
17547 int rc = 0;
17548 char *azArg[52];
17549
17550#ifndef SQLITE_OMIT_VIRTUALTABLE
17551 if( p->expert.pExpert ){
17552 expertFinish(p, 1, 0);
17553 }
17554#endif
17555
17556 /* Parse the input line into tokens.
17557 */
17558 while( zLine[h] && nArg<ArraySize(azArg)-1 ){
17559 while( IsSpace(zLine[h]) ){ h++; }
17560 if( zLine[h]==0 ) break;
17561 if( zLine[h]=='\'' || zLine[h]=='"' ){
17562 int delim = zLine[h++];
17563 azArg[nArg++] = &zLine[h];
17564 while( zLine[h] && zLine[h]!=delim ){
17565 if( zLine[h]=='\\' && delim=='"' && zLine[h+1]!=0 ) h++;
17566 h++;
17567 }
17568 if( zLine[h]==delim ){
17569 zLine[h++] = 0;
17570 }
17571 if( delim=='"' ) resolve_backslashes(azArg[nArg-1]);
17572 }else{
17573 azArg[nArg++] = &zLine[h];
17574 while( zLine[h] && !IsSpace(zLine[h]) ){ h++; }
17575 if( zLine[h] ) zLine[h++] = 0;
17576 resolve_backslashes(azArg[nArg-1]);
17577 }
17578 }
17579 azArg[nArg] = 0;
17580
17581 /* Process the input line.
17582 */
17583 if( nArg==0 ) return 0; /* no tokens, no error */
17584 n = strlen30(azArg[0]);
17585 c = azArg[0][0];
17586 clearTempFile(p);
17587
17588#ifndef SQLITE_OMIT_AUTHORIZATION
17589 if( c=='a' && strncmp(azArg[0], "auth", n)==0 ){
17590 if( nArg!=2 ){
17591 raw_printf(stderr, "Usage: .auth ON|OFF\n");
17592 rc = 1;
17593 goto meta_command_exit;
17594 }
17595 open_db(p, 0);
17596 if( booleanValue(azArg[1]) ){
17597 sqlite3_set_authorizer(p->db, shellAuth, p);
17598 }else{
17599 sqlite3_set_authorizer(p->db, 0, 0);
17600 }

Callers 2

process_inputFunction · 0.85
wmainFunction · 0.85

Calls 15

expertFinishFunction · 0.85
resolve_backslashesFunction · 0.85
strlen30Function · 0.85
clearTempFileFunction · 0.85
open_dbFunction · 0.85
booleanValueFunction · 0.85
arDotCommandFunction · 0.85
utf8_printfFunction · 0.85
close_dbFunction · 0.85
setBinaryModeFunction · 0.85
setTextModeFunction · 0.85
test_breakpointFunction · 0.85

Tested by

no test coverage detected