[master] b6c3a8e move curses includes to one file

Nils Goroll nils.goroll at uplex.de
Mon May 5 14:33:46 CEST 2014


commit b6c3a8eb48d61a776bb450fc3929636c8a2c01e5
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon May 5 14:29:24 2014 +0200

    move curses includes to one file

diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index 7a7693e..d01595c 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -35,7 +35,6 @@
 
 #include <sys/types.h>
 
-#include <curses.h>
 #include <errno.h>
 #include <limits.h>
 #include <math.h>
@@ -47,6 +46,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "vcurses.h"
 #include "vapi/vsl.h"
 #include "vapi/vsm.h"
 #include "vapi/voptget.h"
diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c
index 373cf09..fd80580 100644
--- a/bin/varnishstat/varnishstat_curses.c
+++ b/bin/varnishstat/varnishstat_curses.c
@@ -53,20 +53,7 @@
 #include "vtim.h"
 
 #include "varnishstat.h"
-
-#if defined HAVE_NCURSESW_CURSES_H
-#  include <ncursesw/curses.h>
-#elif defined HAVE_NCURSESW_H
-#  include <ncursesw.h>
-#elif defined HAVE_NCURSES_CURSES_H
-#  include <ncurses/curses.h>
-#elif defined HAVE_NCURSES_H
-#  include <ncurses.h>
-#elif defined HAVE_CURSES_H
-#  include <curses.h>
-#else
-#  error "SysV or X/Open-compatible Curses header file required"
-#endif
+#include "vcurses.h"
 
 #define LINES_STATUS		3
 #define LINES_BAR_T		1
diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c
index 80b19f2..2c195ef 100644
--- a/bin/varnishtop/varnishtop.c
+++ b/bin/varnishtop/varnishtop.c
@@ -34,7 +34,6 @@
 #include "config.h"
 
 #include <ctype.h>
-#include <curses.h>
 #include <errno.h>
 #include <limits.h>
 #include <pthread.h>
@@ -45,6 +44,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "vcurses.h"
 #include "vapi/vsm.h"
 #include "vapi/vsl.h"
 #include "vapi/voptget.h"
diff --git a/include/Makefile.am b/include/Makefile.am
index 8291a50..50fed78 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -50,6 +50,7 @@ nobase_noinst_HEADERS = \
 	vcli_serve.h \
 	vcs_version.h \
 	vct.h \
+	vcurses.h \
 	vend.h \
 	vev.h \
 	vfil.h \
diff --git a/include/vcurses.h b/include/vcurses.h
new file mode 100644
index 0000000..d24b556
--- /dev/null
+++ b/include/vcurses.h
@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2014 Varnish Software AS
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * include the right curses headers
+ */
+
+#if defined HAVE_NCURSESW_CURSES_H
+#  include <ncursesw/curses.h>
+#elif defined HAVE_NCURSESW_H
+#  include <ncursesw.h>
+#elif defined HAVE_NCURSES_CURSES_H
+#  include <ncurses/curses.h>
+#elif defined HAVE_NCURSES_H
+#  include <ncurses.h>
+#elif defined HAVE_CURSES_H
+#  include <curses.h>
+#else
+#  error "SysV or X/Open-compatible Curses header file required"
+#endif



More information about the varnish-commit mailing list