#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <strings.h>
#include <signal.h>
#include <errno.h>
#include <libintl.h>
#include <sys/types.h>
#include "vold.h"
#include "rmm_common.h"
char *progname = "volcheck";
static void
usage()
{
fprintf(stderr,
gettext("usage: %s [-t #secs -i #secs] [-v] [path | nickname]\n"),
progname);
fprintf(stderr,
gettext("If path is not supplied all media is checked\n"));
}
int
main(int argc, char **argv)
{
const char *opts = "itv";
int c;
LibHalContext *hal_ctx;
DBusError error;
rmm_error_t rmm_error;
int ret = 0;
vold_init(argc, argv);
while ((c = getopt(argc, argv, opts)) != EOF) {
switch (c) {
case 'i':
break;
case 't':
break;
case 'v':
break;
default:
usage();
return (1);
}
}
if ((hal_ctx = rmm_hal_init(0, 0, 0, 0, &error, &rmm_error)) == NULL) {
(void) fprintf(stderr,
gettext("HAL initialization failed: %s\n"),
rmm_strerror(&error, rmm_error));
rmm_dbus_error_free(&error);
return (1);
}
if (optind == argc) {
ret = rmm_rescan(hal_ctx, NULL, B_FALSE);
} else {
for (; optind < argc; optind++) {
if (rmm_rescan(hal_ctx, argv[optind], B_FALSE) != 0) {
ret = 1;
}
}
}
rmm_hal_fini(hal_ctx);
return (ret);
}