/*
- $Id: uuidtest.c,v 1.1 2009-11-27 21:15:48 franklahm Exp $
+ $Id: uuidtest.c,v 1.3 2009-11-28 12:27:24 franklahm Exp $
Copyright (c) 2008,2009 Frank Lahm <franklahm@gmail.com>
This program is free software; you can redistribute it and/or modify
static void usage()
{
- printf("Usage: uuidtest -u <user> | -g <group> | -i <UUID>\n");
+ printf("Usage: afpldaptest -u <user> | -g <group> | -i <UUID>\n");
}
static void parse_ldapconf()
{
int ret, i, c;
int verbose = 0;
+ int logsetup = 0;
uuid_t uuid;
uuidtype_t type;
char *uuidstring = NULL;
char *name = NULL;
- setuplog("default log_error /dev/tty");
-
while ((c = getopt(argc, argv, ":vu:g:i:")) != -1) {
switch(c) {
case 'v':
if (! verbose) {
verbose = 1;
- setuplog("default log_debug /dev/tty");
+ setuplog("default log_maxdebug /dev/tty");
+ logsetup = 1;
}
break;
case 'u':
+ if (! logsetup)
+ setuplog("default log_info /dev/tty");
parse_ldapconf();
printf("Searching user: %s\n", optarg);
ret = getuuidfromname( optarg, UUID_USER, uuid);
break;
case 'g':
+ if (! logsetup)
+ setuplog("default log_info /dev/tty");
parse_ldapconf();
printf("Searching group: %s\n", optarg);
ret = getuuidfromname( optarg, UUID_GROUP, uuid);
break;
case 'i':
+ if (! logsetup)
+ setuplog("default log_info /dev/tty");
parse_ldapconf();
printf("Searching uuid: %s\n", optarg);
uuid_string2bin(optarg, uuid);
case ':':
case '?':
+ case 'h':
usage();
exit(EXIT_FAILURE);
}