Mercurial > hg > octave-lojdl
changeset 10027:0f312e11957e
use mkdir module from gnulib
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 26 Dec 2009 00:20:12 -0500 |
parents | 9b3a100922a6 |
children | 52a248732bb6 |
files | ChangeLog acinclude.m4 bootstrap.conf configure.ac liboctave/ChangeLog liboctave/Makefile.am liboctave/file-ops.cc liboctave/mkdir.c |
diffstat | 8 files changed, 17 insertions(+), 143 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-12-25 John W. Eaton <jwe@octave.org> + + * bootstrap.conf (gnulib_modules): Include mkdir in the list. + * configure.ac: Don't check for mkdir. + Don't call OCTAVE_MKDIR_TAKES_ONE_ARG. + * acinclude.m4 (OCTAVE_MKDIR_TAKES_ONE_ARG): Delete. + 2009-12-25 John W. Eaton <jwe@octave.org> * bootstrap.conf (gnulib_modules): Include crypto/md5 in the list.
--- a/acinclude.m4 +++ b/acinclude.m4 @@ -811,28 +811,6 @@ fi AC_LANG_POP(C++)]) dnl -dnl Determine if mkdir accepts only one argument instead dnl of the usual 2. -dnl -AC_DEFUN([OCTAVE_MKDIR_TAKES_ONE_ARG], [ -AC_LANG_PUSH(C++) -AC_CACHE_CHECK([if mkdir takes one argument], octave_cv_mkdir_takes_one_arg, -[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> -#ifdef HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif -#ifdef HAVE_DIRECT_H -# include <direct.h> -#endif]], [[mkdir ("foo", 0);]])], - octave_cv_mkdir_takes_one_arg=no, octave_cv_mkdir_takes_one_arg=yes)]) -AC_LANG_POP(C++) -if test $octave_cv_mkdir_takes_one_arg = yes ; then - AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.]) -fi -]) -dnl dnl Find find. dnl # Prefer GNU find if found.
--- a/bootstrap.conf +++ b/bootstrap.conf @@ -18,9 +18,10 @@ # gnulib modules used by this package. gnulib_modules=" + crypto/md5 fnmatch glob - crypto/md5 + mkdir strftime "
--- a/configure.ac +++ b/configure.ac @@ -1435,7 +1435,7 @@ getegid geteuid getgid getgrent getgrgid getgrnam getpgrp getpid \ getppid getpwent getpwuid gettimeofday getuid getwd _kbhit kill \ lgamma lgammaf lgamma_r lgammaf_r link localtime_r log1p log1pf lstat \ - memmove mkdir mkfifo mkstemp on_exit pipe poll putenv raise readlink \ + memmove mkfifo mkstemp on_exit pipe poll putenv raise readlink \ realpath rename resolvepath rindex rmdir roundl select setgrent setlocale \ setpwent setvbuf sigaction siglongjmp sigpending sigprocmask sigsuspend \ snprintf stat strcasecmp strdup strerror stricmp strncasecmp \ @@ -1731,9 +1731,6 @@ AC_CHECK_MEMBERS(struct group.gr_passwd) -# mkdir takes a single argument on some systems. -OCTAVE_MKDIR_TAKES_ONE_ARG - octave_found_termlib=no for termlib in ncurses curses termcap terminfo termlib; do AC_CHECK_LIB(${termlib}, tputs, [
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,10 @@ +2009-12-25 John W. Eaton <jwe@octave.org> + + * file-ops.cc (file_ops::mkdir): Assume we have an mkdir + function that takes two arguments. + * mkdir.c: Delete. + * Makefile.am (LIBOCTAVE_C_SOURCES): Remove mkdir.c from the list. + 2009-12-25 John W. Eaton <jwe@octave.org> * oct-md5.cc (oct_md5_result_to_str): New function.
--- a/liboctave/Makefile.am +++ b/liboctave/Makefile.am @@ -456,7 +456,6 @@ getopt1.c \ lo-cieee.c \ lo-cutils.c \ - mkdir.c \ oct-getopt.c \ randgamma.c \ randmtzig.c \
--- a/liboctave/file-ops.cc +++ b/liboctave/file-ops.cc @@ -108,22 +108,13 @@ int status = -1; -#if defined (HAVE_MKDIR) - -#if defined (MKDIR_TAKES_ONE_ARG) - status = ::mkdir (name.c_str ()); -#else status = ::mkdir (name.c_str (), mode); -#endif if (status < 0) { using namespace std; msg = ::strerror (errno); } -#else - msg = NOT_SUPPORTED ("mkdir"); -#endif return status; }
deleted file mode 100644 --- a/liboctave/mkdir.c +++ /dev/null @@ -1,106 +0,0 @@ -/* mkdir.c -- BSD compatible make directory function for System V - Copyright (C) 1988, 1990 Free Software Foundation, Inc. - - This program 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 2 of the License, or - (at your option) any later version. - - This program 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 this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifndef HAVE_MKDIR - -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#include <sys/stat.h> -#include <errno.h> -#ifndef errno -extern int errno; -#endif - -#ifdef STAT_MACROS_BROKEN -#undef S_ISDIR -#endif - -#if !defined(S_ISDIR) && defined(S_IFDIR) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#endif - -#include "safe-stat.h" - -/* mkdir adapted from GNU tar. */ - -/* Make directory DPATH, with permission mode DMODE. - - Written by Robert Rother, Mariah Corporation, August 1985 - (sdcsvax!rmr or rmr@uscd). If you want it, it's yours. - - Severely hacked over by John Gilmore to make a 4.2BSD compatible - subroutine. 11Mar86; hoptoad!gnu - - Modified by rmtodd@uokmax 6-28-87 -- when making an already existing dir, - subroutine didn't return EEXIST. It does now. */ - -int -mkdir (dpath, dmode) - char *dpath; - int dmode; -{ - int cpid, status; - struct stat statbuf; - - if (SAFE_STAT (dpath, &statbuf) == 0) - { - errno = EEXIST; /* stat worked, so it already exists. */ - return -1; - } - - /* If stat fails for a reason other than non-existence, return error. */ - if (errno != ENOENT) - return -1; - - cpid = fork (); - switch (cpid) - { - case -1: /* Cannot fork. */ - return -1; /* errno is already set. */ - - case 0: /* Child process. */ - /* Cheap hack to set mode of new directory. Since this child - process is going away anyway, we zap its umask. - This won't suffice to set SUID, SGID, etc. on this - directory, so the parent process calls chmod afterward. */ - status = umask (0); /* Get current umask. */ - umask (status | (0777 & ~dmode)); /* Set for mkdir. */ - execl ("/bin/mkdir", "mkdir", dpath, (char *) 0); - _exit (1); - - default: /* Parent process. */ - /* Wait for kid to finish. */ - while (wait (&status) != cpid) - /* Do nothing. */ ; - - if (status & 0xFFFF) - { - /* /bin/mkdir failed. */ - errno = EIO; - return -1; - } - return chmod (dpath, dmode); - } -} - -#endif