Lines Matching refs:parser
270 struct ftp_parselist_data *parser = tmpdata->parser; in PL_ERROR() local
271 if(parser->file_data) in PL_ERROR()
272 Curl_fileinfo_dtor(NULL, parser->file_data); in PL_ERROR()
273 parser->file_data = NULL; in PL_ERROR()
274 parser->error = err; in PL_ERROR()
284 struct ftp_parselist_data *parser = tmpdata->parser; in ftp_pl_insert_finfo() local
289 finfo->filename = str + parser->offsets.filename; in ftp_pl_insert_finfo()
290 finfo->strings.group = parser->offsets.group ? in ftp_pl_insert_finfo()
291 str + parser->offsets.group : NULL; in ftp_pl_insert_finfo()
292 finfo->strings.perm = parser->offsets.perm ? in ftp_pl_insert_finfo()
293 str + parser->offsets.perm : NULL; in ftp_pl_insert_finfo()
294 finfo->strings.target = parser->offsets.symlink_target ? in ftp_pl_insert_finfo()
295 str + parser->offsets.symlink_target : NULL; in ftp_pl_insert_finfo()
296 finfo->strings.time = str + parser->offsets.time; in ftp_pl_insert_finfo()
297 finfo->strings.user = parser->offsets.user ? in ftp_pl_insert_finfo()
298 str + parser->offsets.user : NULL; in ftp_pl_insert_finfo()
321 tmpdata->parser->file_data = NULL; in ftp_pl_insert_finfo()
329 tmpdata->parser->file_data = NULL; in ftp_pl_insert_finfo()
339 struct ftp_parselist_data *parser = tmpdata->parser; in Curl_ftp_parselist() local
344 if(parser->error) { /* error in previous call */ in Curl_ftp_parselist()
354 if(parser->os_type == OS_TYPE_UNKNOWN && bufflen > 0) { in Curl_ftp_parselist()
356 parser->os_type = (buffer[0] >= '0' && buffer[0] <= '9') ? in Curl_ftp_parselist()
363 if(!parser->file_data) { /* tmp file data is not allocated yet */ in Curl_ftp_parselist()
364 parser->file_data = Curl_fileinfo_alloc(); in Curl_ftp_parselist()
365 if(!parser->file_data) { in Curl_ftp_parselist()
366 parser->error = CURLE_OUT_OF_MEMORY; in Curl_ftp_parselist()
369 parser->file_data->b_data = malloc(FTP_BUFFER_ALLOCSIZE); in Curl_ftp_parselist()
370 if(!parser->file_data->b_data) { in Curl_ftp_parselist()
374 parser->file_data->b_size = FTP_BUFFER_ALLOCSIZE; in Curl_ftp_parselist()
375 parser->item_offset = 0; in Curl_ftp_parselist()
376 parser->item_length = 0; in Curl_ftp_parselist()
379 finfo = parser->file_data; in Curl_ftp_parselist()
391 Curl_fileinfo_dtor(NULL, parser->file_data); in Curl_ftp_parselist()
392 parser->file_data = NULL; in Curl_ftp_parselist()
393 parser->error = CURLE_OUT_OF_MEMORY; in Curl_ftp_parselist()
399 switch (parser->os_type) { in Curl_ftp_parselist()
401 switch (parser->state.UNIX.main) { in Curl_ftp_parselist()
403 switch(parser->state.UNIX.sub.total_dirsize) { in Curl_ftp_parselist()
406 parser->state.UNIX.sub.total_dirsize = PL_UNIX_TOTALSIZE_READING; in Curl_ftp_parselist()
407 parser->item_length++; in Curl_ftp_parselist()
410 parser->state.UNIX.main = PL_UNIX_FILETYPE; in Curl_ftp_parselist()
417 parser->item_length++; in Curl_ftp_parselist()
419 parser->item_length--; in Curl_ftp_parselist()
423 finfo->b_data[parser->item_length - 1] = 0; in Curl_ftp_parselist()
437 parser->state.UNIX.main = PL_UNIX_FILETYPE; in Curl_ftp_parselist()
479 parser->state.UNIX.main = PL_UNIX_PERMISSION; in Curl_ftp_parselist()
480 parser->item_length = 0; in Curl_ftp_parselist()
481 parser->item_offset = 1; in Curl_ftp_parselist()
484 parser->item_length++; in Curl_ftp_parselist()
485 if(parser->item_length <= 9) { in Curl_ftp_parselist()
491 else if(parser->item_length == 10) { in Curl_ftp_parselist()
498 perm = ftp_pl_get_permission(finfo->b_data + parser->item_offset); in Curl_ftp_parselist()
503 parser->file_data->flags |= CURLFINFOFLAG_KNOWN_PERM; in Curl_ftp_parselist()
504 parser->file_data->perm = perm; in Curl_ftp_parselist()
505 parser->offsets.perm = parser->item_offset; in Curl_ftp_parselist()
507 parser->item_length = 0; in Curl_ftp_parselist()
508 parser->state.UNIX.main = PL_UNIX_HLINKS; in Curl_ftp_parselist()
509 parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; in Curl_ftp_parselist()
513 switch(parser->state.UNIX.sub.hlinks) { in Curl_ftp_parselist()
517 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
518 parser->item_length = 1; in Curl_ftp_parselist()
519 parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; in Curl_ftp_parselist()
528 parser->item_length ++; in Curl_ftp_parselist()
532 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
533 hlinks = strtol(finfo->b_data + parser->item_offset, &p, 10); in Curl_ftp_parselist()
535 parser->file_data->flags |= CURLFINFOFLAG_KNOWN_HLINKCOUNT; in Curl_ftp_parselist()
536 parser->file_data->hardlinks = hlinks; in Curl_ftp_parselist()
538 parser->item_length = 0; in Curl_ftp_parselist()
539 parser->item_offset = 0; in Curl_ftp_parselist()
540 parser->state.UNIX.main = PL_UNIX_USER; in Curl_ftp_parselist()
541 parser->state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; in Curl_ftp_parselist()
551 switch(parser->state.UNIX.sub.user) { in Curl_ftp_parselist()
554 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
555 parser->item_length = 1; in Curl_ftp_parselist()
556 parser->state.UNIX.sub.user = PL_UNIX_USER_PARSING; in Curl_ftp_parselist()
560 parser->item_length++; in Curl_ftp_parselist()
562 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
563 parser->offsets.user = parser->item_offset; in Curl_ftp_parselist()
564 parser->state.UNIX.main = PL_UNIX_GROUP; in Curl_ftp_parselist()
565 parser->state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; in Curl_ftp_parselist()
566 parser->item_offset = 0; in Curl_ftp_parselist()
567 parser->item_length = 0; in Curl_ftp_parselist()
573 switch(parser->state.UNIX.sub.group) { in Curl_ftp_parselist()
576 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
577 parser->item_length = 1; in Curl_ftp_parselist()
578 parser->state.UNIX.sub.group = PL_UNIX_GROUP_NAME; in Curl_ftp_parselist()
582 parser->item_length++; in Curl_ftp_parselist()
584 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
585 parser->offsets.group = parser->item_offset; in Curl_ftp_parselist()
586 parser->state.UNIX.main = PL_UNIX_SIZE; in Curl_ftp_parselist()
587 parser->state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; in Curl_ftp_parselist()
588 parser->item_offset = 0; in Curl_ftp_parselist()
589 parser->item_length = 0; in Curl_ftp_parselist()
595 switch(parser->state.UNIX.sub.size) { in Curl_ftp_parselist()
599 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
600 parser->item_length = 1; in Curl_ftp_parselist()
601 parser->state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; in Curl_ftp_parselist()
610 parser->item_length++; in Curl_ftp_parselist()
614 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
615 fsize = curlx_strtoofft(finfo->b_data+parser->item_offset, &p, 10); in Curl_ftp_parselist()
618 parser->file_data->flags |= CURLFINFOFLAG_KNOWN_SIZE; in Curl_ftp_parselist()
619 parser->file_data->size = fsize; in Curl_ftp_parselist()
621 parser->item_length = 0; in Curl_ftp_parselist()
622 parser->item_offset = 0; in Curl_ftp_parselist()
623 parser->state.UNIX.main = PL_UNIX_TIME; in Curl_ftp_parselist()
624 parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; in Curl_ftp_parselist()
634 switch(parser->state.UNIX.sub.time) { in Curl_ftp_parselist()
638 parser->item_offset = finfo->b_used -1; in Curl_ftp_parselist()
639 parser->item_length = 1; in Curl_ftp_parselist()
640 parser->state.UNIX.sub.time = PL_UNIX_TIME_PART1; in Curl_ftp_parselist()
649 parser->item_length++; in Curl_ftp_parselist()
651 parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; in Curl_ftp_parselist()
659 parser->item_length++; in Curl_ftp_parselist()
662 parser->state.UNIX.sub.time = PL_UNIX_TIME_PART2; in Curl_ftp_parselist()
671 parser->item_length++; in Curl_ftp_parselist()
673 parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; in Curl_ftp_parselist()
681 parser->item_length++; in Curl_ftp_parselist()
684 parser->state.UNIX.sub.time = PL_UNIX_TIME_PART3; in Curl_ftp_parselist()
693 parser->item_length++; in Curl_ftp_parselist()
695 finfo->b_data[parser->item_offset + parser->item_length -1] = 0; in Curl_ftp_parselist()
696 parser->offsets.time = parser->item_offset; in Curl_ftp_parselist()
703 parser->state.UNIX.main = PL_UNIX_SYMLINK; in Curl_ftp_parselist()
704 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; in Curl_ftp_parselist()
707 parser->state.UNIX.main = PL_UNIX_FILENAME; in Curl_ftp_parselist()
708 parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_PRESPACE; in Curl_ftp_parselist()
719 switch(parser->state.UNIX.sub.filename) { in Curl_ftp_parselist()
722 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
723 parser->item_length = 1; in Curl_ftp_parselist()
724 parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; in Curl_ftp_parselist()
728 parser->item_length++; in Curl_ftp_parselist()
730 parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_WINDOWSEOL; in Curl_ftp_parselist()
733 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
734 parser->offsets.filename = parser->item_offset; in Curl_ftp_parselist()
735 parser->state.UNIX.main = PL_UNIX_FILETYPE; in Curl_ftp_parselist()
745 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
746 parser->offsets.filename = parser->item_offset; in Curl_ftp_parselist()
747 parser->state.UNIX.main = PL_UNIX_FILETYPE; in Curl_ftp_parselist()
762 switch(parser->state.UNIX.sub.symlink) { in Curl_ftp_parselist()
765 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
766 parser->item_length = 1; in Curl_ftp_parselist()
767 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; in Curl_ftp_parselist()
771 parser->item_length++; in Curl_ftp_parselist()
773 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET1; in Curl_ftp_parselist()
781 parser->item_length++; in Curl_ftp_parselist()
783 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET2; in Curl_ftp_parselist()
790 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; in Curl_ftp_parselist()
794 parser->item_length++; in Curl_ftp_parselist()
796 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET3; in Curl_ftp_parselist()
803 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; in Curl_ftp_parselist()
807 parser->item_length++; in Curl_ftp_parselist()
809 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET4; in Curl_ftp_parselist()
811 finfo->b_data[parser->item_offset + parser->item_length - 4] = 0; in Curl_ftp_parselist()
812 parser->offsets.filename = parser->item_offset; in Curl_ftp_parselist()
813 parser->item_length = 0; in Curl_ftp_parselist()
814 parser->item_offset = 0; in Curl_ftp_parselist()
821 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; in Curl_ftp_parselist()
826 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; in Curl_ftp_parselist()
827 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
828 parser->item_length = 1; in Curl_ftp_parselist()
836 parser->item_length++; in Curl_ftp_parselist()
838 parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_WINDOWSEOL; in Curl_ftp_parselist()
841 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
842 parser->offsets.symlink_target = parser->item_offset; in Curl_ftp_parselist()
848 parser->state.UNIX.main = PL_UNIX_FILETYPE; in Curl_ftp_parselist()
853 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
854 parser->offsets.symlink_target = parser->item_offset; in Curl_ftp_parselist()
860 parser->state.UNIX.main = PL_UNIX_FILETYPE; in Curl_ftp_parselist()
872 switch(parser->state.NT.main) { in Curl_ftp_parselist()
874 parser->item_length++; in Curl_ftp_parselist()
875 if(parser->item_length < 9) { in Curl_ftp_parselist()
881 else if(parser->item_length == 9) { in Curl_ftp_parselist()
883 parser->state.NT.main = PL_WINNT_TIME; in Curl_ftp_parselist()
884 parser->state.NT.sub.time = PL_WINNT_TIME_PRESPACE; in Curl_ftp_parselist()
897 parser->item_length++; in Curl_ftp_parselist()
898 switch(parser->state.NT.sub.time) { in Curl_ftp_parselist()
901 parser->state.NT.sub.time = PL_WINNT_TIME_TIME; in Curl_ftp_parselist()
906 parser->offsets.time = parser->item_offset; in Curl_ftp_parselist()
907 finfo->b_data[parser->item_offset + parser->item_length -1] = 0; in Curl_ftp_parselist()
908 parser->state.NT.main = PL_WINNT_DIRORSIZE; in Curl_ftp_parselist()
909 parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; in Curl_ftp_parselist()
910 parser->item_length = 0; in Curl_ftp_parselist()
920 switch(parser->state.NT.sub.dirorsize) { in Curl_ftp_parselist()
926 parser->item_offset = finfo->b_used - 1; in Curl_ftp_parselist()
927 parser->item_length = 1; in Curl_ftp_parselist()
928 parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_CONTENT; in Curl_ftp_parselist()
932 parser->item_length ++; in Curl_ftp_parselist()
934 finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; in Curl_ftp_parselist()
935 if(strcmp("<DIR>", finfo->b_data + parser->item_offset) == 0) { in Curl_ftp_parselist()
942 parser->item_offset, in Curl_ftp_parselist()
958 parser->file_data->filetype = CURLFILETYPE_FILE; in Curl_ftp_parselist()
961 parser->file_data->flags |= CURLFINFOFLAG_KNOWN_SIZE; in Curl_ftp_parselist()
962 parser->item_length = 0; in Curl_ftp_parselist()
963 parser->state.NT.main = PL_WINNT_FILENAME; in Curl_ftp_parselist()
964 parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; in Curl_ftp_parselist()
970 switch (parser->state.NT.sub.filename) { in Curl_ftp_parselist()
973 parser->item_offset = finfo->b_used -1; in Curl_ftp_parselist()
974 parser->item_length = 1; in Curl_ftp_parselist()
975 parser->state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; in Curl_ftp_parselist()
979 parser->item_length++; in Curl_ftp_parselist()
981 parser->state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; in Curl_ftp_parselist()
985 parser->offsets.filename = parser->item_offset; in Curl_ftp_parselist()
987 parser->offsets.filename = parser->item_offset; in Curl_ftp_parselist()
993 parser->state.NT.main = PL_WINNT_DATE; in Curl_ftp_parselist()
994 parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; in Curl_ftp_parselist()
999 parser->offsets.filename = parser->item_offset; in Curl_ftp_parselist()
1005 parser->state.NT.main = PL_WINNT_DATE; in Curl_ftp_parselist()
1006 parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; in Curl_ftp_parselist()