本文整理汇总了C++中OPT__VERBOSE函数的典型用法代码示例。如果您正苦于以下问题:C++ OPT__VERBOSE函数的具体用法?C++ OPT__VERBOSE怎么用?C++ OPT__VERBOSE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OPT__VERBOSE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
/* I18n */
setlocale(LC_ALL, "");
#if ENABLE_NLS
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
#endif
abrt_init(argv);
const char *dump_dir_name = ".";
const char *conf_filename = NULL;
const char *chroot = NULL;
/* Can't keep these strings/structs static: _() doesn't support that */
const char *program_usage_string = _(
"& [-v] [-c CONFFILE] [-r CHROOT] -d DIR\n"
"\n"
"Query package database and save package and component name"
);
enum {
OPT_v = 1 << 0,
OPT_d = 1 << 1,
OPT_c = 1 << 2,
OPT_r = 1 << 2,
};
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Problem directory")),
OPT_STRING('c', NULL, &conf_filename, "CONFFILE", _("Configuration file")),
OPT_STRING('r', "chroot", &chroot, "CHROOT" , _("Use this directory as RPM root")),
OPT_END()
};
/*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string);
export_abrt_envvars(0);
log_notice("Loading settings");
if (load_conf(conf_filename) != 0)
return 1; /* syntax error (logged already by load_conf) */
log_notice("Initializing rpm library");
rpm_init();
GList *li;
for (li = settings_setOpenGPGPublicKeys; li != NULL; li = g_list_next(li))
{
log_notice("Loading GPG key '%s'", (char*)li->data);
rpm_load_gpgkey((char*)li->data);
}
int r = SavePackageDescriptionToDebugDump(dump_dir_name, chroot);
/* Close RPM database */
rpm_destroy();
return r;
}
开发者ID:babycaseny,项目名称:abrt,代码行数:60,代码来源:abrt-action-save-package-data.c
示例2: prune
static int prune(int argc, const char **argv, const char *prefix)
{
struct notes_tree *t;
int show_only = 0, verbose = 0;
struct option options[] = {
OPT__DRY_RUN(&show_only, "do not remove, show only"),
OPT__VERBOSE(&verbose, "report pruned notes"),
OPT_END()
};
argc = parse_options(argc, argv, prefix, options, git_notes_prune_usage,
0);
if (argc) {
error(_("too many parameters"));
usage_with_options(git_notes_prune_usage, options);
}
t = init_notes_check("prune");
prune_notes(t, (verbose ? NOTES_PRUNE_VERBOSE : 0) |
(show_only ? NOTES_PRUNE_VERBOSE|NOTES_PRUNE_DRYRUN : 0) );
if (!show_only)
commit_notes(t, "Notes removed by 'git notes prune'");
free_notes(t);
return 0;
}
开发者ID:kylebarney,项目名称:git,代码行数:27,代码来源:notes.c
示例3: cmd_status
int cmd_status(int argc, const char **argv)
{
const char *program_usage_string = _(
"& status"
);
int opt_bare = 0; /* must be _int_, OPT_BOOL expects that! */
int opt_since = 0;
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
OPT_BOOL ('b', "bare", &opt_bare, _("Print only the problem count without any message")),
OPT_INTEGER('s', "since", &opt_since, _("Print only the problems more recent than specified timestamp")),
OPT_END()
};
parse_opts(argc, (char **)argv, program_options, program_usage_string);
unsigned int problem_count = count_problem_dirs(opt_since);
/* show only if there is at least 1 problem or user set the -v */
if (problem_count > 0 || g_verbose > 0)
{
if (opt_bare)
printf("%u", problem_count);
else
{
char *list_arg = opt_since ? xasprintf(" --since %d", opt_since) : xstrdup("");
printf(_("ABRT has detected %u problem(s). For more info run: abrt-cli list%s\n"), problem_count, list_arg);
free(list_arg);
}
}
return 0;
}
开发者ID:abrt,项目名称:abrt,代码行数:35,代码来源:status.c
示例4: cmd_verify_commit
int cmd_verify_commit(int argc, const char **argv, const char *prefix)
{
int i = 1, verbose = 0, had_error = 0;
unsigned flags = 0;
const struct option verify_commit_options[] = {
OPT__VERBOSE(&verbose, N_("print commit contents")),
OPT_BIT(0, "raw", &flags, N_("print raw gpg status output"), GPG_VERIFY_RAW),
OPT_END()
};
git_config(git_verify_commit_config, NULL);
argc = parse_options(argc, argv, prefix, verify_commit_options,
verify_commit_usage, PARSE_OPT_KEEP_ARGV0);
if (argc <= i)
usage_with_options(verify_commit_usage, verify_commit_options);
if (verbose)
flags |= GPG_VERIFY_VERBOSE;
/* sometimes the program was terminated because this signal
* was received in the process of writing the gpg input: */
signal(SIGPIPE, SIG_IGN);
while (i < argc)
if (verify_commit(argv[i++], flags))
had_error = 1;
return had_error;
}
开发者ID:0369,项目名称:git,代码行数:28,代码来源:verify-commit.c
示例5: main
int main(int argc, const char **argv)
{
const char *prefix = "prefix/";
const char *usage[] = {
"test-parse-options <options>",
NULL
};
struct option options[] = {
OPT_BOOLEAN('b', "boolean", &boolean, "get a boolean"),
OPT_BIT('4', "or4", &boolean,
"bitwise-or boolean with ...0100", 4),
OPT_NEGBIT(0, "neg-or4", &boolean, "same as --no-or4", 4),
OPT_GROUP(""),
OPT_INTEGER('i', "integer", &integer, "get a integer"),
OPT_INTEGER('j', NULL, &integer, "get a integer, too"),
OPT_SET_INT(0, "set23", &integer, "set integer to 23", 23),
OPT_DATE('t', NULL, ×tamp, "get timestamp of <time>"),
OPT_CALLBACK('L', "length", &integer, "str",
"get length of <str>", length_callback),
OPT_FILENAME('F', "file", &file, "set file to <FILE>"),
OPT_GROUP("String options"),
OPT_STRING('s', "string", &string, "string", "get a string"),
OPT_STRING(0, "string2", &string, "str", "get another string"),
OPT_STRING(0, "st", &string, "st", "get another string (pervert ordering)"),
OPT_STRING('o', NULL, &string, "str", "get another string"),
OPT_SET_PTR(0, "default-string", &string,
"set string to default", (unsigned long)"default"),
OPT_GROUP("Magic arguments"),
OPT_ARGUMENT("quux", "means --quux"),
OPT_NUMBER_CALLBACK(&integer, "set integer to NUM",
number_callback),
{ OPTION_BOOLEAN, '+', NULL, &boolean, NULL, "same as -b",
PARSE_OPT_NOARG | PARSE_OPT_NONEG | PARSE_OPT_NODASH },
OPT_GROUP("Standard options"),
OPT__ABBREV(&abbrev),
OPT__VERBOSE(&verbose),
OPT__DRY_RUN(&dry_run),
OPT__QUIET(&quiet),
OPT_END(),
};
int i;
argc = parse_options(argc, argv, prefix, options, usage, 0);
printf("boolean: %d\n", boolean);
printf("integer: %u\n", integer);
printf("timestamp: %lu\n", timestamp);
printf("string: %s\n", string ? string : "(not set)");
printf("abbrev: %d\n", abbrev);
printf("verbose: %d\n", verbose);
printf("quiet: %s\n", quiet ? "yes" : "no");
printf("dry run: %s\n", dry_run ? "yes" : "no");
printf("file: %s\n", file ? file : "(not set)");
for (i = 0; i < argc; i++)
printf("arg %02d: %s\n", i, argv[i]);
return 0;
}
开发者ID:Fabiano-lr,项目名称:git,代码行数:59,代码来源:test-parse-options.c
示例6: cmd_prune
int cmd_prune(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;
struct progress *progress = NULL;
const struct option options[] = {
OPT__DRY_RUN(&show_only, N_("do not remove, show only")),
OPT__VERBOSE(&verbose, N_("report pruned objects")),
OPT_BOOL(0, "progress", &show_progress, N_("show progress")),
OPT_EXPIRY_DATE(0, "expire", &expire,
N_("expire objects older than <time>")),
OPT_END()
};
char *s;
expire = TIME_MAX;
save_commit_buffer = 0;
check_replace_refs = 0;
ref_paranoia = 1;
init_revisions(&revs, prefix);
argc = parse_options(argc, argv, prefix, options, prune_usage, 0);
if (repository_format_precious_objects)
die(_("cannot prune in a precious-objects repo"));
while (argc--) {
struct object_id oid;
const char *name = *argv++;
if (!get_oid(name, &oid)) {
struct object *object = parse_object_or_die(&oid,
name);
add_pending_object(&revs, object, "");
}
else
die("unrecognized argument: %s", name);
}
if (show_progress == -1)
show_progress = isatty(2);
if (show_progress)
progress = start_progress_delay(_("Checking connectivity"), 0, 0, 2);
mark_reachable_objects(&revs, 1, expire, progress);
stop_progress(&progress);
for_each_loose_file_in_objdir(get_object_directory(), prune_object,
prune_cruft, prune_subdir, NULL);
prune_packed_objects(show_only ? PRUNE_PACKED_DRY_RUN : 0);
remove_temporary_files(get_object_directory());
s = mkpathdup("%s/pack", get_object_directory());
remove_temporary_files(s);
free(s);
if (is_repository_shallow())
prune_shallow(show_only);
return 0;
}
开发者ID:Litttle-butterfly,项目名称:git,代码行数:59,代码来源:prune.c
示例7: cmd_count_objects
int cmd_count_objects(int argc, const char **argv, const char *prefix)
{
int i, verbose = 0;
const char *objdir = get_object_directory();
int len = strlen(objdir);
char *path = xmalloc(len + 50);
unsigned long loose = 0, packed = 0, packed_loose = 0, garbage = 0;
unsigned long loose_size = 0;
struct option opts[] = {
OPT__VERBOSE(&verbose),
OPT_END(),
};
argc = parse_options(argc, argv, opts, count_objects_usage, 0);
/* we do not take arguments other than flags for now */
if (argc)
usage_with_options(count_objects_usage, opts);
memcpy(path, objdir, len);
if (len && objdir[len-1] != '/')
path[len++] = '/';
for (i = 0; i < 256; i++) {
DIR *d;
sprintf(path + len, "%02x", i);
d = opendir(path);
if (!d)
continue;
count_objects(d, path, len, verbose,
&loose, &loose_size, &packed_loose, &garbage);
closedir(d);
}
if (verbose) {
struct packed_git *p;
unsigned long num_pack = 0;
unsigned long size_pack = 0;
if (!packed_git)
prepare_packed_git();
for (p = packed_git; p; p = p->next) {
if (!p->pack_local)
continue;
if (open_pack_index(p))
continue;
packed += p->num_objects;
size_pack += p->pack_size + p->index_size;
num_pack++;
}
printf("count: %lu\n", loose);
printf("size: %lu\n", loose_size / 1024);
printf("in-pack: %lu\n", packed);
printf("packs: %lu\n", num_pack);
printf("size-pack: %lu\n", size_pack / 1024);
printf("prune-packable: %lu\n", packed_loose);
printf("garbage: %lu\n", garbage);
}
else
printf("%lu objects, %lu kilobytes\n",
loose, loose_size / 1024);
return 0;
}
开发者ID:DJHartley,项目名称:git,代码行数:58,代码来源:builtin-count-objects.c
示例8: main
int main(int argc, char **argv)
{
/* I18n */
setlocale(LC_ALL, "");
#if ENABLE_NLS
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
#endif
abrt_init(argv);
const char *dump_dir_name = ".";
const char *root_dir = NULL;
/* Can't keep these strings/structs static: _() doesn't support that */
const char *program_usage_string = _(
"& [-v] -d DIR\n"
"\n"
"Save container metadata"
);
enum {
OPT_v = 1 << 0,
OPT_d = 1 << 1,
};
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Problem directory")),
OPT_STRING('r', NULL, &root_dir, "ROOTDIR" , _("Root directory for running container commands")),
OPT_END()
};
/*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string);
export_abrt_envvars(0);
struct dump_dir *dd = dd_opendir(dump_dir_name, /* for writing */0);
if (dd == NULL)
xfunc_die();
char *container_cmdline = dd_load_text_ext(dd, FILENAME_CONTAINER_CMDLINE, DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
if (container_cmdline == NULL)
error_msg_and_die("The crash didn't occur in container");
if (strstr("/docker ", container_cmdline) == 0)
dump_docker_info(dd, root_dir);
else if (strstr("/lxc-", container_cmdline) == 0)
dump_lxc_info(dd, container_cmdline);
else
error_msg_and_die("Unsupported container technology");
free(container_cmdline);
dd_close(dd);
return 0;
}
开发者ID:arhledvink,项目名称:abrt,代码行数:55,代码来源:abrt-action-save-container-data.c
示例9: main
int main(int argc, char **argv)
{
abrt_init(argv);
map_string_h *settings = new_map_string();
const char *dump_dir_name = ".";
GList *conf_file = NULL;
/* Can't keep these strings/structs static: _() doesn't support that */
const char *program_usage_string = _(
"\b [-v] -c CONFFILE -d DIR\n"
"\n"
"Reports problem to Bugzilla"
);
enum {
OPT_v = 1 << 0,
OPT_d = 1 << 1,
OPT_c = 1 << 2,
};
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Dump directory")),
OPT_LIST( 'c', NULL, &conf_file , "FILE", _("Configuration file (may be given many times)")),
OPT_END()
};
/*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string);
export_abrt_envvars(0);
while (conf_file)
{
char *fn = (char *)conf_file->data;
VERB1 log("Loading settings from '%s'", fn);
load_conf_file(fn, settings, /*skip key w/o values:*/ true);
VERB3 log("Loaded '%s'", fn);
conf_file = g_list_remove(conf_file, fn);
}
VERB1 log("Initializing XML-RPC library");
xmlrpc_env env;
xmlrpc_env_init(&env);
xmlrpc_client_setup_global_const(&env);
if (env.fault_occurred)
error_msg_and_die("XML-RPC Fault: %s(%d)", env.fault_string, env.fault_code);
xmlrpc_env_clean(&env);
report_to_bugzilla(dump_dir_name, settings);
free_map_string(settings);
return 0;
}
开发者ID:wyuka,项目名称:abrt,代码行数:52,代码来源:abrt-action-bugzilla.c
示例10: cmd_push
int cmd_push(int argc, const char **argv, const char *prefix)
{
int flags = 0;
int all = 0;
int mirror = 0;
int dry_run = 0;
int force = 0;
int tags = 0;
int rc;
const char *repo = NULL; /* default repository */
struct option options[] = {
OPT__VERBOSE(&verbose),
OPT_STRING( 0 , "repo", &repo, "repository", "repository"),
OPT_BOOLEAN( 0 , "all", &all, "push all refs"),
OPT_BOOLEAN( 0 , "mirror", &mirror, "mirror all refs"),
OPT_BOOLEAN( 0 , "tags", &tags, "push tags"),
OPT_BOOLEAN( 0 , "dry-run", &dry_run, "dry run"),
OPT_BOOLEAN('f', "force", &force, "force updates"),
OPT_BOOLEAN( 0 , "thin", &thin, "use thin pack"),
OPT_STRING( 0 , "receive-pack", &receivepack, "receive-pack", "receive pack program"),
OPT_STRING( 0 , "exec", &receivepack, "receive-pack", "receive pack program"),
OPT_END()
};
argc = parse_options(argc, argv, options, push_usage, 0);
if (force)
flags |= TRANSPORT_PUSH_FORCE;
if (dry_run)
flags |= TRANSPORT_PUSH_DRY_RUN;
if (verbose)
flags |= TRANSPORT_PUSH_VERBOSE;
if (tags)
add_refspec("refs/tags/*");
if (all)
flags |= TRANSPORT_PUSH_ALL;
if (mirror)
flags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE);
if (argc > 0) {
repo = argv[0];
set_refspecs(argv + 1, argc - 1);
}
rc = do_push(repo, flags);
if (rc == -1)
usage_with_options(push_usage, options);
else
return rc;
}
开发者ID:Jatinpurohit,项目名称:git,代码行数:51,代码来源:builtin-push.c
示例11: cmd_prune
int cmd_prune(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;
struct progress *progress = NULL;
const struct option options[] = {
OPT__DRY_RUN(&show_only, N_("do not remove, show only")),
OPT__VERBOSE(&verbose, N_("report pruned objects")),
OPT_BOOL(0, "progress", &show_progress, N_("show progress")),
OPT_DATE(0, "expire", &expire,
N_("expire objects older than <time>")),
OPT_END()
};
char *s;
expire = ULONG_MAX;
save_commit_buffer = 0;
read_replace_refs = 0;
init_revisions(&revs, prefix);
argc = parse_options(argc, argv, prefix, options, prune_usage, 0);
while (argc--) {
unsigned char sha1[20];
const char *name = *argv++;
if (!get_sha1(name, sha1)) {
struct object *object = parse_object(sha1);
if (!object)
die("bad object: %s", name);
add_pending_object(&revs, object, "");
}
else
die("unrecognized argument: %s", name);
}
if (show_progress == -1)
show_progress = isatty(2);
if (show_progress)
progress = start_progress_delay("Checking connectivity", 0, 0, 2);
mark_reachable_objects(&revs, 1, progress);
stop_progress(&progress);
prune_object_dir(get_object_directory());
prune_packed_objects(show_only);
remove_temporary_files(get_object_directory());
s = xstrdup(mkpath("%s/pack", get_object_directory()));
remove_temporary_files(s);
free(s);
return 0;
}
开发者ID:DavidGould,项目名称:git,代码行数:50,代码来源:prune.c
示例12: cmd_list
int cmd_list(int argc, const char **argv)
{
const char *program_usage_string = _(
"& list [options]"
);
int opt_not_reported = 0;
int opt_detailed = 0;
int opt_since = 0;
int opt_until = 0;
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
OPT_BOOL('n', "not-reported" , &opt_not_reported, _("List only not-reported problems")),
/* deprecate -d option with --pretty=full*/
OPT_BOOL('d', "detailed" , &opt_detailed, _("Show detailed report")),
OPT_INTEGER('s', "since" , &opt_since, _("List only the problems more recent than specified timestamp")),
OPT_INTEGER('u', "until" , &opt_until, _("List only the problems older than specified timestamp")),
OPT_END()
};
parse_opts(argc, (char **)argv, program_options, program_usage_string);
vector_of_problem_data_t *ci = fetch_crash_infos();
if (ci == NULL)
return 1;
g_ptr_array_sort_with_data(ci, &cmp_problem_data, (char *) FILENAME_LAST_OCCURRENCE);
#if SUGGEST_AUTOREPORTING != 0
const bool output =
#endif
print_crash_list(ci, opt_detailed, opt_not_reported, opt_since, opt_until, CD_TEXT_ATT_SIZE_BZ);
free_vector_of_problem_data(ci);
#if SUGGEST_AUTOREPORTING != 0
load_abrt_conf();
if (!g_settings_autoreporting)
{
if (output)
putc('\n', stderr);
fprintf(stderr, _("The Autoreporting feature is disabled. Please consider enabling it by issuing\n"
"'abrt-auto-reporting enabled' as a user with root privileges\n"));
}
#endif
return 0;
}
开发者ID:abrt,项目名称:abrt,代码行数:49,代码来源:list.c
示例13: cmd_verify_tag
int cmd_verify_tag(int argc, const char **argv, const char *prefix)
{
int i = 1, verbose = 0, had_error = 0;
unsigned flags = 0;
struct ref_format format = REF_FORMAT_INIT;
const struct option verify_tag_options[] = {
OPT__VERBOSE(&verbose, N_("print tag contents")),
OPT_BIT(0, "raw", &flags, N_("print raw gpg status output"), GPG_VERIFY_RAW),
OPT_STRING(0, "format", &format.format, N_("format"), N_("format to use for the output")),
OPT_END()
};
git_config(git_verify_tag_config, NULL);
argc = parse_options(argc, argv, prefix, verify_tag_options,
verify_tag_usage, PARSE_OPT_KEEP_ARGV0);
if (argc <= i)
usage_with_options(verify_tag_usage, verify_tag_options);
if (verbose)
flags |= GPG_VERIFY_VERBOSE;
if (format.format) {
if (verify_ref_format(&format))
usage_with_options(verify_tag_usage,
verify_tag_options);
flags |= GPG_VERIFY_OMIT_STATUS;
}
while (i < argc) {
struct object_id oid;
const char *name = argv[i++];
if (get_oid(name, &oid)) {
had_error = !!error("tag '%s' not found.", name);
continue;
}
if (gpg_verify_tag(&oid, name, flags)) {
had_error = 1;
continue;
}
if (format.format)
pretty_print_ref(name, oid.hash, &format);
}
return had_error;
}
开发者ID:LinTeX9527,项目名称:git,代码行数:48,代码来源:verify-tag.c
示例14: prune
static int prune(int ac, const char **av, const char *prefix)
{
struct option options[] = {
OPT__DRY_RUN(&show_only, N_("do not remove, show only")),
OPT__VERBOSE(&verbose, N_("report pruned working trees")),
OPT_EXPIRY_DATE(0, "expire", &expire,
N_("expire working trees older than <time>")),
OPT_END()
};
expire = TIME_MAX;
ac = parse_options(ac, av, prefix, options, worktree_usage, 0);
if (ac)
usage_with_options(worktree_usage, options);
prune_worktrees();
return 0;
}
开发者ID:ayanmw,项目名称:git,代码行数:17,代码来源:worktree.c
示例15: cmd_info
int cmd_info(int argc, const char **argv)
{
const char *program_usage_string = _(
"& info [options] DIR..."
);
int opt_detailed = 0;
int text_size = CD_TEXT_ATT_SIZE_BZ;
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
/* deprecate -d option with --pretty=full*/
OPT_BOOL( 'd', "detailed" , &opt_detailed, _("Show detailed report")),
OPT_INTEGER('s', "size", &text_size, _("Text larger than this will be shown abridged")),
OPT_END()
};
parse_opts(argc, (char **)argv, program_options, program_usage_string);
argv += optind;
if (!argv[0])
show_usage_and_die(program_usage_string, program_options);
if (text_size <= 0)
text_size = INT_MAX;
int errs = 0;
while (*argv)
{
const char *dump_dir = *argv++;
problem_data_t *problem = load_problem_data(dump_dir);
if (!problem)
{
error_msg(_("No such problem directory '%s'"), dump_dir);
errs++;
continue;
}
_cmd_info(problem, opt_detailed, text_size);
problem_data_free(problem);
if (*argv)
printf("\n");
}
return errs;
}
开发者ID:abrt,项目名称:abrt,代码行数:45,代码来源:list.c
示例16: main
int main(int argc, char **argv)
{
abrt_init(argv);
GList *dir_list = NULL;
GList *file_list = NULL;
char *preserve = NULL;
/* Can't keep these strings/structs static: _() doesn't support that */
const char *program_usage_string = _(
"\b [-v] [-d SIZE:DIR]... [-f SIZE:DIR]... [-p DIR]\n"
"\n"
"Deletes dump dirs (-d) or files (-f) in DIRs until they are smaller than SIZE"
);
enum {
OPT_v = 1 << 0,
OPT_d = 1 << 1,
OPT_f = 1 << 2,
OPT_p = 1 << 3,
};
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
OPT_LIST( 'd', NULL, &dir_list , "SIZE:DIR", _("Delete dump dirs")),
OPT_LIST( 'f', NULL, &file_list, "SIZE:DIR", _("Delete files")),
OPT_STRING('p', NULL, &preserve , "DIR" , _("Preserve this dump dir")),
OPT_END()
};
/*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string);
argv += optind;
if (argv[0] || !(dir_list || file_list))
show_usage_and_die(program_usage_string, program_options);
export_abrt_envvars(0);
g_list_foreach(dir_list, delete_dirs, preserve);
g_list_foreach(file_list, delete_files, NULL);
return 0;
}
开发者ID:michalnowak,项目名称:abrt-tests,代码行数:40,代码来源:abrt-action-trim-files.c
示例17: cmd_report
int cmd_report(int argc, const char **argv)
{
const char *program_usage_string = _(
"& report [options] DIR..."
);
enum {
OPT_v = 1 << 0,
OPT_d = 1 << 1,
OPT_u = 1 << 2,
};
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
OPT_BOOL('d', "delete", NULL, _("Remove PROBLEM_DIR after reporting")),
OPT_BOOL('u', "unsafe", NULL, _("Ignore security checks to be able to "
"report all problems")),
OPT_END()
};
unsigned opts = parse_opts(argc, (char **)argv, program_options, program_usage_string);
argv += optind;
if (!argv[0])
show_usage_and_die(program_usage_string, program_options);
export_abrt_envvars(/*prog_prefix:*/ 0);
load_abrt_conf();
free_abrt_conf_data();
int report_flags = 0;
if (opts & OPT_d)
report_flags |= CMD_REPORT_REMOVE;
if (opts & OPT_u)
report_flags |= CMD_REPORT_UNSAFE;
return _cmd_report(argv, report_flags);
}
开发者ID:xsulca00,项目名称:abrt,代码行数:39,代码来源:report.c
示例18: main
int main(int argc, char **argv)
{
abrt_init(argv);
const char *dump_dir_name = ".";
const char *conf_file = NULL;
/* Can't keep these strings/structs static: _() doesn't support that */
const char *program_usage_string = _(
"\b [-v] -d DIR [-c CONFFILE]\n"
"\n"
"Sends contents of a dump directory DIR via email"
);
enum {
OPT_v = 1 << 0,
OPT_d = 1 << 1,
OPT_c = 1 << 2,
};
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
OPT_STRING('d', NULL, &dump_dir_name, "DIR" , _("Dump directory")),
OPT_STRING('c', NULL, &conf_file , "CONFFILE", _("Config file")),
OPT_END()
};
/*unsigned opts =*/ parse_opts(argc, argv, program_options, program_usage_string);
export_abrt_envvars(0);
map_string_h *settings = new_map_string();
if (conf_file)
load_conf_file(conf_file, settings, /*skip key w/o values:*/ true);
create_and_send_email(dump_dir_name, settings);
free_map_string(settings);
return 0;
}
开发者ID:rplnt,项目名称:abrt,代码行数:38,代码来源:abrt-action-mailx.c
示例19: cmd_verify_tag
int cmd_verify_tag(int argc, const char **argv, const char *prefix)
{
int i = 1, verbose = 0, had_error = 0;
const struct option verify_tag_options[] = {
OPT__VERBOSE(&verbose, "print tag contents"),
OPT_END()
};
git_config(git_default_config, NULL);
argc = parse_options(argc, argv, prefix, verify_tag_options,
verify_tag_usage, PARSE_OPT_KEEP_ARGV0);
if (argc <= i)
usage_with_options(verify_tag_usage, verify_tag_options);
/* sometimes the program was terminated because this signal
* was received in the process of writing the gpg input: */
signal(SIGPIPE, SIG_IGN);
while (i < argc)
if (verify_tag(argv[i++], verbose))
had_error = 1;
return had_error;
}
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:23,代码来源:verify-tag.c
示例20: cmd_read_tree
int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
{
int i, newfd, stage = 0;
unsigned char sha1[20];
struct tree_desc t[MAX_UNPACK_TREES];
struct unpack_trees_options opts;
int prefix_set = 0;
const struct option read_tree_options[] = {
{ OPTION_CALLBACK, 0, "index-output", NULL, N_("file"),
N_("write resulting index to <file>"),
PARSE_OPT_NONEG, index_output_cb },
OPT_SET_INT(0, "empty", &read_empty,
N_("only empty the index"), 1),
OPT__VERBOSE(&opts.verbose_update, N_("be verbose")),
OPT_GROUP(N_("Merging")),
OPT_SET_INT('m', NULL, &opts.merge,
N_("perform a merge in addition to a read"), 1),
OPT_SET_INT(0, "trivial", &opts.trivial_merges_only,
N_("3-way merge if no file level merging required"), 1),
OPT_SET_INT(0, "aggressive", &opts.aggressive,
N_("3-way merge in presence of adds and removes"), 1),
OPT_SET_INT(0, "reset", &opts.reset,
N_("same as -m, but discard unmerged entries"), 1),
{ OPTION_STRING, 0, "prefix", &opts.prefix, N_("<subdirectory>/"),
N_("read the tree into the index under <subdirectory>/"),
PARSE_OPT_NONEG | PARSE_OPT_LITERAL_ARGHELP },
OPT_SET_INT('u', NULL, &opts.update,
N_("update working tree with merge result"), 1),
{ OPTION_CALLBACK, 0, "exclude-per-directory", &opts,
N_("gitignore"),
N_("allow explicitly ignored files to be overwritten"),
PARSE_OPT_NONEG, exclude_per_directory_cb },
OPT_SET_INT('i', NULL, &opts.index_only,
N_("don't check the working tree after merging"), 1),
OPT__DRY_RUN(&opts.dry_run, N_("don't update the index or the work tree")),
OPT_SET_INT(0, "no-sparse-checkout", &opts.skip_sparse_checkout,
N_("skip applying sparse checkout filter"), 1),
OPT_SET_INT(0, "debug-unpack", &opts.debug_unpack,
N_("debug unpack-trees"), 1),
OPT_END()
};
memset(&opts, 0, sizeof(opts));
opts.head_idx = -1;
opts.src_index = &the_index;
opts.dst_index = &the_index;
git_config(git_default_config, NULL);
argc = parse_options(argc, argv, unused_prefix, read_tree_options,
read_tree_usage, 0);
newfd = hold_locked_index(&lock_file, 1);
prefix_set = opts.prefix ? 1 : 0;
if (1 < opts.merge + opts.reset + prefix_set)
die("Which one? -m, --reset, or --prefix?");
if (opts.reset || opts.merge || opts.prefix) {
if (read_cache_unmerged() && (opts.prefix || opts.merge))
die("You need to resolve your current index first");
stage = opts.merge = 1;
}
resolve_undo_clear();
for (i = 0; i < argc; i++) {
const char *arg = argv[i];
if (get_sha1(arg, sha1))
die("Not a valid object name %s", arg);
if (list_tree(sha1) < 0)
die("failed to unpack tree object %s", arg);
stage++;
}
if (nr_trees == 0 && !read_empty)
warning("read-tree: emptying the index with no arguments is deprecated; use --empty");
else if (nr_trees > 0 && read_empty)
die("passing trees as arguments contradicts --empty");
if (1 < opts.index_only + opts.update)
die("-u and -i at the same time makes no sense");
if ((opts.update||opts.index_only) && !opts.merge)
die("%s is meaningless without -m, --reset, or --prefix",
opts.update ? "-u" : "-i");
if ((opts.dir && !opts.update))
die("--exclude-per-directory is meaningless unless -u");
if (opts.merge && !opts.index_only)
setup_work_tree();
if (opts.merge) {
if (stage < 2)
die("just how do you expect me to merge %d trees?", stage-1);
switch (stage - 1) {
case 1:
opts.fn = opts.prefix ? bind_merge : oneway_merge;
break;
case 2:
opts.fn = twoway_merge;
opts.initial_checkout = is_cache_unborn();
break;
//.........这里部分代码省略.........
开发者ID:4rch17,项目名称:git,代码行数:101,代码来源:read-tree.c
注:本文中的OPT__VERBOSE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论