summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2019-01-07 17:19:33 +0100
committerDave Davenport <qball@gmpclient.org>2019-01-07 17:19:33 +0100
commit89715ef5676a292f84a7dc0890eec0dc4f494c21 (patch)
treeffb57f20125bb93f372635bdd7b7dcf1dba9f980
parent19279f5a426b437ee1534ee336d33383d3bdd318 (diff)
Return EX_DATAERR when fails to parse theme.
This way a script can check if there was an error, otherwise you can wind up in a loop.
-rw-r--r--configure.ac2
-rwxr-xr-xscript/rofi-theme-selector5
-rw-r--r--source/rofi.c2
3 files changed, 8 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 6725c9ef..62bdf1dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,6 +109,8 @@ AC_CHECK_HEADER([math.h],, AC_MSG_ERROR("Could not find math.h header file"))
AC_SEARCH_LIBS([floor],[m],, AC_MSG_ERROR("Could not find floor in math library"))
AC_SEARCH_LIBS([ceil], [m],, AC_MSG_ERROR("Could not find ceil in math library"))
+AC_CHECK_HEADER([sysexits.h],, AC_MSG_ERROR("Could not find the sysexists.h header file"))
+
dnl ---------------------------------------------------------------------
dnl Check dependencies
dnl ---------------------------------------------------------------------
diff --git a/script/rofi-theme-selector b/script/rofi-theme-selector
index eec7b0a8..f49e8d59 100755
--- a/script/rofi-theme-selector
+++ b/script/rofi-theme-selector
@@ -149,7 +149,10 @@ Current theme: <b>${CUR}</b>"""
if [ ${RTR} = 10 ]
then
return 0;
- elif [ ${RTR} = 1 ]
+ elif [ ${RTR} = 1 ]
+ then
+ return 1;
+ elif [ ${RTR} = 65 ]
then
return 1;
fi
diff --git a/source/rofi.c b/source/rofi.c
index 3d125c5e..4bea8012 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -41,6 +41,7 @@
#include <gmodule.h>
#include <xcb/xcb.h>
#include <sys/types.h>
+#include <sysexits.h>
#include <glib-unix.h>
@@ -675,6 +676,7 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
}
rofi_view_error_dialog ( emesg->str, ERROR_MSG_MARKUP );
g_string_free ( emesg, TRUE );
+ rofi_set_return_code ( EX_DATAERR );
return G_SOURCE_REMOVE;
}
// Dmenu mode.