Declare file in the set function of setgetend functions.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-09-22 00:00:54 +02:00
parent 4b1079510b
commit 360eaaf527
4 changed files with 8 additions and 8 deletions

View File

@ -25,8 +25,6 @@
#include <grp.h>
#include <stddef.h>
extern "C" { FILE* __grp_file = NULL; }
extern "C" struct group* getgrent(void)
{
if ( !__grp_file && !(__grp_file = opengr()) )

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2013.
Copyright(C) Jonas 'Sortie' Termansen 2013, 2015.
This file is part of the Sortix C Library.
@ -25,10 +25,12 @@
#include <grp.h>
#include <stdio.h>
extern "C" { FILE* __grp_file = NULL; }
extern "C" void setgrent(void)
{
if ( __grp_file )
fseeko(__grp_file, 0, SEEK_SET);
rewind(__grp_file);
else
__grp_file = opengr();
}

View File

@ -25,8 +25,6 @@
#include <stddef.h>
#include <pwd.h>
extern "C" { FILE* __pwd_file = NULL; }
extern "C" struct passwd* getpwent(void)
{
if ( !__pwd_file && !(__pwd_file = openpw()) )

View File

@ -1,6 +1,6 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2013.
Copyright(C) Jonas 'Sortie' Termansen 2013, 2015.
This file is part of the Sortix C Library.
@ -25,10 +25,12 @@
#include <pwd.h>
#include <stdio.h>
extern "C" { FILE* __pwd_file = NULL; }
extern "C" void setpwent(void)
{
if ( __pwd_file )
fseeko(__pwd_file, 0, SEEK_SET);
rewind(__pwd_file);
else
__pwd_file = openpw();
}