summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/cvs/lib/strippath.c
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1995-03-31 07:45:33 +0000
committernate <nate@FreeBSD.org>1995-03-31 07:45:33 +0000
commit02981a52b9b7d28ced57a7a8115421fdd16789eb (patch)
tree958f60d7dbf93543b5943afdbdf191d284685c48 /gnu/usr.bin/cvs/lib/strippath.c
parent4de36c4e9835a2fa1c9db2a6d16811ace584305a (diff)
downloadFreeBSD-src-02981a52b9b7d28ced57a7a8115421fdd16789eb.zip
FreeBSD-src-02981a52b9b7d28ced57a7a8115421fdd16789eb.tar.gz
Original sources from CVS-1.4A2 munged to fit our directory structure.
Diffstat (limited to 'gnu/usr.bin/cvs/lib/strippath.c')
-rw-r--r--gnu/usr.bin/cvs/lib/strippath.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gnu/usr.bin/cvs/lib/strippath.c b/gnu/usr.bin/cvs/lib/strippath.c
index 3d606a8..39687f9 100644
--- a/gnu/usr.bin/cvs/lib/strippath.c
+++ b/gnu/usr.bin/cvs/lib/strippath.c
@@ -15,14 +15,20 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#if defined(STDC_HEADERS) || defined(USG)
-#include <string.h>
-#ifndef index
-#define index strchr
+#ifdef HAVE_CONFIG_H
+#include "config.h"
#endif
-#else
+
+#if STDC_HEADERS || HAVE_STRING_H
+#include <string.h>
+/* An ANSI string.h and pre-ANSI memory.h might conflict. */
+#if !STDC_HEADERS && HAVE_MEMORY_H
+#include <memory.h>
+#endif /* not STDC_HEADERS and HAVE_MEMORY_H */
+#else /* not STDC_HJEADERS and not HAVE_STRING_H */
#include <strings.h>
-#endif
+/* memory.h and strings.h conflict on some systems. */
+#endif /* not STDC_HEADERS and not HAVE_STRING_H */
#include <stdio.h>
@@ -43,7 +49,7 @@ strip_path (path)
int stripped = 0;
char *cp, *slash;
- for (cp = path; (slash = index(cp, '/')) != NULL; cp = slash)
+ for (cp = path; (slash = strchr(cp, '/')) != NULL; cp = slash)
{
*slash = '\0';
if ((!*cp && (cp != path || stripped)) ||
OpenPOWER on IntegriCloud