summaryrefslogtreecommitdiff
path: root/libc/pwd_grp
diff options
context:
space:
mode:
Diffstat (limited to 'libc/pwd_grp')
-rw-r--r--libc/pwd_grp/.indent.pro33
-rw-r--r--libc/pwd_grp/__getgrent.c240
-rw-r--r--libc/pwd_grp/fgetgrent.c16
-rw-r--r--libc/pwd_grp/fgetpwent.c14
-rw-r--r--libc/pwd_grp/getgrgid.c30
-rw-r--r--libc/pwd_grp/getgrnam.c35
-rw-r--r--libc/pwd_grp/getpw.c45
-rw-r--r--libc/pwd_grp/getpwnam.c35
-rw-r--r--libc/pwd_grp/getpwuid.c26
-rw-r--r--libc/pwd_grp/grent.c31
-rw-r--r--libc/pwd_grp/initgroups.c72
-rw-r--r--libc/pwd_grp/putpwent.c23
-rw-r--r--libc/pwd_grp/pwent.c30
13 files changed, 313 insertions, 317 deletions
diff --git a/libc/pwd_grp/.indent.pro b/libc/pwd_grp/.indent.pro
new file mode 100644
index 000000000..492ecf1c7
--- /dev/null
+++ b/libc/pwd_grp/.indent.pro
@@ -0,0 +1,33 @@
+--blank-lines-after-declarations
+--blank-lines-after-procedures
+--break-before-boolean-operator
+--no-blank-lines-after-commas
+--braces-on-if-line
+--braces-on-struct-decl-line
+--comment-indentation25
+--declaration-comment-column25
+--no-comment-delimiters-on-blank-lines
+--cuddle-else
+--continuation-indentation4
+--case-indentation0
+--else-endif-column33
+--space-after-cast
+--line-comments-indentation0
+--declaration-indentation1
+--dont-format-first-column-comments
+--dont-format-comments
+--honour-newlines
+--indent-level4
+/* changed from 0 to 4 */
+--parameter-indentation4
+--line-length78 /* changed from 75 */
+--continue-at-parentheses
+--no-space-after-function-call-names
+--dont-break-procedure-type
+--dont-star-comments
+--leave-optional-blank-lines
+--dont-space-special-semicolon
+--tab-size4
+/* additions by Mark */
+--case-brace-indentation0
+--leave-preprocessor-space
diff --git a/libc/pwd_grp/__getgrent.c b/libc/pwd_grp/__getgrent.c
index 612f1124d..d1bf8e61e 100644
--- a/libc/pwd_grp/__getgrent.c
+++ b/libc/pwd_grp/__getgrent.c
@@ -29,140 +29,144 @@
* getgrent() except that it is passed a file descriptor. getgrent()
* is just a wrapper for this function.
*/
-struct group *
-__getgrent(int grp_fd)
+struct group *__getgrent(int grp_fd)
{
-#ifndef GR_SCALE_DYNAMIC
- static char line_buff[GR_MAX_LINE_LEN];
- static char * members[GR_MAX_MEMBERS];
+#ifndef GR_SCALE_DYNAMIC
+ static char line_buff[GR_MAX_LINE_LEN];
+ static char *members[GR_MAX_MEMBERS];
#else
- static char * line_buff = NULL;
- static char ** members = NULL;
- short line_index;
- short buff_size;
+ static char *line_buff = NULL;
+ static char **members = NULL;
+ short line_index;
+ short buff_size;
#endif
- static struct group group;
- register char * ptr;
- char * field_begin;
- short member_num;
- char * endptr;
- int line_len;
+ static struct group group;
+ register char *ptr;
+ char *field_begin;
+ short member_num;
+ char *endptr;
+ int line_len;
- /* We use the restart label to handle malformatted lines */
-restart:
+ /* We use the restart label to handle malformatted lines */
+ restart:
#ifdef GR_SCALE_DYNAMIC
- line_index=0;
- buff_size=256;
+ line_index = 0;
+ buff_size = 256;
#endif
#ifndef GR_SCALE_DYNAMIC
- /* Read the line into the static buffer */
- if ((line_len=read(grp_fd, line_buff, GR_MAX_LINE_LEN))<=0)
- return NULL;
- field_begin=strchr(line_buff, '\n');
- if (field_begin!=NULL)
- lseek(grp_fd, (long) (1+field_begin-(line_buff+line_len)), SEEK_CUR);
- else /* The line is too long - skip it :-\ */
- {
- do { if ((line_len=read(grp_fd, line_buff, GR_MAX_LINE_LEN))<=0)
- return NULL;
- } while (!(field_begin=strchr(line_buff, '\n')));
- lseek(grp_fd, (long) ((field_begin-line_buff)-line_len+1), SEEK_CUR);
- goto restart;
- }
- if (*line_buff=='#' || *line_buff==' ' || *line_buff=='\n' ||
- *line_buff=='\t')
- goto restart;
- *field_begin='\0';
-
-#else /* !GR_SCALE_DYNAMIC */
- line_buff=realloc(line_buff, buff_size);
- while (1)
- {
- if ((line_len=read(grp_fd, line_buff+line_index,
- buff_size-line_index))<=0)
- return NULL;
- field_begin=strchr(line_buff, '\n');
- if (field_begin!=NULL)
- {
- lseek(grp_fd, (long) (1+field_begin-(line_len+line_index+line_buff)),
- SEEK_CUR);
- *field_begin='\0';
- if (*line_buff=='#' || *line_buff==' ' || *line_buff=='\n' ||
- *line_buff=='\t')
- goto restart;
- break;
+ /* Read the line into the static buffer */
+ if ((line_len = read(grp_fd, line_buff, GR_MAX_LINE_LEN)) <= 0)
+ return NULL;
+ field_begin = strchr(line_buff, '\n');
+ if (field_begin != NULL)
+ lseek(grp_fd, (long) (1 + field_begin - (line_buff + line_len)),
+ SEEK_CUR);
+ else { /* The line is too long - skip it :-\ */
+
+ do {
+ if ((line_len = read(grp_fd, line_buff, GR_MAX_LINE_LEN)) <= 0)
+ return NULL;
+ } while (!(field_begin = strchr(line_buff, '\n')));
+ lseek(grp_fd, (long) ((field_begin - line_buff) - line_len + 1),
+ SEEK_CUR);
+ goto restart;
}
- else /* Allocate some more space */
- {
- line_index=buff_size;
- buff_size+=256;
- line_buff=realloc(line_buff, buff_size);
+ if (*line_buff == '#' || *line_buff == ' ' || *line_buff == '\n' ||
+ *line_buff == '\t')
+ goto restart;
+ *field_begin = '\0';
+
+#else /* !GR_SCALE_DYNAMIC */
+ line_buff = realloc(line_buff, buff_size);
+ while (1) {
+ if ((line_len = read(grp_fd, line_buff + line_index,
+ buff_size - line_index)) <= 0)
+ return NULL;
+ field_begin = strchr(line_buff, '\n');
+ if (field_begin != NULL) {
+ lseek(grp_fd,
+ (long) (1 + field_begin -
+ (line_len + line_index + line_buff)), SEEK_CUR);
+ *field_begin = '\0';
+ if (*line_buff == '#' || *line_buff == ' '
+ || *line_buff == '\n' || *line_buff == '\t')
+ goto restart;
+ break;
+ } else { /* Allocate some more space */
+
+ line_index = buff_size;
+ buff_size += 256;
+ line_buff = realloc(line_buff, buff_size);
+ }
}
- }
-#endif /* GR_SCALE_DYNAMIC */
+#endif /* GR_SCALE_DYNAMIC */
- /* Now parse the line */
- group.gr_name=line_buff;
- ptr=strchr(line_buff, ':');
- if (ptr==NULL) goto restart;
- *ptr++='\0';
+ /* Now parse the line */
+ group.gr_name = line_buff;
+ ptr = strchr(line_buff, ':');
+ if (ptr == NULL)
+ goto restart;
+ *ptr++ = '\0';
- group.gr_passwd=ptr;
- ptr=strchr(ptr, ':');
- if (ptr==NULL) goto restart;
- *ptr++='\0';
+ group.gr_passwd = ptr;
+ ptr = strchr(ptr, ':');
+ if (ptr == NULL)
+ goto restart;
+ *ptr++ = '\0';
- field_begin=ptr;
- ptr=strchr(ptr, ':');
- if (ptr==NULL) goto restart;
- *ptr++='\0';
+ field_begin = ptr;
+ ptr = strchr(ptr, ':');
+ if (ptr == NULL)
+ goto restart;
+ *ptr++ = '\0';
- group.gr_gid=(gid_t) strtoul(field_begin, &endptr, 10);
- if (*endptr!='\0') goto restart;
+ group.gr_gid = (gid_t) strtoul(field_begin, &endptr, 10);
+ if (*endptr != '\0')
+ goto restart;
- member_num=0;
- field_begin=ptr;
+ member_num = 0;
+ field_begin = ptr;
#ifndef GR_SCALE_DYNAMIC
- while ((ptr=strchr(ptr, ','))!=NULL)
- {
- *ptr='\0';
- ptr++;
- members[member_num]=field_begin;
- field_begin=ptr;
- member_num++;
- }
- if (*field_begin=='\0')
- members[member_num]=NULL;
- else
- {
- members[member_num]=field_begin;
- members[member_num+1]=NULL;
- }
-#else /* !GR_SCALE_DYNAMIC */
- if (members!=NULL)
- free (members);
- members=(char **) malloc(1*sizeof(char *));
- while ((ptr=strchr(ptr, ','))!=NULL)
- {
- *ptr='\0';
- ptr++;
- members[member_num]=field_begin;
- field_begin=ptr;
- member_num++;
- members=(char **)realloc((void *)members, (member_num+1)*sizeof(char *));
- }
- if (*field_begin=='\0')
- members[member_num]=NULL;
- else
- {
- members[member_num]=field_begin;
- members[member_num+1]=NULL;
- }
-#endif /* GR_SCALE_DYNAMIC */
-
- group.gr_mem=members;
- return &group;
+ while ((ptr = strchr(ptr, ',')) != NULL) {
+ *ptr = '\0';
+ ptr++;
+ members[member_num] = field_begin;
+ field_begin = ptr;
+ member_num++;
+ }
+ if (*field_begin == '\0')
+ members[member_num] = NULL;
+ else {
+ members[member_num] = field_begin;
+ members[member_num + 1] = NULL;
+ }
+#else /* !GR_SCALE_DYNAMIC */
+ if (members != NULL)
+ free(members);
+ members = (char **) malloc(1 * sizeof(char *));
+
+ while ((ptr = strchr(ptr, ',')) != NULL) {
+ *ptr = '\0';
+ ptr++;
+ members[member_num] = field_begin;
+ field_begin = ptr;
+ member_num++;
+ members =
+ (char **) realloc((void *) members,
+
+ (member_num + 1) * sizeof(char *));
+ }
+ if (*field_begin == '\0')
+ members[member_num] = NULL;
+ else {
+ members[member_num] = field_begin;
+ members[member_num + 1] = NULL;
+ }
+#endif /* GR_SCALE_DYNAMIC */
+
+ group.gr_mem = members;
+ return &group;
}
diff --git a/libc/pwd_grp/fgetgrent.c b/libc/pwd_grp/fgetgrent.c
index 800236fcc..09701a38b 100644
--- a/libc/pwd_grp/fgetgrent.c
+++ b/libc/pwd_grp/fgetgrent.c
@@ -22,14 +22,12 @@
#include <errno.h>
#include <grp.h>
-struct group *
-fgetgrent(FILE * file)
+struct group *fgetgrent(FILE * file)
{
- if (file==NULL)
- {
- errno=EINTR;
- return NULL;
- }
-
- return __getgrent(fileno(file));
+ if (file == NULL) {
+ errno = EINTR;
+ return NULL;
+ }
+
+ return __getgrent(fileno(file));
}
diff --git a/libc/pwd_grp/fgetpwent.c b/libc/pwd_grp/fgetpwent.c
index e12b89051..cd8742d80 100644
--- a/libc/pwd_grp/fgetpwent.c
+++ b/libc/pwd_grp/fgetpwent.c
@@ -22,14 +22,12 @@
#include <stdio.h>
#include <pwd.h>
-struct passwd *
-fgetpwent(FILE * file)
+struct passwd *fgetpwent(FILE * file)
{
- if (file==NULL)
- {
- errno=EINTR;
- return NULL;
- }
+ if (file == NULL) {
+ errno = EINTR;
+ return NULL;
+ }
- return __getpwent(fileno(file));
+ return __getpwent(fileno(file));
}
diff --git a/libc/pwd_grp/getgrgid.c b/libc/pwd_grp/getgrgid.c
index c1dd20e35..fa74a9644 100644
--- a/libc/pwd_grp/getgrgid.c
+++ b/libc/pwd_grp/getgrgid.c
@@ -23,26 +23,20 @@
#include <fcntl.h>
#include <grp.h>
-struct group *
-getgrgid(const gid_t gid)
+struct group *getgrgid(const gid_t gid)
{
- struct group * group;
- int grp_fd;
+ struct group *group;
+ int grp_fd;
- if ((grp_fd=open("/etc/group", O_RDONLY))<0)
- return NULL;
+ if ((grp_fd = open("/etc/group", O_RDONLY)) < 0)
+ return NULL;
- while ((group=__getgrent(grp_fd))!=NULL)
- if (group->gr_gid==gid)
- {
- close(grp_fd);
- return group;
- }
+ while ((group = __getgrent(grp_fd)) != NULL)
+ if (group->gr_gid == gid) {
+ close(grp_fd);
+ return group;
+ }
- close(grp_fd);
- return NULL;
+ close(grp_fd);
+ return NULL;
}
-
-
-
-
diff --git a/libc/pwd_grp/getgrnam.c b/libc/pwd_grp/getgrnam.c
index e6c27fc57..999404284 100644
--- a/libc/pwd_grp/getgrnam.c
+++ b/libc/pwd_grp/getgrnam.c
@@ -24,28 +24,25 @@
#include <fcntl.h>
#include <grp.h>
-struct group *
-getgrnam(const char * name)
+struct group *getgrnam(const char *name)
{
- int grp_fd;
- struct group * group;
+ int grp_fd;
+ struct group *group;
- if (name==NULL)
- {
- errno=EINVAL;
- return NULL;
- }
+ if (name == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
- if ((grp_fd=open("/etc/group", O_RDONLY))<0)
- return NULL;
+ if ((grp_fd = open("/etc/group", O_RDONLY)) < 0)
+ return NULL;
- while ((group=__getgrent(grp_fd))!=NULL)
- if (!strcmp(group->gr_name, name))
- {
- close(grp_fd);
- return group;
- }
+ while ((group = __getgrent(grp_fd)) != NULL)
+ if (!strcmp(group->gr_name, name)) {
+ close(grp_fd);
+ return group;
+ }
- close(grp_fd);
- return NULL;
+ close(grp_fd);
+ return NULL;
}
diff --git a/libc/pwd_grp/getpw.c b/libc/pwd_grp/getpw.c
index 4f4e39025..f0663c917 100644
--- a/libc/pwd_grp/getpw.c
+++ b/libc/pwd_grp/getpw.c
@@ -23,29 +23,24 @@
#include <stdio.h>
#include <pwd.h>
-int
-getpw(uid_t uid, char *buf)
+int getpw(uid_t uid, char *buf)
{
- struct passwd * passwd;
-
- if (buf==NULL)
- {
- errno=EINVAL;
- return -1;
- }
- if ((passwd=getpwuid(uid))==NULL)
- return -1;
-
- if (sprintf(buf, "%s:%s:%u:%u:%s:%s:%s", passwd->pw_name, passwd->pw_passwd,
- passwd->pw_gid, passwd->pw_uid, passwd->pw_gecos,
- passwd->pw_dir, passwd->pw_shell)<0)
- {
- errno=ENOBUFS;
- return -1;
- }
-
- return 0;
-}
-
-
-
+ struct passwd *passwd;
+
+ if (buf == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+ if ((passwd = getpwuid(uid)) == NULL)
+ return -1;
+
+ if (sprintf
+ (buf, "%s:%s:%u:%u:%s:%s:%s", passwd->pw_name, passwd->pw_passwd,
+ passwd->pw_gid, passwd->pw_uid, passwd->pw_gecos, passwd->pw_dir,
+ passwd->pw_shell) < 0) {
+ errno = ENOBUFS;
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/libc/pwd_grp/getpwnam.c b/libc/pwd_grp/getpwnam.c
index 85dbc8ed8..63671927b 100644
--- a/libc/pwd_grp/getpwnam.c
+++ b/libc/pwd_grp/getpwnam.c
@@ -25,28 +25,25 @@
#include <pwd.h>
-struct passwd *
-getpwnam(const char * name)
+struct passwd *getpwnam(const char *name)
{
- int passwd_fd;
- struct passwd * passwd;
+ int passwd_fd;
+ struct passwd *passwd;
- if (name==NULL)
- {
- errno=EINVAL;
- return NULL;
- }
+ if (name == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
- if ((passwd_fd=open("/etc/passwd", O_RDONLY))<0)
- return NULL;
+ if ((passwd_fd = open("/etc/passwd", O_RDONLY)) < 0)
+ return NULL;
- while ((passwd=__getpwent(passwd_fd))!=NULL)
- if (!strcmp(passwd->pw_name, name))
- {
- close(passwd_fd);
- return passwd;
- }
+ while ((passwd = __getpwent(passwd_fd)) != NULL)
+ if (!strcmp(passwd->pw_name, name)) {
+ close(passwd_fd);
+ return passwd;
+ }
- close(passwd_fd);
- return NULL;
+ close(passwd_fd);
+ return NULL;
}
diff --git a/libc/pwd_grp/getpwuid.c b/libc/pwd_grp/getpwuid.c
index ffd58c1f0..1cd0d691c 100644
--- a/libc/pwd_grp/getpwuid.c
+++ b/libc/pwd_grp/getpwuid.c
@@ -23,22 +23,20 @@
#include <fcntl.h>
#include <pwd.h>
-struct passwd *
-getpwuid(uid_t uid)
+struct passwd *getpwuid(uid_t uid)
{
- int passwd_fd;
- struct passwd * passwd;
+ int passwd_fd;
+ struct passwd *passwd;
- if ((passwd_fd=open("/etc/passwd", O_RDONLY))<0)
- return NULL;
+ if ((passwd_fd = open("/etc/passwd", O_RDONLY)) < 0)
+ return NULL;
- while ((passwd=__getpwent(passwd_fd))!=NULL)
- if (passwd->pw_uid==uid)
- {
- close(passwd_fd);
- return passwd;
- }
+ while ((passwd = __getpwent(passwd_fd)) != NULL)
+ if (passwd->pw_uid == uid) {
+ close(passwd_fd);
+ return passwd;
+ }
- close (passwd_fd);
- return NULL;
+ close(passwd_fd);
+ return NULL;
}
diff --git a/libc/pwd_grp/grent.c b/libc/pwd_grp/grent.c
index 19d618b2b..aab878a89 100644
--- a/libc/pwd_grp/grent.c
+++ b/libc/pwd_grp/grent.c
@@ -28,30 +28,25 @@
#include <fcntl.h>
#include <grp.h>
-static int grp_fd=-1;
+static int grp_fd = -1;
-void
-setgrent(void)
+void setgrent(void)
{
- if (grp_fd!=-1)
- close(grp_fd);
- grp_fd=open("/etc/group", O_RDONLY);
+ if (grp_fd != -1)
+ close(grp_fd);
+ grp_fd = open("/etc/group", O_RDONLY);
}
-void
-endgrent(void)
+void endgrent(void)
{
- if (grp_fd!=-1)
- close(grp_fd);
- grp_fd=-1;
+ if (grp_fd != -1)
+ close(grp_fd);
+ grp_fd = -1;
}
-struct group *
-getgrent(void)
+struct group *getgrent(void)
{
- if (grp_fd==-1)
- return NULL;
- return __getgrent(grp_fd);
+ if (grp_fd == -1)
+ return NULL;
+ return __getgrent(grp_fd);
}
-
-
diff --git a/libc/pwd_grp/initgroups.c b/libc/pwd_grp/initgroups.c
index 35e1d03ec..04de22632 100644
--- a/libc/pwd_grp/initgroups.c
+++ b/libc/pwd_grp/initgroups.c
@@ -24,57 +24,51 @@
#include <grp.h>
#include "config.h"
-int
-initgroups(__const char * user, gid_t gid)
+int initgroups(__const char *user, gid_t gid)
{
- register struct group * group;
+ register struct group *group;
+
#ifndef GR_DYNAMIC_GROUP_LIST
- gid_t group_list[GR_MAX_GROUPS];
+ gid_t group_list[GR_MAX_GROUPS];
#else
- gid_t * group_list=NULL;
+ gid_t *group_list = NULL;
#endif
- register char ** tmp_mem;
- int num_groups;
- int grp_fd;
+ register char **tmp_mem;
+ int num_groups;
+ int grp_fd;
- if ((grp_fd=open("/etc/group", O_RDONLY))<0)
- return -1;
+ if ((grp_fd = open("/etc/group", O_RDONLY)) < 0)
+ return -1;
- num_groups=0;
+ num_groups = 0;
#ifdef GR_DYNAMIC_GROUP_LIST
- group_list=(gid_t *) realloc(group_list, 1);
+ group_list = (gid_t *) realloc(group_list, 1);
#endif
- group_list[num_groups]=gid;
+ group_list[num_groups] = gid;
#ifndef GR_DYNAMIC_GROUP_LIST
- while (num_groups<GR_MAX_GROUPS &&
- (group=__getgrent(grp_fd))!=NULL)
+ while (num_groups < GR_MAX_GROUPS &&
+ (group = __getgrent(grp_fd)) != NULL)
#else
- while ((group=__getgrent(grp_fd))!=NULL)
-#endif
- {
- if (group->gr_gid!=gid);
- {
- tmp_mem=group->gr_mem;
- while(*tmp_mem!=NULL)
- {
- if (!strcmp(*tmp_mem, user))
+ while ((group = __getgrent(grp_fd)) != NULL)
+#endif
+ {
+ if (group->gr_gid != gid);
{
- num_groups++;
-#ifdef GR_DYNAMIC_GROUP_LIST
- group_list=(gid_t *)realloc(group_list,
- num_groups*sizeof(gid_t *));
-#endif
- group_list[num_groups]=group->gr_gid;
+ tmp_mem = group->gr_mem;
+ while (*tmp_mem != NULL) {
+ if (!strcmp(*tmp_mem, user)) {
+ num_groups++;
+#ifdef GR_DYNAMIC_GROUP_LIST
+ group_list = (gid_t *) realloc(group_list, num_groups *
+ sizeof(gid_t *));
+#endif
+ group_list[num_groups] = group->gr_gid;
+ }
+ tmp_mem++;
+ }
}
- tmp_mem++;
- }
}
- }
- close(grp_fd);
- return setgroups(num_groups, group_list);
+ close(grp_fd);
+ return setgroups(num_groups, group_list);
}
-
-
-
-
diff --git a/libc/pwd_grp/putpwent.c b/libc/pwd_grp/putpwent.c
index a0035ea98..da8e13d67 100644
--- a/libc/pwd_grp/putpwent.c
+++ b/libc/pwd_grp/putpwent.c
@@ -22,18 +22,17 @@
#include <errno.h>
#include <pwd.h>
-int
-putpwent(const struct passwd * passwd, FILE * f)
+int putpwent(const struct passwd *passwd, FILE * f)
{
- if (passwd == NULL || f == NULL)
- {
- errno=EINVAL;
- return -1;
- }
- if (fprintf(f, "%s:%s:%u:%u:%s:%s:%s\n", passwd->pw_name, passwd->pw_passwd,
- passwd->pw_gid, passwd->pw_uid, passwd->pw_gecos,
- passwd->pw_dir, passwd->pw_shell)<0)
- return -1;
+ if (passwd == NULL || f == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+ if (fprintf
+ (f, "%s:%s:%u:%u:%s:%s:%s\n", passwd->pw_name, passwd->pw_passwd,
+ passwd->pw_gid, passwd->pw_uid, passwd->pw_gecos, passwd->pw_dir,
+ passwd->pw_shell) < 0)
+ return -1;
- return 0;
+ return 0;
}
diff --git a/libc/pwd_grp/pwent.c b/libc/pwd_grp/pwent.c
index 51f76b53f..475c8e560 100644
--- a/libc/pwd_grp/pwent.c
+++ b/libc/pwd_grp/pwent.c
@@ -33,30 +33,24 @@
/* file descriptor for the password file currently open */
static int pw_fd = -1;
-void
-setpwent(void)
+void setpwent(void)
{
- if (pw_fd!=-1)
- close(pw_fd);
+ if (pw_fd != -1)
+ close(pw_fd);
- pw_fd=open("/etc/passwd", O_RDONLY);
+ pw_fd = open("/etc/passwd", O_RDONLY);
}
-void
-endpwent(void)
+void endpwent(void)
{
- if (pw_fd!=-1)
- close(pw_fd);
- pw_fd=-1;
+ if (pw_fd != -1)
+ close(pw_fd);
+ pw_fd = -1;
}
-struct passwd *
-getpwent(void)
+struct passwd *getpwent(void)
{
- if (pw_fd!=-1)
- return (__getpwent(pw_fd));
- return NULL;
+ if (pw_fd != -1)
+ return (__getpwent(pw_fd));
+ return NULL;
}
-
-
-