Commit Diff


commit - bd3c3461ae2a15d147300a84b259799fb998e3b5
commit + 1e12e95db0ca46c3c59d51955d66bcefed764487
blob - a6d21f954682c09856c6a4342e6a35d6ba0ff935 (mode 644)
blob + /dev/null
--- TODO
+++ /dev/null
@@ -1,3 +0,0 @@
-- add options -b and -e for basic and extended regex;
-
-- add support for pledge(2);
blob - ca6ddb5d3b7b497dbbb5dc1ca18cb8fa9fc19d81
blob + 8a935f2d25dfd8da5274a7b59ee6aea634dd559a
--- rene.c
+++ rene.c
@@ -28,6 +28,21 @@ warn(const char *fmt, ...)
 	fprintf(stderr, ": %s\n", w);
 }
 
+void
+err(int eval, const char *fmt, ...)
+{
+	char *w = strerror(errno);
+	fputs("rene: ", stderr);
+	if (fmt != NULL) {
+		va_list argp;
+		va_start(argp, fmt);
+		vfprintf(stderr, fmt, argp);
+		va_end(argp);
+	}
+	fprintf(stderr, ": %s\n", w);
+	exit(eval);
+}
+
 int
 strrep(char *from, char *to, char *s, char **new)
 {
@@ -112,6 +127,11 @@ main(int argc, char *argv[])
 {
 	char *from, *to;
 
+#ifdef __OpenBSD__
+	if (pledge("stdio cpath rpath", NULL) == -1)
+		err(1, "pledge");
+#endif
+
 	int c;
 	while ((c = getopt(argc, argv, "ailnov")) != -1) {
 		switch (c) {