"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "exec.c" between
multitail-6.2.1.tgz and multitail-6.4.tgz

About: multitail lets you view one or multiple files like the original tail program.

exec.c  (multitail-6.2.1.tgz):exec.c  (multitail-6.4.tgz)
skipping to change at line 36 skipping to change at line 36
pid_t pid = -1; pid_t pid = -1;
/* start child process */ /* start child process */
if ((pid = fork()) == 0) if ((pid = fork()) == 0)
{ {
char *pars[16], *posix_version = NULL; char *pars[16], *posix_version = NULL;
int npars = 0; int npars = 0;
char nlines_buffer[32]; char nlines_buffer[32];
#ifndef __minix #ifndef __minix
setpgid(0,0); setpgid(0, 0);
#endif #endif
setup_for_childproc(pipefd[1], 0, "dumb"); setup_for_childproc(pipefd[1], 0, "dumb");
/* create command for take last n lines & follow and start tail * / /* create command for take last n lines & follow and start tail * /
/* the command to start */ /* the command to start */
pars[npars++] = tail; pars[npars++] = tail;
/* Linux' tail has the --retry option, but not all /* Linux' tail has the --retry option, but not all
skipping to change at line 159 skipping to change at line 159
int fd_master = 1, fd_slave = 1; int fd_master = 1, fd_slave = 1;
/* allocate pseudo-tty & fork*/ /* allocate pseudo-tty & fork*/
cur -> pid = get_pty_and_fork(&fd_master, &fd_slave); cur -> pid = get_pty_and_fork(&fd_master, &fd_slave);
if (-1 == cur -> pid) error_exit(TRUE, FALSE, "An error occured w hile invoking get_pty_and_fork.\n"); if (-1 == cur -> pid) error_exit(TRUE, FALSE, "An error occured w hile invoking get_pty_and_fork.\n");
/* child? */ /* child? */
if (cur -> pid == 0) if (cur -> pid == 0)
{ {
#ifndef __minix #ifndef __minix
setpgid(0,0); setpgid(0, 0);
#endif #endif
/* reset signal handler for SIGTERM */ /* reset signal handler for SIGTERM */
signal(SIGTERM, SIG_DFL); signal(SIGTERM, SIG_DFL);
/* sleep if requested and only when 2nd or 3d (etc.) exec ution time */ /* sleep if requested and only when 2nd or 3d (etc.) exec ution time */
if (cur -> restart.restart && cur -> restart.first == 0) if (cur -> restart.restart && cur -> restart.first == 0)
sleep(cur -> restart.restart); sleep(cur -> restart.restart);
/* connect slave-fd to stdin/out/err */ /* connect slave-fd to stdin/out/err */
skipping to change at line 213 skipping to change at line 213
{ {
/* start the process that will check every 'interval' sec onds /* start the process that will check every 'interval' sec onds
* if a matching file with a more recent mod-time is avai lable * if a matching file with a more recent mod-time is avai lable
*/ */
cur -> pid = fork(); cur -> pid = fork();
if (cur -> pid == 0) if (cur -> pid == 0)
{ {
char *cur_file = NULL, *new_file; char *cur_file = NULL, *new_file;
#ifndef __minix #ifndef __minix
setpgid(0,0); setpgid(0, 0);
#endif #endif
signal(SIGTERM, start_proc_signal_handler); signal(SIGTERM, start_proc_signal_handler);
for(;;) for(;;)
{ {
/* find (new) file */ /* find (new) file */
new_file = find_most_recent_file(cur -> f ilename, cur_file); new_file = find_most_recent_file(cur -> f ilename, cur_file);
/* if find_most_recent_file returned NOT null, a file was found /* if find_most_recent_file returned NOT null, a file was found
skipping to change at line 295 skipping to change at line 295
if (n_children >= MAX_N_SPAWNED_PROCESSES) if (n_children >= MAX_N_SPAWNED_PROCESSES)
return 0; return 0;
} }
else else
endwin(); endwin();
child = fork(); child = fork();
if (child == 0) if (child == 0)
{ {
#ifndef __minix #ifndef __minix
setpgid(0,0); setpgid(0, 0);
#endif #endif
if (bg) if (bg)
setup_for_childproc(open_null(), 1, "dumb"); setup_for_childproc(open_null(), 1, "dumb");
/* start process */ /* start process */
if (-1 == execlp(shell, shell, "-c", execute, (void *)NULL)) erro r_exit(TRUE, FALSE, "Error while starting \"%s -c '%s'\".\n", execute); if (-1 == execlp(shell, shell, "-c", execute, (void *)NULL)) erro r_exit(TRUE, FALSE, "Error while starting \"%s -c '%s'\".\n", execute);
/* if execlp returns, an error occured */ /* if execlp returns, an error occured */
error_exit(FALSE, FALSE, "Error while starting process!\n"); error_exit(FALSE, FALSE, "Error while starting process!\n");
skipping to change at line 382 skipping to change at line 382
pid_t exec_with_pty(char *command, int *fd) pid_t exec_with_pty(char *command, int *fd)
{ {
int fd_master = -1, fd_slave = -1; int fd_master = -1, fd_slave = -1;
pid_t pid = get_pty_and_fork(&fd_master, &fd_slave); pid_t pid = get_pty_and_fork(&fd_master, &fd_slave);
if (-1 == pid) error_exit(TRUE, FALSE, "An error occured while invoking g et_pty_and_fork.\n"); if (-1 == pid) error_exit(TRUE, FALSE, "An error occured while invoking g et_pty_and_fork.\n");
if (pid == 0) if (pid == 0)
{ {
#ifndef __minix #ifndef __minix
setpgid(0,0); setpgid(0, 0);
#endif #endif
myclose(fd_master); myclose(fd_master);
/* connect slave-fd to stdin/out/err */ /* connect slave-fd to stdin/out/err */
setup_for_childproc(fd_slave, 1, "dumb"); setup_for_childproc(fd_slave, 1, "dumb");
/* start process */ /* start process */
if (-1 == execlp(command, command, (void *)NULL)) error_exit(TRUE , FALSE, "Error while starting '%s'.\n", command); if (-1 == execlp(command, command, (void *)NULL)) error_exit(TRUE , FALSE, "Error while starting '%s'.\n", command);
} }
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS