source: rtems/cpukit/libcsupport/src/seekdir.c @ 98b785e

4.115
Last change on this file since 98b785e was 1749cef, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/05/08 at 06:44:40

Compile contents conditionally.

  • Property mode set to 100644
File size: 771 bytes
Line 
1/*
2 *  seekdir() - POSIX 1003.1b - XXX
3 *
4 *  COPYRIGHT (c) 1989-1999.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 */
12
13#if HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#ifndef HAVE_SEEKDIR
18
19#include <sys/param.h>
20#include <assert.h>
21#include <dirent.h>
22#include <stdio.h>
23#include <unistd.h>
24#include <errno.h>
25
26void seekdir(
27   DIR  *dirp,
28   long  loc
29)
30{
31  off_t status;
32
33  if ( !dirp )
34    return;
35
36  status = lseek( dirp->dd_fd, loc, SEEK_SET );
37
38  /*
39   * This is not a nice way to error out, but we have no choice here.
40   */
41
42  if ( status == -1 )
43    return;
44
45  dirp->dd_loc = 0;
46}
47
48#endif
Note: See TracBrowser for help on using the repository browser.