// SPDX-License-Identifier: GPL-2.0-only /* * chproc.c - simple process manager * * Features: list and kill. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #define PROGRAM_NAME "chproc" #define PROGRAM_VERSION "0.1" #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define DIR_PROC "/proc" struct flag_options { int name; int all; int kill; int help; int version; }; struct data_options { char *process_name; char *process_pid; }; struct options { struct flag_options flags; struct data_options data; }; struct flag_handler { int *flag; int id; }; enum flag_index { F_NAME, F_ALL, F_KILL, F_HELP, F_VERSION }; static int usage(void) { fprintf(stderr, "Usage: %s