rewinddir.c revision 90039
1210299Sed/*-
2193323Sed * Copyright (c) 1990, 1993
3193323Sed *	The Regents of the University of California.  All rights reserved.
4193323Sed *
5193323Sed * Redistribution and use in source and binary forms, with or without
6193323Sed * modification, are permitted provided that the following conditions
7193323Sed * are met:
8193323Sed * 1. Redistributions of source code must retain the above copyright
9193323Sed *    notice, this list of conditions and the following disclaimer.
10193323Sed * 2. Redistributions in binary form must reproduce the above copyright
11193323Sed *    notice, this list of conditions and the following disclaimer in the
12193323Sed *    documentation and/or other materials provided with the distribution.
13193323Sed * 3. All advertising materials mentioning features or use of this software
14193323Sed *    must display the following acknowledgement:
15193323Sed *	This product includes software developed by the University of
16193323Sed *	California, Berkeley and its contributors.
17210299Sed * 4. Neither the name of the University nor the names of its contributors
18193323Sed *    may be used to endorse or promote products derived from this software
19193323Sed *    without specific prior written permission.
20193323Sed *
21193323Sed * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22193323Sed * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23193323Sed * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24193323Sed * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25193323Sed * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26193323Sed * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27193323Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28193323Sed * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29193323Sed * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30193323Sed * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31193323Sed * SUCH DAMAGE.
32193323Sed */
33193323Sed
34193323Sed#if defined(LIBC_SCCS) && !defined(lint)
35193323Sedstatic char sccsid[] = "@(#)rewinddir.c	8.1 (Berkeley) 6/8/93";
36193323Sed#endif /* LIBC_SCCS and not lint */
37193323Sed#include <sys/cdefs.h>
38193323Sed__FBSDID("$FreeBSD: head/lib/libc/gen/rewinddir.c 90039 2002-02-01 00:57:29Z obrien $");
39218893Sdim
40193323Sed#include <sys/types.h>
41193323Sed#include <dirent.h>
42193323Sed
43193323Sed#include "telldir.h"
44193323Sed
45205218Srdivackyvoid
46210299Sedrewinddir(dirp)
47193323Sed	DIR *dirp;
48193323Sed{
49210299Sed
50193323Sed	_seekdir(dirp, dirp->dd_rewind);
51239462Sdim	dirp->dd_rewind = telldir(dirp);
52239462Sdim}
53239462Sdim