Home | History | Annotate | Download | only in lib

Lines Matching refs:parser

271   struct ftp_parselist_data *parser = tmpdata->parser;
272 if(parser->file_data)
273 Curl_fileinfo_dtor(NULL, parser->file_data);
274 parser->file_data = NULL;
275 parser->error = err;
278 static bool ftp_pl_gettime(struct ftp_parselist_data *parser, char *string)
280 (void)parser;
286 * parser->file_data->flags
305 struct ftp_parselist_data *parser = tmpdata->parser;
310 finfo->filename = str + parser->offsets.filename;
311 finfo->strings.group = parser->offsets.group ?
312 str + parser->offsets.group : NULL;
313 finfo->strings.perm = parser->offsets.perm ?
314 str + parser->offsets.perm : NULL;
315 finfo->strings.target = parser->offsets.symlink_target ?
316 str + parser->offsets.symlink_target : NULL;
317 finfo->strings.time = str + parser->offsets.time;
318 finfo->strings.user = parser->offsets.user ?
319 str + parser->offsets.user : NULL;
342 tmpdata->parser->file_data = NULL;
350 tmpdata->parser->file_data = NULL;
360 struct ftp_parselist_data *parser = tmpdata->parser;
365 if(parser->error) { /* error in previous call */
375 if(parser->os_type == OS_TYPE_UNKNOWN && bufflen > 0) {
377 parser->os_type = (buffer[0] >= '0' && buffer[0] <= '9') ?
384 if(!parser->file_data) { /* tmp file data is not allocated yet */
385 parser->file_data = Curl_fileinfo_alloc();
386 if(!parser->file_data) {
387 parser->error = CURLE_OUT_OF_MEMORY;
390 parser->file_data->b_data = malloc(FTP_BUFFER_ALLOCSIZE);
391 if(!parser->file_data->b_data) {
395 parser->file_data->b_size = FTP_BUFFER_ALLOCSIZE;
396 parser->item_offset = 0;
397 parser->item_length = 0;
400 finfo = parser->file_data;
412 Curl_fileinfo_dtor(NULL, parser->file_data);
413 parser->file_data = NULL;
414 parser->error = CURLE_OUT_OF_MEMORY;
420 switch (parser->os_type) {
422 switch (parser->state.UNIX.main) {
424 switch(parser->state.UNIX.sub.total_dirsize) {
427 parser->state.UNIX.sub.total_dirsize = PL_UNIX_TOTALSIZE_READING;
428 parser->item_length++;
431 parser->state.UNIX.main = PL_UNIX_FILETYPE;
438 parser->item_length++;
440 parser->item_length--;
444 finfo->b_data[parser->item_length - 1] = 0;
458 parser->state.UNIX.main = PL_UNIX_FILETYPE;
500 parser->state.UNIX.main = PL_UNIX_PERMISSION;
501 parser->item_length = 0;
502 parser->item_offset = 1;
505 parser->item_length++;
506 if(parser->item_length <= 9) {
512 else if(parser->item_length == 10) {
519 perm = ftp_pl_get_permission(finfo->b_data + parser->item_offset);
524 parser->file_data->flags |= CURLFINFOFLAG_KNOWN_PERM;
525 parser->file_data->perm = perm;
526 parser->offsets.perm = parser->item_offset;
528 parser->item_length = 0;
529 parser->state.UNIX.main = PL_UNIX_HLINKS;
530 parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE;
534 switch(parser->state.UNIX.sub.hlinks) {
538 parser->item_offset = finfo->b_used - 1;
539 parser->item_length = 1;
540 parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER;
549 parser->item_length ++;
553 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;
554 hlinks = strtol(finfo->b_data + parser->item_offset, &p, 10);
556 parser->file_data->flags |= CURLFINFOFLAG_KNOWN_HLINKCOUNT;
557 parser->file_data->hardlinks = hlinks;
559 parser->item_length = 0;
560 parser->item_offset = 0;
561 parser->state.UNIX.main = PL_UNIX_USER;
562 parser->state.UNIX.sub.user = PL_UNIX_USER_PRESPACE;
572 switch(parser->state.UNIX.sub.user) {
575 parser->item_offset = finfo->b_used - 1;
576 parser->item_length = 1;
577 parser->state.UNIX.sub.user = PL_UNIX_USER_PARSING;
581 parser->item_length++;
583 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;
584 parser->offsets.user = parser->item_offset;
585 parser->state.UNIX.main = PL_UNIX_GROUP;
586 parser->state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE;
587 parser->item_offset = 0;
588 parser->item_length = 0;
594 switch(parser->state.UNIX.sub.group) {
597 parser->item_offset = finfo->b_used - 1;
598 parser->item_length = 1;
599 parser->state.UNIX.sub.group = PL_UNIX_GROUP_NAME;
603 parser->item_length++;
605 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;
606 parser->offsets.group = parser->item_offset;
607 parser->state.UNIX.main = PL_UNIX_SIZE;
608 parser->state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE;
609 parser->item_offset = 0;
610 parser->item_length = 0;
616 switch(parser->state.UNIX.sub.size) {
620 parser->item_offset = finfo->b_used - 1;
621 parser->item_length = 1;
622 parser->state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER;
631 parser->item_length++;
635 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;
636 fsize = curlx_strtoofft(finfo->b_data+parser->item_offset, &p, 10);
639 parser->file_data->flags |= CURLFINFOFLAG_KNOWN_SIZE;
640 parser->file_data->size = fsize;
642 parser->item_length = 0;
643 parser->item_offset = 0;
644 parser->state.UNIX.main = PL_UNIX_TIME;
645 parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART1;
655 switch(parser->state.UNIX.sub.time) {
659 parser->item_offset = finfo->b_used -1;
660 parser->item_length = 1;
661 parser->state.UNIX.sub.time = PL_UNIX_TIME_PART1;
670 parser->item_length++;
672 parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART2;
680 parser->item_length++;
683 parser->state.UNIX.sub.time = PL_UNIX_TIME_PART2;
692 parser->item_length++;
694 parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART3;
702 parser->item_length++;
705 parser->state.UNIX.sub.time = PL_UNIX_TIME_PART3;
714 parser->item_length++;
716 finfo->b_data[parser->item_offset + parser->item_length -1] = 0;
717 parser->offsets.time = parser->item_offset;
718 if(ftp_pl_gettime(parser, finfo->b_data + parser->item_offset)) {
719 parser->file_data->flags |= CURLFINFOFLAG_KNOWN_TIME;
722 parser->state.UNIX.main = PL_UNIX_SYMLINK;
723 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE;
726 parser->state.UNIX.main = PL_UNIX_FILENAME;
727 parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_PRESPACE;
738 switch(parser->state.UNIX.sub.filename) {
741 parser->item_offset = finfo->b_used - 1;
742 parser->item_length = 1;
743 parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME;
747 parser->item_length++;
749 parser->item_length--;
750 parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_WINDOWSEOL;
753 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;
754 parser->offsets.filename = parser->item_offset;
755 parser->state.UNIX.main = PL_UNIX_FILETYPE;
765 finfo->b_data[parser->item_offset + parser->item_length] = 0;
766 parser->offsets.filename = parser->item_offset;
767 parser->state.UNIX.main = PL_UNIX_FILETYPE;
782 switch(parser->state.UNIX.sub.symlink) {
785 parser->item_offset = finfo->b_used - 1;
786 parser->item_length = 1;
787 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME;
791 parser->item_length++;
793 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET1;
801 parser->item_length++;
803 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET2;
810 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME;
814 parser->item_length++;
816 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET3;
823 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME;
827 parser->item_length++;
829 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET4;
831 finfo->b_data[parser->item_offset + parser->item_length - 4] = 0;
832 parser->offsets.filename = parser->item_offset;
833 parser->item_length = 0;
834 parser->item_offset = 0;
841 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME;
846 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET;
847 parser->item_offset = finfo->b_used - 1;
848 parser->item_length = 1;
856 parser->item_length ++;
858 parser->item_length --;
859 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_WINDOWSEOL;
862 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;
863 parser->offsets.symlink_target = parser->item_offset;
869 parser->state.UNIX.main = PL_UNIX_FILETYPE;
874 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;
875 parser->offsets.symlink_target = parser->item_offset;
881 parser->state.UNIX.main = PL_UNIX_FILETYPE;
893 switch(parser->state.NT.main) {
895 parser->item_length++;
896 if(parser->item_length < 9) {
902 else if(parser->item_length == 9) {
904 parser->state.NT.main = PL_WINNT_TIME;
905 parser->state.NT.sub.time = PL_WINNT_TIME_PRESPACE;
918 parser->item_length++;
919 switch(parser->state.NT.sub.time) {
922 parser->state.NT.sub.time = PL_WINNT_TIME_TIME;
927 parser->offsets.time = parser->item_offset;
928 finfo->b_data[parser->item_offset + parser->item_length -1] = 0;
929 parser->state.NT.main = PL_WINNT_DIRORSIZE;
930 parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_PRESPACE;
931 parser->item_length = 0;
941 switch(parser->state.NT.sub.dirorsize) {
947 parser->item_offset = finfo->b_used - 1;
948 parser->item_length = 1;
949 parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_CONTENT;
953 parser->item_length ++;
955 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0;
956 if(strcmp("<DIR>", finfo->b_data + parser->item_offset) == 0) {
963 parser->item_offset,
979 parser->file_data->filetype = CURLFILETYPE_FILE;
982 parser->file_data->flags |= CURLFINFOFLAG_KNOWN_SIZE;
983 parser->item_length = 0;
984 parser->state.NT.main = PL_WINNT_FILENAME;
985 parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE;
991 switch (parser->state.NT.sub.filename) {
994 parser->item_offset = finfo->b_used -1;
995 parser->item_length = 1;
996 parser->state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT;
1000 parser->item_length++;
1002 parser->state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL;
1006 parser->offsets.filename = parser->item_offset;
1008 parser->offsets.filename = parser->item_offset;
1014 parser->state.NT.main = PL_WINNT_DATE;
1015 parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE;
1020 parser->offsets.filename = parser->item_offset;
1026 parser->state.NT.main = PL_WINNT_DATE;
1027 parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE;