changeset 21901:7338be52b892

hide gnulib filemode header * liboctave/wrappers/strmode-wrapper.c, liboctave/wrappers/strmode-wrapper.h: New files. * liboctave/wrappers/module.mk: Update. * file-stat.cc: Use new octave_strmode_wrapper function.
author John W. Eaton <jwe@octave.org>
date Tue, 14 Jun 2016 15:18:59 -0400
parents d25e9f85ffb4
children a46c49f0d52e
files liboctave/system/file-stat.cc liboctave/wrappers/module.mk liboctave/wrappers/strmode-wrapper.c liboctave/wrappers/strmode-wrapper.h
diffstat 4 files changed, 81 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/system/file-stat.cc	Tue Jun 14 14:28:09 2016 -0400
+++ b/liboctave/system/file-stat.cc	Tue Jun 14 15:18:59 2016 -0400
@@ -27,11 +27,10 @@
 #include <cerrno>
 #include <cstring>
 
-#include "filemode.h"
-
 #include "file-ops.h"
 #include "file-stat.h"
 #include "statdefs.h"
+#include "strmode-wrapper.h"
 
 namespace octave
 {
@@ -158,7 +157,7 @@
     {
       char buf[12];
 
-      strmode (m_mode, buf);
+      octave_strmode_wrapper (m_mode, buf);
 
       return std::string (buf);
     }
--- a/liboctave/wrappers/module.mk	Tue Jun 14 14:28:09 2016 -0400
+++ b/liboctave/wrappers/module.mk	Tue Jun 14 15:18:59 2016 -0400
@@ -11,6 +11,7 @@
   liboctave/wrappers/putenv-wrapper.h \
   liboctave/wrappers/set-program-name-wrapper.h \
   liboctave/wrappers/strftime-wrapper.h \
+  liboctave/wrappers/strmode-wrapper.h \
   liboctave/wrappers/strptime-wrapper.h \
   liboctave/wrappers/uname-wrapper.h \
   liboctave/wrappers/unsetenv-wrapper.h \
@@ -30,6 +31,7 @@
   liboctave/wrappers/putenv-wrapper.c \
   liboctave/wrappers/set-program-name-wrapper.c \
   liboctave/wrappers/strftime-wrapper.c \
+  liboctave/wrappers/strmode-wrapper.c \
   liboctave/wrappers/strptime-wrapper.c \
   liboctave/wrappers/uname-wrapper.c \
   liboctave/wrappers/unsetenv-wrapper.c \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/wrappers/strmode-wrapper.c	Tue Jun 14 15:18:59 2016 -0400
@@ -0,0 +1,39 @@
+/*
+
+Copyright (C) 2016 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+// strmode may be provided by gnulib.  We don't include gnulib headers
+// directly in Octave's C++ source files to avoid problems that may be
+// caused by the way that gnulib overrides standard library functions.
+
+#if defined (HAVE_CONFIG_H)
+#  include "config.h"
+#endif
+
+#include "filemode.h"
+
+#include "strmode-wrapper.h"
+
+void
+octave_strmode_wrapper (mode_t mode, char *buffer)
+{
+  strmode (mode, buffer);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/wrappers/strmode-wrapper.h	Tue Jun 14 15:18:59 2016 -0400
@@ -0,0 +1,38 @@
+/*
+
+Copyright (C) 2016 John W. Eaton
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if ! defined (octave_strmode_wrapper_h)
+#define octave_strmode_wrapper_h 1
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+// Expects a buffer with at least 12 characters.
+
+extern void octave_strmode_wrapper (mode_t mode, char *buffer);
+
+#if defined __cplusplus
+}
+#endif
+
+#endif