Lines Matching refs:parser
190 struct ftp_parselist_data *parser = *parserp; in Curl_ftp_parselist_data_free() local
191 if(parser) in Curl_ftp_parselist_data_free()
192 Curl_fileinfo_cleanup(parser->file_data); in Curl_ftp_parselist_data_free()
193 free(parser); in Curl_ftp_parselist_data_free()
278 struct ftp_parselist_data *parser = ftpwc->parser; in ftp_pl_insert_finfo() local
284 finfo->filename = str + parser->offsets.filename; in ftp_pl_insert_finfo()
285 finfo->strings.group = parser->offsets.group ? in ftp_pl_insert_finfo()
286 str + parser->offsets.group : NULL; in ftp_pl_insert_finfo()
287 finfo->strings.perm = parser->offsets.perm ? in ftp_pl_insert_finfo()
288 str + parser->offsets.perm : NULL; in ftp_pl_insert_finfo()
289 finfo->strings.target = parser->offsets.symlink_target ? in ftp_pl_insert_finfo()
290 str + parser->offsets.symlink_target : NULL; in ftp_pl_insert_finfo()
291 finfo->strings.time = str + parser->offsets.time; in ftp_pl_insert_finfo()
292 finfo->strings.user = parser->offsets.user ? in ftp_pl_insert_finfo()
293 str + parser->offsets.user : NULL; in ftp_pl_insert_finfo()
322 ftpwc->parser->file_data = NULL; in ftp_pl_insert_finfo()
332 struct ftp_parselist_data *parser = ftpwc->parser; in Curl_ftp_parselist() local
339 if(parser->error) { /* error in previous call */ in Curl_ftp_parselist()
349 if(parser->os_type == OS_TYPE_UNKNOWN && bufflen > 0) { in Curl_ftp_parselist()
351 parser->os_type = (buffer[0] >= '0' && buffer[0] <= '9') ? in Curl_ftp_parselist()
358 if(!parser->file_data) { /* tmp file data is not allocated yet */ in Curl_ftp_parselist()
359 parser->file_data = Curl_fileinfo_alloc(); in Curl_ftp_parselist()
360 if(!parser->file_data) { in Curl_ftp_parselist()
361 parser->error = CURLE_OUT_OF_MEMORY; in Curl_ftp_parselist()
364 parser->file_data->info.b_data = malloc(FTP_BUFFER_ALLOCSIZE); in Curl_ftp_parselist()
365 if(!parser->file_data->info.b_data) { in Curl_ftp_parselist()
366 parser->error = CURLE_OUT_OF_MEMORY; in Curl_ftp_parselist()
369 parser->file_data->info.b_size = FTP_BUFFER_ALLOCSIZE; in Curl_ftp_parselist()
370 parser->item_offset = 0; in Curl_ftp_parselist()
371 parser->item_length = 0; in Curl_ftp_parselist()
374 infop = parser->file_data; in Curl_ftp_parselist()
387 Curl_fileinfo_cleanup(parser->file_data); in Curl_ftp_parselist()
388 parser->file_data = NULL; in Curl_ftp_parselist()
389 parser->error = CURLE_OUT_OF_MEMORY; in Curl_ftp_parselist()
394 switch(parser->os_type) { in Curl_ftp_parselist()
396 switch(parser->state.UNIX.main) { in Curl_ftp_parselist()
398 switch(parser->state.UNIX.sub.total_dirsize) { in Curl_ftp_parselist()
401 parser->state.UNIX.sub.total_dirsize = PL_UNIX_TOTALSIZE_READING; in Curl_ftp_parselist()
402 parser->item_length++; in Curl_ftp_parselist()
405 parser->state.UNIX.main = PL_UNIX_FILETYPE; in Curl_ftp_parselist()
412 parser->item_length++; in Curl_ftp_parselist()
414 parser->item_length--; in Curl_ftp_parselist()
418 finfo->b_data[parser->item_length - 1] = 0; in Curl_ftp_parselist()
428 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
431 parser->state.UNIX.main = PL_UNIX_FILETYPE; in Curl_ftp_parselist()
435 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
469 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
472 parser->state.UNIX.main = PL_UNIX_PERMISSION; in Curl_ftp_parselist()
473 parser->item_length = 0; in Curl_ftp_parselist()
474 parser->item_offset = 1; in Curl_ftp_parselist()
477 parser->item_length++; in Curl_ftp_parselist()
478 if(parser->item_length <= 9) { in Curl_ftp_parselist()
480 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
484 else if(parser->item_length == 10) { in Curl_ftp_parselist()
487 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
491 perm = ftp_pl_get_permission(finfo->b_data + parser->item_offset); in Curl_ftp_parselist()
493 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
496 parser->file_data->info.flags |= CURLFINFOFLAG_KNOWN_PERM; in Curl_ftp_parselist()
497 parser->file_data->info.perm = perm; in Curl_ftp_parselist()
498 parser->offsets.perm = parser->item_offset; in Curl_ftp_parselist()
500 parser->item_length = 0; in Curl_ftp_parselist()
501 parser->state.UNIX.main = PL_UNIX_HLINKS; in Curl_ftp_parselist()
502 parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; in Curl_ftp_parselist()
506 switch(parser->state.UNIX.sub.hlinks) { in Curl_ftp_parselist()
510 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
511 parser->item_length = 1; in Curl_ftp_parselist()
512 parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; in Curl_ftp_parselist()
515 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
521 parser->item_length ++; in Curl_ftp_parselist()
525 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
526 hlinks = strtol(finfo->b_data + parser->item_offset, &p, 10); in Curl_ftp_parselist()
528 parser->file_data->info.flags |= CURLFINFOFLAG_KNOWN_HLINKCOUNT; in Curl_ftp_parselist()
529 parser->file_data->info.hardlinks = hlinks; in Curl_ftp_parselist()
531 parser->item_length = 0; in Curl_ftp_parselist()
532 parser->item_offset = 0; in Curl_ftp_parselist()
533 parser->state.UNIX.main = PL_UNIX_USER; in Curl_ftp_parselist()
534 parser->state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; in Curl_ftp_parselist()
537 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
544 switch(parser->state.UNIX.sub.user) { in Curl_ftp_parselist()
547 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
548 parser->item_length = 1; in Curl_ftp_parselist()
549 parser->state.UNIX.sub.user = PL_UNIX_USER_PARSING; in Curl_ftp_parselist()
553 parser->item_length++; in Curl_ftp_parselist()
555 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
556 parser->offsets.user = parser->item_offset; in Curl_ftp_parselist()
557 parser->state.UNIX.main = PL_UNIX_GROUP; in Curl_ftp_parselist()
558 parser->state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; in Curl_ftp_parselist()
559 parser->item_offset = 0; in Curl_ftp_parselist()
560 parser->item_length = 0; in Curl_ftp_parselist()
566 switch(parser->state.UNIX.sub.group) { in Curl_ftp_parselist()
569 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
570 parser->item_length = 1; in Curl_ftp_parselist()
571 parser->state.UNIX.sub.group = PL_UNIX_GROUP_NAME; in Curl_ftp_parselist()
575 parser->item_length++; in Curl_ftp_parselist()
577 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
578 parser->offsets.group = parser->item_offset; in Curl_ftp_parselist()
579 parser->state.UNIX.main = PL_UNIX_SIZE; in Curl_ftp_parselist()
580 parser->state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; in Curl_ftp_parselist()
581 parser->item_offset = 0; in Curl_ftp_parselist()
582 parser->item_length = 0; in Curl_ftp_parselist()
588 switch(parser->state.UNIX.sub.size) { in Curl_ftp_parselist()
592 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
593 parser->item_length = 1; in Curl_ftp_parselist()
594 parser->state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; in Curl_ftp_parselist()
597 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
603 parser->item_length++; in Curl_ftp_parselist()
607 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
608 if(!curlx_strtoofft(finfo->b_data + parser->item_offset, in Curl_ftp_parselist()
612 parser->file_data->info.flags |= CURLFINFOFLAG_KNOWN_SIZE; in Curl_ftp_parselist()
613 parser->file_data->info.size = fsize; in Curl_ftp_parselist()
615 parser->item_length = 0; in Curl_ftp_parselist()
616 parser->item_offset = 0; in Curl_ftp_parselist()
617 parser->state.UNIX.main = PL_UNIX_TIME; in Curl_ftp_parselist()
618 parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; in Curl_ftp_parselist()
622 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
629 switch(parser->state.UNIX.sub.time) { in Curl_ftp_parselist()
633 parser->item_offset = finfo->b_used -1; in Curl_ftp_parselist()
634 parser->item_length = 1; in Curl_ftp_parselist()
635 parser->state.UNIX.sub.time = PL_UNIX_TIME_PART1; in Curl_ftp_parselist()
638 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
644 parser->item_length++; in Curl_ftp_parselist()
646 parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; in Curl_ftp_parselist()
649 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
654 parser->item_length++; in Curl_ftp_parselist()
657 parser->state.UNIX.sub.time = PL_UNIX_TIME_PART2; in Curl_ftp_parselist()
660 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
666 parser->item_length++; in Curl_ftp_parselist()
668 parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; in Curl_ftp_parselist()
671 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
676 parser->item_length++; in Curl_ftp_parselist()
679 parser->state.UNIX.sub.time = PL_UNIX_TIME_PART3; in Curl_ftp_parselist()
682 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
688 parser->item_length++; in Curl_ftp_parselist()
690 finfo->b_data[parser->item_offset + parser->item_length -1] = 0; in Curl_ftp_parselist()
691 parser->offsets.time = parser->item_offset; in Curl_ftp_parselist()
698 parser->state.UNIX.main = PL_UNIX_SYMLINK; in Curl_ftp_parselist()
699 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; in Curl_ftp_parselist()
702 parser->state.UNIX.main = PL_UNIX_FILENAME; in Curl_ftp_parselist()
703 parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_PRESPACE; in Curl_ftp_parselist()
707 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
714 switch(parser->state.UNIX.sub.filename) { in Curl_ftp_parselist()
717 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
718 parser->item_length = 1; in Curl_ftp_parselist()
719 parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; in Curl_ftp_parselist()
723 parser->item_length++; in Curl_ftp_parselist()
725 parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_WINDOWSEOL; in Curl_ftp_parselist()
728 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
729 parser->offsets.filename = parser->item_offset; in Curl_ftp_parselist()
730 parser->state.UNIX.main = PL_UNIX_FILETYPE; in Curl_ftp_parselist()
733 parser->error = result; in Curl_ftp_parselist()
740 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
741 parser->offsets.filename = parser->item_offset; in Curl_ftp_parselist()
742 parser->state.UNIX.main = PL_UNIX_FILETYPE; in Curl_ftp_parselist()
745 parser->error = result; in Curl_ftp_parselist()
750 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
757 switch(parser->state.UNIX.sub.symlink) { in Curl_ftp_parselist()
760 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
761 parser->item_length = 1; in Curl_ftp_parselist()
762 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; in Curl_ftp_parselist()
766 parser->item_length++; in Curl_ftp_parselist()
768 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET1; in Curl_ftp_parselist()
771 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
776 parser->item_length++; in Curl_ftp_parselist()
778 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET2; in Curl_ftp_parselist()
781 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
785 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; in Curl_ftp_parselist()
789 parser->item_length++; in Curl_ftp_parselist()
791 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET3; in Curl_ftp_parselist()
794 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
798 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; in Curl_ftp_parselist()
802 parser->item_length++; in Curl_ftp_parselist()
804 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET4; in Curl_ftp_parselist()
806 finfo->b_data[parser->item_offset + parser->item_length - 4] = 0; in Curl_ftp_parselist()
807 parser->offsets.filename = parser->item_offset; in Curl_ftp_parselist()
808 parser->item_length = 0; in Curl_ftp_parselist()
809 parser->item_offset = 0; in Curl_ftp_parselist()
812 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
816 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; in Curl_ftp_parselist()
821 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; in Curl_ftp_parselist()
822 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
823 parser->item_length = 1; in Curl_ftp_parselist()
826 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
831 parser->item_length++; in Curl_ftp_parselist()
833 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_WINDOWSEOL; in Curl_ftp_parselist()
836 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
837 parser->offsets.symlink_target = parser->item_offset; in Curl_ftp_parselist()
840 parser->error = result; in Curl_ftp_parselist()
843 parser->state.UNIX.main = PL_UNIX_FILETYPE; in Curl_ftp_parselist()
848 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
849 parser->offsets.symlink_target = parser->item_offset; in Curl_ftp_parselist()
852 parser->error = result; in Curl_ftp_parselist()
855 parser->state.UNIX.main = PL_UNIX_FILETYPE; in Curl_ftp_parselist()
858 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
867 switch(parser->state.NT.main) { in Curl_ftp_parselist()
869 parser->item_length++; in Curl_ftp_parselist()
870 if(parser->item_length < 9) { in Curl_ftp_parselist()
872 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
876 else if(parser->item_length == 9) { in Curl_ftp_parselist()
878 parser->state.NT.main = PL_WINNT_TIME; in Curl_ftp_parselist()
879 parser->state.NT.sub.time = PL_WINNT_TIME_PRESPACE; in Curl_ftp_parselist()
882 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
887 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
892 parser->item_length++; in Curl_ftp_parselist()
893 switch(parser->state.NT.sub.time) { in Curl_ftp_parselist()
896 parser->state.NT.sub.time = PL_WINNT_TIME_TIME; in Curl_ftp_parselist()
901 parser->offsets.time = parser->item_offset; in Curl_ftp_parselist()
902 finfo->b_data[parser->item_offset + parser->item_length -1] = 0; in Curl_ftp_parselist()
903 parser->state.NT.main = PL_WINNT_DIRORSIZE; in Curl_ftp_parselist()
904 parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; in Curl_ftp_parselist()
905 parser->item_length = 0; in Curl_ftp_parselist()
908 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
915 switch(parser->state.NT.sub.dirorsize) { in Curl_ftp_parselist()
921 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
922 parser->item_length = 1; in Curl_ftp_parselist()
923 parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_CONTENT; in Curl_ftp_parselist()
927 parser->item_length ++; in Curl_ftp_parselist()
929 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
930 if(strcmp("<DIR>", finfo->b_data + parser->item_offset) == 0) { in Curl_ftp_parselist()
937 parser->item_offset, in Curl_ftp_parselist()
939 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
943 parser->file_data->info.filetype = CURLFILETYPE_FILE; in Curl_ftp_parselist()
946 parser->file_data->info.flags |= CURLFINFOFLAG_KNOWN_SIZE; in Curl_ftp_parselist()
947 parser->item_length = 0; in Curl_ftp_parselist()
948 parser->state.NT.main = PL_WINNT_FILENAME; in Curl_ftp_parselist()
949 parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; in Curl_ftp_parselist()
955 switch(parser->state.NT.sub.filename) { in Curl_ftp_parselist()
958 parser->item_offset = finfo->b_used -1; in Curl_ftp_parselist()
959 parser->item_length = 1; in Curl_ftp_parselist()
960 parser->state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; in Curl_ftp_parselist()
964 parser->item_length++; in Curl_ftp_parselist()
966 parser->state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; in Curl_ftp_parselist()
970 parser->offsets.filename = parser->item_offset; in Curl_ftp_parselist()
972 parser->offsets.filename = parser->item_offset; in Curl_ftp_parselist()
975 parser->error = result; in Curl_ftp_parselist()
978 parser->state.NT.main = PL_WINNT_DATE; in Curl_ftp_parselist()
979 parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; in Curl_ftp_parselist()
984 parser->offsets.filename = parser->item_offset; in Curl_ftp_parselist()
987 parser->error = result; in Curl_ftp_parselist()
990 parser->state.NT.main = PL_WINNT_DATE; in Curl_ftp_parselist()
991 parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; in Curl_ftp_parselist()
994 parser->error = CURLE_FTP_BAD_FILE_LIST; in Curl_ftp_parselist()
1014 if(parser->file_data) { in Curl_ftp_parselist()
1015 Curl_fileinfo_cleanup(parser->file_data); in Curl_ftp_parselist()
1016 parser->file_data = NULL; in Curl_ftp_parselist()