prism2.device: fix strict aliasing issue detected with gcc 4.8.3
[AROS.git] / compiler / posixc / seekdir.c
blob902f322b5df6b7b402bfd8cfbba3fdeaea69e8b6
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <dos/dos.h>
7 #include <proto/dos.h>
8 #include "__fdesc.h"
9 #include "__dirdesc.h"
11 /*****************************************************************************
13 NAME */
15 #include <dirent.h>
17 void seekdir(
19 /* SYNOPSIS */
20 DIR *dir,
21 off_t offset)
23 /* FUNCTION
25 INPUTS
27 RESULT
29 NOTES
31 EXAMPLE
33 BUGS
35 SEE ALSO
37 INTERNALS
39 ******************************************************************************/
41 int pos = offset;
42 fdesc *desc = __getfdesc(dir->fd);
43 if (!desc)
44 return;
46 if (!Examine(desc->fcb->handle, dir->priv))
47 return;
49 if (offset > 1)
50 for
52 pos = 2;
53 (pos <= offset) && ExNext(desc->fcb->handle, dir->priv);
54 pos++
56 dir->pos = pos;