181 lines
4.2 KiB
Diff
181 lines
4.2 KiB
Diff
|
From 602dbcb26e9591922ca94f5b326694a2309fff18 Mon Sep 17 00:00:00 2001
|
||
|
From: Mike Frysinger <vapier@gentoo.org>
|
||
|
Date: Fri, 10 Jan 2014 10:07:39 -0500
|
||
|
Subject: [PATCH 11/34] move gettext logic into misc.h
|
||
|
|
||
|
This lets us autogenerate config.h using autoheader rather than
|
||
|
hand maintain it.
|
||
|
---
|
||
|
chacl/chacl.c | 4 ++--
|
||
|
getfacl/getfacl.c | 5 ++---
|
||
|
include/config.h.in | 10 ----------
|
||
|
include/misc.h | 17 +++++++++++++++++
|
||
|
libacl/perm_copy.h | 2 ++
|
||
|
setfacl/do_set.c | 3 ++-
|
||
|
setfacl/setfacl.c | 5 ++---
|
||
|
7 files changed, 27 insertions(+), 19 deletions(-)
|
||
|
|
||
|
diff --git a/chacl/chacl.c b/chacl/chacl.c
|
||
|
index 854a620..525a7ff 100644
|
||
|
--- a/chacl/chacl.c
|
||
|
+++ b/chacl/chacl.c
|
||
|
@@ -17,6 +17,7 @@
|
||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||
|
*/
|
||
|
|
||
|
+#include "config.h"
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
#include <unistd.h>
|
||
|
@@ -29,8 +30,7 @@
|
||
|
#include <sys/stat.h>
|
||
|
#include <sys/acl.h>
|
||
|
#include <acl/libacl.h>
|
||
|
-#include <locale.h>
|
||
|
-#include "config.h"
|
||
|
+#include "misc.h"
|
||
|
|
||
|
static int acl_delete_file (const char * path, acl_type_t type);
|
||
|
static int list_acl(char *file);
|
||
|
diff --git a/getfacl/getfacl.c b/getfacl/getfacl.c
|
||
|
index f8eaf25..22cc1c7 100644
|
||
|
--- a/getfacl/getfacl.c
|
||
|
+++ b/getfacl/getfacl.c
|
||
|
@@ -21,6 +21,7 @@
|
||
|
USA.
|
||
|
*/
|
||
|
|
||
|
+#include "config.h"
|
||
|
#include <stdio.h>
|
||
|
#include <errno.h>
|
||
|
#include <sys/acl.h>
|
||
|
@@ -34,11 +35,9 @@
|
||
|
#include <dirent.h>
|
||
|
#include <libgen.h>
|
||
|
#include <getopt.h>
|
||
|
-#include <locale.h>
|
||
|
-#include "config.h"
|
||
|
+#include "misc.h"
|
||
|
#include "user_group.h"
|
||
|
#include "walk_tree.h"
|
||
|
-#include "misc.h"
|
||
|
|
||
|
#define POSIXLY_CORRECT_STR "POSIXLY_CORRECT"
|
||
|
|
||
|
diff --git a/include/config.h.in b/include/config.h.in
|
||
|
index 6787b6e..6a720ac 100644
|
||
|
--- a/include/config.h.in
|
||
|
+++ b/include/config.h.in
|
||
|
@@ -39,16 +39,6 @@
|
||
|
/* Define if you want gettext (I18N) support */
|
||
|
#undef ENABLE_GETTEXT
|
||
|
|
||
|
-#ifdef ENABLE_GETTEXT
|
||
|
-# include <libintl.h>
|
||
|
-# define _(x) gettext(x)
|
||
|
-#else
|
||
|
-# define _(x) (x)
|
||
|
-# define textdomain(d) do { } while (0)
|
||
|
-# define bindtextdomain(d,dir) do { } while (0)
|
||
|
-#endif
|
||
|
-#include <locale.h>
|
||
|
-
|
||
|
/* On GNU/kFreeBSD, ENODATA is not defined in the system headers */
|
||
|
#include <errno.h>
|
||
|
#ifndef ENODATA
|
||
|
diff --git a/include/misc.h b/include/misc.h
|
||
|
index 0c5fdcc..a4fa70e 100644
|
||
|
--- a/include/misc.h
|
||
|
+++ b/include/misc.h
|
||
|
@@ -15,9 +15,26 @@
|
||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
+#ifndef __MISC_H
|
||
|
+#define __MISC_H
|
||
|
+
|
||
|
+#include <stdio.h>
|
||
|
+
|
||
|
extern int high_water_alloc(void **buf, size_t *bufsize, size_t newsize);
|
||
|
|
||
|
extern const char *quote(const char *str, const char *quote_chars);
|
||
|
extern char *unquote(char *str);
|
||
|
|
||
|
extern char *next_line(FILE *file);
|
||
|
+
|
||
|
+#ifdef ENABLE_NLS
|
||
|
+# include <libintl.h>
|
||
|
+# define _(x) gettext(x)
|
||
|
+#else
|
||
|
+# define _(x) (x)
|
||
|
+# define textdomain(d) do { } while (0)
|
||
|
+# define bindtextdomain(d,dir) do { } while (0)
|
||
|
+#endif
|
||
|
+#include <locale.h>
|
||
|
+
|
||
|
+#endif
|
||
|
diff --git a/libacl/perm_copy.h b/libacl/perm_copy.h
|
||
|
index 87b1566..350ae6a 100644
|
||
|
--- a/libacl/perm_copy.h
|
||
|
+++ b/libacl/perm_copy.h
|
||
|
@@ -35,3 +35,5 @@
|
||
|
#define HAVE_ACL_GET_TAG_TYPE 1
|
||
|
#define HAVE_ACL_SET_FD 1
|
||
|
#define HAVE_ACL_SET_FILE 1
|
||
|
+
|
||
|
+#include "misc.h"
|
||
|
diff --git a/setfacl/do_set.c b/setfacl/do_set.c
|
||
|
index 3e7e982..60da837 100644
|
||
|
--- a/setfacl/do_set.c
|
||
|
+++ b/setfacl/do_set.c
|
||
|
@@ -20,6 +20,7 @@
|
||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||
|
*/
|
||
|
|
||
|
+#include "config.h"
|
||
|
#include <stdio.h>
|
||
|
#include <errno.h>
|
||
|
#include <sys/acl.h>
|
||
|
@@ -33,10 +34,10 @@
|
||
|
#include <unistd.h>
|
||
|
#include <dirent.h>
|
||
|
#include <ftw.h>
|
||
|
+#include "misc.h"
|
||
|
#include "sequence.h"
|
||
|
#include "do_set.h"
|
||
|
#include "parse.h"
|
||
|
-#include "config.h"
|
||
|
#include "walk_tree.h"
|
||
|
|
||
|
|
||
|
diff --git a/setfacl/setfacl.c b/setfacl/setfacl.c
|
||
|
index 81062a6..f6135b7 100644
|
||
|
--- a/setfacl/setfacl.c
|
||
|
+++ b/setfacl/setfacl.c
|
||
|
@@ -20,6 +20,7 @@
|
||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||
|
*/
|
||
|
|
||
|
+#include "config.h"
|
||
|
#include <limits.h>
|
||
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
@@ -29,13 +30,11 @@
|
||
|
#include <dirent.h>
|
||
|
#include <libgen.h>
|
||
|
#include <getopt.h>
|
||
|
-#include <locale.h>
|
||
|
-#include "config.h"
|
||
|
+#include "misc.h"
|
||
|
#include "sequence.h"
|
||
|
#include "parse.h"
|
||
|
#include "do_set.h"
|
||
|
#include "walk_tree.h"
|
||
|
-#include "misc.h"
|
||
|
|
||
|
#define POSIXLY_CORRECT_STR "POSIXLY_CORRECT"
|
||
|
|
||
|
--
|
||
|
2.5.2
|
||
|
|