+static char *default_name = "no_name";
+static struct{
+ char status, stop, kill, start;
+ char *name;
+} options;
+
+static void extract_options(int argc, char **argv)
+{
+ /* -status <name> Get status - if we thought we ran it, current real status */
+ /* -stop <name> Run provided command to gently stop */
+ /* -kill <name> Aggressive killing of process (signal 15) */
+ /* -start <name> Run name */
+ if(argc == 1){
+ /* only tomc given */
+ tomc_p("no args given.");
+ exit(EXIT_SUCCESS);
+ }
+
+ options.name = NULL;
+
+ for(int i = 1;
+ i < argc;
+ i++){
+ char *arg = argv[i];
+#define X(op) {if(strcmp("-" #op, arg) == 0){options.op = 1; continue;}}
+ X(status);
+ X(stop);
+ X(kill);
+ X(start);
+#undef X
+ /* assume last non option was the name */
+ options.name = arg;
+ }
+
+ if(options.name == NULL){
+ options.name = default_name;
+ }
+}
+
+static void print_options()