Lines Matching refs:hol
415 struct hol struct
433 static struct hol *
441 struct hol *hol = malloc (sizeof (struct hol)); in make_hol() local
443 assert (hol); in make_hol()
445 hol->num_entries = 0; in make_hol()
446 hol->clusters = 0; in make_hol()
459 hol->num_entries++; in make_hol()
464 hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries); in make_hol()
465 hol->short_options = malloc (num_short_options + 1); in make_hol()
467 assert (hol->entries && hol->short_options); in make_hol()
469 assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry)); in make_hol()
473 so = hol->short_options; in make_hol()
474 for (o = opts, entry = hol->entries; ! oend (o); entry++) in make_hol()
491 if (oshort (o) && ! find_char (o->key, hol->short_options, so)) in make_hol()
501 return hol; in make_hol()
508 hol_add_cluster (struct hol *hol, int group, const char *header, int index, in hol_add_cluster() argument
522 cl->next = hol->clusters; in hol_add_cluster()
523 hol->clusters = cl; in hol_add_cluster()
530 hol_free (struct hol *hol) in hol_free() argument
532 struct hol_cluster *cl = hol->clusters; in hol_free()
541 if (hol->num_entries > 0) in hol_free()
543 free (hol->entries); in hol_free()
544 free (hol->short_options); in hol_free()
547 free (hol); in hol_free()
636 hol_find_entry (struct hol *hol, const char *name) in hol_find_entry() argument
638 struct hol_entry *entry = hol->entries; in hol_find_entry()
639 unsigned num_entries = hol->num_entries; in hol_find_entry()
661 hol_set_group (struct hol *hol, const char *name, int group) in hol_set_group() argument
663 struct hol_entry *entry = hol_find_entry (hol, name); in hol_set_group()
908 hol_sort (struct hol *hol) in hol_sort() argument
910 if (hol->num_entries > 0) in hol_sort()
911 qsort (hol->entries, hol->num_entries, sizeof (struct hol_entry), in hol_sort()
921 hol_append (struct hol *hol, struct hol *more) in hol_append() argument
923 struct hol_cluster **cl_end = &hol->clusters; in hol_append()
934 if (hol->num_entries == 0) in hol_append()
936 hol->num_entries = more->num_entries; in hol_append()
937 hol->entries = more->entries; in hol_append()
938 hol->short_options = more->short_options; in hol_append()
948 unsigned num_entries = hol->num_entries + more->num_entries; in hol_append()
951 unsigned hol_so_len = strlen (hol->short_options); in hol_append()
960 __mempcpy (__mempcpy (entries, hol->entries, in hol_append()
961 hol->num_entries * sizeof (struct hol_entry)), in hol_append()
965 __mempcpy (short_options, hol->short_options, hol_so_len); in hol_append()
968 for (e = entries, left = hol->num_entries; left > 0; e++, left--) in hol_append()
970 = short_options + (e->short_options - hol->short_options); in hol_append()
1001 free (hol->entries); in hol_append()
1002 free (hol->short_options); in hol_append()
1004 hol->entries = entries; in hol_append()
1005 hol->num_entries = num_entries; in hol_append()
1006 hol->short_options = short_options; in hol_append()
1015 static struct hol *
1019 struct hol *hol = make_hol (argp, cluster); in argp_hol() local
1026 ? hol_add_cluster (hol, child->group, child->header, in argp_hol()
1030 hol_append (hol, argp_hol (child->argp, child_cluster)) ; in argp_hol()
1033 return hol; in argp_hol()
1337 hol_help (struct hol *hol, const struct argp_state *state, in hol_help() argument
1344 for (entry = hol->entries, num = hol->num_entries; num > 0; entry++, num--) in hol_help()
1447 hol_usage (struct hol *hol, argp_fmtstream_t stream) in hol_usage() argument
1449 if (hol->num_entries > 0) in hol_usage()
1453 char *short_no_arg_opts = alloca (strlen (hol->short_options) + 1); in hol_usage()
1457 for (entry = hol->entries, nentries = hol->num_entries in hol_usage()
1469 for (entry = hol->entries, nentries = hol->num_entries in hol_usage()
1476 for (entry = hol->entries, nentries = hol->num_entries in hol_usage()
1664 struct hol *hol = 0; in _help() local
1687 hol = argp_hol (argp, 0); in _help()
1690 hol_set_group (hol, "help", -1); in _help()
1691 hol_set_group (hol, "version", -1); in _help()
1693 hol_sort (hol); in _help()
1727 if (hol->num_entries > 0) in _help()
1734 hol_usage (hol, fs); in _help()
1766 if (hol->num_entries > 0) in _help()
1770 hol_help (hol, state, fs); in _help()
1793 if (hol) in _help()
1794 hol_free (hol); in _help()