aboutsummaryrefslogtreecommitdiff
path: root/rpt.c
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-02-03 18:03:23 +0100
committerTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-02-03 18:03:23 +0100
commitfde02eafff1ec7c16666f689a6bb62e7a78d6671 (patch)
treeb10492f15538a2584521c62671c33a8af529b2a9 /rpt.c
parent0a3803bb3f3cb019ee9cf371e0ed55be04e94a4f (diff)
code made POSIX-compliant
Diffstat (limited to 'rpt.c')
-rw-r--r--rpt.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/rpt.c b/rpt.c
index 46a3de9..392e442 100644
--- a/rpt.c
+++ b/rpt.c
@@ -2,7 +2,6 @@
#include <errno.h>
#include <fcntl.h>
-#include <getopt.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
@@ -80,7 +79,7 @@ exec_child(char **argv)
if (stdin_clone)
{
- status = lseek(clone_fd, 0, L_SET);
+ status = lseek(clone_fd, 0, SEEK_SET);
if (status < 0)
{
@@ -177,23 +176,13 @@ copy_stdin()
int
main(int argc, char* argv[])
{
- struct option const opts[] = {
- {"count", required_argument, NULL, 'n'},
- {"force", no_argument, NULL, 'f'},
- {"version", no_argument, NULL, 'V'},
- {"help", no_argument, NULL, 'h'},
- {NULL, 0, NULL, 0}
- };
-
- opterr = 0; /* dismiss getopt error message */
int opt;
-
char *strcount = NULL;
long count = 1;
void (*handle_error_f)(int status) = exit_on_error;
- while ((opt = getopt_long(argc, argv, "+:n:fVh", opts, NULL)) >= 0)
+ while ((opt = getopt(argc, argv, ":n:fVh")) != -1)
{
switch(opt)
{