Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
/* $XConsortium: DirIterator.C /main/2 1995/07/17 14:09:48 drk $ */
/*******************************************************************
** (c) Copyright Hewlett-Packard Company, 1990, 1991, 1992, 1993.
** All rights are reserved. Copying or other reproduction of this
** program except for archival purposes is prohibited without prior
** written consent of Hewlett-Packard Company.
********************************************************************
****************************<+>*************************************/
#include "DirIterator.h"
#include <errno.h>
DirectoryIterator::DirectoryIterator
(
const CString & dir
) : state(good_)
{
theDir = opendir(dir.data());
if (theDir == 0)
state = bad_;
}
DirectoryIterator::~DirectoryIterator()
{
closedir(theDir);
}
struct dirent * DirectoryIterator::operator()()
{
struct dirent * direntry = readdir(theDir);
if (direntry == 0)
state = (errno ? bad_ : done_);
return direntry;
}