static const gchar * log_matcher_string_match_string(LogMatcherString *self, const gchar *value, gsize value_len) { const gchar *result = NULL; gboolean match = FALSE; const gchar *pattern = self->super.pattern; if (self->pattern_len > value_len) return NULL; if (G_LIKELY((self->super.flags & (LMF_SUBSTRING + LMF_PREFIX)) == 0)) { if (self->super.flags & LMF_ICASE) match = strncasecmp(value, pattern, value_len) == 0; else match = strncmp(value, pattern, value_len) == 0; } else if (self->super.flags & LMF_PREFIX) { if (self->super.flags & LMF_ICASE) match = strncasecmp(value, pattern, MIN(value_len, self->pattern_len)) == 0; else match = strncmp(value, pattern, MIN(value_len, self->pattern_len)) == 0; } else if (self->super.flags & LMF_SUBSTRING) { if (self->super.flags & LMF_ICASE) { gchar *buf; gchar *res; APPEND_ZERO(buf, value, value_len); res = strcasestr(buf, pattern); if (res) result = value + (res - buf); } else { result = g_strstr_len(value, value_len, pattern); } } if (match && !result) result = value; return result; }
static gboolean entry_name_find(const struct cache_entry *entry, const char *value) { char *name; gboolean ret; if (!entry->name) return FALSE; if (strlen(value) == 0) return TRUE; name = g_utf8_strdown(entry->name, -1); ret = (g_strstr_len(name, -1, value) ? TRUE : FALSE); g_free(name); return ret; }
static gint google_get_size_value (gchar * ref, gchar * name) { gint number = 0; gchar * start = g_strstr_len (ref,256,name); if (start != NULL) { start += strlen (name); gchar * end = strchr (start,' '); if (end != NULL) { gchar numbuf[MAX_NUM_BUF] = {}; gsize span = MIN (end - start,MAX_NUM_BUF-1); strncpy (numbuf,start,span); number = strtol (numbuf,NULL,10); } } return number; }
static void cleanup_contact (char *contact) { char *c, *c2; /* replace "'<> with space */ for (c2 = contact; *c2; ++c2) if (*c2 == '"' || *c2 == '\'' || *c2 == '<' || *c2 == '>') *c2 = ' '; /* remove everything between '()' if it's after the 5th pos; * good to cleanup corporate contact address spam... */ c = g_strstr_len (contact, -1, "("); if (c && c - contact > 5) *c = '\0'; g_strstrip (contact); }
/** * gst_gl_context_check_feature: * @context: a #GstGLContext * @feature: a platform specific feature * * Some features require that the context be created before it is possible to * determine their existence and so will fail if that is not the case. * * Returns: Whether @feature is supported by @context */ gboolean gst_gl_context_check_feature (GstGLContext * context, const gchar * feature) { GstGLContextClass *context_class; g_return_val_if_fail (GST_GL_IS_CONTEXT (context), FALSE); g_return_val_if_fail (feature != NULL, FALSE); context_class = GST_GL_CONTEXT_GET_CLASS (context); if (g_strstr_len (feature, 3, "GL_")) return gst_gl_check_extension (feature, context->priv->gl_exts); if (!context_class->check_feature) return FALSE; return context_class->check_feature (context, feature); }
static void _finalize ( GObject *object) { GumdDbusServerP2P *self = GUMD_DBUS_SERVER_P2P (object); if (self->priv->address) { if (g_str_has_prefix (self->priv->address, "unix:path=")) { const gchar *path = g_strstr_len(self->priv->address, -1, "unix:path=") + 10; if (path) { g_unlink (path); } } g_free (self->priv->address); self->priv->address = NULL; } G_OBJECT_CLASS (gumd_dbus_server_p2p_parent_class)->finalize (object); }
static void notify_chat_nick (PurpleAccount *account, const gchar *sender, const gchar *message, PurpleConversation *conv, gpointer data) { gchar *nick; nick = (gchar *)purple_conv_chat_get_nick (PURPLE_CONV_CHAT(conv)); if (nick && !strcmp (sender, nick)) return; if (!g_strstr_len (message, strlen(message), nick)) return; notify_msg_sent (account, conv, sender, message); }
/*UA*/ gint awn_ua_alignment_list_cmp (gconstpointer a, gconstpointer b) { const gchar * str1 = a; const gchar * str2 = b; gchar * search = NULL; GStrv tokens = g_strsplit (str1,"::",2); g_return_val_if_fail (tokens,-1); search = g_strstr_len (str2,-1,tokens[0]); g_strfreev (tokens); if (!search) { return -1; }; return 0; }
static const char * str_utf8_search_first (const char *text, const char *search, int case_sen) { char *fold_text; char *deco_text; const char *match; const char *result = NULL; const char *m; fold_text = (case_sen) ? (char *) text : g_utf8_casefold (text, -1); deco_text = g_utf8_normalize (fold_text, -1, G_NORMALIZE_ALL); match = deco_text; do { match = g_strstr_len (match, -1, search); if (match != NULL) { if ((!str_utf8_iscombiningmark (match) || (match == deco_text)) && !str_utf8_iscombiningmark (match + strlen (search))) { result = text; m = deco_text; while (m < match) { str_utf8_cnext_noncomb_char (&m); str_utf8_cnext_noncomb_char (&result); } } else { str_utf8_cnext_char (&match); } } } while (match != NULL && result == NULL); g_free (deco_text); if (!case_sen) g_free (fold_text); return result; }
static void clip_receive_html ( GtkClipboard *c, GtkSelectionData *sd, gpointer p ) { VikLayersPanel *vlp = p; gsize r, w; GError *err = NULL; gchar *s, *span; gint tag = 0, i; struct LatLon coord; if (sd->length == -1) { return; } /* - copying from Mozilla seems to give html in UTF-16. */ if (!(s = g_convert ( (gchar *)sd->data, sd->length, "UTF-8", "UTF-16", &r, &w, &err))) { return; } // g_print("html is %d bytes long: %s\n", sd->length, s); /* scrape a coordinate pasted from a geocaching.com page: look for a * telltale tag if possible, and then remove tags */ if (!(span = g_strstr_len(s, w, "<span id=\"LatLon\">"))) { span = s; } for (i=0; i<strlen(span); i++) { gchar c = span[i]; if (c == '<') { tag++; } if (tag>0) { span[i] = ' '; } if (c == '>') { if (tag>0) tag--; } } if (clip_parse_latlon(span, &coord)) { clip_add_wp(vlp, &coord); } g_free(s); }
static AsIcon * as_app_desktop_create_icon (AsApp *app, const gchar *name, AsAppParseFlags flags) { AsIcon *icon = as_icon_new (); gchar *dot; g_autofree gchar *name_fixed = NULL; /* local */ if (g_path_is_absolute (name)) { as_icon_set_kind (icon, AS_ICON_KIND_LOCAL); as_icon_set_filename (icon, name); return icon; } /* work around a common mistake in desktop files */ name_fixed = g_strdup (name); dot = g_strstr_len (name_fixed, -1, "."); if (dot != NULL && (g_strcmp0 (dot, ".png") == 0 || g_strcmp0 (dot, ".xpm") == 0 || g_strcmp0 (dot, ".svg") == 0)) { *dot = '\0'; } /* stock */ if (as_utils_is_stock_icon_name (name_fixed)) { as_icon_set_kind (icon, AS_ICON_KIND_STOCK); as_icon_set_name (icon, name_fixed); return icon; } /* stock, but kinda sneaky */ if ((flags & AS_APP_PARSE_FLAG_USE_FALLBACKS) > 0 && _as_utils_is_stock_icon_name_fallback (name_fixed)) { as_icon_set_kind (icon, AS_ICON_KIND_STOCK); as_icon_set_name (icon, name_fixed); return icon; } /* just use default of UNKNOWN */ as_icon_set_name (icon, name_fixed); return icon; }
gboolean _gumd_dbus_server_p2p_start ( GumdDbusServer *self) { g_return_val_if_fail (GUMD_IS_DBUS_SERVER_P2P (self), FALSE); DBG("Start P2P DBus Server"); GumdDbusServerP2P *server = GUMD_DBUS_SERVER_P2P (self); if (!server->priv->bus_server) { GError *err = NULL; gchar *guid = g_dbus_generate_guid (); server->priv->bus_server = g_dbus_server_new_sync ( server->priv->address, G_DBUS_SERVER_FLAGS_NONE, guid, NULL, NULL, &err); g_free (guid); if (!server->priv->bus_server) { WARN ("Failed to start server at address '%s':%s", server->priv->address, err ? err->message : "NULL"); g_error_free (err); return FALSE; } g_signal_connect (server->priv->bus_server, "new-connection", G_CALLBACK(_on_client_request), server); } if (!g_dbus_server_is_active (server->priv->bus_server)) { const gchar *path = NULL; g_dbus_server_start (server->priv->bus_server); path = g_strstr_len(server->priv->address, -1, "unix:path=") + 10; if (path) { if (g_chmod (path, S_IRUSR | S_IWUSR) < 0) { WARN("Setting server socket permission failed with error '%s'", strerror(errno)); } } } DBG("Dbus server started at : %s", server->priv->address); return TRUE; }
/** * na_core_utils_str_subst: * @pattern: the pattern. * @key: the key string to be substituted. * @subst: the string which will replace @key. * * Returns: * a copy of @pattern where the first occurrence of @key has been * substituted with @subst, as a newly allocated string which should be * g_free() by the caller, * or a copy of @pattern if @key is not found in @pattern. */ gchar * na_core_utils_str_subst( const gchar *pattern, const gchar *key, const gchar *subst ) { GString *result; gchar *found; result = g_string_new( "" ); found = g_strstr_len( pattern, -1, key ); if( found ){ result = g_string_append_len( result, pattern, ( gssize )( found - pattern )); result = g_string_append( result, subst ); result = g_string_append( result, found + g_utf8_strlen( key, -1 )); } else { result = g_string_append( result, pattern ); } return( g_string_free( result, FALSE )); }
static gboolean bbcode_parse_tag(const gchar *raw_tag, gsize raw_tag_len, BBCodeTag *current_tag, BBCodeTag **ret_tag, gchar **ret_tag_argument, gboolean *ret_close_tag) { BBCodeTag *bbtag; const gchar *start = raw_tag + 1, *end = raw_tag + raw_tag_len - 1; const gchar *split = g_strstr_len(raw_tag, raw_tag_len, "="); gchar *tag, *arg; gboolean close_tag; if(raw_tag[1] == '/') { start += 1; close_tag = TRUE; } else { close_tag = FALSE; } if(split) { tag = g_strndup(start, (gsize) (split - start)); arg = g_strndup(split + 1, (gsize) (end - (split + 1))); } else { tag = g_strndup(start, (gsize) (end - start)); arg = g_strdup(""); } bbtag = g_hash_table_lookup(tag_table, tag); g_free(tag); if(bbtag) { if(close_tag && bbtag == current_tag) { /* we're closing a tag ... */ *ret_close_tag = TRUE; g_free(arg); return TRUE; } if(!close_tag && (!current_tag || current_tag->nesting)) { /* we're opening a tag ... */ *ret_tag = bbtag; *ret_tag_argument = arg; *ret_close_tag = FALSE; return TRUE; } } g_free(arg); return FALSE; }
gboolean is_livecd () { const gchar *filename = "/proc/cmdline"; gchar *contents = NULL; gboolean result = FALSE; gsize length = 0; if (g_file_get_contents(filename,&contents,&length,NULL)) { gchar* ptr = g_strstr_len(contents, -1, "boot=casper"); if (ptr == NULL) { result = FALSE; } else { result = TRUE; g_message("====is livecd os====="); } g_free(contents); } return result; }
/* @str points to the start of "#version", "# version" or "#\tversion", etc */ static const gchar * _check_valid_version_preprocessor_string (const gchar * str) { gint i = 0; if (!str || !str[i]) return NULL; /* there can be whitespace between the '#' and 'version' */ do { i++; if (str[i] == '\0' || str[i] == '\n' || str[i] == '\r') return NULL; } while (g_ascii_isspace (str[i])); if (g_strstr_len (&str[i], 7, "version")) return &str[i + 7]; return NULL; }
void ghb_load_icons() { GHashTableIter iter; gchar *key; GValue *gval; GValue *icons = ghb_resource_get("icons"); ghb_dict_iter_init(&iter, icons); // middle (void*) cast prevents gcc warning "defreferencing type-punned // pointer will break strict-aliasing rules" while (g_hash_table_iter_next( &iter, (gpointer*)(void*)&key, (gpointer*)(void*)&gval)) { gint colorspace, bps, width, height, rowstride; gboolean alpha; ghb_rawdata_t *rd; gint size; GdkPixbuf *pb; char *name = g_strdup(key); char *pos; pos = g_strstr_len(name, -1, "."); if (pos != NULL) *pos = '\0'; colorspace = ghb_value_int(ghb_dict_lookup(gval, "colorspace")); alpha = ghb_value_boolean(ghb_dict_lookup(gval, "alpha")); bps = ghb_value_int(ghb_dict_lookup(gval, "bps")); width = ghb_value_int(ghb_dict_lookup(gval, "width")); height = ghb_value_int(ghb_dict_lookup(gval, "height")); rowstride = ghb_value_int(ghb_dict_lookup(gval, "rowstride")); rd = g_value_get_boxed(ghb_dict_lookup(gval, "data")); pb = gdk_pixbuf_new_from_data( rd->data, colorspace, alpha, bps, width, height, rowstride, NULL, NULL); size = gdk_pixbuf_get_height(pb); gtk_icon_theme_add_builtin_icon(name, size, pb); g_object_unref(pb); g_free(name); } }
static void fb_login_captcha_cb(FacebookAccount *fba, gchar *response, gsize len, gpointer userdata) { const gchar *challenge_start = "challenge : '"; gchar *challenge; gchar *image_url; challenge = g_strstr_len(response, len, challenge_start); if (challenge) { challenge += strlen(challenge_start); challenge = g_strndup(challenge, strchr(challenge, '\'') - challenge); image_url = g_strdup_printf("/image?c=%s", challenge); fb_post_or_get(fba, FB_METHOD_GET | FB_METHOD_SSL, "api-secure.recaptcha.net", image_url, NULL, fb_login_captcha_image_cb, NULL, FALSE); } }
static char* _find_app_id_by_filter(const char* name, const char* keys_str, GKeyFile* filter) { if (filter == NULL) return NULL; g_assert(name != NULL && keys_str != NULL); if (g_key_file_has_group(filter, name)) { gsize size = 0; char** keys = g_key_file_get_keys(filter, name, &size, NULL); for (gsize i=0; i<size; i++) { if (g_strstr_len(keys_str , -1, keys[i])) { char* value = g_key_file_get_string(filter, name, keys[i], NULL); g_strfreev(keys); return value; } } g_strfreev(keys); /*g_debug("find \"%s\" in filter.ini but can't find the really desktop file\n", name);*/ } return NULL; }
/** * as_utils_is_category_id: * @category_name: an XDG category name, e.g. "ProjectManagement" * * Searches the known list of registered XDG category names. * See https://specifications.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry * for a reference. * * Returns: %TRUE if the category name is valid * * Since: 0.9.7 **/ gboolean as_utils_is_category_name (const gchar *category_name) { g_autoptr(GBytes) data = NULL; g_autofree gchar *key = NULL; /* custom spec-extensions are generally valid if prefixed correctly */ if (g_str_has_prefix (category_name, "X-")) return TRUE; /* load the readonly data section and look for the category name */ data = g_resource_lookup_data (as_get_resource (), "/org/freedesktop/appstream/xdg-category-names.txt", G_RESOURCE_LOOKUP_FLAGS_NONE, NULL); if (data == NULL) return FALSE; key = g_strdup_printf ("\n%s\n", category_name); return g_strstr_len (g_bytes_get_data (data, NULL), -1, key) != NULL; }
/* If the PROP_DEVICE_NAME is set, find the mixer related to device; * otherwise we get the default input mixer. */ static gboolean gst_directsound_src_mixer_find (GstDirectSoundSrc * dsoundsrc, MIXERCAPS * mixer_caps) { MMRESULT mmres; guint i, num_mixers; num_mixers = mixerGetNumDevs (); for (i = 0; i < num_mixers; i++) { mmres = mixerOpen (&dsoundsrc->mixer, i, 0L, 0L, MIXER_OBJECTF_MIXER | MIXER_OBJECTF_WAVEIN); if (mmres != MMSYSERR_NOERROR) continue; mmres = mixerGetDevCaps (GPOINTER_TO_UINT (dsoundsrc->mixer), mixer_caps, sizeof (MIXERCAPS)); if (mmres != MMSYSERR_NOERROR) { mixerClose (dsoundsrc->mixer); continue; } /* Get default mixer */ if (dsoundsrc->device_name == NULL) { GST_DEBUG ("Got default input mixer: %s", mixer_caps->szPname); return TRUE; } if (g_strstr_len (dsoundsrc->device_name, -1, mixer_caps->szPname) != NULL) { GST_DEBUG ("Got requested input mixer: %s", mixer_caps->szPname); return TRUE; } /* Wrong mixer */ mixerClose (dsoundsrc->mixer); } GST_DEBUG ("Can't find input mixer"); return FALSE; }
gint gnc_state_drop_sections_for (const gchar *partial_name) { gchar **groups; gint found_count = 0, dropped_count = 0; gsize i, num_groups; GError *error = NULL; if (!state_file) { PWARN ("No pre-existing state found, ignoring drop request"); return 0; } ENTER(""); groups = g_key_file_get_groups (state_file, &num_groups); for (i = 0; i < num_groups; i++) { if (g_strstr_len (groups[i], -1, partial_name)) { DEBUG ("Section \"%s\" matches \"%s\", removing", groups[i], partial_name); found_count++; if (!g_key_file_remove_group (state_file, groups[i], &error)) { PWARN ("Warning: unable to remove section %s.\n %s", groups[i], error->message); g_error_free (error); } else dropped_count++; } } g_strfreev (groups); LEAVE("Found %i sections matching \"%s\", successfully removed %i", found_count, partial_name, dropped_count); return dropped_count; }
static int qio_channel_websock_handshake_read(QIOChannelWebsock *ioc, Error **errp) { char *handshake_end; ssize_t ret; /* Typical HTTP headers from novnc are 512 bytes, so limiting * total header size to 4096 is easily enough. */ size_t want = 4096 - ioc->encinput.offset; buffer_reserve(&ioc->encinput, want); ret = qio_channel_read(ioc->master, (char *)buffer_end(&ioc->encinput), want, errp); if (ret < 0) { return -1; } ioc->encinput.offset += ret; handshake_end = g_strstr_len((char *)ioc->encinput.buffer, ioc->encinput.offset, QIO_CHANNEL_WEBSOCK_HANDSHAKE_END); if (!handshake_end) { if (ioc->encinput.offset >= 4096) { error_setg(errp, "End of headers not found in first 4096 bytes"); return -1; } else { return 0; } } if (qio_channel_websock_handshake_process(ioc, (char *)ioc->encinput.buffer, ioc->encinput.offset, errp) < 0) { return -1; } buffer_advance(&ioc->encinput, handshake_end - (char *)ioc->encinput.buffer + strlen(QIO_CHANNEL_WEBSOCK_HANDSHAKE_END)); return 1; }
/** * pk_iso8601_to_date: (skip) * @iso_date: The ISO8601 date to convert * * Return value: If valid then a new %GDate, else NULL * * Since: 0.5.2 **/ GDate * pk_iso8601_to_date (const gchar *iso_date) { gboolean ret = FALSE; guint retval; guint d = 0; guint m = 0; guint y = 0; GTimeVal time_val; GDate *date = NULL; if (iso_date == NULL || iso_date[0] == '\0') goto out; /* try to parse complete ISO8601 date */ if (g_strstr_len (iso_date, -1, " ") != NULL) ret = g_time_val_from_iso8601 (iso_date, &time_val); if (ret && time_val.tv_sec != 0) { g_debug ("Parsed %s %i", iso_date, ret); date = g_date_new (); g_date_set_time_val (date, &time_val); goto out; } /* g_time_val_from_iso8601() blows goats and won't * accept a valid ISO8601 formatted date without a * time value - try and parse this case */ retval = sscanf (iso_date, "%u-%u-%u", &y, &m, &d); if (retval != 3) goto out; /* check it's valid */ ret = g_date_valid_dmy (d, m, y); if (!ret) goto out; /* create valid object */ date = g_date_new_dmy (d, m, y); out: return date; }
static gboolean size_fits (GlyrQuery * s, gchar ** ref) { gboolean result = FALSE; if (ref != NULL) { gchar * search_ptr = ref[0]; if (search_ptr != NULL) { search_ptr = strchr (search_ptr,'"'); gint ratio = 0; gchar * width_string = get_search_value (search_ptr,"width=\"","\""); gchar * height_string = get_search_value (search_ptr,"height=\"","\""); if (width_string && height_string) { ratio = (strtol (width_string,NULL,10) + strtol (height_string,NULL,10) ) /2; } g_free (width_string); g_free (height_string); gboolean original_size_allowed = TRUE; if (g_strstr_len (ref[0],100,"original") != NULL) { /* Deny extremelly large images by default, except explicitely wanted */ if (! (ratio >= 1000 && s->img_min_size >= 1000 && s->img_max_size == -1) ) { original_size_allowed = FALSE; } } if (size_is_okay (ratio, s->img_min_size, s->img_max_size) == TRUE && original_size_allowed == TRUE) { result = TRUE; } search_ptr = strchr (search_ptr,'>'); } ref[0] = search_ptr + 1; } return result; }
/* Read each component of an rgbe file header. A pointer to the scanlines, * immediately after the header, is cached on success. */ static gboolean rgbe_header_read (rgbe_file *file) { gchar *magic_end; gchar *data; gsize data_size; gboolean success = FALSE; goffset cursor = 0; g_return_val_if_fail (file, FALSE); g_return_val_if_fail (file->file, FALSE); rgbe_header_init (&file->header); /* g_mapped_file_get_contents() returned value is not assured to be * zero-terminated. So we must protect any search and compare calls * with max size to stay in bounds. Hence strstr() is not usable. */ data_size = g_mapped_file_get_length (file->file); data = g_mapped_file_get_contents (file->file); if (! data || strncmp (&data[cursor], RADIANCE_MAGIC, MIN (strlen (RADIANCE_MAGIC), data_size))) goto cleanup; magic_end = g_strstr_len (&data[cursor], data_size, "\n"); if (! magic_end) goto cleanup; cursor += magic_end - data + 1; if (!rgbe_header_read_variables (file, &cursor)) goto cleanup; if (!rgbe_header_read_orientation (file, &cursor)) goto cleanup; file->scanlines = &data[cursor]; success = TRUE; cleanup: return success; }
static void as_node_string_replace_inplace (gchar *text, const gchar *search, gchar replace) { const gchar *start = text; gchar *tmp; gsize len; gsize len_escaped = 0; while ((tmp = g_strstr_len (start, -1, search)) != NULL) { *tmp = replace; len = strlen (tmp); if (len_escaped == 0) len_escaped = strlen (search); memcpy (tmp + 1, tmp + len_escaped, (len - len_escaped) + 1); start = tmp + 1; } }
static void parse_one_option( struct working_parameter_s *pParam, char *pStr, int len ) { char *pEq; pEq = g_strstr_len( pStr, len, "=" ); if (!pEq) { ERROR("Invalid UNIX socket argument format. Must be key=value"); return; } else { char *pK, *pV; pV = pEq+1; pK = pStr; *pEq = '\0'; DEBUG("UNIX socket option found: k=[%s] v=[%s]", pK, pV); if (0==g_ascii_strcasecmp(pK,"mode")) { parse_option_mode( pParam, pV ); } else { ERROR("Unrecongnized UNIX socket option [%s] with value [%s]", pK, pV); } } }
static gchar * find_token_type (const gchar *str, TokenType *token_type) { gchar *ptr = NULL; *token_type = TOKEN_NONE; ptr = g_strstr_len (str, -1, TOKEN_EXEC_FILE_LIST); if (ptr != NULL) { *token_type = TOKEN_PATH_LIST; return ptr; } ptr = g_strstr_len (str, -1, TOKEN_EXEC_URI_LIST); if (ptr != NULL) { *token_type = TOKEN_URI_LIST; return ptr; } ptr = g_strstr_len (str, -1, TOKEN_EXEC_PARENT); if (ptr != NULL) { *token_type = TOKEN_PARENT_PATH; return ptr; } ptr = g_strstr_len (str, -1, TOKEN_EXEC_FILE_NAME); if (ptr != NULL) { *token_type = TOKEN_FILE_DISPLAY_NAME; return ptr; } ptr = g_strstr_len (str, -1, TOKEN_EXEC_PARENT_NAME); if (ptr != NULL) { *token_type = TOKEN_PARENT_DISPLAY_NAME; return ptr; } ptr = g_strstr_len (str, -1, TOKEN_LABEL_FILE_NAME); if (ptr != NULL) { *token_type = TOKEN_FILE_DISPLAY_NAME; return ptr; } ptr = g_strstr_len (str, -1, TOKEN_EXEC_DEVICE); if (ptr != NULL) { *token_type = TOKEN_DEVICE; return ptr; } return NULL; }
void check_alias(gpointer alias) { char *alias_name = _get_real_name(alias); /* add to beans list or common prefix */ char * r = NULL; if (lp->params.s3.delimiter) r = g_strstr_len((!lp->params.s3.prefix) ? alias_name : alias_name + strlen(lp->params.s3.prefix), -1, lp->params.s3.delimiter); if (r) { GRID_DEBUG("Found common prefix : %.*s", ((int)( r - alias_name)) + 1, alias_name); add_prefix(g_strndup(alias_name, r + 1 - alias_name)); } else { _get_cb(obc, alias); } g_free(alias_name); }