On Thu, May 19, 2016 at 05:09:55PM -0700, Eric Pruitt wrote:
> I wrote a tool for filtering lists of files based on return codes of
> subprocesses called "query:" https://github.com/ericpruitt/query .
> 
> Find all dynamically linked executables:
> 
>     find -type f | query sh -c 'ldd "$QUERY_FILENAME"'
> 
> Find all files ending in ".json" that are malformed:
> 
>     find -type f -iname '*.json' | query -s ! python -m json.tool
> 
> The tool should pretty portable. I haven't tested it on FreeBSD or
> OpenBSD yet, but I was able to compile it on Mac OS X. I am using
> signal(2) whose behavior varies across platforms, but I don't think that
> will be a problem in practice since the handler only calls exit(3).
> Please let me know what you think of the idea and code.
> 
> Thanks,
> Eric
> 

Hi,

Briefly tested on OpenBSD and found a small issue (patch attached).

-- 
Kind regards,
Hiltjo
>From 940f8491f37acdf7a4970c786052ca506688e846 Mon Sep 17 00:00:00 2001
From: Hiltjo Posthuma <hil...@codemadness.org>
Date: Fri, 20 May 2016 10:50:37 +0200
Subject: [PATCH] fix build on OpenBSD: include signal.h for SIGUSR1 and kill()

---
 query.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/query.c b/query.c
index 67ddbe0..d4915c0 100644
--- a/query.c
+++ b/query.c
@@ -11,6 +11,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <getopt.h>
+#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-- 
2.8.1

Reply via email to