static int ftp_parse_entry_mlsd(char *mlsd, AVIODirEntry *next)

{

    char *fact, *value;

    av_dlog(NULL, "%s\n", mlsd);

    while(fact = av_strtok(mlsd, ";", &mlsd)) {

        if (fact[0] == ' ') {

            next->name = av_strdup(&fact[1]);

            continue;

        }

        fact = av_strtok(fact, "=", &value);

        if (!av_strcasecmp(fact, "type")) {

            if (!av_strcasecmp(value, "cdir") || !av_strcasecmp(value, "pdir"))

                return 1;

            if (!av_strcasecmp(value, "dir"))

                next->type = AVIO_ENTRY_DIRECTORY;

            else if (!av_strcasecmp(value, "file"))

                next->type = AVIO_ENTRY_FILE;

            else if (!av_strcasecmp(value, "OS.unix=slink:"))

                next->type = AVIO_ENTRY_SYMBOLIC_LINK;

        } else if (!av_strcasecmp(fact, "modify")) {

            next->modification_timestamp = ftp_parse_date(value);

        } else if (!av_strcasecmp(fact, "UNIX.mode")) {

            next->filemode = strtoumax(value, NULL, 8);

        } else if (!av_strcasecmp(fact, "UNIX.uid") || !av_strcasecmp(fact, "UNIX.owner"))

            next->user_id = strtoumax(value, NULL, 10);

        else if (!av_strcasecmp(fact, "UNIX.gid") || !av_strcasecmp(fact, "UNIX.group"))

            next->group_id = strtoumax(value, NULL, 10);

        else if (!av_strcasecmp(fact, "size") || !av_strcasecmp(fact, "sizd"))

            next->size = strtoll(value, NULL, 10);

    }

    return 0;

}

static int ftp_parse_entry_mlsd(char *mlsd, AVIODirEntry *next)

{

    char *fact, *value;

    av_dlog(NULL, "%s\n", mlsd);

    while(fact = av_strtok(mlsd, ";", &mlsd)) {

        if (fact[0] == ' ') {

            next->name = av_strdup(&fact[1]);

            continue;

        }

        fact = av_strtok(fact, "=", &value);

        if (!av_strcasecmp(fact, "type")) {

            if (!av_strcasecmp(value, "cdir") || !av_strcasecmp(value, "pdir"))

                return 1;

            if (!av_strcasecmp(value, "dir"))

                next->type = AVIO_ENTRY_DIRECTORY;

            else if (!av_strcasecmp(value, "file"))

                next->type = AVIO_ENTRY_FILE;

            else if (!av_strcasecmp(value, "OS.unix=slink:"))

                next->type = AVIO_ENTRY_SYMBOLIC_LINK;

        } else if (!av_strcasecmp(fact, "modify")) {

            next->modification_timestamp = ftp_parse_date(value);

        } else if (!av_strcasecmp(fact, "UNIX.mode")) {

            next->filemode = strtoumax(value, NULL, 8);

        } else if (!av_strcasecmp(fact, "UNIX.uid") || !av_strcasecmp(fact, "UNIX.owner"))

            next->user_id = strtoumax(value, NULL, 10);

        else if (!av_strcasecmp(fact, "UNIX.gid") || !av_strcasecmp(fact, "UNIX.group"))

            next->group_id = strtoumax(value, NULL, 10);

        else if (!av_strcasecmp(fact, "size") || !av_strcasecmp(fact, "sizd"))

            next->size = strtoll(value, NULL, 10);

    }

    return 0;

}

static int FUNC_0(char *VAR_0, AVIODirEntry *VAR_1)

{

    char *VAR_2, *VAR_3;

    av_dlog(NULL, "%s\n", VAR_0);

    while(VAR_2 = av_strtok(VAR_0, ";", &VAR_0)) {

        if (VAR_2[0] == ' ') {

            VAR_1->name = av_strdup(&VAR_2[1]);

            continue;

        }

        VAR_2 = av_strtok(VAR_2, "=", &VAR_3);

        if (!av_strcasecmp(VAR_2, "type")) {

            if (!av_strcasecmp(VAR_3, "cdir") || !av_strcasecmp(VAR_3, "pdir"))

                return 1;

            if (!av_strcasecmp(VAR_3, "dir"))

                VAR_1->type = AVIO_ENTRY_DIRECTORY;

            else if (!av_strcasecmp(VAR_3, "file"))

                VAR_1->type = AVIO_ENTRY_FILE;

            else if (!av_strcasecmp(VAR_3, "OS.unix=slink:"))

                VAR_1->type = AVIO_ENTRY_SYMBOLIC_LINK;

        } else if (!av_strcasecmp(VAR_2, "modify")) {

            VAR_1->modification_timestamp = ftp_parse_date(VAR_3);

        } else if (!av_strcasecmp(VAR_2, "UNIX.mode")) {

            VAR_1->filemode = strtoumax(VAR_3, NULL, 8);

        } else if (!av_strcasecmp(VAR_2, "UNIX.uid") || !av_strcasecmp(VAR_2, "UNIX.owner"))

            VAR_1->user_id = strtoumax(VAR_3, NULL, 10);

        else if (!av_strcasecmp(VAR_2, "UNIX.gid") || !av_strcasecmp(VAR_2, "UNIX.group"))

            VAR_1->group_id = strtoumax(VAR_3, NULL, 10);

        else if (!av_strcasecmp(VAR_2, "size") || !av_strcasecmp(VAR_2, "sizd"))

            VAR_1->size = strtoll(VAR_3, NULL, 10);

    }

    return 0;

}

static int FUNC_0(char *VAR_0, AVIODirEntry *VAR_1)
{ char *VAR_2, *VAR_3; av_dlog(NULL, "%s\n", VAR_0); while(VAR_2 = av_strtok(VAR_0, ";", &VAR_0)) { if (VAR_2[0] == ' ') { VAR_1->name = av_strdup(&VAR_2[1]); continue; } VAR_2 = av_strtok(VAR_2, "=", &VAR_3); if (!av_strcasecmp(VAR_2, "type")) { if (!av_strcasecmp(VAR_3, "cdir") || !av_strcasecmp(VAR_3, "pdir"))
return 1; if (!av_strcasecmp(VAR_3, "dir"))
VAR_1->type = AVIO_ENTRY_DIRECTORY; else if (!av_strcasecmp(VAR_3, "file"))
VAR_1->type = AVIO_ENTRY_FILE; else if (!av_strcasecmp(VAR_3, "OS.unix=slink:"))
VAR_1->type = AVIO_ENTRY_SYMBOLIC_LINK; } else if (!av_strcasecmp(VAR_2, "modify")) { VAR_1->modification_timestamp = ftp_parse_date(VAR_3); } else if (!av_strcasecmp(VAR_2, "UNIX.mode")) { VAR_1->filemode = strtoumax(VAR_3, NULL, 8); } else if (!av_strcasecmp(VAR_2, "UNIX.uid") || !av_strcasecmp(VAR_2, "UNIX.owner")) VAR_1->user_id = strtoumax(VAR_3, NULL, 10); else if (!av_strcasecmp(VAR_2, "UNIX.gid") || !av_strcasecmp(VAR_2, "UNIX.group"))
VAR_1->group_id = strtoumax(VAR_3, NULL, 10); else if (!av_strcasecmp(VAR_2, "size") || !av_strcasecmp(VAR_2, "sizd"))
VAR_1->size = strtoll(VAR_3, NULL, 10); } return 0; }