From: Alan Cox Date: Fri, 5 Jun 2015 23:57:14 +0000 (+0100) Subject: ssh: add fg/bg experimental commands X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=d2a55e58705c519f118b5956d56f5afa58066e0d;p=FUZIX.git ssh: add fg/bg experimental commands We don't have real process groups in kernel so it's a bit limited --- diff --git a/Applications/util/ssh.c b/Applications/util/ssh.c index 6188b6dc..eb6aa569 100644 --- a/Applications/util/ssh.c +++ b/Applications/util/ssh.c @@ -293,7 +293,18 @@ int main(int argc, char *argval[]) umask(i); } } - + else if (strcmp(cmd, "fg") == 0) { + if (lastfg == -1 || kill(lastfg, SIGCONT) == -1) + write(2, "fg: can't continue\n", 19); + else + while(pidwait(pid, 0) != pid); + } + else if (strcmp(cmd, "bg") == 0) { + if (lastfg == -1 || kill(lastfg, SIGCONT) == -1) + write(2, "bg: can't continue\n", 19); + else + lastfg = -1; + } #ifdef SSH_EXPENSIVE /* Check for User request to kill a process */ else if (strcmp(cmd, "kill") == 0) { @@ -314,18 +325,6 @@ int main(int argc, char *argval[]) perror("kill"); } } - else if (strcmp(cmd, "fg") == 0) { - if (lastfg == -1 || kill(lastfg, SIGCONT) == -1) - write(2, "fg: can't continue\n", 19); - else - while(pidwait(pid, 0) != pid); - } - else if (strcmp(cmd, "bg") == 0) { - if (lastfg == -1 || kill(lastfg, SIGCONT) == -1) - write(2, "bg: can't continue\n", 19); - else - lastfg = -1; - } else if (strcmp(cmd, "pwd") == 0) { if (getcwd(buf, 128)){ char *ptr=&buf[strlen(buf)];