From 34f0ed3be656992a2d847f17b49724226a4e90ac Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 4 Aug 2021 15:13:18 +1000 Subject: Add -q option to start things without joining the session. And a null -a for later. --- src/sledjchisl/sledjchisl.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index e779c0c..cf241ba 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -5,13 +5,13 @@ * * Not using the usual taybox args system, coz it's not working as advertised. -USE_SLEDJCHISL(NEWTOY(sledjchisl, "", TOYFLAG_USR|TOYFLAG_BIN)) +USE_SLEDJCHISL(NEWTOY(sledjchisl, "qa", TOYFLAG_USR|TOYFLAG_BIN)) config SLEDJCHISL bool "sledjchisl" default y help - usage: sledjchisl [mode [arguments]] + usage: sledjchisl [-q] [-a] [mode [arguments]] opensim-SC management system. @@ -19,31 +19,37 @@ config SLEDJCHISL create "Sim Name" x,y size will create a sim. start + start -q start sim01 start "Welcome sim" - will start a sim or everything. + Will start a sim or everything. + -q when starting everything wont show the tmux console. backup backup "Joan Smith" backup sim01 backup "Welcome sim" - will backup sim or everything. + Will backup sim or everything. gitar i "Joan Smith" gitar o sim01 gitar o "Welcome sim" restart restart sim01 restart "Welcome sim" - will stop then start a sim, or everything. + Will stop then start a sim, or everything. status status sim01 status "Welcome sim" - will show status of a sim, or everything. + Will show status of a sim, or everything. stop + stop -a stop sim01 stop "Welcome sim" - will stop a sim, or everything. + Will stop a sim, or everything. + -a when stopping everything will close down all tmux windows and panes. */ + + /* configs/sim01 - backup-sim @@ -7204,12 +7210,19 @@ jit library is loaded or the JIT compiler will not be activated. if (!WIFEXITED(i)) E("tmux select-pane command failed!"); } - // 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! %s", toybuf); + // toybox argument parsing is half working. + if ((NULL == toys.optargs[0]) || (('-' != toys.optargs[0][0]) && ('q' != toys.optargs[0][1]))) + { + T("Joining the session."); + // 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! %s", toybuf); + } + else + T("NOT joining the session."); goto finished; } } -- cgit v1.1