summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-19 19:17:58 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-19 19:17:58 -0200
commit97a3f5665a62ff3a606da48f3854d082f249e6a8 (patch)
tree3552e5cb38f8c9efd7b5fbd4da060c9fd80effbd
parenta0dc8902b476fc2dddf02fceec7a7186d81f48fc (diff)
Ansification and compile warning fixes.
This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings.
-rw-r--r--.gitignore24
-rw-r--r--Makefile.am10
-rw-r--r--configure.ac8
-rw-r--r--xbacklight.c9
4 files changed, 51 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5a26cac
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,24 @@
+.deps
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+compile
+config.guess
+config.h
+config.h.in
+config.log
+config.status
+config.sub
+configure
+depcomp
+install-sh
+missing
+stamp-h1
+xbacklight
+xbacklight.1
+*~
+*.o
+ChangeLog
+xbacklight-*.tar.*
+tags
diff --git a/Makefile.am b/Makefile.am
index f79356b..abf6d1a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -62,3 +62,13 @@ SUFFIXES = .$(APP_MAN_SUFFIX) .man
.man.$(APP_MAN_SUFFIX):
sed $(MAN_SUBSTS) < $< > $@
+
+EXTRA_DIST += ChangeLog
+MAINTAINERCLEANFILES=ChangeLog
+
+.PHONY: ChangeLog
+
+ChangeLog:
+ $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog
diff --git a/configure.ac b/configure.ac
index 68723a7..7536fbc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,17 +26,25 @@ AC_INIT(xbacklight,[1.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xo
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
+# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG
+m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.2)
+
AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_INSTALL
+XORG_CWARNFLAGS
+
# Checks for pkg-config packages
PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2.0 xrender x11)
+XRANDR_CFLAGS="$CWARNFLAGS $XRANDR_CFLAGS"
AC_SUBST(XRANDR_CFLAGS)
AC_SUBST(XRANDR_LIBS)
XORG_MANPAGE_SECTIONS
XORG_RELEASE_VERSION
+XORG_CHANGELOG
AC_OUTPUT([Makefile])
diff --git a/xbacklight.c b/xbacklight.c
index d0cdb92..6eb3327 100644
--- a/xbacklight.c
+++ b/xbacklight.c
@@ -25,6 +25,10 @@
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+
typedef enum { Get, Set, Inc, Dec } op_t;
static char *program_name;
@@ -225,6 +229,9 @@ main (int argc, char **argv)
case Dec:
new = cur - set;
break;
+ default:
+ XSync (dpy, False);
+ return 1;
}
if (new > max) new = max;
if (new < min) new = min;
@@ -249,4 +256,6 @@ main (int argc, char **argv)
XRRFreeScreenResources (resources);
}
XSync (dpy, False);
+
+ return 0;
}