From f97498a3f0e2a296a6ca4fc08e5211a900c568e0 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Sat, 3 Dec 2016 22:29:39 +0100 Subject: [PATCH] Build in macOS. --- read20.c | 17 +++++++++++++++++ tapeio.c | 12 ++++++++++++ 2 files changed, 29 insertions(+) diff --git a/read20.c b/read20.c index e0c7710..81eff98 100644 --- a/read20.c +++ b/read20.c @@ -84,6 +84,23 @@ char *expression = 0; char *re_comp_error; /* Error message from re_comp() */ extern char *re_comp(); +#ifdef __APPLE__ +static regex_t re_regexp; + +char *re_comp(char *s) +{ + if (regcomp(&re_regexp, s, 0) == 0) + return NULL; + else + return "error"; +} + +static int re_exec(char *s) +{ + return regexec(&re_regexp, s, 0, 0, 0); +} +#endif + /* read20 [-f tapefile] [-t] [-c] [-T] [-n number] pattern diff --git a/tapeio.c b/tapeio.c index 7ffc7f5..2860cf2 100644 --- a/tapeio.c +++ b/tapeio.c @@ -53,6 +53,16 @@ #define MTSETBLK STSETBLK #define MTSETDENSITY STSETDENSITY #define mtop stop +#elif __APPLE__ +#define MTWEOF 0 +#define MTREW 0 +#define MTFSR 0 +#define MTFSF 0 +#define MTBSR 0 +#define MTIOCTOP 0 +#define MTSETBLK 0 +#define MTSETDENSITY 0 +struct mtop { int mt_op; int mt_count; }; #else #include #endif @@ -280,9 +290,11 @@ tape_handle_t opentape (char *name, int create, int writable) *p++ = '\0'; /* shoot out @, point at host name */ user = (*p != '\0') ? host : NULL; /* keep non-null user */ } +#ifndef __APPLE__ if ((mtape->tapefd = rexec (&p, htons (512), user, NULL, "/etc/rmt", (int *) NULL)) < 0) FAIL ("?Connection failed\n"); +#endif /* build rmt "open device" command */ if ((1 + strlen (port) + 1 + 1 + 1 + 1) > sizeof (mtape->netbuf))