Mail Archives: djgpp-workers/2001/01/21/07:41:24
> No, they aren't Posix, and a program which assumes them without testing
> is buggy. But I think we've bumped into this enough times, so please go
> ahead and post the patches to add them.
OK - here goes. I wasn't sure if this was worhy of a mention in
wc204, so I didn't add an entry there.
Index: include/grp.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/grp.h,v
retrieving revision 1.2
diff -u -r1.2 grp.h
--- grp.h 2000/12/05 14:05:52 1.2
+++ grp.h 2001/01/21 12:08:54
@@ -18,9 +18,10 @@
#endif
struct group {
- gid_t gr_gid;
- char ** gr_mem;
- char * gr_name;
+ gid_t gr_gid; /* Group ID. */
+ char ** gr_mem; /* Member list. */
+ char * gr_name; /* Group name. */
+ char * gr_passwd; /* Password. */
};
struct group * getgrgid(gid_t _gid);
Index: include/pwd.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/pwd.h,v
retrieving revision 1.2
diff -u -r1.2 pwd.h
--- pwd.h 2000/12/05 14:05:53 1.2
+++ pwd.h 2001/01/21 12:08:54
@@ -22,11 +22,13 @@
#endif
struct passwd {
- char * pw_name;
- uid_t pw_uid;
- gid_t pw_gid;
- char * pw_dir;
- char * pw_shell;
+ char * pw_name; /* Username. */
+ uid_t pw_uid; /* User ID. */
+ gid_t pw_gid; /* Group ID. */
+ char * pw_dir; /* Home directory. */
+ char * pw_shell; /* Shell program. */
+ char * pw_gecos; /* Real name. */
+ char * pw_passwd; /* Password. */
};
struct passwd * getpwuid(uid_t _uid);
Index: src/libc/posix/grp/getgrent.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/grp/getgrent.txh,v
retrieving revision 1.3
diff -u -r1.3 getgrent.txh
--- getgrent.txh 1999/06/20 08:53:40 1.3
+++ getgrent.txh 2001/01/21 12:08:56
@@ -24,6 +24,7 @@
char ** gr_mem; /* gr_mem[0] points to
getenv("USER"/"LOGNAME") or "user" */
char * gr_name; /* getenv("GROUP") or "dos" */
+ char * gr_passwd; /* "" */
@};
@end example
Index: src/libc/posix/grp/getgrgid.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/grp/getgrgid.c,v
retrieving revision 1.1
diff -u -r1.1 getgrgid.c
--- getgrgid.c 1995/05/21 06:52:42 1.1
+++ getgrgid.c 2001/01/21 12:08:56
@@ -10,6 +10,7 @@
static char *mem[2];
static char def_name[] = "user";
static char def_grp[] = "dos";
+static char def_passwd[] = "";
static void
grp_init(void)
@@ -45,6 +46,7 @@
g.gr_gid = getgid();
g.gr_mem = mem;
g.gr_name = grp;
+ g.gr_passwd = def_passwd;
}
struct group *
Index: src/libc/posix/pwd/getpwnam.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/pwd/getpwnam.c,v
retrieving revision 1.2
diff -u -r1.2 getpwnam.c
--- getpwnam.c 1998/06/28 22:19:40 1.2
+++ getpwnam.c 2001/01/21 12:08:56
@@ -5,8 +5,9 @@
#include <stdlib.h>
#include <string.h>
-static char slash[] = "/";
-static char shell[] = "sh";
+static char passwd[] = "";
+static char slash [] = "/";
+static char shell [] = "sh";
struct passwd *
getpwnam(const char *name)
@@ -25,5 +26,7 @@
rv.pw_shell = getenv("COMSPEC");
if (rv.pw_shell == 0)
rv.pw_shell = shell;
+ rv.pw_gecos = getlogin();
+ rv.pw_passwd = passwd;
return &rv;
}
Index: src/libc/posix/pwd/getpwuid.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/pwd/getpwuid.c,v
retrieving revision 1.1
diff -u -r1.1 getpwuid.c
--- getpwuid.c 1995/05/10 03:58:12 1.1
+++ getpwuid.c 2001/01/21 12:08:56
@@ -3,8 +3,9 @@
#include <unistd.h>
#include <stdlib.h>
-static char slash[] = "/";
-static char shell[] = "sh";
+static char passwd[] = "";
+static char slash [] = "/";
+static char shell [] = "sh";
struct passwd *
getpwuid(uid_t uid)
@@ -23,5 +24,7 @@
rv.pw_shell = getenv("COMSPEC");
if (rv.pw_shell == 0)
rv.pw_shell = shell;
+ rv.pw_gecos = getlogin();
+ rv.pw_passwd = passwd;
return &rv;
}
Index: src/libc/posix/pwd/pwent.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/pwd/pwent.txh,v
retrieving revision 1.3
diff -u -r1.3 pwent.txh
--- pwent.txh 1999/08/09 10:27:24 1.3
+++ pwent.txh 2001/01/21 12:08:56
@@ -19,13 +19,16 @@
int pw_gid; /* getgid() */
char * pw_dir; /* "/" or getenv("HOME") */
char * pw_shell; /* "/bin/sh" or getenv("SHELL") */
+ char * pw_gecos; /* getlogin() */
+ char * pw_passwd; /* "" */
@};
@end example
-The @code{pw_name} member is returned as described under @code{getlogin}
-(@pxref{getlogin}). The @code{pw_uid} member is returned as described
-under @code{getuid} (@pxref{getuid}). @code{pw_gid} is returned as
-described under @code{getgid} (@pxref{getgid}). The @code{pw_dir}
+The @code{pw_name} and @code{pw_gecos} members are returned as described
+under @code{getlogin} (@pxref{getlogin}). The @code{pw_uid} member is
+returned as described under @code{getuid} (@pxref{getuid}). @code{pw_gid}
+is returned as described under @code{getgid} (@pxref{getgid}). The
+@code{pw_passwd} member is set to the empty string. The @code{pw_dir}
member is set to the value of the environment variable @code{HOME} if it
is defined, or to @file{/} otherwise. @code{pw_shell} is set as
follows:
- Raw text -