...
| Code Block | ||
|---|---|---|
| ||
int fd;
int flags;
char *editor;
if(!(fd = open(file_name, 0, O_RDONLY))) {
/* Handle Error */
}
if((flags = fcntl(fd, F_GETFD, 0)) < 0 == -1) {
/* Handle Error */
}
if(fcntl(fd, F_SET_FD, flags | FD_CLOEXEC)) {
/* Handle Error */
}
/* ... */
editor = getenv("EDITOR");
if (editor == NULL) {
/* Handle getenv() error */
}
system(editor);
|
...