From a0902fe51010645f779e4d02cd46f35e488b8bd2 Mon Sep 17 00:00:00 2001 From: Adam Spragg Date: Mon, 23 May 2022 15:29:11 +0100 Subject: Return non-zero exit status if "compare" finds differences This makes `metastore` more useful in scripts, just to check if it found anything, in the same way as `diff` and `grep`. Note that POSIX requires that EXIT_SUCCESS is 0, and EXIT_FAILURE is 1, so I've defined EXIT_DIFFERENCES as 2 which, while different from the values `diff` and `grep` use (1 for finding something, 2 for errors), maintains a certain amount of backwards compatibility with previous versions of metastore. --- src/metastore.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/metastore.h') diff --git a/src/metastore.h b/src/metastore.h index de51292..b7d588e 100644 --- a/src/metastore.h +++ b/src/metastore.h @@ -46,6 +46,9 @@ #define ACTIONS_READING 0x07 #define ACTIONS_WRITING 0x70 +/* Exit statuses (statii?) other than SUCCESS (0) and FAILURE (1) */ +#define EXIT_DIFFERENCES 2 + /* Possible build defines */ #ifndef NO_XATTR # define NO_XATTR 0 -- cgit v1.2.1