* this function is a POSIX compliant version, which will return current * location in directory stream. * * @param d the directory stream pointer. * * @return the current location in directory stream. */
| 806 | * @return the current location in directory stream. |
| 807 | */ |
| 808 | long telldir(DIR *d) |
| 809 | { |
| 810 | struct dfs_file *fd; |
| 811 | long result; |
| 812 | |
| 813 | fd = fd_get(d->fd); |
| 814 | if (fd == NULL) |
| 815 | { |
| 816 | rt_set_errno(-EBADF); |
| 817 | |
| 818 | return 0; |
| 819 | } |
| 820 | |
| 821 | result = fd->pos - d->num + d->cur; |
| 822 | |
| 823 | return result; |
| 824 | } |
| 825 | RTM_EXPORT(telldir); |
| 826 | |
| 827 | /** |
no test coverage detected