1) make use of new delpendency scheme
2) made " #if" look like "# if" for portability 3) added strdup.c CVS patchset: 2021 CVS date: 1998/03/04 16:51:38
This commit is contained in:
parent
d29004dc69
commit
1d7baffb33
|
@ -1,4 +1,5 @@
|
|||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = $(srcdir)
|
||||
|
||||
include ../Makefile.inc
|
||||
|
@ -8,11 +9,7 @@ LIBMISC = libmisc.a
|
|||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
TARGET=everything
|
||||
else
|
||||
TARGET=depend everything
|
||||
endif
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
|
@ -28,10 +25,12 @@ clean:
|
|||
rm -f *.a *.o *~ $(PROGS)
|
||||
|
||||
distclean: clean
|
||||
rm -f .depend Makefile
|
||||
rm -f Makefile
|
||||
|
||||
depend:
|
||||
$(CPP) $(CFLAGS) -M $(srcdir)/*.c > .depend
|
||||
topdir_path=`( cd $(top_srcdir) && pwd )` ; \
|
||||
$(CPP) $(CFLAGS) -MM $(srcdir)/*.c | \
|
||||
sed s+$$topdir_path+$(top_srcdir)+g > .depend
|
||||
|
||||
ifeq (.depend,$(wildcard .depend))
|
||||
include .depend
|
||||
|
|
|
@ -40,7 +40,7 @@ our_mntent *getmntent(FILE *filep) {
|
|||
|
||||
if (*chptr == COMMENTCHAR) continue;
|
||||
|
||||
#if __aix__
|
||||
# if __aix__
|
||||
/* aix uses a screwed up file format */
|
||||
if (*chptr == '/') {
|
||||
start = chptr;
|
||||
|
@ -49,7 +49,7 @@ our_mntent *getmntent(FILE *filep) {
|
|||
item.mnt_dir = strdup(start);
|
||||
return &item;
|
||||
}
|
||||
#else
|
||||
# else
|
||||
while (!isspace(*chptr) && (*chptr)) chptr++;
|
||||
if (!*chptr) return NULL;
|
||||
|
||||
|
@ -62,7 +62,7 @@ our_mntent *getmntent(FILE *filep) {
|
|||
|
||||
item.our_mntdir = strdup(start);
|
||||
return &item;
|
||||
#endif
|
||||
# endif
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -35,13 +35,19 @@
|
|||
char *realpath(const char *path, char resolved_path []);
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_STDTYPES_H
|
||||
# include <sys/stdtypes.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if NEED_TIMEZONE
|
||||
#include <sys/stdtypes.h>
|
||||
extern time_t timezone;
|
||||
#endif
|
||||
|
||||
#if NEED_MYREALLOC
|
||||
#include <sys/stdtypes.h>
|
||||
#define realloc(ptr,size) myrealloc(ptr,size)
|
||||
extern void *myrealloc(void *, size_t);
|
||||
#endif
|
||||
|
@ -66,7 +72,15 @@ extern void *myrealloc(void *, size_t);
|
|||
#if HAVE_GETMNTINFO_R || HAVE_MNTCTL
|
||||
# define GETMNTENT_ONE 0
|
||||
# define GETMNTENT_TWO 0
|
||||
# include <sys/mount.h>
|
||||
# if HAVE_SYS_MNTCTL_H
|
||||
# include <sys/mntctl.h>
|
||||
# endif
|
||||
# if HAVE_SYS_VMOUNT_H
|
||||
# include <sys/vmount.h>
|
||||
# endif
|
||||
# if HAVE_SYS_MOUNT_H
|
||||
# include <sys/mount.h>
|
||||
# endif
|
||||
#elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
|
||||
# if HAVE_MNTENT_H
|
||||
# include <stdio.h>
|
||||
|
@ -74,15 +88,15 @@ extern void *myrealloc(void *, size_t);
|
|||
# define our_mntent struct mntent
|
||||
# define our_mntdir mnt_dir
|
||||
# elif HAVE_STRUCT_MNTTAB
|
||||
#include <stdio.h>
|
||||
#include <mnttab.h>
|
||||
# include <stdio.h>
|
||||
# include <mnttab.h>
|
||||
struct our_mntent {
|
||||
char * our_mntdir;
|
||||
};
|
||||
struct our_mntent *getmntent(FILE *filep);
|
||||
# define our_mntent struct our_mntent
|
||||
# else
|
||||
#include <stdio.h>
|
||||
# include <stdio.h>
|
||||
struct our_mntent {
|
||||
char * our_mntdir;
|
||||
};
|
||||
|
@ -98,7 +112,7 @@ extern void *myrealloc(void *, size_t);
|
|||
# define GETMNTENT_TWO 1
|
||||
# define our_mntent struct mnttab
|
||||
# define our_mntdir mnt_mountp
|
||||
#else if !HAVE_MNTCTL
|
||||
#else /* if !HAVE_MNTCTL */
|
||||
# error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Author: Tim Mooney <mooney@plains.nodak.edu>
|
||||
* Copyright: This file is in the public domain.
|
||||
*
|
||||
* a replacement for strdup() for those platforms that don't have it,
|
||||
* like Ultrix.
|
||||
*
|
||||
* Requires: malloc(), strlen(), strcpy().
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STDLIB_H) || defined(STDC_HEADERS)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
extern void *malloc(size_t);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
|
||||
# include <string.h>
|
||||
#else
|
||||
extern size_t strlen(const char *);
|
||||
extern char *strcpy(char *, const char *);
|
||||
#endif
|
||||
|
||||
char * strdup(const char *s) {
|
||||
void *p = NULL;
|
||||
|
||||
p = malloc(strlen(s)+1);
|
||||
if (!p) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy( (char *) p, s);
|
||||
return (char *) p;
|
||||
}
|
||||
|
Loading…
Reference in New Issue