diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:45:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:45:40 +0000 |
commit | 07d7f4cfa4b10de87a31b68191036ff446add675 (patch) | |
tree | 7162524d8aaf1aef62d2f4fa51f595ed113981ff /replace | |
parent | Adding upstream version 2.1.6. (diff) | |
download | pacemaker-upstream/2.1.7.tar.xz pacemaker-upstream/2.1.7.zip |
Adding upstream version 2.1.7.upstream/2.1.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | replace/Makefile.am | 28 | ||||
-rw-r--r-- | replace/NoSuchFunctionName.c | 31 | ||||
-rw-r--r-- | replace/alphasort.c | 55 | ||||
-rw-r--r-- | replace/scandir.c | 233 | ||||
-rw-r--r-- | replace/strchrnul.c | 15 | ||||
-rw-r--r-- | replace/strerror.c | 37 | ||||
-rw-r--r-- | replace/strndup.c | 38 | ||||
-rw-r--r-- | replace/strnlen.c | 31 |
8 files changed, 0 insertions, 468 deletions
diff --git a/replace/Makefile.am b/replace/Makefile.am deleted file mode 100644 index 1236b66..0000000 --- a/replace/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -# -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include - -QUIET_LIBTOOL_OPTS = @QUIET_LIBTOOL_OPTS@ -LIBTOOL = @LIBTOOL@ @QUIET_LIBTOOL_OPTS@ - - -noinst_LTLIBRARIES = libreplace.la -libreplace_la_SOURCES = -libreplace_la_LIBADD = @LTLIBOBJS@ diff --git a/replace/NoSuchFunctionName.c b/replace/NoSuchFunctionName.c deleted file mode 100644 index 2964f50..0000000 --- a/replace/NoSuchFunctionName.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2002 Alan Robertson <alanr@unix.sh> - * This software licensed under the GNU LGPL. - * - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ -void nosuchfunctionname(void); - -/* - * This is a completely useless function put here only to make OpenBSD make - * procedures happy. I hope no one ever makes such a function ;-) - */ -void -nosuchfunctionname(void) -{ - return; -} diff --git a/replace/alphasort.c b/replace/alphasort.c deleted file mode 100644 index f09f426..0000000 --- a/replace/alphasort.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * alphasort - replacement for alphasort functions. - * - * Matt Soffen - - * Copyright (C) 2001 Matt Soffen <matt@soffen.com> - * - * Taken from the FreeBSD file (with copyright notice) - * /usr/src/gnu/lib/libdialog/dir.c - *************************************************************************** - * Program: dir.c - * Author: Marc van Kempen - * desc: Directory routines, sorting and reading - * - * Copyright (c) 1995, Marc van Kempen - * - * All rights reserved. - * - * This software may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with - * its use. - * - *************************************************************************** - */ - -#include <crm_internal.h> -#include <sys/types.h> -#include <sys/stat.h> - -#include <unistd.h> /* XXX for _POSIX_VERSION ifdefs */ - -#if HAVE_STRINGS_H -# include <strings.h> -#endif - -#if !defined sgi && !defined _POSIX_VERSION -# include <sys/dir.h> -#endif - -#include <sys/types.h> -#include <dirent.h> -#include <stdlib.h> -#include <stddef.h> - -int -alphasort(const void *dirent1, const void *dirent2) -{ - return (strcmp((*(const struct dirent **)dirent1)->d_name, - (*(const struct dirent **)dirent2)->d_name)); -} diff --git a/replace/scandir.c b/replace/scandir.c deleted file mode 100644 index 71ac64e..0000000 --- a/replace/scandir.c +++ /dev/null @@ -1,233 +0,0 @@ -/* scandir: Scan a directory, collecting all (selected) items into a an array. - * - * This code borrowed from 'libit', which can be found here: - * - * http://www.iro.umontreal.ca/~pinard/libit/dist/scandir/ - * - * The original author put this code in the public domain. - * It has been modified slightly to get rid of warnings, etc. - * - * Below is the email I received from pinard@iro.umontreal.ca (François Pinard) - * when I sent him an email asking him about the license, etc. of this - * code which I obtained from his site. - * - * I think the correct spelling of his name is Rich Salz. I think he's now - * rsalz@datapower.com... - * -- - * Rich Salz, Chief Security Architect - * DataPower Technology http://www.datapower.com - * XS40 XML Security Gateway http://www.datapower.com/products/xs40.html - * - * Copyright(C): none (public domain) - * License: none (public domain) - * Author: Rich Salz <rsalz@datapower.com> - * - * - * - * -- Alan Robertson - * alanr@unix.sh - * - ************************************************************************** - * - * Subject: Re: Scandir replacement function - * Date: 18 May 2001 12:00:48 -0400 - * From: pinard@iro.umontreal.ca (François Pinard) - * To: Alan Robertson <alanr@unix.sh> - * References: 1 - * - * - * [Alan Robertson] - * - * > Hi, I'd like to use your scandir replacement function found here: - * > http://www.iro.umontreal.ca/~pinard/libit/dist/scandir/ But, it does - * > not indicate authorship or licensing terms in it. Could you tell me - * > who wrote this code, under what license you distribute it, and whether - * > and under what terms I may further distribute it? - * - * Hello, Alan. These are (somewhat) explained in UNSHAR.HDR found in the - * same directory. The routines have been written by Rick Saltz (I'm not - * completely sure of the spelling) a long while ago. I think that nowadays, - * Rick is better known as the main author of the nice INN package. - * - ************************************************************************** - * - * I spent a little time verifying this with Rick Salz. - * The results are below: - * - ************************************************************************** - * - * Date: Tue, 20 Sep 2005 21:52:09 -0400 (EDT) - * From: Rich Salz <rsalz@datapower.com> - * To: Alan Robertson <alanr@unix.sh> - * Subject: Re: Verifying permissions/licenses/etc on some old code of yours - - * scandir.c - * In-Reply-To: <433071CA.8000107@unix.sh> - * Message-ID: <Pine.LNX.4.44L0.0509202151270.9198-100000@smtp.datapower.com> - * Content-Type: TEXT/PLAIN; charset=US-ASCII - * - * yes, it's most definitely in the public domain. - * - * I'm glad you find it useful. I'm surprised it hasn't been replaced by, - * e.g,. something in GLibC. Ii'm impressed you tracked me down. - * - * /r$ - * - * -- - * Rich Salz Chief Security Architect - * DataPower Technology http://www.datapower.com - * XS40 XML Security Gateway http://www.datapower.com/products/xs40.html - * ----------------------------------------------------------------------> - * Subject: scandir, ftw REDUX - * Date: 1 Jan 88 00:47:01 GMT - * From: rsalz@pebbles.bbn.com - * Newsgroups: comp.sources.misc - * - * - * Forget my previous message -- I just decided for completeness's sake to - * implement the SysV ftw(3) routine, too. - * - * To repeat, these are public-domain implementations of the SystemV ftw() - * routine, the BSD scandir() and alphasort() routines, and documentation for - * same. The FTW manpage could be more readable, but so it goes. - * - * Anyhow, feel free to post these, and incorporate them into your existing - * packages. I have readdir() routiens for MSDOS and the Amiga if anyone - * wants them, and should have them for VMS by the end of January; let me - * know if you want copies. - * - * Yours in filesystems, - * /r$ - * - * Anyhow, feel free to post - * ----------------------------------------------------------------------< - * - */ - -#include <crm_internal.h> -#include <sys/types.h> -#include <dirent.h> -#include <stdlib.h> -#include <stddef.h> -#include <string.h> - -#ifndef NULL -# define NULL ((void *) 0) -#endif - -/* Initial guess at directory allocated. */ -#define INITIAL_ALLOCATION 20 - -int - - -scandir(const char *directory_name, - struct dirent ***array_pointer, int (*select_function) (const struct dirent *), -#ifdef USE_SCANDIR_COMPARE_STRUCT_DIRENT - /* This is what the Linux man page says */ - int (*compare_function) (const struct dirent **, const struct dirent **) -#else - /* This is what the Linux header file says ... */ - int (*compare_function) (const void *, const void *) -#endif - ); - -int -scandir(const char *directory_name, - struct dirent ***array_pointer, int (*select_function) (const struct dirent *), -#ifdef USE_SCANDIR_COMPARE_STRUCT_DIRENT - /* This is what the linux man page says */ - int (*compare_function) (const struct dirent **, const struct dirent **) -#else - /* This is what the linux header file says ... */ - int (*compare_function) (const void *, const void *) -#endif - ) -{ - DIR *directory; - struct dirent **array; - struct dirent *entry; - struct dirent *copy; - int allocated = INITIAL_ALLOCATION; - int counter = 0; - - /* Get initial list space and open directory. */ - - if ((directory = opendir(directory_name)) == NULL) { - return -1; - } - - if ((array = (struct dirent **)malloc(allocated * sizeof(struct dirent *))) - == NULL) { - closedir(directory); - return -1; - } - - /* Read entries in the directory. */ - - while (entry = readdir(directory), entry) - if (select_function == NULL || (*select_function) (entry)) { - /* User wants them all, or he wants this one. Copy the entry. */ - - /* - * On some OSes the declaration of "entry->d_name" is a minimal-length - * placeholder. Example: Solaris: - * /usr/include/sys/dirent.h: - * "char d_name[1];" - * man page "dirent(3)": - * The field d_name is the beginning of the character array - * giving the name of the directory entry. This name is - * null terminated and may have at most MAXNAMLEN chars. - * So our malloc length may need to be increased accordingly. - * sizeof(entry->d_name): space (possibly minimal) in struct. - * strlen(entry->d_name): actual length of the entry. - * - * John Kavadias <john_kavadias@hotmail.com> - * David Lee <t.d.lee@durham.ac.uk> - */ - int namelength = strlen(entry->d_name) + 1; /* length with NULL */ - int extra = 0; - - if (sizeof(entry->d_name) <= namelength) { - /* allocated space <= required space */ - extra += namelength - sizeof(entry->d_name); - } - - if ((copy = (struct dirent *)malloc(sizeof(struct dirent) + extra)) == NULL) { - closedir(directory); - free(array); - return -1; - } - copy->d_ino = entry->d_ino; - copy->d_reclen = entry->d_reclen; - strcpy(copy->d_name, entry->d_name); - - /* Save the copy. */ - - if (counter + 1 == allocated) { - allocated <<= 1; - array = pcmk__realloc((char *)array, - allocated * sizeof(struct dirent *)); - if (array == NULL) { - closedir(directory); - free(array); - free(copy); - return -1; - } - } - array[counter++] = copy; - } - - /* Close things off. */ - - array[counter] = NULL; - *array_pointer = array; - closedir(directory); - - /* Sort? */ - - if (counter > 1 && compare_function) - qsort((char *)array, counter, sizeof(struct dirent *) - , (int (*)(const void *, const void *))(compare_function)); - - return counter; -} diff --git a/replace/strchrnul.c b/replace/strchrnul.c deleted file mode 100644 index d1be6df..0000000 --- a/replace/strchrnul.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <crm_internal.h> -/* Borrowed from gnulib's strchrnul.c under GLPv2+ */ - -#include <string.h> -/* Find the first occurrence of C in S or the final NUL byte. */ -char * -strchrnul(const char *s, int c_in) -{ - char c = c_in; - - while (*s && (*s != c)) - s++; - - return (char *)s; -} diff --git a/replace/strerror.c b/replace/strerror.c deleted file mode 100644 index bb1b25a..0000000 --- a/replace/strerror.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2002 Alan Robertson <alanr@unix.sh> - * This software licensed under the GNU LGPL. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of version 2.1 of the GNU Lesser General Public - * License as published by the Free Software Foundation. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ -#include <crm_internal.h> -#include <errno.h> -#include <stdio.h> -extern const char *sys_err[]; -extern int sys_nerr; -char * -strerror(int errnum) -{ - static char whaterr[32]; - - if (errnum < 0) { - return "negative errno"; - } - if (errnum >= sys_nerr) { - snprintf(whaterr, sizeof(whaterr), "error %d", errnum); - return whaterr; - } - return sys_err[sys_nerr]; -} diff --git a/replace/strndup.c b/replace/strndup.c deleted file mode 100644 index 9fe02cc..0000000 --- a/replace/strndup.c +++ /dev/null @@ -1,38 +0,0 @@ -#include <crm_internal.h> -#include <stdlib.h> -#include <string.h> -/* - * Copyright (C) 2004 Matt Soffen <sirgeek-ha@mrsucko.org> - * This software licensed under the GNU LGPL. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -/* Taken from the GlibC implementation of strndup */ - -char * -strndup(const char *str, size_t len) -{ - size_t n = strnlen(str, len); - char *new = (char *)malloc(len + 1); - - if (NULL == new) { - return NULL; - } - - new[n] = '\0'; - return (char *)memcpy(new, str, len); -} diff --git a/replace/strnlen.c b/replace/strnlen.c deleted file mode 100644 index 7f4250c..0000000 --- a/replace/strnlen.c +++ /dev/null @@ -1,31 +0,0 @@ -#include <crm_internal.h> -#include <string.h> -/* - * Copyright (C) 2003 Alan Robertson <alanr@unix.sh> - * This software licensed under the GNU LGPL. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -size_t -strnlen(const char *s, size_t maxlen) -{ - const char *eospos; - - eospos = memchr(s, (int)'\0', maxlen); - - return (eospos == NULL ? maxlen : (size_t) (eospos - s)); -} |