src/libmetha/worker.c
static M_CODE
__lm_worker_default_crawler_init(uehandle_t *h, int argc, const char **argv)
{
    int x;
    char *s;
    char *url;

    for (x=0; x<argc; x++) {
        url = s = (char *)argv[x];
        /** 
         * The only thing we need to take care of here is making sure that the 
         * given URL begins with a protocol. The lm_url_set() function, which 
         * will be used for these strings later, does NOT accept URLs wihout 
         * protocol information. Hence, if the given URL here does not begin 
         * with a protocol, we must guess it. If we fail to guess it, we shouldnt
         * even bother trying to add it.
         **/

        while (isalnum(*s))
            s++;
        if (*s != ':') {
            /* this URL does not have a specified protocol, we assume it will be ftp
             * if the URL begins with, for example, "ftp.kernel.org". If it begins with 
             * a slash or a dot, then we assume it is a local URL ("file" protocol).
             * For all other cases, assume HTTP. */
            if (!(s = lm_strtourl(url)))
                return M_OUT_OF_MEM;

            ue_add_initial(h, s, strlen(s));
            free(s);
        } else
            ue_add_initial(h, url, strlen(url));
    }

    return M_OK;
}
/** 
 * Default crawler init function. This function will build urls
 * from the given arguments and run ue_add_initial() on
 * each.
 **/
Default crawler init function. This function will build urls
from the given arguments and run ue_add_initial() on
each.
Default crawler init function . This function will build urls from the given arguments and run ue_add_initial () on each .
static M_CODE
__lm_worker_default_crawler_init(uehandle_t *h, int argc, const char **argv)
{
    int x;
    char *s;
    char *url;
    for (x=0; x<argc; x++) {
        url = s = (char *)argv[x];
        while (isalnum(*s))
            s++;
        if (*s != ':') {
            if (!(s = lm_strtourl(url)))
                return M_OUT_OF_MEM;
            ue_add_initial(h, s, strlen(s));
            free(s);
        } else
            ue_add_initial(h, url, strlen(url));
    }
    return M_OK;
}
static M_CODE __lm_worker_default_crawler_init ( uehandle_t * h , int argc , const char * * argv ) { int x ; char * s ; char * url ; for ( x = 0 ; x < argc ; x ++ ) { url = s = ( char * ) argv [ x ] ; while ( isalnum ( * s ) ) s ++ ; if ( * s != ' ' ) { if ( ! ( s = lm_strtourl ( url ) ) ) return M_OUT_OF_MEM ; ue_add_initial ( h , s , strlen ( s ) ) ; free ( s ) ; } else ue_add_initial ( h , url , strlen ( url ) ) ; } return M_OK ; }
Default crawler init function.
Default crawler init function .
/** 
         * The only thing we need to take care of here is making sure that the 
         * given URL begins with a protocol. The lm_url_set() function, which 
         * will be used for these strings later, does NOT accept URLs wihout 
         * protocol information. Hence, if the given URL here does not begin 
         * with a protocol, we must guess it. If we fail to guess it, we shouldnt
         * even bother trying to add it.
         **/ /* this URL does not have a specified protocol, we assume it will be ftp
             * if the URL begins with, for example, "ftp.kernel.org". If it begins with 
             * a slash or a dot, then we assume it is a local URL ("file" protocol).
             * For all other cases, assume HTTP. */