public static void main(String[] args) throws IOException { boolean ret = true; String[] leftedArgs = ginit(args); if(leftedArgs.length > 1) System.exit(1); else if(leftedArgs.length == 0) interactiveFlag = true; if(builtinTest != null) { System.exit(builtinTest(builtinTest)); } if(testScript != null) { System.exit(test(testScript)); } CTX konoha = open(); if(startupScript != null) { startup(konoha, startupScript); } if(leftedArgs.length == 1) { ret = load(konoha, leftedArgs[0]); } if(ret && (interactiveFlag != false)) { // TODO interactiveFlag to boolean? ret = kShell(konoha); } close(konoha); // MODGC_check_malloced_size() System.exit(ret ? assertResult : 1); }
public static void startup(CTX konoha, String startup_script) { String[] buf = new String[256]; String path = System.getenv("KONOHA_SCRIPTPATH"); String local = ""; if (path == null) { path = System.getenv("KONOHA_HOME"); local = "/script"; } if (path == null) { path = System.getenv("HOME"); local = "/.konoha/script"; } //TODO snprintf(buf, sizeof(buf), "%s%s%s.k", path, local, startup_script); if (true /*TODO load(konoha, (const char*)buf)*/ ) { System.exit(1); } }