add pledge() support on OpenBSD - ploot - simple plotting tools HTML git clone git://bitreich.org/ploot git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ploot DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit f5bdc6b7ddfd050efc31f5cc89a6fba87e58819f DIR parent a546b97f9fe7f4a9e30b514bfc257ba85cd9a7f9 HTML Author: Josuah Demangeon <me@josuah.net> Date: Tue, 22 Jun 2021 01:02:44 +0200 add pledge() support on OpenBSD Diffstat: M ploot-braille.c | 7 +++++++ M ploot-farbfeld.c | 7 +++++++ M ploot-feed.c | 7 +++++++ M ploot-text.c | 7 +++++++ 4 files changed, 28 insertions(+), 0 deletions(-) --- DIR diff --git a/ploot-braille.c b/ploot-braille.c @@ -11,6 +11,10 @@ #include "scale.h" #include "util.h" +#ifndef __OpenBSD__ +#define pledge(...) 0 +#endif + /* * Plot the body as an histogram interpolating the gaps and include * a vertical and horizontal axis. @@ -146,6 +150,9 @@ main(int argc, char **argv) size_t ncol; int c, rows, cols; + if (pledge("stdio", "") < 0) + err(1, "pledge: %s", strerror(errno)); + rows = 20, cols = 80; arg0 = *argv; while ((c = getopt(argc, argv, "r:c:")) > -1) { DIR diff --git a/ploot-farbfeld.c b/ploot-farbfeld.c @@ -16,6 +16,10 @@ #include "util.h" #include "scale.h" +#ifndef __OpenBSD__ +#define pledge(...) 0 +#endif + #define MARGIN 4 #define IMAGE_H (TITLE_H + PLOT_H + XLABEL_H) @@ -284,6 +288,9 @@ main(int argc, char **argv) size_t ncol; int c; + if (pledge("stdio", "") < 0) + err(1, "pledge: %s", strerror(errno)); + arg0 = *argv; while ((c = getopt(argc, argv, "t:u:")) > -1) { switch (c) { DIR diff --git a/ploot-feed.c b/ploot-feed.c @@ -10,6 +10,10 @@ #include <unistd.h> #include "util.h" +#ifndef __OpenBSD__ +#define pledge(...) 0 +#endif + #define WIDTH_MAX 1024 #define BRAILLE_START 10240 @@ -220,6 +224,9 @@ main(int argc, char **argv) char *labv[4069 / 2], labels[4069]; int c; + if (pledge("stdio", "") < 0) + err(1, "pledge: %s", strerror(errno)); + arg0 = *argv; while ((c = getopt(argc, argv, "w:")) > -1) { switch (c) { DIR diff --git a/ploot-text.c b/ploot-text.c @@ -5,6 +5,10 @@ #include <string.h> #include <errno.h> +#ifndef __OpenBSD__ +#define pledge(...) 0 +#endif + #include "drawille.h" #include "font.h" #include "util.h" @@ -25,6 +29,9 @@ main(int argc, char **argv) size_t h, w; int c, row; + if (pledge("stdio", "") < 0) + err(1, "pledge: %s", strerror(errno)); + ft = &font8; arg0 = *argv; while ((c = getopt(argc, argv, "12")) > -1) {