-static const struct
-{
- const char *psz_shortcut;
- const char *psz_name;
-} pp_shortcuts[] = {
- { "luacli", "cli" },
- { "luarc", "cli" },
-#ifndef WIN32
- { "cli", "cli" },
- { "rc", "cli" },
-#endif
- { "luahotkeys", "hotkeys" },
- /* { "hotkeys", "hotkeys" }, */
- { "luatelnet", "telnet" },
- { "telnet", "telnet" },
- { "luahttp", "http" },
- { "http", "http" },
- { NULL, NULL } };
-
-static const char *WordInList( const char *psz_list, const char *psz_word )
-{
- for( ;; )
- {
- const char *end = strchr( psz_list, ',' );
- if( end == NULL )
- break;
-
- if( !strncmp( psz_list, psz_word, end - psz_list ) )
- return psz_list;
- psz_list = end + 1;
- }
- return !strcmp( psz_list, psz_word ) ? psz_list : NULL;
-}
-
-static char *GetModuleName( intf_thread_t *p_intf )
-{
- int i;
- const char *psz_intf;
- /*if( *p_intf->psz_intf == '$' )
- psz_intf = var_GetString( p_intf, p_intf->psz_intf+1 );
- else*/
- psz_intf = p_intf->psz_intf;
-
- int i_candidate = -1;
- const char *psz_candidate = NULL;
- for( i = 0; pp_shortcuts[i].psz_name; i++ )
- {
- const char *psz_match;
- if( ( psz_match = WordInList( psz_intf, pp_shortcuts[i].psz_shortcut ) ) )
- {
- if( !psz_candidate || psz_match < psz_candidate )
- {
- psz_candidate = psz_match;
- i_candidate = i;
- }
- }
- }
-
- if( i_candidate >= 0 )
- return strdup( pp_shortcuts[i_candidate].psz_name );
-
- return var_CreateGetString( p_intf, "lua-intf" );
-}
-