From 99b519b4e02f24e83f1c6549e9977614fc76e27a Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 17 Mar 2020 20:55:55 +1000 Subject: Various other shuffles and clean ups. --- src/sledjchisl/sledjchisl.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 800a224..765c987 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -79,7 +79,6 @@ GLOBALS( - // Duplicate some small amount of code from qlibc, coz / and = are not good choices, and the standard says we can pick those. /** * Encode data using BASE64 algorithm. @@ -4324,6 +4323,12 @@ void sledjchisl_main(void) int status, result, i; void *vd; + I("libfcgi version: %s", FCGI_VERSION); + I("Lua version: %s", LUA_RELEASE); + I("LuaJIT version: %s", LUAJIT_VERSION); + I("MariaDB / MySQL client version: %s", mysql_get_client_info()); + I("toybox version: %s", TOYBOX_VERSION); + pwd = getcwd(0, 0); if (-1 == fstat(STDIN_FILENO, &statbuf)) @@ -4334,14 +4339,14 @@ void sledjchisl_main(void) } else { - if (S_ISREG (statbuf.st_mode)) D("regular file"); - else if (S_ISDIR (statbuf.st_mode)) D("directory"); - else if (S_ISCHR (statbuf.st_mode)) D("character device"); - else if (S_ISBLK (statbuf.st_mode)) D("block device"); - else if (S_ISFIFO(statbuf.st_mode)) D("FIFO (named pipe)"); - else if (S_ISLNK (statbuf.st_mode)) D("symbolic link"); - else if (S_ISSOCK(statbuf.st_mode)) D("socket"); - else D("unknown file descriptor type"); + if (S_ISREG (statbuf.st_mode)) D("STDIN is a regular file."); + else if (S_ISDIR (statbuf.st_mode)) D("STDIN is a directory."); + else if (S_ISCHR (statbuf.st_mode)) D("STDIN is a character device."); + else if (S_ISBLK (statbuf.st_mode)) D("STDIN is a block device."); + else if (S_ISFIFO(statbuf.st_mode)) D("STDIN is a FIFO (named pipe)."); + else if (S_ISLNK (statbuf.st_mode)) D("STDIN is a symbolic link."); + else if (S_ISSOCK(statbuf.st_mode)) D("STDIN is a socket."); + else D("STDIN is a unknown file descriptor type."); if (!S_ISCHR(statbuf.st_mode)) isWeb = TRUE; } @@ -4985,18 +4990,18 @@ fcgiDone: scUser, Tcmd, scRun, Tsocket, Tconsole, Ttab, Tconsole, scRoot); i = system(toybuf); if (!WIFEXITED(i)) - E("tmux new-session command failed!"); + E("tmux new-session command failed! %s", toybuf); } // Join the session. memset(toybuf, 0, sizeof(toybuf)); snprintf(toybuf, sizeof(toybuf), "%s %s/%s select-window -t '%s' \\; attach-session -t '%s'", Tcmd, scRun, Tsocket, Tconsole, Tconsole); i = system(toybuf); if (!WIFEXITED(i)) - E("tmux attach-session command failed!"); + E("tmux attach-session command failed! %s", toybuf); goto finished; } else - E("tmux list-sessions command failed!"); + E("tmux list-sessions command failed! %s", toybuf); } @@ -5128,16 +5133,18 @@ fcgiDone: lua_pop(L, 1); // Take the returned value out of the stack + +finished: + // An example of calling a toy directly. -// printf("\n\n"); -// char *argv[] = {"ls", "-l", "-a", NULL}; -// printf("%d\n", runToy(argv)); + printf("\n\n"); + char *argv[] = {"ls", "-l", "-a", NULL}; + printf("%d\n", runToy(argv)); puts(""); fflush(stdout); -finished: if (database) mysql_close(database); mysql_library_end(); lua_close(L); @@ -5147,5 +5154,4 @@ finished: free(stats); } if (configs) configs->free(configs); -// return EXIT_SUCCESS; } -- cgit v1.1