URI:
       Added DEBUGON macro. Removed tabs. Prints fuse argv[] in DEBUG mode. - susmb - mounting of SMB/CIFS shares via FUSE
  HTML git clone git://git.codemadness.org/susmb
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 6bf1827f804d12efddc9e89f62cb4cd5ce478406
   DIR parent 0e75a1aa0cdd9993a0141293a190b7f16758371d
  HTML Author: geoff <devnull@localhost>
       Date:   Sun,  7 May 2006 21:29:21 +0000
       
       Added DEBUGON macro.
       Removed tabs.
       Prints fuse argv[] in DEBUG mode.
       
       Diffstat:
         M Makefile                            |       7 +++++--
         M auth.c                              |      10 +++++-----
         M conffile.c                          |       8 ++++----
         M conffile.h                          |       4 ++--
         M options.c                           |      14 +++++++-------
         M sax.h                               |       2 +-
         M usmb.c                              |      10 +++++-----
         M utils.h                             |       7 ++++---
         M version.h                           |      26 +++++++++++++-------------
       
       9 files changed, 46 insertions(+), 42 deletions(-)
       ---
   DIR diff --git a/Makefile b/Makefile
       @@ -3,7 +3,7 @@ CC = gcc
        
        CFLAGS = -Wall -W -std=c99 -pedantic -O \
                 -I$(SAMBA)/include -D_BSD_SOURCE -DFUSE_USE_VERSION=25 \
       -                                 -DHAVE_UTIME_H -ggdb -DDEBUG
       +         -DHAVE_UTIME_H
        
        LDLIBS = -lsmbclient
        LDFLAGS = -L$(SAMBA)/lib
       @@ -21,10 +21,13 @@ PROGRAM = usmb
        
        all: $(PROGRAM)
        
       +debug: CFLAGS += -ggdb -DDEBUG
       +debug: all
       +
        $(PROGRAM): $(OBJECTS)
                $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
        
        clean:
                $(RM) $(PROGRAM) $(OBJECTS)
        
       -.PHONY: all clean
       +.PHONY: all debug clean
   DIR diff --git a/auth.c b/auth.c
       @@ -1,9 +1,9 @@
        struct auth {
       -        const char *server;
       -        const char *share;
       -        const char *domain;
       -        const char *username;
       -        const char *password;
       +  const char *server;
       +  const char *share;
       +  const char *domain;
       +  const char *username;
       +  const char *password;
        };
        
        
   DIR diff --git a/conffile.c b/conffile.c
       @@ -52,7 +52,7 @@ void credentials_destroy (struct credentials *creds)
        
        struct mount * mount_new (const char *server, const char *share,
                                  const char *mountpoint, const char *credentials,
       -                                                                                                        const char *options)
       +                          const char *options)
        {
          struct mount *mount = malloc (sizeof (struct mount));
        
       @@ -61,7 +61,7 @@ struct mount * mount_new (const char *server, const char *share,
        
          mount->server = xstrdup (server);
          mount->share = xstrdup (share);
       -        mount->mountpoint = xstrdup (mountpoint);
       +  mount->mountpoint = xstrdup (mountpoint);
          mount->options = xstrdup (options);
          mount->credentials = xstrdup (credentials);
        
       @@ -136,7 +136,7 @@ bool conffile_add_mount (struct conffile *cf, char *key, struct mount *mount)
          assert (NULL != key);
          assert (NULL != mount);
        
       -        DEBUG (fprintf (stderr, "add_mount (%s)\n", key));
       +  DEBUG (fprintf (stderr, "add_mount (%s)\n", key));
        
          if (NULL != g_hash_table_lookup (cf->mounts, key))
          {
       @@ -156,7 +156,7 @@ bool conffile_add_credentials (struct conffile *cf, char *key,
          assert (NULL != key);
          assert (NULL != credentials);
        
       -        DEBUG (fprintf (stderr, "add_credentials (%s)\n", key));
       +  DEBUG (fprintf (stderr, "add_credentials (%s)\n", key));
        
          if (NULL != g_hash_table_lookup (cf->credentials, key))
          {
   DIR diff --git a/conffile.h b/conffile.h
       @@ -29,8 +29,8 @@
          void credentials_destroy (struct credentials *creds);
        
          struct mount * mount_new (const char *server, const char *share,
       -                                  const char *mountpoint, const char *credentials,
       -                                                                                                                const char *options);
       +                            const char *mountpoint, const char *credentials,
       +                            const char *options);
        
          void mount_destroy (struct mount *mount);
        
   DIR diff --git a/options.c b/options.c
       @@ -95,8 +95,8 @@ bool parse_args (int *argc, char ***argv,
            exit (EXIT_SUCCESS);
          }
        
       -        if (NULL != conffile)
       -                *out_conffile = conffile;
       +  if (NULL != conffile)
       +    *out_conffile = conffile;
        
          return ret;
        }
       @@ -121,7 +121,7 @@ void build_fuse_args (char *options, char *mountpoint,
          int argc = 0;
        
          argv[argc++] = "usmb";
       -        argv[argc++] = "-s";
       +  argv[argc++] = "-s";
        
          if (debug)
            argv[argc++] = "-d";
       @@ -142,9 +142,9 @@ void build_fuse_args (char *options, char *mountpoint,
          *out_argc = argc;
          *out_argv = argv;
        
       -#if 0
       -        for (int i = 0; i < argc; ++i)
       -                fprintf (stderr, "%d: %s\n", i, argv[i]);
       -#endif
       +  #ifdef DEBUGON
       +    for (int i = 0; i < argc; ++i)
       +      fprintf (stderr, "%d: %s\n", i, argv[i]);
       +  #endif
        }
        
   DIR diff --git a/sax.h b/sax.h
       @@ -1,7 +1,7 @@
        #ifndef SAX_H
          #define SAX_H
        
       -        #include "conffile.h"
       +  #include "conffile.h"
        
          struct conffile * parse_xml_conf (const char *file);
        
   DIR diff --git a/usmb.c b/usmb.c
       @@ -208,11 +208,11 @@ int main (int argc, char **argv)
          const char *conffile;
          const char *mountid;
        
       -        {
       -                static char conf[256];
       -                snprintf (conf, sizeof (conf), "%s/.usmb.conf", getenv ("HOME"));
       -                conffile = conf;
       -        }
       +  {
       +    static char conf[256];
       +    snprintf (conf, sizeof (conf), "%s/.usmb.conf", getenv ("HOME"));
       +    conffile = conf;
       +  }
        
          if (!parse_args (&argc, &argv, &mountid, &conffile))
            return EXIT_FAILURE;
   DIR diff --git a/utils.h b/utils.h
       @@ -4,12 +4,13 @@
          #ifdef DEBUG
            #undef DEBUG
            #define DEBUG(x) (x)
       +    #define DEBUGON
          #else
            #define DEBUG(x) ((void)0)
          #endif
        
       -        char * concat_strings (int num, ...);
       -        char * xstrdup (const char *in);
       -        void xfree (const void *ptr);
       +  char * concat_strings (int num, ...);
       +  char * xstrdup (const char *in);
       +  void xfree (const void *ptr);
        
        #endif
   DIR diff --git a/version.h b/version.h
       @@ -1,21 +1,21 @@
        #ifndef VERSION_H
          #define VERSION_H
        
       -        #include <stdio.h>
       +  #include <stdio.h>
        
       -        // suffix: a = alpha, b = beta, p = pre-release, r = release
       +  // suffix: a = alpha, b = beta, p = pre-release, r = release
        
       -        #define USMB_VERSION_MAJOR 0
       -        #define USMB_VERSION_MINOR 1
       -        #define USMB_VERSION_SUFFIX 'a'
       +  #define USMB_VERSION_MAJOR 0
       +  #define USMB_VERSION_MINOR 1
       +  #define USMB_VERSION_SUFFIX 'a'
        
       -        static inline void show_version (FILE *fp)
       -        {
       -          fprintf (fp, "usmb version: %d.%d%c\n",
       -                   USMB_VERSION_MAJOR, USMB_VERSION_MINOR, USMB_VERSION_SUFFIX);
       -          fprintf (fp, "FUSE version: %d.%d\n",
       -                         FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION);
       -          fprintf (fp, "Samba version: %s\n", smbc_version());
       -        }
       +  static inline void show_version (FILE *fp)
       +  {
       +    fprintf (fp, "usmb version: %d.%d%c\n",
       +             USMB_VERSION_MAJOR, USMB_VERSION_MINOR, USMB_VERSION_SUFFIX);
       +    fprintf (fp, "FUSE version: %d.%d\n",
       +             FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION);
       +    fprintf (fp, "Samba version: %s\n", smbc_version());
       +  }
        
        #endif