/*
- * Copyright (C) 2008 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2008 Andre Noll <maan@tuebingen.mpg.de>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
#include "error.h"
#include "user.h"
#include "select.cmdline.h"
+#include "select.h"
/** \cond */
/* global list */
static FILE *output_file;
-__printf_1_2 static int output(const char const *fmt, ...)
+__printf_1_2 static int output(const char *fmt, ...)
{
va_list argp;
int ret;
return output("%s", select_conf.trailer_arg);
}
+/* row: a pointer to a row of the *user* table */
static int user_summary_loop_function(struct osl_row *row, void *data)
{
struct user_summary_info *usi = data;
if (usi->preg) {
char *dirname;
- ret = get_dir_name_of_row(row, &dirname);
+ ret = get_dir_name_of_user_row(row, usi->ui, &dirname);
if (ret < 0)
goto err;
ret = dir_is_admissible(dirname, usi->preg, usi->inverse_matching);
return print_user_lists(fi);
case select_mode_arg_user_summary:
return print_user_summary(fi);
+ default:
+ ERROR_LOG("bad select mode\n");
+ return -ERRNO_TO_ERROR(EINVAL);
};
- ERROR_LOG("bad select mode\n");
- return -ERRNO_TO_ERROR(EINVAL);
}
static int open_pipe(char *path)
{
- int p[2], ret, argc;
+ int p[2], ret;
char **argv;
ret = pipe(p);
if (p[0] != STDIN_FILENO)
dup2(p[0], STDIN_FILENO);
DEBUG_LOG("executing %s\n", path);
- argc = split_args(path, &argv, " \t");
+ split_args(path, &argv, " \t");
execvp(argv[0], argv);
ERROR_LOG("error executing %s: %s\n", path,
adu_strerror(ERRNO_TO_ERROR(errno)));
/** Default format string for user_list mode. */
#define USER_LIST_DFLT_FMT "%(size:r:5) %(files:r:5) %(dirname)\n"
/** Default format string for user_summary mode. */
-#define USER_SUMMARY_DFLT_FMT "%(pw_name:l:16) %(uid:r:5) %(dirs:r:5) %(files:r:5) %(size:r:5)\n"
+#define USER_SUMMARY_DFLT_FMT "%(pw_name:l:16) %(uid:r:6) %(dirs:r:5) %(files:r:5) %(size:r:5)\n"
static int setup_format_string(char *fmt, struct format_info **fi)
{