include stdio.h include signal.h include fcntl.h - PowerPoint PPT Presentation

1 / 1
About This Presentation
Title:

include stdio.h include signal.h include fcntl.h

Description:

include stdio.h include signal.h include fcntl.h – PowerPoint PPT presentation

Number of Views:137
Avg rating:3.0/5.0
Slides: 2
Provided by: deepen
Category:
Tags: argv | fcntl | include | signal | stdio

less

Transcript and Presenter's Notes

Title: include stdio.h include signal.h include fcntl.h


1



include ltstdio.hgtinclude
ltsignal.hgtinclude ltfcntl.hgtinclude
ltunistd.hgtinclude ltstdlib.hgtconst char
file_name "nohup.out"intmain(int argc, char
argv) int new_stdout if
(argc lt 2) fprintf(stderr, "Usage s
command arguments\n", argv) exit(1)
if (isatty( 1 )) fprintf(stderr, "Sending
output to s\n", file_name) close( 1 )
if ((new_stdout open(file_name, O_WRONLY
O_CREAT O_APPEND,
0644)) -1) perror(file_name)
exit(2) if (signal(SIGHUP,
SIG_IGN) SIG_ERR) perror("SIGHUP")
exit(3) argv execvp(argv, argv)
perror(argv) / Should not get here
unless / exit(4) / the exec
fails. / 
Write a Comment
User Comments (0)
About PowerShow.com