mirror of
https://github.com/lbonn/rofi
synced 2024-11-10 14:24:27 +00:00
Tried to fix strlen on NULL
This commit is contained in:
parent
abe44475fc
commit
545c423b61
4 changed files with 44 additions and 1 deletions
14
Makefile.am
14
Makefile.am
|
@ -13,6 +13,9 @@ bin_PROGRAMS=rofi
|
|||
|
||||
dist_bin_SCRIPTS=script/rofi-sensible-terminal
|
||||
|
||||
nodist_rofi_SOURCES=\
|
||||
$(top_builddir)/gitconfig.h
|
||||
|
||||
rofi_SOURCES=\
|
||||
source/rofi.c\
|
||||
source/view.c\
|
||||
|
@ -122,6 +125,7 @@ EXTRA_DIST=\
|
|||
INSTALL.md\
|
||||
AUTHORS\
|
||||
doc/rofi.doxy.in\
|
||||
script/get_git_rev.sh\
|
||||
Changelog
|
||||
|
||||
##
|
||||
|
@ -305,3 +309,13 @@ ohcount: $(rofi_SOURCES)
|
|||
doxy: doc/rofi.doxy $(rofi_SOURCES)
|
||||
doxygen $(top_builddir)/doc/rofi.doxy
|
||||
|
||||
clean-local:
|
||||
-rm $(top_builddir)/gitconfig.h
|
||||
|
||||
$(top_builddir)/gitconfig.h: .FORCE
|
||||
$(top_srcdir)/script/get_git_rev.sh $(top_srcdir) $(top_builddir)/gitconfig.h
|
||||
|
||||
$(rofi_SOURCES): $(top_builddir)/gitconfig.h
|
||||
|
||||
.PHONY: .FORCE
|
||||
.FORCE:
|
||||
|
|
21
script/get_git_rev.sh
Executable file
21
script/get_git_rev.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
DIR=$1
|
||||
FILE=$2
|
||||
|
||||
if [ -d "${DIR}/.git/" ]
|
||||
then
|
||||
echo -n "#define GIT_VERSION \"" > ${FILE}.tmp
|
||||
REV=$(git log -1 --pretty=tformat:%h)
|
||||
echo -n "${REV}" >> ${FILE}.tmp
|
||||
echo "\"" >> ${FILE}.tmp
|
||||
else
|
||||
echo "#undef GIT_VERSION" > ${FILE}.tmp
|
||||
fi
|
||||
|
||||
if ! diff ${FILE}.tmp ${FILE} > /dev/null
|
||||
then
|
||||
mv ${FILE}.tmp ${FILE}
|
||||
else
|
||||
rm ${FILE}.tmp
|
||||
fi
|
|
@ -419,7 +419,7 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
|
|||
&& !client_has_window_type ( c, xcb->ewmh._NET_WM_WINDOW_TYPE_DESKTOP )
|
||||
&& !client_has_state ( c, xcb->ewmh._NET_WM_STATE_SKIP_PAGER )
|
||||
&& !client_has_state ( c, xcb->ewmh._NET_WM_STATE_SKIP_TASKBAR ) ) {
|
||||
classfield = MAX ( classfield, strlen ( c->class ) );
|
||||
classfield = MAX ( classfield, (c->class != NULL)?(strlen ( c->class )):0 );
|
||||
|
||||
if ( client_has_state ( c, xcb->ewmh._NET_WM_STATE_DEMANDS_ATTENTION ) ) {
|
||||
c->demands = TRUE;
|
||||
|
|
|
@ -63,6 +63,8 @@
|
|||
#include "view.h"
|
||||
#include "view-internal.h"
|
||||
|
||||
#include "gitconfig.h"
|
||||
|
||||
// Pidfile.
|
||||
char *pidfile = NULL;
|
||||
const char *cache_dir = NULL;
|
||||
|
@ -303,6 +305,9 @@ static void help ( G_GNUC_UNUSED int argc, char **argv )
|
|||
printf ( "\n" );
|
||||
printf ( "For more information see: man rofi\n" );
|
||||
printf ( "Version: "VERSION "\n" );
|
||||
#ifdef GIT_VERSION
|
||||
printf ( "Git: "GIT_VERSION "\n");
|
||||
#endif
|
||||
printf ( "Bugreports: "PACKAGE_BUGREPORT "\n" );
|
||||
}
|
||||
|
||||
|
@ -605,6 +610,9 @@ int main ( int argc, char *argv[] )
|
|||
// Version
|
||||
if ( find_arg ( "-v" ) >= 0 || find_arg ( "-version" ) >= 0 ) {
|
||||
fprintf ( stdout, "Version: "VERSION "\n" );
|
||||
#ifdef GIT_VERSION
|
||||
fprintf ( stdout, "Git: "GIT_VERSION "\n");
|
||||
#endif
|
||||
exit ( EXIT_SUCCESS );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue