From e527e458f4401965a778b74069e4eb93247f42bb Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Fri, 15 Apr 2005 18:07:26 +0000
Subject: [PATCH] various #include fixes: since proto.h includes nano.h, only
 include the former in source files; also add an #include guard to proto.h,
 and make the config.h #include in nano.h match the config.h #includes
 everywhere else

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2471 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog    | 4 ++++
 src/chars.c  | 1 -
 src/color.c  | 1 -
 src/cut.c    | 1 -
 src/files.c  | 1 -
 src/global.c | 1 -
 src/move.c   | 1 -
 src/nano.c   | 1 -
 src/nano.h   | 7 +++++--
 src/proto.h  | 5 +++++
 src/rcfile.c | 1 -
 src/search.c | 1 -
 src/utils.c  | 1 -
 src/winio.c  | 1 -
 14 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 175eead1..8603f643 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 CVS code -
 - General:
 	- Miscellaneous comment fixes. (DLR)
+	- Various #include fixes.  Since proto.h includes nano.h, only
+	  include the former in source files.  Also add an #include
+	  guard to proto.h, and make the config.h #include in nano.h
+	  match the config.h #includes everywhere else. (DLR)
 - files.c:
   get_next_filename()
 	- Use a long instead of an int for the number prepended to the
diff --git a/src/chars.c b/src/chars.c
index 7f6c8b7e..9716951e 100644
--- a/src/chars.c
+++ b/src/chars.c
@@ -28,7 +28,6 @@
 #include <ctype.h>
 #include <assert.h>
 #include "proto.h"
-#include "nano.h"
 
 #ifdef NANO_WIDE
 #ifdef HAVE_WCHAR_H
diff --git a/src/color.c b/src/color.c
index 4eed7d67..c877510d 100644
--- a/src/color.c
+++ b/src/color.c
@@ -29,7 +29,6 @@
 #include <errno.h>
 #include <fcntl.h>
 #include "proto.h"
-#include "nano.h"
 
 #ifdef ENABLE_COLOR
 
diff --git a/src/cut.c b/src/cut.c
index 6200a88d..05d87aaf 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -28,7 +28,6 @@
 #include <stdio.h>
 #include <assert.h>
 #include "proto.h"
-#include "nano.h"
 
 static bool keep_cutbuffer = FALSE;
 	/* Should we keep the contents of the cutbuffer? */
diff --git a/src/files.c b/src/files.c
index 5fdec471..15181b0f 100644
--- a/src/files.c
+++ b/src/files.c
@@ -35,7 +35,6 @@
 #include <pwd.h>
 #include <assert.h>
 #include "proto.h"
-#include "nano.h"
 
 static file_format fmt = NIX_FILE;
 	/* The format of the current file. */
diff --git a/src/global.c b/src/global.c
index b55703c4..107ea44c 100644
--- a/src/global.c
+++ b/src/global.c
@@ -26,7 +26,6 @@
 #include <stdlib.h>
 #include <assert.h>
 #include "proto.h"
-#include "nano.h"
 
 /* Global variables */
 
diff --git a/src/move.c b/src/move.c
index 221d80d4..a74d3a12 100644
--- a/src/move.c
+++ b/src/move.c
@@ -28,7 +28,6 @@
 #include <ctype.h>
 #include <assert.h>
 #include "proto.h"
-#include "nano.h"
 
 void do_first_line(void)
 {
diff --git a/src/nano.c b/src/nano.c
index cae70cd9..66625341 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -38,7 +38,6 @@
 #include <locale.h>
 #include <assert.h>
 #include "proto.h"
-#include "nano.h"
 
 #ifdef HAVE_TERMIOS_H
 #include <termios.h>
diff --git a/src/nano.h b/src/nano.h
index 5fc3d616..6b7b3221 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -22,8 +22,12 @@
 #ifndef NANO_H
 #define NANO_H 1
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #ifdef __TANDEM
-/* Tandem NonStop Kernel */
+/* Tandem NonStop Kernel. */
 #include <floss.h>
 #define NANO_ROOT_UID 65535
 #else
@@ -88,7 +92,6 @@
 #include <stddef.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include "config.h"
 
 /* If no snprintf() or vsnprintf(), use the versions from glib. */
 #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
diff --git a/src/proto.h b/src/proto.h
index 8a049e37..2b4654a7 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -19,6 +19,9 @@
  *                                                                        *
  **************************************************************************/
 
+#ifndef PROTO_H
+#define PROTO_H 1
+
 /* Externs. */
 
 #include <sys/types.h>
@@ -696,3 +699,5 @@ void dump_buffer_reverse(void);
 #ifdef NANO_EXTRA
 void do_credits(void);
 #endif
+
+#endif /* !PROTO_H */
diff --git a/src/rcfile.c b/src/rcfile.c
index 9d0be640..8a832bbd 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -32,7 +32,6 @@
 #include <ctype.h>
 #include <assert.h>
 #include "proto.h"
-#include "nano.h"
 
 #ifdef ENABLE_NANORC
 
diff --git a/src/search.c b/src/search.c
index d904aaf3..696e2349 100644
--- a/src/search.c
+++ b/src/search.c
@@ -31,7 +31,6 @@
 #include <errno.h>
 #include <assert.h>
 #include "proto.h"
-#include "nano.h"
 
 static bool search_last_line = FALSE;
 	/* Have we gone past the last line while searching? */
diff --git a/src/utils.c b/src/utils.c
index 76437d72..450dd78a 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -32,7 +32,6 @@
 #include <errno.h>
 #include <assert.h>
 #include "proto.h"
-#include "nano.h"
 
 #ifdef HAVE_REGEX_H
 #ifdef BROKEN_REGEXEC
diff --git a/src/winio.c b/src/winio.c
index 3befda1b..09f2c170 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -30,7 +30,6 @@
 #include <ctype.h>
 #include <assert.h>
 #include "proto.h"
-#include "nano.h"
 
 static int *key_buffer = NULL;
 				/* The default keystroke buffer,
-- 
GitLab