diff options
-rw-r--r-- | Makefile.in | 44 | ||||
-rwxr-xr-x | configure | 31 | ||||
-rw-r--r-- | configure.in | 13 | ||||
-rw-r--r-- | include/config.h.in (renamed from config.h.in) | 14 | ||||
-rw-r--r-- | include/duser.h | 6 | ||||
-rw-r--r-- | src/Makefile.in | 4 | ||||
-rw-r--r-- | src/user.c | 8 |
7 files changed, 77 insertions, 43 deletions
diff --git a/Makefile.in b/Makefile.in index e99b3ee..8b90141 100644 --- a/Makefile.in +++ b/Makefile.in @@ -36,9 +36,10 @@ host_triplet = @host@ target_triplet = @target@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ - compile config.guess config.sub depcomp install-sh missing + $(srcdir)/Makefile.in $(top_srcdir)/configure \ + $(top_srcdir)/include/config.h.in AUTHORS COPYING ChangeLog \ + INSTALL NEWS compile config.guess config.sub depcomp \ + install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -46,7 +47,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = config.h +CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = @@ -201,8 +202,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive +all: all-recursive .SUFFIXES: am--refresh: @@ -240,22 +240,22 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): -config.h: stamp-h1 +include/config.h: include/stamp-h1 @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + rm -f include/stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) include/stamp-h1; \ else :; fi -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: $(am__configure_deps) +include/stamp-h1: $(top_srcdir)/include/config.h.in $(top_builddir)/config.status + @rm -f include/stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status include/config.h +$(top_srcdir)/include/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 + rm -f include/stamp-h1 touch $@ distclean-hdr: - -rm -f config.h stamp-h1 + -rm -f include/config.h include/stamp-h1 # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. @@ -337,7 +337,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) mkid -fID $$unique tags: TAGS -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ @@ -354,7 +354,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ @@ -372,9 +372,9 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ fi; \ fi ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ @@ -569,7 +569,7 @@ distcleancheck: distclean exit 1; } >&2 check-am: all-am check: check-recursive -all-am: Makefile config.h +all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive @@ -666,8 +666,8 @@ ps-am: uninstall-am: -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ - ctags-recursive install-am install-strip tags-recursive +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ @@ -1769,6 +1769,8 @@ ac_func_list="$ac_func_list strdup" ac_func_list="$ac_func_list strerror" ac_func_list="$ac_func_list strncasecmp" ac_func_list="$ac_func_list strstr" +ac_func_list="$ac_func_list strchrnul" +ac_func_list="$ac_func_list strcasestr" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -2509,7 +2511,7 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' -ac_config_headers="$ac_config_headers config.h" +ac_config_headers="$ac_config_headers include/config.h" @@ -5151,16 +5153,37 @@ done + + + + + + + + # Checks for currently used operating system. case "$host_os" in *linux*) CFLAGS="-O2 -Wall -Wextra -I../include" + +cat >>confdefs.h <<\_ACEOF +#define __NLINUX__ 1 +_ACEOF + ;; *solaris*) - CFLAGS="-O2 -Wall -D_NLINUX_ -I../include" + # The STSCI Build of GNU GCC has a broken -Wextra handler + CFLAGS="-O2 -Wall -I../include" + +cat >>confdefs.h <<\_ACEOF +#define __NSOLARIS__ 1 +_ACEOF + ;; *) - CFLAGS="-O2 -Wall -Wextra -I../include" + { { $as_echo "$as_me:$LINENO: error: duser does not currently support your platform" >&5 +$as_echo "$as_me: error: duser does not currently support your platform" >&2;} + { (exit 1); exit 1; }; } ;; esac @@ -5810,7 +5833,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 for ac_config_target in $ac_config_targets do case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; diff --git a/configure.in b/configure.in index 7a97a17..9705e98 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(1.11.1) -AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_HEADERS([include/config.h]) AC_CONFIG_SRCDIR([src/duser.c]) # Checks for programs. @@ -25,18 +25,21 @@ AC_TYPE_SIZE_T # Checks for library functions. AC_FUNC_MALLOC -AC_CHECK_FUNCS_ONCE([memset strcasecmp strdup strerror strncasecmp strstr]) +AC_CHECK_FUNCS_ONCE([memset strcasecmp strdup strerror strncasecmp strstr strchrnul strcasestr]) # Checks for currently used operating system. case "$host_os" in *linux*) CFLAGS="-O2 -Wall -Wextra -I../include" + AC_DEFINE([__NLINUX__], 1, [host operating system is linux]) ;; - *solaris*) - CFLAGS="-O2 -Wall -D_NLINUX_ -I../include" + *solaris*) + # The STSCI Build of GNU GCC has a broken -Wextra handler + CFLAGS="-O2 -Wall -I../include" + AC_DEFINE([__NSOLARIS__], 1, [host operating system is solaris]) ;; *) - CFLAGS="-O2 -Wall -Wextra -I../include" + AC_MSG_ERROR([duser does not currently support your platform]) ;; esac diff --git a/config.h.in b/include/config.h.in index 7533f1a..022e00a 100644 --- a/config.h.in +++ b/include/config.h.in @@ -1,4 +1,4 @@ -/* config.h.in. Generated from configure.in by autoheader. */ +/* include/config.h.in. Generated from configure.in by autoheader. */ /* duser configuration path */ #undef CFG_PATH @@ -31,6 +31,12 @@ /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP +/* Define to 1 if you have the `strcasestr' function. */ +#undef HAVE_STRCASESTR + +/* Define to 1 if you have the `strchrnul' function. */ +#undef HAVE_STRCHRNUL + /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP @@ -85,6 +91,12 @@ /* Version number of package */ #undef VERSION +/* host operating system is linux */ +#undef __NLINUX__ + +/* host operating system is solaris */ +#undef __NSOLARIS__ + /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc diff --git a/include/duser.h b/include/duser.h index 06cdf84..5a102bb 100644 --- a/include/duser.h +++ b/include/duser.h @@ -22,13 +22,13 @@ #define DUSER_H #ifdef HAVE_CONFIG_H - #include "config.h" +#include "config.h" #endif #include <limits.h> #define REGEX_MAX 255 #define SELF __FUNCTION__ -#ifndef _NLINUX_ +#ifndef __NSOLARIS__ # define FMTLIST "%20s\t%5d%23s\n" #else # define FMTLIST "%20s\t%5d%16s\n" @@ -77,7 +77,7 @@ int user_cmd(const int argc, char* argv[]); int user_choice(char c); int user_add(const char* filename, const char* needle); int user_new_list(const char* fname); -#ifdef _NLINUX_ +#ifdef __NSOLARIS__ char *strcasestr(const char *s, const char *find); char *strchrnul(const char* s, int c); #endif diff --git a/src/Makefile.in b/src/Makefile.in index 6dc339b..3474743 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -43,7 +43,7 @@ am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" @@ -52,7 +52,7 @@ am_duser_OBJECTS = duser.$(OBJEXT) user.$(OBJEXT) util.$(OBJEXT) \ log.$(OBJEXT) cfg.$(OBJEXT) duser_OBJECTS = $(am_duser_OBJECTS) duser_LDADD = $(LDADD) -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f @@ -32,10 +32,6 @@ #include <time.h> #include <fcntl.h> #include <libgen.h> -#ifdef _NLINUX_ -# define HAVE_STRCHRNUL -# define HAVE_STRCASESTR -#endif #include "duser.h" extern char list_path[PATH_MAX]; @@ -320,7 +316,7 @@ int get_file_count(const char* path) while((ep = readdir(dp))) { -#ifdef _NLINUX_ +#ifdef __NSOLARIS__ char path[PATH_MAX]; struct stat st; snprintf(path, PATH_MAX, "%s%s", list_path, ep->d_name); @@ -376,7 +372,7 @@ char** get_file_list(const char* path, int count) } while((ep = readdir(dp))) { -#ifdef _NLINUX_ +#ifdef __NSOLARIS__ char path[PATH_MAX]; struct stat st; snprintf(path, PATH_MAX, "%s%s", list_path, ep->d_name); |