Mercurial > gftp.yaz
comparison lib/fsplib/fsplib.c @ 667:6b6fbcf76d00
2005-1-18 Brian Masney <masneyb@gftp.org>
* lib/fsplib/fsplib.[ch] - updated files from FSPLIB 0.3
author | masneyb |
---|---|
date | Wed, 19 Jan 2005 02:05:56 +0000 |
parents | be9663e0be00 |
children | 81172373727f |
comparison
equal
deleted
inserted
replaced
666:8ff1c1647b95 | 667:6b6fbcf76d00 |
---|---|
1 /* | 1 /* |
2 This file is part of fsplib - FSP protocol stack implemented in C | 2 This file is part of fsplib - FSP protocol stack implemented in C |
3 language. See http://fsp.sourceforge.net for more information. | 3 language. See http://fsp.sourceforge.net for more information. |
4 | 4 |
5 Copyright (c) 2003-2004 by Radim HSN Kolar (hsn@netmag.cz) | 5 Copyright (c) 2003-2005 by Radim HSN Kolar (hsn@netmag.cz) |
6 | 6 |
7 You may copy or modify this file in any manner you wish, provided | 7 You may copy or modify this file in any manner you wish, provided |
8 that this notice is always included, and that you hold the author | 8 that this notice is always included, and that you hold the author |
9 harmless for any loss or damage resulting from the installation or | 9 harmless for any loss or damage resulting from the installation or |
10 use of this software. | 10 use of this software. |
249 s->seq = (s-> seq + 0x08) & 0xfff8; | 249 s->seq = (s-> seq + 0x08) & 0xfff8; |
250 t_delay = 0; | 250 t_delay = 0; |
251 /* compute initial delay here */ | 251 /* compute initial delay here */ |
252 /* we are using hardcoded value for now */ | 252 /* we are using hardcoded value for now */ |
253 f_delay = 1340; | 253 f_delay = 1340; |
254 l_delay = 0; | |
254 for(;;retry++) | 255 for(;;retry++) |
255 { | 256 { |
256 if(t_delay >= s->timeout) | 257 if(t_delay >= s->timeout) |
257 { | 258 { |
258 client_set_key((FSP_LOCK *)s->lock,p->key); | 259 client_set_key((FSP_LOCK *)s->lock,p->key); |
576 | 577 |
577 int fsp_readdir_r(FSP_DIR *dir,struct dirent *entry, struct dirent **result) | 578 int fsp_readdir_r(FSP_DIR *dir,struct dirent *entry, struct dirent **result) |
578 { | 579 { |
579 FSP_RDENTRY fentry,*fresult; | 580 FSP_RDENTRY fentry,*fresult; |
580 int rc; | 581 int rc; |
582 char *c; | |
581 | 583 |
582 if (dir == NULL || entry == NULL || *result == NULL) | 584 if (dir == NULL || entry == NULL || *result == NULL) |
583 return -EINVAL; | 585 return -EINVAL; |
584 if (dir->dirpos<0 || dir->dirpos % 4) | 586 if (dir->dirpos<0 || dir->dirpos % 4) |
585 return -ESPIPE; | 587 return -ESPIPE; |
593 | 595 |
594 if (fentry.type == FSP_RDTYPE_DIR ) | 596 if (fentry.type == FSP_RDTYPE_DIR ) |
595 entry->d_type=DT_DIR; | 597 entry->d_type=DT_DIR; |
596 else | 598 else |
597 entry->d_type=DT_REG; | 599 entry->d_type=DT_REG; |
600 | |
601 /* remove symlink destination */ | |
602 c=strchr(fentry.name,'\n'); | |
603 if (c) | |
604 { | |
605 *c='\0'; | |
606 rc=fentry.namlen-strlen(fentry.name); | |
607 fentry.reclen-=rc; | |
608 fentry.namlen-=rc; | |
609 } | |
610 | |
598 entry->d_fileno = 10; | 611 entry->d_fileno = 10; |
599 entry->d_reclen = fentry.reclen; | 612 entry->d_reclen = fentry.reclen; |
600 strncpy(entry->d_name,fentry.name,MAXNAMLEN); | 613 strncpy(entry->d_name,fentry.name,MAXNAMLEN); |
601 | 614 |
602 if (fentry.namlen > MAXNAMLEN) | 615 if (fentry.namlen > MAXNAMLEN) |
603 { | 616 { |
604 entry->d_name[MAXNAMLEN + 1 ] = '\0'; | 617 entry->d_name[MAXNAMLEN + 1 ] = '\0'; |
605 #ifdef HAVE_NAMLEN | 618 #ifdef HAVE_NAMLEN |
606 entry->d_namlen = MAXNAMLEN; | 619 entry->d_namlen = MAXNAMLEN; |
607 } else | 620 } else |
608 { | 621 { |
609 entry->d_namlen = fentry.namlen; | 622 entry->d_namlen = fentry.namlen; |
610 #endif | 623 #endif |