Branch Coverage

xs/ftpparse.c
Criterion Covered Total %
branch 210 552 38.0


line true false branch
29 0 0 for (i=0;i
0 0 for (i=0;i
0 0 for (i=0;i
20 4 for (i=0;i
30 0 0 if (s[i]!=t[i]) return 0;
0 0 if (s[i]!=t[i]) return 0;
0 0 if (s[i]!=t[i]) return 0;
20 0 if (s[i]!=t[i]) return 0;
36 0 0 if (*year<70) *year+=2000;
0 0 if (*year<70) *year+=2000;
0 1 if (*year<70) *year+=2000;
0 1 if (*year<70) *year+=2000;
0 8 if (*year<70) *year+=2000;
0 8 if (*year<70) *year+=2000;
37 0 0 else if (*year<100) *year+=1900;
0 0 else if (*year<100) *year+=1900;
0 1 else if (*year<100) *year+=1900;
0 1 else if (*year<100) *year+=1900;
8 0 else if (*year<100) *year+=1900;
0 8 else if (*year<100) *year+=1900;
38 0 0 else if (*year<1970) return 0;
0 0 else if (*year<1970) return 0;
1 0 else if (*year<1970) return 0;
1 0 else if (*year<1970) return 0;
0 0 else if (*year<1970) return 0;
8 0 else if (*year<1970) return 0;
48 0 0 for (i=0;i
0 0 for (i=0;i
0 0 for (i=0;i
0 0 for (i=0;i
0 0 for (i=0;i
0 0 for (i=0;i
72 39 for (i=0;i
115 1 for (i=0;i
3 0 for (i=0;i
4 1 for (i=0;i
16 8 for (i=0;i
16 8 for (i=0;i
16 8 for (i=0;i
138 0 for (i=0;i
101 37 for (i=0;i
2 1 for (i=0;i
0 0 for (i=0;i
49 0 0 if (p[i]>'9' || p[i]<'0')
0 0 if (p[i]>'9' || p[i]<'0')
0 0 if (p[i]>'9' || p[i]<'0')
0 0 if (p[i]>'9' || p[i]<'0')
0 0 if (p[i]>'9' || p[i]<'0')
0 0 if (p[i]>'9' || p[i]<'0')
72 0 if (p[i]>'9' || p[i]<'0')
78 37 if (p[i]>'9' || p[i]<'0')
2 1 if (p[i]>'9' || p[i]<'0')
4 0 if (p[i]>'9' || p[i]<'0')
16 0 if (p[i]>'9' || p[i]<'0')
16 0 if (p[i]>'9' || p[i]<'0')
16 0 if (p[i]>'9' || p[i]<'0')
92 46 if (p[i]>'9' || p[i]<'0')
92 9 if (p[i]>'9' || p[i]<'0')
2 0 if (p[i]>'9' || p[i]<'0')
0 0 if (p[i]>'9' || p[i]<'0')
62 0 0 for (i=0;i
0 0 for (i=0;i
0 0 for (i=0;i
38 1 for (i=0;i
139 38 for (i=0;i
20 4 for (i=0;i
0 0 for (i=0;i
63 0 0 if (p[i]>'9' || p[i]<'0')
0 0 if (p[i]>'9' || p[i]<'0')
0 0 if (p[i]>'9' || p[i]<'0')
0 38 if (p[i]>'9' || p[i]<'0')
139 0 if (p[i]>'9' || p[i]<'0')
16 4 if (p[i]>'9' || p[i]<'0')
0 0 if (p[i]>'9' || p[i]<'0')
86 2 35 if (!this_year) {
92 98 2 if (tai_less(&n,&yearstart)) break;
97 0 37 if (tai_less(&now,&x))
112 0 0 if (l<14) return 0;
114 0 0 for (i = 0; i < l; i++) {
116 0 0 if (p[i]<'0' || p[i]>'9') return 0;
168 72 5 if (len < 3) return -1;
172 500 33 for (i = 0;i < 12;++i)
173 500 0 if (CMP(0) && CMP(1) && CMP(2))
41 459 if (CMP(0) && CMP(1) && CMP(2))
3 38 if (CMP(0) && CMP(1) && CMP(2))
2 1 if (CMP(0) && CMP(1) && CMP(2))
2 38 if (CMP(0) && CMP(1) && CMP(2))
1 1 if (CMP(0) && CMP(1) && CMP(2))
184 0 0 if (buf[0]!='+') return 0;
187 0 0 for (pos = 1;pos < len;pos++) {
188 0 0 if ('\t'==buf[pos]) {
191 0 0 if (!f->namelen) return 0; /* huh? */
195 0 0 if (',' != buf[pos])
201 0 0 if (pos-start-1==0) return 0;
202 0 0 if (get_uint64(buf+start+1,pos-start-1,&f->size)
207 0 0 if (pos-start-1==0) return 0;
208 0 0 if (get_ulong(buf+start+1,pos-start-1,&ul)!=pos-start-1) return 0;
214 0 0 if (pos-start-1==0) return 0;
241 46 0 if (len==x) return 0;
242 46 0 if (!x || x>2) return 0;
244 46 0 if (':' != buf[x]) return 0;
245 46 0 if (len==++x) return 0;
248 46 0 if (y!=2) return 0;
251 9 37 if (x!=len && ':' == buf[x]) {
1 8 if (x!=len && ':' == buf[x]) {
252 1 0 if (len==++x) return 0;
255 1 0 if (y!=2) return 0;
261 8 38 if (x!=len && ('A' == buf[x] || 'P' == buf[x])) {
8 0 if (x!=len && ('A' == buf[x] || 'P' == buf[x])) {
262 0 8 if ('P' == buf [x])
265 8 0 if (len==x) return 0;
266 8 0 if ('M' != buf[x]) return 0;
268 8 0 if (len==x) return 0;
270 8 38 if (len==x || buf[x]==' ') return x;
8 0 if (len==x || buf[x]==' ') return x;
296 264 0 for (state=start=pos=0;pos
299 8 16 if ('-'==buf[pos]) {
301 8 0 if (pos==start) return 0;
302 8 0 if (get_ulong(buf+start,pos-start,&mon)!=pos-start) return 0;
307 8 16 if ('-'==buf[pos]) {
309 8 0 if (pos==start) return 0;
310 8 0 if (get_ulong(buf+start,pos-start,&day)!=pos-start) return 0;
315 8 16 if (' '==buf[pos]) {
317 8 0 if (pos-start!=2 && pos-start!=4) return 0;
318 8 0 if (get_ulong(buf+start,pos-start,&year)!=pos-start) return 0;
320 8 0 if (!fix_year(&year)) return 0;
324 8 8 if (' ' == buf[pos]) continue;
330 8 0 if (!x) return 0;
332 8 0 if (pos==len) return 0;
336 88 8 if (' ' == buf[pos]) continue;
341 8 36 if (' ' == buf[pos]) {
342 4 4 if (get_uint64(buf+start,pos-start,&size)!=pos-start) {
343 4 0 if (pos-start < 5
344 4 0 || !my_byte_equal(buf+start,5,""))
357 36 8 if (' ' == buf[pos])
358 36 0 if (--maxspaces)
369 4 4 if (flagtryretr) {
373 8 0 if (!fix_year(&year)) return 0;
389 2448 46 for (pos=start=0;pos
390 1576 872 if (inword) {
391 315 1261 if (' ' == buf[pos]) {
394 1 314 if (count==MAXWORDS) {
400 361 511 if (' ' != buf[pos]) {
407 46 1 if (inword) {
429 1 8 if (count<4) return 0;
435 1 0 if (!x || x>2 || day>31) return 0;
1 0 if (!x || x>2 || day>31) return 0;
436 1 0 if (q[x] != '-') return 0;
440 1 0 if (-1==mon) return 0;
441 1 0 if (q[3]!='-') return 0;
443 1 0 if (m<5) return 0;
446 1 0 if (!x || q[x]!=' ') return 0;
1 0 if (!x || q[x]!=' ') return 0;
447 1 0 if (!fix_year(&year)) return 0;
450 1 0 if (x!=l[3]) return 0;
455 11 0 for (x=0;x
456 10 1 if (p[0][x]==';')
458 1 0 if (x>4)
459 1 0 if (p[0][x-4]=='.'
460 1 0 && p[0][x-3]=='D'
461 0 1 && p[0][x-2]=='I'
462 0 0 && p[0][x-1]=='R') {
466 1 0 if (!f->flagtrycwd)
471 0 1 if (f->name[0]=='[') {
474 0 0 for (y=1;ynamelen;y++)
475 0 0 if (f->name[y]==']')
477 0 0 if (y!=f->namelen) y++; /* skip ] */
478 0 0 if (y!=f->namelen) {
549 0 39 if (l[1]==6 && my_byte_equal(p[1],l[1],"folder"))
0 0 if (l[1]==6 && my_byte_equal(p[1],l[1],"folder"))
553 1 38 if (x==l[i]) may_have_size=1;
556 76 1 while (i
558 38 38 if (-1==mon) {
561 38 0 if (x==l[i]) may_have_size=1;
564 38 38 if (-1!=mon) break;
566 39 0 if (i==count) return 0;
569 38 1 if (!x) return 0;
570 38 0 if (p[i][x]!=' ') return 0;
571 38 0 if (++i==count) return 0;
574 38 0 if (!x) return 0;
575 37 1 if (p[i][x]==':') {
577 37 0 if (x!=l[i]) return 0;
584 0 1 if (i+2
586 0 0 if (x!=l[i+1]) {
592 1 0 if (!fix_year(&year)) return 0;
594 38 0 if (++i==count) return 0;
602 38 0 if (p[0][1]!=' ') {
603 0 38 while (f->name[-2]==' ') {
608 38 0 if (may_have_size) {
618 1 37 if ('l'==*buf) {
620 6 0 for (j=1;jnamelen-4;j++) /* 1, -4: no empty names, please */
621 1 5 if (f->name[j]==' '
622 1 0 && f->name[j+1]=='-'
623 1 0 && f->name[j+2]=='>'
624 1 0 && f->name[j+3]==' ') {
650 0 8 if (count<4) return 0;
652 0 0 if (x!=l[3]) return 0;
656 0 0 if (x!=2 || p[2][x]!='-') return 0;
0 0 if (x!=2 || p[2][x]!='-') return 0;
659 0 0 if (x!=5 || p[2][x]!='-') return 0;
0 0 if (x!=5 || p[2][x]!='-') return 0;
662 0 0 if ((x!=8 && x!=10) || p[2][x]!=' ') return 0;
0 0 if ((x!=8 && x!=10) || p[2][x]!=' ') return 0;
663 0 0 if (!fix_year(&year)) return 0;
664 0 0 if (my_byte_equal(p[1],5,""))
668 0 0 if (!x || p[1][x]!=' ') return 0;
0 0 if (!x || p[1][x]!=' ') return 0;
674 0 0 if (!dir)
678 0 0 if (dir) f->flagtrycwd=1;
705 0 0 if (count<4) return 0;
708 0 0 if (!x || p[0][x]!=' ') return 0;
0 0 if (!x || p[0][x]!=' ') return 0;
710 0 0 for (i=1; i
712 0 0 if (!x) continue;
713 0 0 if (x!=2 || p[i][x]!='-') return 0;
0 0 if (x!=2 || p[i][x]!='-') return 0;
717 0 0 if (x!=5 || p[i][x]!='-') return 0;
0 0 if (x!=5 || p[i][x]!='-') return 0;
720 0 0 if (x!=8 || p[i][x]!=' ') return 0;
0 0 if (x!=8 || p[i][x]!=' ') return 0;
721 0 0 if (!fix_year(&year)) return 0;
724 0 0 if (i>1)
725 0 0 if (my_byte_equal(p[i-1],3,"DIR"))
729 0 0 if (i==count) return 0;
731 0 0 if (x!=l[i]) return 0;
733 0 0 if (i==count) return 0;
737 0 0 if (dir) {
781 0 0 if (is_mlst)
782 0 0 if (ll>1) {
786 0 0 if (ll<2) /* empty facts, space, one-byte-filename */
789 0 0 for (i=0; i
791 0 0 if (x[i]==' ')
793 0 0 while (i+j
0 0 while (i+j
0 0 while (i+j
0 0 while (i+j
795 0 0 if (i+j==ll)
797 0 0 if (x[i+j]==' ')
799 0 0 if (x[i+j]==';')
802 0 0 while (i+j+k
0 0 while (i+j+k
0 0 while (i+j+k
804 0 0 if (i+j+k==ll)
808 0 0 if (ISFACT ("size")) {
0 0 if (ISFACT ("size")) {
811 0 0 } else if (ISFACT ("modify")) {
0 0 } else if (ISFACT ("modify")) {
814 0 0 } else if (ISFACT ("type")) {
0 0 } else if (ISFACT ("type")) {
815 0 0 if (k==5 && case_startb (x + i + j + 1, 4, "file"))
0 0 if (k==5 && case_startb (x + i + j + 1, 4, "file"))
817 0 0 else if (case_startb (x + i + j + 1, 3, "dir")) /* "current" */
819 0 0 else if (case_startb (x + i + j + 1, 4, "pdir")) /* "parent" */
821 0 0 else if (case_startb (x + i + j + 1, 4, "cdir"))
827 0 0 } else if (ISFACT ("unique")) {
0 0 } else if (ISFACT ("unique")) {
832 0 0 if (x[i]==' ') {
837 0 0 if (ll==i) return 0;
839 0 0 if (ll==i) return 0;
848 0 0 if (id) {
867 55 4 if (len < 2) /* an empty name in EPLF, with no info, could be 2 chars */
873 0 0 if (parse_eplf(fp,buf,len))
878 0 8 if (parse_msdos(fp,buf,len)) return 1;
884 39 8 switch(*buf) {
887 1 38 if (parse_unix(fp,buf,len,p,l,count)) return 1;
891 0 9 if (*buf==' ') {
892 0 0 switch(p[0][0]) {
895 0 0 if (parse_os2(fp,p,l,count)) return 1;
900 8 1 if (parse_multinet(fp,p,l,count)) return 1;
901 8 0 if (parse_supertcp(fp,p,l,count)) return 1;
909 47 12 if (!x) return x;
910 0 47 if (eat_leading_spaces && fp->format!=FTPPARSE_FORMAT_EPLF
0 0 if (eat_leading_spaces && fp->format!=FTPPARSE_FORMAT_EPLF
911 0 0 && fp->format!=FTPPARSE_FORMAT_MLSX)
912 0 0 while (fp->namelen > 1 && fp->name[0]==' ') {
0 0 while (fp->namelen > 1 && fp->name[0]==' ') {