diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-05-08 05:11:54 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-05-08 05:11:54 +0000 |
commit | 1a6d39b25940cf50b705300b5c515bd9bfa6c49e (patch) | |
tree | fc7b4aa7014275d52ffb66e812588d468a74ca9f | |
parent | 0a36de0580ac0b686c5f72910bd3f0f0853e54d9 (diff) | |
download | busybox-w32-1a6d39b25940cf50b705300b5c515bd9bfa6c49e.tar.gz busybox-w32-1a6d39b25940cf50b705300b5c515bd9bfa6c49e.tar.bz2 busybox-w32-1a6d39b25940cf50b705300b5c515bd9bfa6c49e.zip |
A few more structural updates for job control.
-Erik
-rw-r--r-- | hush.c | 17 | ||||
-rw-r--r-- | shell/hush.c | 17 |
2 files changed, 26 insertions, 8 deletions
@@ -1089,11 +1089,21 @@ static void insert_bg_job(struct pipe *pi) | |||
1089 | thejob->next = NULL; | 1089 | thejob->next = NULL; |
1090 | thejob->running_progs = thejob->num_progs; | 1090 | thejob->running_progs = thejob->num_progs; |
1091 | thejob->stopped_progs = 0; | 1091 | thejob->stopped_progs = 0; |
1092 | thejob->text = xmalloc(MAX_LINE); | ||
1093 | |||
1094 | //if (pi->progs[0] && pi->progs[0].argv && pi->progs[0].argv[0]) | ||
1095 | { | ||
1096 | char *bar=thejob->text; | ||
1097 | char **foo=pi->progs[0].argv; | ||
1098 | while(foo && *foo) { | ||
1099 | bar += sprintf(bar, "%s ", *foo++); | ||
1100 | } | ||
1101 | } | ||
1092 | 1102 | ||
1093 | /* we don't wait for background thejobs to return -- append it | 1103 | /* we don't wait for background thejobs to return -- append it |
1094 | to the list of backgrounded thejobs and leave it alone */ | 1104 | to the list of backgrounded thejobs and leave it alone */ |
1095 | printf("[%d] %d\n", pi->jobid, pi->pgrp); | 1105 | printf("[%d] %d\n", thejob->jobid, thejob->progs[0].pid); |
1096 | last_bg_pid = pi->pgrp; | 1106 | last_bg_pid = thejob->progs[0].pid; |
1097 | } | 1107 | } |
1098 | 1108 | ||
1099 | /* remove a backgrounded job from a jobset */ | 1109 | /* remove a backgrounded job from a jobset */ |
@@ -1169,8 +1179,7 @@ static void checkjobs() | |||
1169 | pi->progs[prognum].is_stopped = 1; | 1179 | pi->progs[prognum].is_stopped = 1; |
1170 | 1180 | ||
1171 | if (pi->stopped_progs == pi->num_progs) { | 1181 | if (pi->stopped_progs == pi->num_progs) { |
1172 | printf(JOB_STATUS_FORMAT, pi->jobid, "Stopped", | 1182 | printf(JOB_STATUS_FORMAT, pi->jobid, "Stopped", pi->text); |
1173 | pi->text); | ||
1174 | } | 1183 | } |
1175 | } | 1184 | } |
1176 | } | 1185 | } |
diff --git a/shell/hush.c b/shell/hush.c index 1cb5f39ab..d0b30ebac 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -1089,11 +1089,21 @@ static void insert_bg_job(struct pipe *pi) | |||
1089 | thejob->next = NULL; | 1089 | thejob->next = NULL; |
1090 | thejob->running_progs = thejob->num_progs; | 1090 | thejob->running_progs = thejob->num_progs; |
1091 | thejob->stopped_progs = 0; | 1091 | thejob->stopped_progs = 0; |
1092 | thejob->text = xmalloc(MAX_LINE); | ||
1093 | |||
1094 | //if (pi->progs[0] && pi->progs[0].argv && pi->progs[0].argv[0]) | ||
1095 | { | ||
1096 | char *bar=thejob->text; | ||
1097 | char **foo=pi->progs[0].argv; | ||
1098 | while(foo && *foo) { | ||
1099 | bar += sprintf(bar, "%s ", *foo++); | ||
1100 | } | ||
1101 | } | ||
1092 | 1102 | ||
1093 | /* we don't wait for background thejobs to return -- append it | 1103 | /* we don't wait for background thejobs to return -- append it |
1094 | to the list of backgrounded thejobs and leave it alone */ | 1104 | to the list of backgrounded thejobs and leave it alone */ |
1095 | printf("[%d] %d\n", pi->jobid, pi->pgrp); | 1105 | printf("[%d] %d\n", thejob->jobid, thejob->progs[0].pid); |
1096 | last_bg_pid = pi->pgrp; | 1106 | last_bg_pid = thejob->progs[0].pid; |
1097 | } | 1107 | } |
1098 | 1108 | ||
1099 | /* remove a backgrounded job from a jobset */ | 1109 | /* remove a backgrounded job from a jobset */ |
@@ -1169,8 +1179,7 @@ static void checkjobs() | |||
1169 | pi->progs[prognum].is_stopped = 1; | 1179 | pi->progs[prognum].is_stopped = 1; |
1170 | 1180 | ||
1171 | if (pi->stopped_progs == pi->num_progs) { | 1181 | if (pi->stopped_progs == pi->num_progs) { |
1172 | printf(JOB_STATUS_FORMAT, pi->jobid, "Stopped", | 1182 | printf(JOB_STATUS_FORMAT, pi->jobid, "Stopped", pi->text); |
1173 | pi->text); | ||
1174 | } | 1183 | } |
1175 | } | 1184 | } |
1176 | } | 1185 | } |