Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: fusl/src/passwd/getgrent.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fusl/src/passwd/getgr_r.c ('k') | fusl/src/passwd/getgrent_a.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fusl/src/passwd/getgrent.c
diff --git a/fusl/src/passwd/getgrent.c b/fusl/src/passwd/getgrent.c
new file mode 100644
index 0000000000000000000000000000000000000000..835b9ab5a22a7edf8b906d547626cdcaeff1d8e1
--- /dev/null
+++ b/fusl/src/passwd/getgrent.c
@@ -0,0 +1,39 @@
+#include "pwf.h"
+
+static FILE *f;
+static char *line, **mem;
+static struct group gr;
+
+void setgrent()
+{
+ if (f) fclose(f);
+ f = 0;
+}
+
+weak_alias(setgrent, endgrent);
+
+struct group *getgrent()
+{
+ struct group *res;
+ size_t size=0, nmem=0;
+ if (!f) f = fopen("/etc/group", "rbe");
+ if (!f) return 0;
+ __getgrent_a(f, &gr, &line, &size, &mem, &nmem, &res);
+ return res;
+}
+
+struct group *getgrgid(gid_t gid)
+{
+ struct group *res;
+ size_t size=0, nmem=0;
+ __getgr_a(0, gid, &gr, &line, &size, &mem, &nmem, &res);
+ return res;
+}
+
+struct group *getgrnam(const char *name)
+{
+ struct group *res;
+ size_t size=0, nmem=0;
+ __getgr_a(name, 0, &gr, &line, &size, &mem, &nmem, &res);
+ return res;
+}
« no previous file with comments | « fusl/src/passwd/getgr_r.c ('k') | fusl/src/passwd/getgrent_a.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698