diff options
author | Alice Frosi <afrosi@redhat.com> | 2023-04-25 13:40:09 +0200 |
---|---|---|
committer | Alice Frosi <afrosi@redhat.com> | 2023-04-25 13:40:09 +0200 |
commit | 17a61e200f40ff3390d78645f3bdda62a09042ce (patch) | |
tree | fd24bef97d6777e9fb0c8c63c98dcb31877f0a17 | |
parent | 76473f932904f811f66b576dad54a278395b9a8a (diff) | |
download | seitan-17a61e200f40ff3390d78645f3bdda62a09042ce.tar seitan-17a61e200f40ff3390d78645f3bdda62a09042ce.tar.gz seitan-17a61e200f40ff3390d78645f3bdda62a09042ce.tar.bz2 seitan-17a61e200f40ff3390d78645f3bdda62a09042ce.tar.lz seitan-17a61e200f40ff3390d78645f3bdda62a09042ce.tar.xz seitan-17a61e200f40ff3390d78645f3bdda62a09042ce.tar.zst seitan-17a61e200f40ff3390d78645f3bdda62a09042ce.zip |
seitan: use functions from util.h
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | seitan.c | 13 |
2 files changed, 8 insertions, 7 deletions
@@ -11,7 +11,7 @@ export OUTDIR COMMON_DIR := $(DIR)/common BIN := $(OUTDIR)seitan -SRCS := seitan.c $(COMMON_DIR)/common.c operations.c +SRCS := seitan.c $(COMMON_DIR)/common.c $(COMMON_DIR)/util.c operations.c HEADERS := $(COMMON_DIR)/common.h $(COMMON_DIR)/gluten.h \ $(COMMON_DIR)/numbers.h $(COMMON_DIR)/util.h operations.h @@ -71,7 +71,7 @@ static void parse(int argc, char **argv, struct arguments *arguments) int option_index = 0; int oc; if (arguments == NULL) - fprintf(stderr, "Empty args\n"); + usage(); while ((oc = getopt_long(argc, argv, ":i:o:p:s:", options, &option_index)) != -1) { switch (oc) { @@ -89,12 +89,15 @@ static void parse(int argc, char **argv, struct arguments *arguments) } } if (arguments->input_file == NULL) { - fprintf(stderr, "missing input file\n"); + err("missing input file"); usage(); } if (arguments->socket != NULL && arguments->pid > 0) { - fprintf(stderr, - "the socket and pid options cannot be used together\n"); + err("the socket and pid options cannot be used together"); + usage(); + } + if (arguments->socket == NULL && arguments->pid < 0) { + err("select one of the options between socket and pid"); usage(); } } @@ -211,8 +214,6 @@ int main(int argc, char **argv) die(" creating the socket"); if ((notifier = recvfd(fd)) < 0) die(" failed recieving the notifier fd"); - } else { - die(" select between pid and socket option"); } sleep(1); |