aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/sledjchisl/sledjchisl.c
diff options
context:
space:
mode:
authoronefang2020-03-17 20:55:55 +1000
committeronefang2020-03-17 20:55:55 +1000
commit99b519b4e02f24e83f1c6549e9977614fc76e27a (patch)
treee2388733011ff67ce46fa51d0166689d5868a333 /src/sledjchisl/sledjchisl.c
parentMove the tmux check until after we have loaded the config and paths. (diff)
downloadopensim-SC-99b519b4e02f24e83f1c6549e9977614fc76e27a.zip
opensim-SC-99b519b4e02f24e83f1c6549e9977614fc76e27a.tar.gz
opensim-SC-99b519b4e02f24e83f1c6549e9977614fc76e27a.tar.bz2
opensim-SC-99b519b4e02f24e83f1c6549e9977614fc76e27a.tar.xz
Various other shuffles and clean ups.
Diffstat (limited to '')
-rw-r--r--src/sledjchisl/sledjchisl.c40
1 files changed, 23 insertions, 17 deletions
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(
79 79
80 80
81 81
82
83// Duplicate some small amount of code from qlibc, coz / and = are not good choices, and the standard says we can pick those. 82// Duplicate some small amount of code from qlibc, coz / and = are not good choices, and the standard says we can pick those.
84/** 83/**
85 * Encode data using BASE64 algorithm. 84 * Encode data using BASE64 algorithm.
@@ -4324,6 +4323,12 @@ void sledjchisl_main(void)
4324 int status, result, i; 4323 int status, result, i;
4325 void *vd; 4324 void *vd;
4326 4325
4326 I("libfcgi version: %s", FCGI_VERSION);
4327 I("Lua version: %s", LUA_RELEASE);
4328 I("LuaJIT version: %s", LUAJIT_VERSION);
4329 I("MariaDB / MySQL client version: %s", mysql_get_client_info());
4330 I("toybox version: %s", TOYBOX_VERSION);
4331
4327 pwd = getcwd(0, 0); 4332 pwd = getcwd(0, 0);
4328 4333
4329 if (-1 == fstat(STDIN_FILENO, &statbuf)) 4334 if (-1 == fstat(STDIN_FILENO, &statbuf))
@@ -4334,14 +4339,14 @@ void sledjchisl_main(void)
4334 } 4339 }
4335 else 4340 else
4336 { 4341 {
4337 if (S_ISREG (statbuf.st_mode)) D("regular file"); 4342 if (S_ISREG (statbuf.st_mode)) D("STDIN is a regular file.");
4338 else if (S_ISDIR (statbuf.st_mode)) D("directory"); 4343 else if (S_ISDIR (statbuf.st_mode)) D("STDIN is a directory.");
4339 else if (S_ISCHR (statbuf.st_mode)) D("character device"); 4344 else if (S_ISCHR (statbuf.st_mode)) D("STDIN is a character device.");
4340 else if (S_ISBLK (statbuf.st_mode)) D("block device"); 4345 else if (S_ISBLK (statbuf.st_mode)) D("STDIN is a block device.");
4341 else if (S_ISFIFO(statbuf.st_mode)) D("FIFO (named pipe)"); 4346 else if (S_ISFIFO(statbuf.st_mode)) D("STDIN is a FIFO (named pipe).");
4342 else if (S_ISLNK (statbuf.st_mode)) D("symbolic link"); 4347 else if (S_ISLNK (statbuf.st_mode)) D("STDIN is a symbolic link.");
4343 else if (S_ISSOCK(statbuf.st_mode)) D("socket"); 4348 else if (S_ISSOCK(statbuf.st_mode)) D("STDIN is a socket.");
4344 else D("unknown file descriptor type"); 4349 else D("STDIN is a unknown file descriptor type.");
4345 if (!S_ISCHR(statbuf.st_mode)) 4350 if (!S_ISCHR(statbuf.st_mode))
4346 isWeb = TRUE; 4351 isWeb = TRUE;
4347 } 4352 }
@@ -4985,18 +4990,18 @@ fcgiDone:
4985 scUser, Tcmd, scRun, Tsocket, Tconsole, Ttab, Tconsole, scRoot); 4990 scUser, Tcmd, scRun, Tsocket, Tconsole, Ttab, Tconsole, scRoot);
4986 i = system(toybuf); 4991 i = system(toybuf);
4987 if (!WIFEXITED(i)) 4992 if (!WIFEXITED(i))
4988 E("tmux new-session command failed!"); 4993 E("tmux new-session command failed! %s", toybuf);
4989 } 4994 }
4990 // Join the session. 4995 // Join the session.
4991 memset(toybuf, 0, sizeof(toybuf)); 4996 memset(toybuf, 0, sizeof(toybuf));
4992 snprintf(toybuf, sizeof(toybuf), "%s %s/%s select-window -t '%s' \\; attach-session -t '%s'", Tcmd, scRun, Tsocket, Tconsole, Tconsole); 4997 snprintf(toybuf, sizeof(toybuf), "%s %s/%s select-window -t '%s' \\; attach-session -t '%s'", Tcmd, scRun, Tsocket, Tconsole, Tconsole);
4993 i = system(toybuf); 4998 i = system(toybuf);
4994 if (!WIFEXITED(i)) 4999 if (!WIFEXITED(i))
4995 E("tmux attach-session command failed!"); 5000 E("tmux attach-session command failed! %s", toybuf);
4996 goto finished; 5001 goto finished;
4997 } 5002 }
4998 else 5003 else
4999 E("tmux list-sessions command failed!"); 5004 E("tmux list-sessions command failed! %s", toybuf);
5000 } 5005 }
5001 5006
5002 5007
@@ -5128,16 +5133,18 @@ fcgiDone:
5128 5133
5129 lua_pop(L, 1); // Take the returned value out of the stack 5134 lua_pop(L, 1); // Take the returned value out of the stack
5130 5135
5136
5137finished:
5138
5131 // An example of calling a toy directly. 5139 // An example of calling a toy directly.
5132// printf("\n\n"); 5140 printf("\n\n");
5133// char *argv[] = {"ls", "-l", "-a", NULL}; 5141 char *argv[] = {"ls", "-l", "-a", NULL};
5134// printf("%d\n", runToy(argv)); 5142 printf("%d\n", runToy(argv));
5135 5143
5136 5144
5137 puts(""); 5145 puts("");
5138 fflush(stdout); 5146 fflush(stdout);
5139 5147
5140finished:
5141 if (database) mysql_close(database); 5148 if (database) mysql_close(database);
5142 mysql_library_end(); 5149 mysql_library_end();
5143 lua_close(L); 5150 lua_close(L);
@@ -5147,5 +5154,4 @@ finished:
5147 free(stats); 5154 free(stats);
5148 } 5155 }
5149 if (configs) configs->free(configs); 5156 if (configs) configs->free(configs);
5150// return EXIT_SUCCESS;
5151} 5157}