replace argz
This commit is contained in:
parent
3459387094
commit
7e5fa7fe7d
@ -8,6 +8,8 @@ ChangeLog for davfs2
|
|||||||
Replace xxfsent functions by xxmntent functions.
|
Replace xxfsent functions by xxmntent functions.
|
||||||
Don't compare commandline and fstab for options
|
Don't compare commandline and fstab for options
|
||||||
'user' and 'users', only check fstab for presence.
|
'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)
|
2010-08-07 Werner Baumann (werner.baumann@onlinehome.de)
|
||||||
* webdav.c:
|
* webdav.c:
|
||||||
|
@ -42,7 +42,7 @@ DAV_CHECK_NEON
|
|||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_HEADER_DIRENT
|
AC_HEADER_DIRENT
|
||||||
AC_HEADER_STDC
|
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.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
|
@ -20,9 +20,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef HAVE_ARGZ_H
|
|
||||||
#include <argz.h>
|
|
||||||
#endif
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <error.h>
|
#include <error.h>
|
||||||
@ -150,7 +147,7 @@ static dav_args *
|
|||||||
parse_commandline(int argc, char *argv[]);
|
parse_commandline(int argc, char *argv[]);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_config(char *argv[], dav_args *args);
|
parse_config(int argc, char *argv[], dav_args *args);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_secrets(dav_args *args);
|
parse_secrets(dav_args *args);
|
||||||
@ -194,7 +191,7 @@ static dav_args *
|
|||||||
new_args(void);
|
new_args(void);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
log_dbg_cmdline(char *argv[]);
|
log_dbg_cmdline(int argc, char *argv[]);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
log_dbg_config(char *argv[], dav_args *args);
|
log_dbg_config(char *argv[], dav_args *args);
|
||||||
@ -246,7 +243,7 @@ main(int argc, char *argv[])
|
|||||||
if (getuid() != 0)
|
if (getuid() != 0)
|
||||||
check_fstab(args);
|
check_fstab(args);
|
||||||
|
|
||||||
parse_config(argv, args);
|
parse_config(argc, argv, args);
|
||||||
|
|
||||||
check_mountpoint(args);
|
check_mountpoint(args);
|
||||||
|
|
||||||
@ -938,7 +935,7 @@ is_mounted(void)
|
|||||||
static dav_args *
|
static dav_args *
|
||||||
parse_commandline(int argc, char *argv[])
|
parse_commandline(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
log_dbg_cmdline(argv);
|
log_dbg_cmdline(argc, argv);
|
||||||
dav_args *args = new_args();
|
dav_args *args = new_args();
|
||||||
|
|
||||||
char *short_options = "vwVho:";
|
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
|
given it will be parsed too and overwrites the values from the system
|
||||||
wide configuration file. */
|
wide configuration file. */
|
||||||
static void
|
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);
|
read_config(args, DAV_SYS_CONF_DIR "/" DAV_CONFIG, 1);
|
||||||
|
|
||||||
@ -1829,15 +1826,26 @@ new_args(void)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
log_dbg_cmdline(char *argv[])
|
log_dbg_cmdline(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len = argc;
|
||||||
char *cmdline;
|
int i;
|
||||||
if (argz_create(argv, &cmdline, &len) == 0) {
|
for (i = 0; i < argc; i++)
|
||||||
argz_stringify(cmdline, len, ' ');
|
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);
|
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), cmdline);
|
||||||
free(cmdline);
|
free(cmdline);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user