Exemplo n.º 1
0
static int list_one(h5item *item, struct descriptor *xd)
{
  char *name = strcpy(malloc(strlen(item->name)+1),item->name);
  char *tmp;
  h5item *itm;
  for (itm = item->parent; itm; itm=itm->parent) {
    tmp = malloc(strlen(name)+strlen(itm->name)+2);
    strcpy(tmp,itm->name);
    strcat(tmp,"/");
    strcat(tmp,name);
    free(name);
    name = tmp;
  }
  if (item->item_type == H5G_DATASET || item->item_type == -1)
  {
    struct descriptor name_d = {0,DTYPE_T,CLASS_S,0};
    name_d.length = strlen(name);
    name_d.pointer = name;
    TdiVector(xd,&name_d,xd MDS_END_ARG);
  }
  free(name);
  if (item->attribute)
    list_one(item->attribute,xd);
  if (item->child)
    list_one(item->child,xd);
  if (item->brother)
    list_one(item->brother,xd);
}
Exemplo n.º 2
0
// Overload with both kinds of bindings.
// Returns false only if neither exists.
bool builtin_bind_t::list_one(const wcstring &seq, const wcstring &bind_mode, bool user,
                              bool preset, io_streams_t &streams) {
    bool retval = false;
    if (preset) {
        retval |= list_one(seq, bind_mode, false, streams);
    }
    if (user) {
        retval |= list_one(seq, bind_mode, true, streams);
    }
    return retval;
}
Exemplo n.º 3
0
void
secret_key_list( STRLIST list )
{
    if( !list )
	list_all(1);
    else  /* List by user id */
	list_one( list, 1 );
}
Exemplo n.º 4
0
/****************
 * List the keys
 * If list is NULL, all available keys are listed
 */
void
public_key_list( STRLIST list )
{
    if( !list )
	list_all(0);
    else
	list_one( list, 0 );
}
Exemplo n.º 5
0
/// List all current key bindings.
void builtin_bind_t::list(const wchar_t *bind_mode, bool user, io_streams_t &streams) {
    const std::vector<input_mapping_name_t> lst = input_mapping_get_names(user);

    for (const input_mapping_name_t &binding : lst) {
        if (bind_mode && bind_mode != binding.mode) {
            continue;
        }

        list_one(binding.seq, binding.mode, user, streams);
    }
}
Exemplo n.º 6
0
SANE_Status
tcp_configure_device (const char *devname, SANE_Status (*list_one)(SANE_String_Const devname))
{
/*
    TODO:	LAN scanners multicast discovery.
		devname would contain "tcp auto"
		
		We find new devnames and feed them to
		`list_one_device' one by one
*/
    return list_one(devname);
}
Exemplo n.º 7
0
int hdf5list(struct descriptor *xd)
{
  MdsFree1Dx(xd,0);
  if (current)
    list_one(current,xd);
}
Exemplo n.º 8
0
bool builtin_bind_t::insert(int optind, int argc, wchar_t **argv, io_streams_t &streams) {
    wchar_t *cmd = argv[0];
    int arg_count = argc - optind;

    if (arg_count < 2) {
        // If we get both or neither preset/user, we list both.
        if (!opts->have_preset && !opts->have_user) {
            opts->preset = true;
            opts->user = true;
        }
    } else {
        // Inserting both on the other hand makes no sense.
        if (opts->have_preset && opts->have_user) {
            streams.err.append_format(
                BUILTIN_ERR_COMBO2, cmd,
                L"--preset and --user can not be used together when inserting bindings.");
            return true;
        }
    }

    if (arg_count == 0) {
        // We don't overload this with user and def because we want them to be grouped.
        // First the presets, then the users (because of scrolling).
        if (opts->preset) {
            list(opts->bind_mode_given ? opts->bind_mode : NULL, false, streams);
        }
        if (opts->user) {
            list(opts->bind_mode_given ? opts->bind_mode : NULL, true, streams);
        }
    } else if (arg_count == 1) {
        wcstring seq;
        if (opts->use_terminfo) {
            if (!get_terminfo_sequence(argv[optind], &seq, streams)) {
                // get_terminfo_sequence already printed the error.
                return true;
            }
        } else {
            seq = argv[optind];
        }

        if (!list_one(seq, opts->bind_mode, opts->user, opts->preset, streams)) {
            wcstring eseq = escape_string(argv[optind], 0);
            if (!opts->silent) {
                if (opts->use_terminfo) {
                    streams.err.append_format(_(L"%ls: No binding found for key '%ls'\n"), cmd,
                                              eseq.c_str());
                } else {
                    streams.err.append_format(_(L"%ls: No binding found for sequence '%ls'\n"), cmd,
                                              eseq.c_str());
                }
            }
            return true;
        }
    } else {
        // Actually insert!
        if (add(argv[optind], argv + (optind + 1), argc - (optind + 1), opts->bind_mode,
                opts->sets_bind_mode, opts->use_terminfo, opts->user, streams)) {
            return true;
        }
    }

    return false;
}