static int child_count = 0;
static int parent_count = 0;
+static int process_count = 0;
int get_child_count(void)
{
return parent_count;
}
+int get_process_count(void)
+{
+ return process_count;
+}
+
int do_fork(void)
{
int child, error;
return child;
}
+ process_count = child_count;
/* reset child's child count */
child_count = 0;
parent_count++;
int ofd, efd;
fd_set rfds;
int maxfd;
- char stdoutstr[32], stderrstr[16];
+ char stdoutstr[32], stderrstr[32], indent[16] = { " " };
+ indent[get_parent_count() + 1] = 0;
+
if ((child = do_fork()))
return child;
while (1) {
char *sptr , *eptr;
- char rbuf[BUF_SIZE], indent[16] = { ' ' };
+ char rbuf[BUF_SIZE];
int bytes;
char *typestr;
- indent[get_parent_count()] = 0;
-
maxfd = max(ofd, efd);
error = select(maxfd, &rfds, NULL, NULL, NULL);
int get_child_count(void);
int get_parent_count(void);
+int get_process_count(void);
int do_fork(void);
int run(const char *p, char *const argv[]);