source: rtems/c/src/exec/libcsupport/src/telldir.c @ c7016198

4.104.114.84.95
Last change on this file since c7016198 was 19b74f31, checked in by Joel Sherrill <joel.sherrill@…>, on 11/02/99 at 16:25:05

Check for NULL being passed in.

  • Property mode set to 100644
File size: 804 bytes
Line 
1/*
2 *  telldir() - XXX
3 *
4 *  COPYRIGHT (c) 1989-1998.
5 *  On-Line Applications Research Corporation (OAR).
6 *  Copyright assigned to U.S. Government, 1994.
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 */
13
14#include <sys/param.h>
15#include <assert.h>
16#include <dirent.h>
17#include <stdlib.h>
18#include <unistd.h>
19#include <errno.h>
20
21#include "libio_.h"
22
23
24long telldir(
25  DIR *dirp
26)
27{
28  rtems_libio_t  *iop;
29
30  if ( !dirp )
31    set_errno_and_return_minus_one( EBADF );
32
33  /*
34   *  Get the file control block structure associated with the
35   *  file descriptor
36   */
37
38  iop = rtems_libio_iop( dirp->dd_fd );
39
40  if (iop == NULL)
41     assert(0);
42
43  return (long)( iop->offset );
44}
Note: See TracBrowser for help on using the repository browser.