Logo Search packages:      
Sourcecode: libgphoto2 version File versions

int gp_port_info_list_lookup_name ( GPPortInfoList list,
const char *  name 

Look up a name in the list.

list a GPPortInfoList
name a name
Looks for an entry in the list with the exact given name.

The index of the entry or a gphoto2 error code

Definition at line 435 of file gphoto2-port-info-list.c.

References CHECK_NULL, _GPPortInfoList::count, GP_ERROR_UNKNOWN_PORT, gp_log(), GP_LOG_DEBUG, _GPPortInfoList::info, and _GPPortInfo::name.

      int i, generic;

      CHECK_NULL (list && name);

      gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list", _("Looking up entry "
            "'%s'..."), name);

      /* Ignore generic entries */
      for (generic = i = 0; i < list->count; i++)
            if (!strlen (list->info[i].name))
            else if (!strcmp (list->info[i].name, name))
                  return (i - generic);

      return (GP_ERROR_UNKNOWN_PORT);

Generated by  Doxygen 1.6.0   Back to index