aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/sledjchisl/sledjchisl.c
diff options
context:
space:
mode:
authoronefang2021-08-13 03:24:30 +1000
committeronefang2021-08-13 03:24:30 +1000
commitf14fca5a656b3f60042e309d45657a1948c06f6d (patch)
tree210f2bd0ea526f46b722909d217c41f7722c2b01 /src/sledjchisl/sledjchisl.c
parentClose everything on full stop. (diff)
downloadopensim-SC-f14fca5a656b3f60042e309d45657a1948c06f6d.zip
opensim-SC-f14fca5a656b3f60042e309d45657a1948c06f6d.tar.gz
opensim-SC-f14fca5a656b3f60042e309d45657a1948c06f6d.tar.bz2
opensim-SC-f14fca5a656b3f60042e309d45657a1948c06f6d.tar.xz
Actually use toybox option parsing, and combine last two name parts.
Diffstat (limited to '')
-rw-r--r--src/sledjchisl/sledjchisl.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c
index 0aa0bf2..9bbc63b 100644
--- a/src/sledjchisl/sledjchisl.c
+++ b/src/sledjchisl/sledjchisl.c
@@ -2,16 +2,14 @@
2 * 2 *
3 * Copyright 2020 David Seikel <sledjchisl@sledjhamr.org> 3 * Copyright 2020 David Seikel <sledjchisl@sledjhamr.org>
4 * Not in SUSv4. An entirely new invention, thus no web site either. 4 * Not in SUSv4. An entirely new invention, thus no web site either.
5 *
6 * Not using the usual taybox args system, coz it's not working as advertised.
7 5
8USE_SLEDJCHISL(NEWTOY(sledjchisl, "qia", TOYFLAG_USR|TOYFLAG_BIN)) 6USE_SLEDJCHISL(NEWTOY(sledjchisl, "?qma", TOYFLAG_USR|TOYFLAG_BIN))
9 7
10config SLEDJCHISL 8config SLEDJCHISL
11 bool "sledjchisl" 9 bool "sledjchisl"
12 default y 10 default y
13 help 11 help
14 usage: sledjchisl [-q] [-a] [mode [arguments]] 12 usage: sledjchisl [-qma] [mode [name]]
15 13
16 opensim-SC management system. 14 opensim-SC management system.
17 15
@@ -27,14 +25,15 @@ config SLEDJCHISL
27 Will start a sim or everything. 25 Will start a sim or everything.
28 -q when starting everything wont show the tmux console. 26 -q when starting everything wont show the tmux console.
29 backup 27 backup
30 backup -i 28 backup -m
31 backup -i "Joan Smith" 29 backup -m "Joan Smith"
32 backup Welcome 30 backup Welcome
33 backup Welcome.ini 31 backup Welcome.ini
34 backup Welcome.shini 32 backup Welcome.shini
35 backup "Welcome sim" 33 backup "Welcome sim"
36 Will backup sim or everything. 34 Will backup sim or everything.
37 gitar i "Joan Smith" 35 -m for a members inventory.
36 gitar m "Joan Smith"
38 gitar Welcome 37 gitar Welcome
39 gitar Welcome.ini 38 gitar Welcome.ini
40 gitar Welcome.shini 39 gitar Welcome.shini
@@ -62,6 +61,13 @@ config SLEDJCHISL
62*/ 61*/
63 62
64 63
64// Toybox's strend overrides another strend that causes MariaDB library to crash. Renaming it to tb_strend helps.
65// I deal with that by using a sed invokation when building toybox.
66#define FOR_sledjchisl
67#include "toys.h"
68
69GLOBALS(
70)
65 71
66/* 72/*
67 configs/sim01 - 73 configs/sim01 -
@@ -137,10 +143,6 @@ extern char **environ;
137#include "openssl/hmac.h" 143#include "openssl/hmac.h"
138#include <uuid/uuid.h> 144#include <uuid/uuid.h>
139 145
140// Toybox's strend overrides another strend that causes MariaDB library to crash. Renaming it to tb_strend helps.
141// I deal with that by using a sed invokation when building toybox.
142#include "toys.h"
143
144typedef enum 146typedef enum
145{ 147{
146 CREATE = 0, 148 CREATE = 0,
@@ -1806,7 +1808,7 @@ void doSimsThing(simData *simd, char *sim, char *type, int count, int window, in
1806 break; 1808 break;
1807 } 1809 }
1808 1810
1809 case BACKUP : // "backup -i 'onefang rejected'" "backup 'Welcome sim'" "backup Welcome.shini" "Welcome.shini backup" "backup Welcome.ini" "backup Welcome" "backup" backup everything 1811 case BACKUP : // "backup -m 'onefang rejected'" "backup 'Welcome sim'" "backup Welcome.shini" "Welcome.shini backup" "backup Welcome.ini" "backup Welcome" "backup" backup everything
1810 { // TODO - If it's not a sim code, and not a sim name, it's an account inventory. 1812 { // TODO - If it's not a sim code, and not a sim name, it's an account inventory.
1811 if (checkSimIsRunning(simd->tab)) 1813 if (checkSimIsRunning(simd->tab))
1812 { 1814 {
@@ -1843,7 +1845,7 @@ void doSimsThing(simData *simd, char *sim, char *type, int count, int window, in
1843 break; 1845 break;
1844 } 1846 }
1845 1847
1846 case GITAR : // "gitAR i name" "gitAR o name" 1848 case GITAR : // "gitAR -m avatar name" "gitAR sim name"
1847 { 1849 {
1848 break; 1850 break;
1849 } 1851 }
@@ -7651,7 +7653,7 @@ jit library is loaded or the JIT compiler will not be activated.
7651 E("tmux select-pane command failed!"); 7653 E("tmux select-pane command failed!");
7652 } 7654 }
7653 // toybox argument parsing is half working. 7655 // toybox argument parsing is half working.
7654 if ((NULL == toys.optargs[0]) || (('-' != toys.optargs[0][0]) && ('q' != toys.optargs[0][1]))) 7656 if (!FLAG(q))
7655 { 7657 {
7656 V("Joining the session."); 7658 V("Joining the session.");
7657 // Join the session. 7659 // Join the session.
@@ -7870,23 +7872,27 @@ jit library is loaded or the JIT compiler will not be activated.
7870 7872
7871 if (0 == toys.optc) 7873 if (0 == toys.optc)
7872 ; 7874 ;
7873 else if (strcmp(toys.optargs[0], "create") == 0)
7874 currentMode = CREATE;
7875 else if (strcmp(toys.optargs[0], "start") == 0)
7876 currentMode = START;
7877 else if (strcmp(toys.optargs[0], "backup") == 0) 7875 else if (strcmp(toys.optargs[0], "backup") == 0)
7878 currentMode = BACKUP; 7876 currentMode = BACKUP;
7877 else if (strcmp(toys.optargs[0], "create") == 0)
7878 currentMode = CREATE;
7879 else if (strcmp(toys.optargs[0], "gitar") == 0) 7879 else if (strcmp(toys.optargs[0], "gitar") == 0)
7880 currentMode = GITAR; 7880 currentMode = GITAR;
7881 else if (strcmp(toys.optargs[0], "restart") == 0)
7882 currentMode = RESTART;
7883 else if (strcmp(toys.optargs[0], "start") == 0)
7884 currentMode = START;
7881 else if (strcmp(toys.optargs[0], "status") == 0) 7885 else if (strcmp(toys.optargs[0], "status") == 0)
7882 currentMode = STATUS; 7886 currentMode = STATUS;
7883 else if (strcmp(toys.optargs[0], "stop") == 0) 7887 else if (strcmp(toys.optargs[0], "stop") == 0)
7884 currentMode = STOP; 7888 currentMode = STOP;
7885 else
7886 ourSims->target = toys.optargs[0];
7887 if (2 == toys.optc) 7889 if (2 == toys.optc)
7888 ourSims->target = toys.optargs[1]; 7890 ourSims->target = xstrdup(toys.optargs[1]);
7889//V("ARGS - %d %d %i |%s| %s |%s|", toys.optc, toys.optflags, currentMode, toys.optargs[0], toys.optargs[1], ourSims->target); 7891 else if (3 == toys.optc)
7892 ourSims->target = xmprintf("%s %s", toys.optargs[1], toys.optargs[2]);
7893 else
7894 ourSims->target = NULL;
7895V("Doing %s for %s '%s' %s %s", modeStrings[currentMode], FLAG(m) ? "member" : "", ourSims->target, FLAG(q) ? "quiet" : "", FLAG(a) ? "all" : "");
7890 7896
7891 // Start ROBUST or join the tmux session, or just figure out where the sims are running in tmux. 7897 // Start ROBUST or join the tmux session, or just figure out where the sims are running in tmux.
7892 if ((START == currentMode) && !checkSimIsRunning("ROBUST")) 7898 if ((START == currentMode) && !checkSimIsRunning("ROBUST"))