* NEWS: Mention the addition.
* modules/idcache (Files): Add lib/idcache.h
* lib/idcache.c: Include "idcache.h".
Don't include <sys/types.h>.
Add a FIXME comment.
Move file-scoped "static" declarations to the top.
* lib/idcache.h: New file. Include <sys/types.h> here, instead.
+2007-08-18 Jim Meyering <jim@meyering.net>
+
+ New file: lib/idcache.h
+ * NEWS: Mention the addition.
+ * modules/idcache (Files): Add lib/idcache.h
+ * lib/idcache.c: Include "idcache.h".
+ Don't include <sys/types.h>.
+ Add a FIXME comment.
+ Move file-scoped "static" declarations to the top.
+ * lib/idcache.h: New file. Include <sys/types.h> here, instead.
+
2007-08-17 Bruno Haible <bruno@clisp.org>
and Paul Eggert <eggert@cs.ucla.edu>
2007-08-17 Bruno Haible <bruno@clisp.org>
and Paul Eggert <eggert@cs.ucla.edu>
+2007-08-18 idcache Now provides prototypes in "idcache.h".
+
2007-08-10 xstrtol The STRTOL_FATAL_ERROR macro is removed.
Use the new xstrtol_fatal function instead.
2007-08-10 xstrtol The STRTOL_FATAL_ERROR macro is removed.
Use the new xstrtol_fatal function instead.
/* idcache.c -- map user and group IDs, cached for speed
/* idcache.c -- map user and group IDs, cached for speed
- Copyright (C) 1985, 1988, 1989, 1990, 1997, 1998, 2003, 2005, 2006
+ Copyright (C) 1985, 1988, 1989, 1990, 1997, 1998, 2003, 2005-2007
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <pwd.h>
#include <grp.h>
#include <pwd.h>
#include <grp.h>
char name[FLEXIBLE_ARRAY_MEMBER];
};
char name[FLEXIBLE_ARRAY_MEMBER];
};
+/* FIXME: provide a function to free any malloc'd storage and reset lists,
+ so that an application can use code like this just before exiting:
+ #ifdef lint
+ idcache_clear ();
+ #endif
+*/
+
static struct userid *user_alist;
/* Each entry on list is a user name for which the first lookup failed. */
static struct userid *nouser_alist;
static struct userid *user_alist;
/* Each entry on list is a user name for which the first lookup failed. */
static struct userid *nouser_alist;
+/* Use the same struct as for userids. */
+static struct userid *group_alist;
+
+/* Each entry on list is a group name for which the first lookup failed. */
+static struct userid *nogroup_alist;
+
/* Translate UID to a login name, with cache, or NULL if unresolved. */
char *
/* Translate UID to a login name, with cache, or NULL if unresolved. */
char *
-/* Use the same struct as for userids. */
-static struct userid *group_alist;
-
-/* Each entry on list is a group name for which the first lookup failed. */
-static struct userid *nogroup_alist;
-
/* Translate GID to a group name, with cache, or NULL if unresolved. */
char *
/* Translate GID to a group name, with cache, or NULL if unresolved. */
char *
--- /dev/null
+#ifndef IDCACHE_H
+# define IDCACHE_H 1
+
+# include <sys/types.h>
+
+extern char *getuser (uid_t uid);
+extern char *getgroup (gid_t gid);
+extern uid_t *getuidbyname (const char *user);
+extern gid_t *getgidbyname (const char *group);
+
+#endif
m4/idcache.m4
Depends-on:
m4/idcache.m4
Depends-on: