replace argz

This commit is contained in:
wbaumann 2010-11-03 18:53:02 +00:00
parent 3459387094
commit 7e5fa7fe7d
3 changed files with 26 additions and 16 deletions

View File

@ -8,6 +8,8 @@ ChangeLog for davfs2
Replace xxfsent functions by xxmntent functions.
Don't compare commandline and fstab for options
'user' and 'users', only check fstab for presence.
* mount_davfs.c, log_dbg_cmdline:
Replace argz.

2010-08-07 Werner Baumann (werner.baumann@onlinehome.de)
* webdav.c:

View File

@ -42,7 +42,7 @@ DAV_CHECK_NEON
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([argz.h fcntl.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/mount.h sys/time.h syslog.h termios.h unistd.h utime.h])
AC_CHECK_HEADERS([fcntl.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/mount.h sys/time.h syslog.h termios.h unistd.h utime.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

View File

@ -20,9 +20,6 @@

#include "config.h"

#ifdef HAVE_ARGZ_H
#include <argz.h>
#endif
#include <ctype.h>
#include <errno.h>
#include <error.h>
@ -150,7 +147,7 @@ static dav_args *
parse_commandline(int argc, char *argv[]);

static void
parse_config(char *argv[], dav_args *args);
parse_config(int argc, char *argv[], dav_args *args);

static void
parse_secrets(dav_args *args);
@ -194,7 +191,7 @@ static dav_args *
new_args(void);

static void
log_dbg_cmdline(char *argv[]);
log_dbg_cmdline(int argc, char *argv[]);

static void
log_dbg_config(char *argv[], dav_args *args);
@ -246,7 +243,7 @@ main(int argc, char *argv[])
if (getuid() != 0)
check_fstab(args);

parse_config(argv, args);
parse_config(argc, argv, args);

check_mountpoint(args);

@ -938,7 +935,7 @@ is_mounted(void)
static dav_args *
parse_commandline(int argc, char *argv[])
{
log_dbg_cmdline(argv);
log_dbg_cmdline(argc, argv);
dav_args *args = new_args();

char *short_options = "vwVho:";
@ -1020,7 +1017,7 @@ parse_commandline(int argc, char *argv[])
given it will be parsed too and overwrites the values from the system
wide configuration file. */
static void
parse_config(char *argv[], dav_args *args)
parse_config(int argc, char *argv[], dav_args *args)
{
read_config(args, DAV_SYS_CONF_DIR "/" DAV_CONFIG, 1);

@ -1829,15 +1826,26 @@ new_args(void)


static void
log_dbg_cmdline(char *argv[])
log_dbg_cmdline(int argc, char *argv[])
{
size_t len;
char *cmdline;
if (argz_create(argv, &cmdline, &len) == 0) {
argz_stringify(cmdline, len, ' ');
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), cmdline);
free(cmdline);
size_t len = argc;
int i;
for (i = 0; i < argc; i++)
len += strlen(argv[i]);
char *cmdline = malloc(len);
if (!cmdline) abort();

char *p = cmdline;
for (i = 0; i < argc - 1; i++) {
strcpy(p, argv[i]);
p += strlen(argv[i]);
*p = ' ';
p++;
}
strcpy(p, argv[argc - 1]);

syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), cmdline);
free(cmdline);
}