From 2d88d8779fb5cbc0e466d22a75ef5e3e6877065e Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 22 Mar 2024 11:25:25 -0400 Subject: Make SYSERROR macro act more like perror, and allow extra arguments --- include/omc.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/omc.h') diff --git a/include/omc.h b/include/omc.h index 0b1c562..e693834 100644 --- a/include/omc.h +++ b/include/omc.h @@ -10,7 +10,10 @@ #include #include -#define SYSERROR stderr, "%s:%s:%d: %s\n", path_basename(__FILE__), __FUNCTION__, __LINE__, strerror(errno) +#define SYSERROR(MSG, ...) do { \ + fprintf(stderr, "%s:%s:%d:%s - ", path_basename(__FILE__), __FUNCTION__, __LINE__, strerror(errno) ? "info" : strerror(errno)); \ + fprintf(stderr, MSG LINE_SEP, __VA_ARGS__); \ +} while (0) #define OMC_BUFSIZ 8192 #define OMC_NAME_MAX 255 #define OMC_DIRSTACK_MAX 1024 -- cgit