#ifdef TELLDIR_TAKES_CONST_DIR long telldir(const DIR *dir) #else long telldir(DIR *dir) #endif { struct dir_buf *d = (struct dir_buf *)dir; if (d->ofs >= d->nbytes) { d->seekpos = lseek(d->fd, 0, SEEK_CUR); d->ofs = 0; d->nbytes = 0; } /* this relies on seekpos always being a multiple of DIR_BUF_SIZE. Is that always true on BSD systems? */ if (d->seekpos & (DIR_BUF_SIZE-1)) { abort(); } return d->seekpos + d->ofs; } (gdb) print *d $15 = {fd = 24, nbytes = 56, ofs = 40, seekpos = , buf = "\003\000\000\000\f\000\004\001.\000 2\003\000\000\000\f\000\004\002..\000 \004\000\000\000\020\000\004\005Video\0003\n\005\000\000\000\020\000\004\005Audio\00063", '\0' , "g\002(\000=\032\001\000\001\000\000\000��\000\000��\000\000Media\000", '�' }