Initial autoconfiscation. - susmb - mounting of SMB/CIFS shares via FUSE
 (HTM) git clone git://git.codemadness.org/susmb
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 46b09904dbb90107762e9a74dae533e82f0f896d
 (DIR) parent c418b9445543c8567d2f44e3a65b54372ae8c0cd
 (HTM) Author: Geoff Johnstone <qwerty@acm.org>
       Date:   Fri, 10 Apr 2009 18:09:45 +0100
       
       Initial autoconfiscation.
       
       Diffstat:
         D Makefile                            |     109 -------------------------------
         A Makefile.in                         |     105 +++++++++++++++++++++++++++++++
         M README                              |       8 ++++----
         A aclocal.m4                          |     155 +++++++++++++++++++++++++++++++
         M conffile.c                          |       1 +
         A config.h.in                         |     144 +++++++++++++++++++++++++++++++
         A configure.ac                        |      69 ++++++++++++++++++++++++++++++
         A install-sh                          |     519 +++++++++++++++++++++++++++++++
         M options.c                           |       1 +
         M password.c                          |       1 +
         M usmb.c                              |       1 +
         M usmb_dir.c                          |       1 +
         M usmb_file.c                         |       1 +
         M utils.c                             |       1 +
         M version.c                           |       1 +
         M xml.c                               |       1 +
       
       16 files changed, 1005 insertions(+), 113 deletions(-)
       ---
 (DIR) diff --git a/Makefile b/Makefile
       @@ -1,109 +0,0 @@
       -# usmb - mount SMB shares via FUSE and Samba
       -# Copyright (C) 2006-2009 Geoff Johnstone
       -#
       -# This program is free software; you can redistribute it and/or modify
       -# it under the terms of the GNU General Public License version 3 as
       -# published by the Free Software Foundation.
       -#
       -# 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, see <http://www.gnu.org/licenses/>.
       -
       -
       -SAMBA = /opt/samba
       -CC = gcc
       -INSTALL = install
       -
       -PREFIX = /usr/local
       -BINDIR = $(PREFIX)/bin
       -
       -CFLAGS += -Wall -Wextra -Werror -std=c99 -pedantic -O \
       -          -I$(SAMBA)/include -D_BSD_SOURCE -DFUSE_USE_VERSION=26 \
       -          -DHAVE_UTIME_H -DMUSTCHECK='__attribute__ ((warn_unused_result))' \
       -          -DUNUSED='__attribute__ ((unused))'
       -
       -LDLIBS = -lsmbclient
       -LDFLAGS = -L$(SAMBA)/lib
       -
       -PACKAGES = glib-2.0 libxml-2.0 fuse
       -
       -CFLAGS  += $(shell pkg-config --cflags $(PACKAGES))
       -LDLIBS  += $(shell pkg-config --libs-only-l $(PACKAGES))
       -LDFLAGS += $(shell pkg-config --libs-only-L $(PACKAGES))
       -
       -SOURCES = conffile.c options.c password.c usmb.c usmb_dir.c usmb_file.c \
       -          utils.c version.c xml.c
       -OBJECTS = $(SOURCES:.c=.o)
       -
       -PROGRAM = usmb
       -
       -
       -all: $(PROGRAM)
       -
       -conffile.c: config.rng.h
       -config.rng.h: config.rng
       -        sed -e 's/"/\\"/g' -e 's/\(.*\)/  "\1" \\/' \
       -    -e '1istatic const char *rng_$(^:.rng=) =' $^ > config.rng.h
       -        echo '  "";' >> config.rng.h
       -
       -debug: CFLAGS += -ggdb -DDEBUG
       -debug: all
       -
       -
       -$(PROGRAM): $(OBJECTS)
       -        $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
       -
       -
       -clean:
       -        $(RM) $(PROGRAM) $(OBJECTS)
       -
       -
       -distclean: clean
       -        $(RM) core usmb-*.tar.bz2 usmb-*.tar.gz doc/*.mdzip.bak config.rng.h
       -
       -
       -install-strip: STRIPFLAGS = -s
       -install install-strip: $(PROGRAM)
       -        mkdir -p $(BINDIR)
       -        $(INSTALL) -m 755 $(STRIPFLAGS) $(PROGRAM) $(BINDIR)/
       -
       -
       -uninstall:
       -        $(RM) $(BINDIR)/$(PROGRAM)
       -        rmdir -p $(BINDIR)
       -        @echo Please delete ~/.usmb.conf manually.
       -
       -
       -dist: tar
       -
       -tar: VERSION=$(shell grep 'USMB_VERSION[^_]' version.h | sed 's/.*0x//')
       -tar: STAGING=/tmp/usmb-$(VERSION)
       -tar:
       -        mkdir $(STAGING)
       -        git archive $(VERSION) | tar -C $(STAGING) -x -f -
       -        git log > $(STAGING)/Changelog
       -        cp -a $(PWD)/* $(STAGING)/
       -        rm -rf $(STAGING)/.hg
       -        (cd $(STAGING)/..; \
       -         tar jcf $(PWD)/usmb-$(VERSION).tar.bz2 usmb-$(VERSION) ; \
       -         tar zcf $(PWD)/usmb-$(VERSION).tar.gz usmb-$(VERSION))
       -        rm -rf $(STAGING)
       -
       -
       -.PHONY: all debug dist install install-strip uninstall clean distclean tar
       -
       -conffile.o: conffile.c utils.h xml.h config.rng.h
       -options.o: options.c options.h utils.h version.h
       -password.o: password.c password.h utils.h
       -usmb.o: usmb.c conffile.h options.h usmb.h usmb_dir.h usmb_file.h utils.h \
       -        password.h version.h samba30-compat.h
       -usmb_dir.o: samba30-compat.h usmb_dir.c usmb_dir.h usmb.h utils.h
       -usmb_file.o: samba30-compat.h usmb_file.c usmb_file.h usmb.h utils.h
       -utils.o: utils.c utils.h
       -version.o: version.c version.h
       -xml.o: xml.c xml.h utils.h
       -
 (DIR) diff --git a/Makefile.in b/Makefile.in
       @@ -0,0 +1,105 @@
       +# usmb - mount SMB shares via FUSE and Samba
       +#
       +# @configure_input@
       +#
       +# Copyright (C) 2006-2009 Geoff Johnstone
       +#
       +# This program is free software; you can redistribute it and/or modify
       +# it under the terms of the GNU General Public License version 3 as
       +# published by the Free Software Foundation.
       +#
       +# 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, see <http://www.gnu.org/licenses/>.
       +
       +CC = @CC@
       +
       +prefix = @prefix@
       +exec_prefix = @exec_prefix@
       +bindir = @bindir@
       +
       +CFLAGS = @CFLAGS@
       +LDFLAGS = @LDFLAGS@
       +LIBS = @LIBS@
       +
       +CFLAGS  += @LIBXML2_CFLAGS@ @GLIB_CFLAGS@ @FUSE_CFLAGS@
       +LIBS  += @LIBXML2_LIBS@ @GLIB_LIBS@ @FUSE_LIBS@
       +
       +SOURCES = conffile.c options.c password.c usmb.c usmb_dir.c usmb_file.c \
       +          utils.c version.c xml.c
       +OBJECTS = $(SOURCES:.c=.o)
       +
       +PROGRAM = usmb
       +
       +
       +all: $(PROGRAM)
       +
       +conffile.c: config.rng.h
       +config.rng.h: config.rng
       +        @SED@ -e 's/"/\\"/g' -e 's/\(.*\)/  "\1" \\/' \
       +    -e '1istatic const char *rng_$(^:.rng=) =' $^ > config.rng.h
       +        echo '  "";' >> config.rng.h
       +
       +
       +$(PROGRAM): $(OBJECTS)
       +        $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
       +
       +
       +clean:
       +        $(RM) $(PROGRAM) $(OBJECTS)
       +
       +
       +distclean: clean
       +        $(RM) -r core usmb-*.tar.bz2 usmb-*.tar.gz doc/*.mdzip.bak config.rng.h \
       +                 autom4te.cache config.h.in~ config.status config.log
       +
       +
       +allclean: distclean
       +        $(RM) Makefile configure config.h autom4te.cache
       +
       +
       +install-strip: STRIPFLAGS = -s
       +install install-strip: $(PROGRAM)
       +        @MKDIR_P@ $(bindir)
       +        @INSTALL@ -m 755 $(STRIPFLAGS) $(PROGRAM) $(bindir)/
       +
       +
       +uninstall:
       +        $(RM) $(bindir)/$(PROGRAM)
       +        rmdir -p $(bindir)
       +        @echo Please delete ~/.usmb.conf manually.
       +
       +
       +dist: tar
       +
       +tar: VERSION=$(shell grep 'USMB_VERSION[^_]' version.h | sed 's/.*0x//')
       +tar: STAGING=/tmp/usmb-$(VERSION)
       +tar:
       +        mkdir $(STAGING)
       +        git archive $(VERSION) | tar -C $(STAGING) -x -f -
       +        git log > $(STAGING)/Changelog
       +        cp -a $(PWD)/* $(STAGING)/
       +        rm -rf $(STAGING)/.hg
       +        (cd $(STAGING)/..; \
       +         tar jcf $(PWD)/usmb-$(VERSION).tar.bz2 usmb-$(VERSION) ; \
       +         tar zcf $(PWD)/usmb-$(VERSION).tar.gz usmb-$(VERSION))
       +        rm -rf $(STAGING)
       +
       +
       +.PHONY: all debug dist install install-strip uninstall clean distclean tar
       +
       +conffile.o: conffile.c utils.h xml.h config.rng.h
       +options.o: options.c options.h utils.h version.h
       +password.o: password.c password.h utils.h
       +usmb.o: usmb.c conffile.h options.h usmb.h usmb_dir.h usmb_file.h utils.h \
       +        password.h version.h samba30-compat.h
       +usmb_dir.o: samba30-compat.h usmb_dir.c usmb_dir.h usmb.h utils.h
       +usmb_file.o: samba30-compat.h usmb_file.c usmb_file.h usmb.h utils.h
       +utils.o: utils.c utils.h
       +version.o: version.c version.h
       +xml.o: xml.c xml.h utils.h
       +
 (DIR) diff --git a/README b/README
       @@ -55,11 +55,11 @@ libsmbclient 3.0 (part of Samba) - www.samba.org.
        Installation
        ------------
        
       -Sorry, no autoconf yet.
        You need GNU sed.
       -Edit the Makefile with brain engaged.
       -Run make.
       -Run make install (maybe as root).
       +
       +./configure
       +make
       +make install   # Maybe as root, depending on your installation prefix.
        
        
        Configuration
 (DIR) diff --git a/aclocal.m4 b/aclocal.m4
       @@ -0,0 +1,155 @@
       +# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
       +# 
       +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
       +#
       +# 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.
       +#
       +# As a special exception to the GNU General Public License, if you
       +# distribute this file as part of a program that contains a
       +# configuration script generated by Autoconf, you may include it under
       +# the same distribution terms that you use for the rest of that program.
       +
       +# PKG_PROG_PKG_CONFIG([MIN-VERSION])
       +# ----------------------------------
       +AC_DEFUN([PKG_PROG_PKG_CONFIG],
       +[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
       +m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
       +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
       +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
       +        AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
       +fi
       +if test -n "$PKG_CONFIG"; then
       +        _pkg_min_version=m4_default([$1], [0.9.0])
       +        AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
       +        if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
       +                AC_MSG_RESULT([yes])
       +        else
       +                AC_MSG_RESULT([no])
       +                PKG_CONFIG=""
       +        fi
       +                
       +fi[]dnl
       +])# PKG_PROG_PKG_CONFIG
       +
       +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
       +#
       +# Check to see whether a particular set of modules exists.  Similar
       +# to PKG_CHECK_MODULES(), but does not set variables or print errors.
       +#
       +#
       +# Similar to PKG_CHECK_MODULES, make sure that the first instance of
       +# this or PKG_CHECK_MODULES is called, or make sure to call
       +# PKG_CHECK_EXISTS manually
       +# --------------------------------------------------------------
       +AC_DEFUN([PKG_CHECK_EXISTS],
       +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
       +if test -n "$PKG_CONFIG" && \
       +    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
       +  m4_ifval([$2], [$2], [:])
       +m4_ifvaln([$3], [else
       +  $3])dnl
       +fi])
       +
       +
       +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
       +# ---------------------------------------------
       +m4_define([_PKG_CONFIG],
       +[if test -n "$$1"; then
       +    pkg_cv_[]$1="$$1"
       + elif test -n "$PKG_CONFIG"; then
       +    PKG_CHECK_EXISTS([$3],
       +                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
       +                     [pkg_failed=yes])
       + else
       +    pkg_failed=untried
       +fi[]dnl
       +])# _PKG_CONFIG
       +
       +# _PKG_SHORT_ERRORS_SUPPORTED
       +# -----------------------------
       +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
       +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
       +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
       +        _pkg_short_errors_supported=yes
       +else
       +        _pkg_short_errors_supported=no
       +fi[]dnl
       +])# _PKG_SHORT_ERRORS_SUPPORTED
       +
       +
       +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
       +# [ACTION-IF-NOT-FOUND])
       +#
       +#
       +# Note that if there is a possibility the first call to
       +# PKG_CHECK_MODULES might not happen, you should be sure to include an
       +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
       +#
       +#
       +# --------------------------------------------------------------
       +AC_DEFUN([PKG_CHECK_MODULES],
       +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
       +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
       +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
       +
       +pkg_failed=no
       +AC_MSG_CHECKING([for $1])
       +
       +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
       +_PKG_CONFIG([$1][_LIBS], [libs], [$2])
       +
       +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
       +and $1[]_LIBS to avoid the need to call pkg-config.
       +See the pkg-config man page for more details.])
       +
       +if test $pkg_failed = yes; then
       +        _PKG_SHORT_ERRORS_SUPPORTED
       +        if test $_pkg_short_errors_supported = yes; then
       +                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
       +        else 
       +                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
       +        fi
       +        # Put the nasty error message in config.log where it belongs
       +        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
       +
       +        ifelse([$4], , [AC_MSG_ERROR(dnl
       +[Package requirements ($2) were not met:
       +
       +$$1_PKG_ERRORS
       +
       +Consider adjusting the PKG_CONFIG_PATH environment variable if you
       +installed software in a non-standard prefix.
       +
       +_PKG_TEXT
       +])],
       +                [AC_MSG_RESULT([no])
       +                $4])
       +elif test $pkg_failed = untried; then
       +        ifelse([$4], , [AC_MSG_FAILURE(dnl
       +[The pkg-config script could not be found or is too old.  Make sure it
       +is in your PATH or set the PKG_CONFIG environment variable to the full
       +path to pkg-config.
       +
       +_PKG_TEXT
       +
       +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
       +                [$4])
       +else
       +        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
       +        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
       +        AC_MSG_RESULT([yes])
       +        ifelse([$3], , :, [$3])
       +fi[]dnl
       +])# PKG_CHECK_MODULES
 (DIR) diff --git a/conffile.c b/conffile.c
       @@ -14,6 +14,7 @@
         * along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
        
       +#include "config.h"
        #include <assert.h>
        #include <errno.h>
        #include <stdio.h>
 (DIR) diff --git a/config.h.in b/config.h.in
       @@ -0,0 +1,144 @@
       +/* config.h.in.  Generated from configure.ac by autoheader.  */
       +
       +/* Define to build in debug mode */
       +#undef DEBUG
       +
       +/* Required FUSE API version */
       +#undef FUSE_USE_VERSION
       +
       +/* Define to 1 if you have the <fcntl.h> header file. */
       +#undef HAVE_FCNTL_H
       +
       +/* Define to 1 if you have the <inttypes.h> header file. */
       +#undef HAVE_INTTYPES_H
       +
       +/* Define to 1 if you have the `smbclient' library (-lsmbclient). */
       +#undef HAVE_LIBSMBCLIENT
       +
       +/* Define to 1 if you have the <limits.h> header file. */
       +#undef HAVE_LIMITS_H
       +
       +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
       +   to 0 otherwise. */
       +#undef HAVE_MALLOC
       +
       +/* Define to 1 if you have the <memory.h> header file. */
       +#undef HAVE_MEMORY_H
       +
       +/* Define to 1 if you have the `memset' function. */
       +#undef HAVE_MEMSET
       +
       +/* Define to 1 if the system has the type `ptrdiff_t'. */
       +#undef HAVE_PTRDIFF_T
       +
       +/* Define to 1 if your system has a GNU libc compatible `realloc' function,
       +   and to 0 otherwise. */
       +#undef HAVE_REALLOC
       +
       +/* Define to 1 if stdbool.h conforms to C99. */
       +#undef HAVE_STDBOOL_H
       +
       +/* Define to 1 if you have the <stddef.h> header file. */
       +#undef HAVE_STDDEF_H
       +
       +/* Define to 1 if you have the <stdint.h> header file. */
       +#undef HAVE_STDINT_H
       +
       +/* Define to 1 if you have the <stdlib.h> header file. */
       +#undef HAVE_STDLIB_H
       +
       +/* Define to 1 if you have the `strchr' function. */
       +#undef HAVE_STRCHR
       +
       +/* Define to 1 if you have the `strerror' function. */
       +#undef HAVE_STRERROR
       +
       +/* Define to 1 if you have the <strings.h> header file. */
       +#undef HAVE_STRINGS_H
       +
       +/* Define to 1 if you have the <string.h> header file. */
       +#undef HAVE_STRING_H
       +
       +/* Define to 1 if you have the <sys/stat.h> header file. */
       +#undef HAVE_SYS_STAT_H
       +
       +/* Define to 1 if you have the <sys/time.h> header file. */
       +#undef HAVE_SYS_TIME_H
       +
       +/* Define to 1 if you have the <sys/types.h> header file. */
       +#undef HAVE_SYS_TYPES_H
       +
       +/* Define to 1 if you have the <termios.h> header file. */
       +#undef HAVE_TERMIOS_H
       +
       +/* Define to 1 if you have the <unistd.h> header file. */
       +#undef HAVE_UNISTD_H
       +
       +/* Define to 1 if you have the <utime.h> header file. */
       +#undef HAVE_UTIME_H
       +
       +/* Define to 1 if the system has the type `_Bool'. */
       +#undef HAVE__BOOL
       +
       +/* Marks functions whose result values must not be ignored */
       +#undef MUSTCHECK
       +
       +/* Define to the address where bug reports for this package should be sent. */
       +#undef PACKAGE_BUGREPORT
       +
       +/* Define to the full name of this package. */
       +#undef PACKAGE_NAME
       +
       +/* Define to the full name and version of this package. */
       +#undef PACKAGE_STRING
       +
       +/* Define to the one symbol short name of this package. */
       +#undef PACKAGE_TARNAME
       +
       +/* Define to the version of this package. */
       +#undef PACKAGE_VERSION
       +
       +/* Define to 1 if you have the ANSI C header files. */
       +#undef STDC_HEADERS
       +
       +/* Marks unused parameters */
       +#undef UNUSED
       +
       +/* Define to use BSD APIs (mandatory) */
       +#undef _BSD_SOURCE
       +
       +/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
       +   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
       +   #define below would cause a syntax error. */
       +#undef _UINT64_T
       +
       +/* Define to `int' if <sys/types.h> doesn't define. */
       +#undef gid_t
       +
       +/* Define to `__inline__' or `__inline' if that's what the C compiler
       +   calls it, or to nothing if 'inline' is not supported under any name.  */
       +#ifndef __cplusplus
       +#undef inline
       +#endif
       +
       +/* Define to rpl_malloc if the replacement function should be used. */
       +#undef malloc
       +
       +/* Define to `int' if <sys/types.h> does not define. */
       +#undef mode_t
       +
       +/* Define to `long int' if <sys/types.h> does not define. */
       +#undef off_t
       +
       +/* Define to rpl_realloc if the replacement function should be used. */
       +#undef realloc
       +
       +/* Define to `unsigned int' if <sys/types.h> does not define. */
       +#undef size_t
       +
       +/* Define to `int' if <sys/types.h> doesn't define. */
       +#undef uid_t
       +
       +/* Define to the type of an unsigned integer type of width exactly 64 bits if
       +   such a type exists and the standard includes do not define it. */
       +#undef uint64_t
 (DIR) diff --git a/configure.ac b/configure.ac
       @@ -0,0 +1,69 @@
       +AC_PREREQ([2.63])
       +AC_INIT([usmb], [20090410])
       +AC_CONFIG_SRCDIR([usmb.c])
       +AC_CONFIG_HEADERS([config.h])
       +
       +AC_ARG_ENABLE([debug],
       +              [AS_HELP_STRING([--enable-debug],
       +                              [Build in debug mode (default no)])],
       +              [AC_DEFINE([DEBUG], [], [Define to build in debug mode])])
       +
       +AC_ARG_WITH([samba],
       +            [AS_HELP_STRING([--with-samba=prefix],
       +                              [Location of Samba (i.e. libsmbclient)])],
       +            [CFLAGS="$CFLAGS -I$withval/include"
       +             LDFLAGS="$LDFLAGS -L$withval/lib"])
       +
       +# Checks for programs.
       +AC_PROG_CC_C99([gcc])
       +AC_PROG_INSTALL
       +AC_PROG_MKDIR_P
       +AC_PROG_SED
       +
       +AC_DEFINE([_BSD_SOURCE], [], [Define to use BSD APIs (mandatory)])
       +AC_DEFINE([FUSE_USE_VERSION], [26], [Required FUSE API version])
       +
       +m4_define([UNUSED_],[])
       +m4_define([MUSTCHECK_],[])
       +
       +if test "$GCC" = yes ; then
       +  m4_define([UNUSED_], [__attribute__ ((unused))])
       +  m4_define([MUSTCHECK_], [__attribute__ ((warn_unused_result))])
       +  CFLAGS="$CFLAGS -Wall -Wextra -Werror -pedantic"
       +fi
       +
       +AC_DEFINE([UNUSED], [UNUSED_], [Marks unused parameters])
       +AC_DEFINE([MUSTCHECK], [MUSTCHECK_],
       +          [Marks functions whose result values must not be ignored])
       +
       +# Checks for libraries.
       +AC_CHECK_LIB([smbclient], [smbc_init], [],
       +             [AC_MSG_ERROR(Cannot find libsmbclient.)])
       +
       +PKG_PROG_PKG_CONFIG
       +PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
       +PKG_CHECK_MODULES([GLIB], [glib-2.0])
       +PKG_CHECK_MODULES([FUSE], [fuse])
       +
       +
       +# Checks for header files.
       +AC_CHECK_HEADERS([fcntl.h limits.h stddef.h stdlib.h string.h sys/time.h termios.h unistd.h utime.h])
       +
       +# Checks for typedefs, structures, and compiler characteristics.
       +AC_HEADER_STDBOOL
       +AC_C_INLINE
       +AC_TYPE_MODE_T
       +AC_TYPE_OFF_T
       +AC_TYPE_SIZE_T
       +AC_TYPE_UID_T
       +AC_TYPE_UINT64_T
       +AC_CHECK_TYPES([ptrdiff_t])
       +
       +# Checks for library functions.
       +AC_FUNC_MALLOC
       +AC_FUNC_REALLOC
       +AC_CHECK_FUNCS([memset strchr strerror])
       +
       +AC_CONFIG_FILES([Makefile])
       +AC_OUTPUT
       +
 (DIR) diff --git a/install-sh b/install-sh
       @@ -0,0 +1,519 @@
       +#!/bin/sh
       +# install - install a program, script, or datafile
       +
       +scriptversion=2006-12-25.00
       +
       +# This originates from X11R5 (mit/util/scripts/install.sh), which was
       +# later released in X11R6 (xc/config/util/install.sh) with the
       +# following copyright and license.
       +#
       +# Copyright (C) 1994 X Consortium
       +#
       +# Permission is hereby granted, free of charge, to any person obtaining a copy
       +# of this software and associated documentation files (the "Software"), to
       +# deal in the Software without restriction, including without limitation the
       +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
       +# sell copies of the Software, and to permit persons to whom the Software is
       +# furnished to do so, subject to the following conditions:
       +#
       +# The above copyright notice and this permission notice shall be included in
       +# all copies or substantial portions of the Software.
       +#
       +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
       +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
       +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
       +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
       +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
       +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
       +#
       +# Except as contained in this notice, the name of the X Consortium shall not
       +# be used in advertising or otherwise to promote the sale, use or other deal-
       +# ings in this Software without prior written authorization from the X Consor-
       +# tium.
       +#
       +#
       +# FSF changes to this file are in the public domain.
       +#
       +# Calling this script install-sh is preferred over install.sh, to prevent
       +# `make' implicit rules from creating a file called install from it
       +# when there is no Makefile.
       +#
       +# This script is compatible with the BSD install script, but was written
       +# from scratch.
       +
       +nl='
       +'
       +IFS=" ""        $nl"
       +
       +# set DOITPROG to echo to test this script
       +
       +# Don't use :- since 4.3BSD and earlier shells don't like it.
       +doit=${DOITPROG-}
       +if test -z "$doit"; then
       +  doit_exec=exec
       +else
       +  doit_exec=$doit
       +fi
       +
       +# Put in absolute file names if you don't have them in your path;
       +# or use environment vars.
       +
       +chgrpprog=${CHGRPPROG-chgrp}
       +chmodprog=${CHMODPROG-chmod}
       +chownprog=${CHOWNPROG-chown}
       +cmpprog=${CMPPROG-cmp}
       +cpprog=${CPPROG-cp}
       +mkdirprog=${MKDIRPROG-mkdir}
       +mvprog=${MVPROG-mv}
       +rmprog=${RMPROG-rm}
       +stripprog=${STRIPPROG-strip}
       +
       +posix_glob='?'
       +initialize_posix_glob='
       +  test "$posix_glob" != "?" || {
       +    if (set -f) 2>/dev/null; then
       +      posix_glob=
       +    else
       +      posix_glob=:
       +    fi
       +  }
       +'
       +
       +posix_mkdir=
       +
       +# Desired mode of installed file.
       +mode=0755
       +
       +chgrpcmd=
       +chmodcmd=$chmodprog
       +chowncmd=
       +mvcmd=$mvprog
       +rmcmd="$rmprog -f"
       +stripcmd=
       +
       +src=
       +dst=
       +dir_arg=
       +dst_arg=
       +
       +copy_on_change=false
       +no_target_directory=
       +
       +usage="\
       +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
       +   or: $0 [OPTION]... SRCFILES... DIRECTORY
       +   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
       +   or: $0 [OPTION]... -d DIRECTORIES...
       +
       +In the 1st form, copy SRCFILE to DSTFILE.
       +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
       +In the 4th, create DIRECTORIES.
       +
       +Options:
       +     --help     display this help and exit.
       +     --version  display version info and exit.
       +
       +  -c            (ignored)
       +  -C            install only if different (preserve the last data modification time)
       +  -d            create directories instead of installing files.
       +  -g GROUP      $chgrpprog installed files to GROUP.
       +  -m MODE       $chmodprog installed files to MODE.
       +  -o USER       $chownprog installed files to USER.
       +  -s            $stripprog installed files.
       +  -t DIRECTORY  install into DIRECTORY.
       +  -T            report an error if DSTFILE is a directory.
       +
       +Environment variables override the default commands:
       +  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
       +  RMPROG STRIPPROG
       +"
       +
       +while test $# -ne 0; do
       +  case $1 in
       +    -c) ;;
       +
       +    -C) copy_on_change=true;;
       +
       +    -d) dir_arg=true;;
       +
       +    -g) chgrpcmd="$chgrpprog $2"
       +        shift;;
       +
       +    --help) echo "$usage"; exit $?;;
       +
       +    -m) mode=$2
       +        case $mode in
       +          *' '* | *'        '* | *'
       +'*          | *'*'* | *'?'* | *'['*)
       +            echo "$0: invalid mode: $mode" >&2
       +            exit 1;;
       +        esac
       +        shift;;
       +
       +    -o) chowncmd="$chownprog $2"
       +        shift;;
       +
       +    -s) stripcmd=$stripprog;;
       +
       +    -t) dst_arg=$2
       +        shift;;
       +
       +    -T) no_target_directory=true;;
       +
       +    --version) echo "$0 $scriptversion"; exit $?;;
       +
       +    --)        shift
       +        break;;
       +
       +    -*)        echo "$0: invalid option: $1" >&2
       +        exit 1;;
       +
       +    *)  break;;
       +  esac
       +  shift
       +done
       +
       +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
       +  # When -d is used, all remaining arguments are directories to create.
       +  # When -t is used, the destination is already specified.
       +  # Otherwise, the last argument is the destination.  Remove it from $@.
       +  for arg
       +  do
       +    if test -n "$dst_arg"; then
       +      # $@ is not empty: it contains at least $arg.
       +      set fnord "$@" "$dst_arg"
       +      shift # fnord
       +    fi
       +    shift # arg
       +    dst_arg=$arg
       +  done
       +fi
       +
       +if test $# -eq 0; then
       +  if test -z "$dir_arg"; then
       +    echo "$0: no input file specified." >&2
       +    exit 1
       +  fi
       +  # It's OK to call `install-sh -d' without argument.
       +  # This can happen when creating conditional directories.
       +  exit 0
       +fi
       +
       +if test -z "$dir_arg"; then
       +  trap '(exit $?); exit' 1 2 13 15
       +
       +  # Set umask so as not to create temps with too-generous modes.
       +  # However, 'strip' requires both read and write access to temps.
       +  case $mode in
       +    # Optimize common cases.
       +    *644) cp_umask=133;;
       +    *755) cp_umask=22;;
       +
       +    *[0-7])
       +      if test -z "$stripcmd"; then
       +        u_plus_rw=
       +      else
       +        u_plus_rw='% 200'
       +      fi
       +      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
       +    *)
       +      if test -z "$stripcmd"; then
       +        u_plus_rw=
       +      else
       +        u_plus_rw=,u+rw
       +      fi
       +      cp_umask=$mode$u_plus_rw;;
       +  esac
       +fi
       +
       +for src
       +do
       +  # Protect names starting with `-'.
       +  case $src in
       +    -*) src=./$src;;
       +  esac
       +
       +  if test -n "$dir_arg"; then
       +    dst=$src
       +    dstdir=$dst
       +    test -d "$dstdir"
       +    dstdir_status=$?
       +  else
       +
       +    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
       +    # might cause directories to be created, which would be especially bad
       +    # if $src (and thus $dsttmp) contains '*'.
       +    if test ! -f "$src" && test ! -d "$src"; then
       +      echo "$0: $src does not exist." >&2
       +      exit 1
       +    fi
       +
       +    if test -z "$dst_arg"; then
       +      echo "$0: no destination specified." >&2
       +      exit 1
       +    fi
       +
       +    dst=$dst_arg
       +    # Protect names starting with `-'.
       +    case $dst in
       +      -*) dst=./$dst;;
       +    esac
       +
       +    # If destination is a directory, append the input filename; won't work
       +    # if double slashes aren't ignored.
       +    if test -d "$dst"; then
       +      if test -n "$no_target_directory"; then
       +        echo "$0: $dst_arg: Is a directory" >&2
       +        exit 1
       +      fi
       +      dstdir=$dst
       +      dst=$dstdir/`basename "$src"`
       +      dstdir_status=0
       +    else
       +      # Prefer dirname, but fall back on a substitute if dirname fails.
       +      dstdir=`
       +        (dirname "$dst") 2>/dev/null ||
       +        expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
       +             X"$dst" : 'X\(//\)[^/]' \| \
       +             X"$dst" : 'X\(//\)$' \| \
       +             X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
       +        echo X"$dst" |
       +            sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
       +                   s//\1/
       +                   q
       +                 }
       +                 /^X\(\/\/\)[^/].*/{
       +                   s//\1/
       +                   q
       +                 }
       +                 /^X\(\/\/\)$/{
       +                   s//\1/
       +                   q
       +                 }
       +                 /^X\(\/\).*/{
       +                   s//\1/
       +                   q
       +                 }
       +                 s/.*/./; q'
       +      `
       +
       +      test -d "$dstdir"
       +      dstdir_status=$?
       +    fi
       +  fi
       +
       +  obsolete_mkdir_used=false
       +
       +  if test $dstdir_status != 0; then
       +    case $posix_mkdir in
       +      '')
       +        # Create intermediate dirs using mode 755 as modified by the umask.
       +        # This is like FreeBSD 'install' as of 1997-10-28.
       +        umask=`umask`
       +        case $stripcmd.$umask in
       +          # Optimize common cases.
       +          *[2367][2367]) mkdir_umask=$umask;;
       +          .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
       +
       +          *[0-7])
       +            mkdir_umask=`expr $umask + 22 \
       +              - $umask % 100 % 40 + $umask % 20 \
       +              - $umask % 10 % 4 + $umask % 2
       +            `;;
       +          *) mkdir_umask=$umask,go-w;;
       +        esac
       +
       +        # With -d, create the new directory with the user-specified mode.
       +        # Otherwise, rely on $mkdir_umask.
       +        if test -n "$dir_arg"; then
       +          mkdir_mode=-m$mode
       +        else
       +          mkdir_mode=
       +        fi
       +
       +        posix_mkdir=false
       +        case $umask in
       +          *[123567][0-7][0-7])
       +            # POSIX mkdir -p sets u+wx bits regardless of umask, which
       +            # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
       +            ;;
       +          *)
       +            tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
       +            trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
       +
       +            if (umask $mkdir_umask &&
       +                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
       +            then
       +              if test -z "$dir_arg" || {
       +                   # Check for POSIX incompatibilities with -m.
       +                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
       +                   # other-writeable bit of parent directory when it shouldn't.
       +                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
       +                   ls_ld_tmpdir=`ls -ld "$tmpdir"`
       +                   case $ls_ld_tmpdir in
       +                     d????-?r-*) different_mode=700;;
       +                     d????-?--*) different_mode=755;;
       +                     *) false;;
       +                   esac &&
       +                   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
       +                     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
       +                     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
       +                   }
       +                 }
       +              then posix_mkdir=:
       +              fi
       +              rmdir "$tmpdir/d" "$tmpdir"
       +            else
       +              # Remove any dirs left behind by ancient mkdir implementations.
       +              rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
       +            fi
       +            trap '' 0;;
       +        esac;;
       +    esac
       +
       +    if
       +      $posix_mkdir && (
       +        umask $mkdir_umask &&
       +        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
       +      )
       +    then :
       +    else
       +
       +      # The umask is ridiculous, or mkdir does not conform to POSIX,
       +      # or it failed possibly due to a race condition.  Create the
       +      # directory the slow way, step by step, checking for races as we go.
       +
       +      case $dstdir in
       +        /*) prefix='/';;
       +        -*) prefix='./';;
       +        *)  prefix='';;
       +      esac
       +
       +      eval "$initialize_posix_glob"
       +
       +      oIFS=$IFS
       +      IFS=/
       +      $posix_glob set -f
       +      set fnord $dstdir
       +      shift
       +      $posix_glob set +f
       +      IFS=$oIFS
       +
       +      prefixes=
       +
       +      for d
       +      do
       +        test -z "$d" && continue
       +
       +        prefix=$prefix$d
       +        if test -d "$prefix"; then
       +          prefixes=
       +        else
       +          if $posix_mkdir; then
       +            (umask=$mkdir_umask &&
       +             $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
       +            # Don't fail if two instances are running concurrently.
       +            test -d "$prefix" || exit 1
       +          else
       +            case $prefix in
       +              *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
       +              *) qprefix=$prefix;;
       +            esac
       +            prefixes="$prefixes '$qprefix'"
       +          fi
       +        fi
       +        prefix=$prefix/
       +      done
       +
       +      if test -n "$prefixes"; then
       +        # Don't fail if two instances are running concurrently.
       +        (umask $mkdir_umask &&
       +         eval "\$doit_exec \$mkdirprog $prefixes") ||
       +          test -d "$dstdir" || exit 1
       +        obsolete_mkdir_used=true
       +      fi
       +    fi
       +  fi
       +
       +  if test -n "$dir_arg"; then
       +    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
       +    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
       +    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
       +      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
       +  else
       +
       +    # Make a couple of temp file names in the proper directory.
       +    dsttmp=$dstdir/_inst.$$_
       +    rmtmp=$dstdir/_rm.$$_
       +
       +    # Trap to clean up those temp files at exit.
       +    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
       +
       +    # Copy the file name to the temp name.
       +    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
       +
       +    # and set any options; do chmod last to preserve setuid bits.
       +    #
       +    # If any of these fail, we abort the whole thing.  If we want to
       +    # ignore errors from any of these, just make sure not to ignore
       +    # errors from the above "$doit $cpprog $src $dsttmp" command.
       +    #
       +    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
       +    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
       +    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
       +    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
       +
       +    # If -C, don't bother to copy if it wouldn't change the file.
       +    if $copy_on_change &&
       +       old=`LC_ALL=C ls -dlL "$dst"        2>/dev/null` &&
       +       new=`LC_ALL=C ls -dlL "$dsttmp"        2>/dev/null` &&
       +
       +       eval "$initialize_posix_glob" &&
       +       $posix_glob set -f &&
       +       set X $old && old=:$2:$4:$5:$6 &&
       +       set X $new && new=:$2:$4:$5:$6 &&
       +       $posix_glob set +f &&
       +
       +       test "$old" = "$new" &&
       +       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
       +    then
       +      rm -f "$dsttmp"
       +    else
       +      # Rename the file to the real destination.
       +      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
       +
       +      # The rename failed, perhaps because mv can't rename something else
       +      # to itself, or perhaps because mv is so ancient that it does not
       +      # support -f.
       +      {
       +        # Now remove or move aside any old file at destination location.
       +        # We try this two ways since rm can't unlink itself on some
       +        # systems and the destination file might be busy for other
       +        # reasons.  In this case, the final cleanup might fail but the new
       +        # file should still install successfully.
       +        {
       +          test ! -f "$dst" ||
       +          $doit $rmcmd -f "$dst" 2>/dev/null ||
       +          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
       +            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
       +          } ||
       +          { echo "$0: cannot unlink or rename $dst" >&2
       +            (exit 1); exit 1
       +          }
       +        } &&
       +
       +        # Now rename the file to the real destination.
       +        $doit $mvcmd "$dsttmp" "$dst"
       +      }
       +    fi || exit 1
       +
       +    trap '' 0
       +  fi
       +done
       +
       +# Local variables:
       +# eval: (add-hook 'write-file-hooks 'time-stamp)
       +# time-stamp-start: "scriptversion="
       +# time-stamp-format: "%:y-%02m-%02d.%02H"
       +# time-stamp-end: "$"
       +# End:
 (DIR) diff --git a/options.c b/options.c
       @@ -14,6 +14,7 @@
         * along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
        
       +#include "config.h"
        #include <assert.h>
        #include <glib.h>
        #include <stdbool.h>
 (DIR) diff --git a/password.c b/password.c
       @@ -14,6 +14,7 @@
         * along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
        
       +#include "config.h"
        #include <assert.h>
        #include <stdbool.h>
        #include <stdio.h>
 (DIR) diff --git a/usmb.c b/usmb.c
       @@ -14,6 +14,7 @@
         * along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
        
       +#include "config.h"
        #include <sys/time.h>        // struct timeval needed by libsmbclient.h
        #include <unistd.h>
        #include <libsmbclient.h>
 (DIR) diff --git a/usmb_dir.c b/usmb_dir.c
       @@ -14,6 +14,7 @@
         * along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
        
       +#include "config.h"
        #include <sys/time.h>        // struct timeval needed by libsmbclient.h
        #include <libsmbclient.h>
        #include "samba30-compat.h"
 (DIR) diff --git a/usmb_file.c b/usmb_file.c
       @@ -14,6 +14,7 @@
         * along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
        
       +#include "config.h"
        #include <sys/time.h>        // struct timeval needed by libsmbclient.h
        #include <libsmbclient.h>
        #include "samba30-compat.h"
 (DIR) diff --git a/utils.c b/utils.c
       @@ -14,6 +14,7 @@
         * along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
        
       +#include "config.h"
        #include <assert.h>
        #include <errno.h>
        #include <stdarg.h>
 (DIR) diff --git a/version.c b/version.c
       @@ -14,6 +14,7 @@
         * along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
        
       +#include "config.h"
        #include <stdio.h>
        #include <sys/time.h>
        #include <libsmbclient.h>
 (DIR) diff --git a/xml.c b/xml.c
       @@ -14,6 +14,7 @@
         * along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
        
       +#include "config.h"
        #include <libxml/xmlreader.h>
        #include <libxml/xpath.h>
        #include <libxml/xpathInternals.h>