C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
detach.c File Reference

Launch executable, detaching from current process. More...

#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
Include dependency graph for detach.c:

Go to the source code of this file.

Functions

int fork_detach_execvp (char **eargv)
 Fork, set new session ID, close files, and execute detached command.
int main (int argc, char *argv[])

Detailed Description

Launch executable, detaching from current process.

Author
Bill Waller Copyright (c) 2025 MIT License billx.nosp@m.wall.nosp@m.er@gm.nosp@m.ail..nosp@m.com
Date
2026-02-09

Definition in file detach.c.

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 63 of file detach.c.

63 {
64 char **eargv = &argv[1];
65
66 if (argc < 2) {
67 fprintf(stderr, "Usage: %s <command> [args...]\n", argv[0]);
68 return EXIT_FAILURE;
69 }
70
71 if (fork_detach_execvp(eargv) != 0) {
72 fprintf(stderr, "Failed to fork and execute command\n");
73 return EXIT_FAILURE;
74 }
75 return EXIT_SUCCESS;
76}
char * eargv[MAXARGS]
Definition futil.c:58
int fork_detach_execvp(char **eargv)
Fork, set new session ID, close files, and execute detached command.
Definition detach.c:29

References fork_detach_execvp().

Here is the call graph for this function: