From 11730e7506399b5638744f92cc06a198b2d87956 Mon Sep 17 00:00:00 2001 From: wlemb Date: Wed, 4 Jul 2001 23:11:58 +0000 Subject: *** empty log message *** --- src/libs/libgroff/maxfilename.cc | 67 ++++++++++++++++++++++++++++++++++++++++ src/utils/indxbib/dirnamemax.c | 49 ----------------------------- 2 files changed, 67 insertions(+), 49 deletions(-) create mode 100644 src/libs/libgroff/maxfilename.cc delete mode 100755 src/utils/indxbib/dirnamemax.c diff --git a/src/libs/libgroff/maxfilename.cc b/src/libs/libgroff/maxfilename.cc new file mode 100644 index 00000000..c5a03d73 --- /dev/null +++ b/src/libs/libgroff/maxfilename.cc @@ -0,0 +1,67 @@ +// -*- C++ -*- +/* Copyright (C) 1992, 2001 Free Software Foundation, Inc. + Written by James Clark (jjc@jclark.com) + +This file is part of groff. + +groff 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, or (at your option) any later +version. + +groff 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 groff; see the file COPYING. If not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* file_name_max(dir) does the same as pathconf(dir, _PC_NAME_MAX) */ + +#include + +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ + +#ifdef _POSIX_VERSION + +size_t file_name_max(const char *fname) +{ + return pathconf(fname, _PC_NAME_MAX); +} + +#else /* not _POSIX_VERSION */ + +#ifdef HAVE_LIMITS_H +#include +#endif /* HAVE_LIMITS_H */ + +#ifdef HAVE_DIRENT_H +#include +#else /* not HAVE_DIRENT_H */ +#ifdef HAVE_SYS_DIR_H +#include +#endif /* HAVE_SYS_DIR_H */ +#endif /* not HAVE_DIRENT_H */ + +#ifndef NAME_MAX +#ifdef MAXNAMLEN +#define NAME_MAX MAXNAMLEN +#else /* !MAXNAMLEN */ +#ifdef MAXNAMELEN +#define NAME_MAX MAXNAMELEN +#else /* !MAXNAMELEN */ +#define NAME_MAX 14 +#endif /* !MAXNAMELEN */ +#endif /* !MAXNAMLEN */ +#endif /* !NAME_MAX */ + +size_t file_name_max(const char *) +{ + return NAME_MAX; +} + +#endif /* not _POSIX_VERSION */ diff --git a/src/utils/indxbib/dirnamemax.c b/src/utils/indxbib/dirnamemax.c deleted file mode 100755 index a8cd9923..00000000 --- a/src/utils/indxbib/dirnamemax.c +++ /dev/null @@ -1,49 +0,0 @@ -/* dir_name_max(dir) does the same as pathconf(dir, _PC_NAME_MAX) */ - -#include - -#ifdef HAVE_UNISTD_H -#include -#endif /* HAVE_UNISTD_H */ - -#ifdef _POSIX_VERSION - -long dir_name_max(dir) - char *dir; -{ - return pathconf(dir, _PC_NAME_MAX); -} - -#else /* not _POSIX_VERSION */ - -#ifdef HAVE_LIMITS_H -#include -#endif /* HAVE_LIMITS_H */ - -#ifdef HAVE_DIRENT_H -#include -#else /* not HAVE_DIRENT_H */ -#ifdef HAVE_SYS_DIR_H -#include -#endif /* HAVE_SYS_DIR_H */ -#endif /* not HAVE_DIRENT_H */ - -#ifndef NAME_MAX -#ifdef MAXNAMLEN -#define NAME_MAX MAXNAMLEN -#else /* !MAXNAMLEN */ -#ifdef MAXNAMELEN -#define NAME_MAX MAXNAMELEN -#else /* !MAXNAMELEN */ -#define NAME_MAX 14 -#endif /* !MAXNAMELEN */ -#endif /* !MAXNAMLEN */ -#endif /* !NAME_MAX */ - -long dir_name_max(dir) - char *dir; -{ - return NAME_MAX; -} - -#endif /* not _POSIX_VERSION */ -- cgit v1.2.1