Deleted Added
full compact
cache.c (90110) cache.c (90113)
1/*-
2 * Copyright (c) 1992 Keith Muller.
3 * Copyright (c) 1992, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Keith Muller of the University of California, San Diego.
8 *

--- 26 unchanged lines hidden (view full) ---

35 * SUCH DAMAGE.
36 */
37
38#ifndef lint
39#if 0
40static char sccsid[] = "@(#)cache.c 8.1 (Berkeley) 5/31/93";
41#endif
42static const char rcsid[] =
1/*-
2 * Copyright (c) 1992 Keith Muller.
3 * Copyright (c) 1992, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Keith Muller of the University of California, San Diego.
8 *

--- 26 unchanged lines hidden (view full) ---

35 * SUCH DAMAGE.
36 */
37
38#ifndef lint
39#if 0
40static char sccsid[] = "@(#)cache.c 8.1 (Berkeley) 5/31/93";
41#endif
42static const char rcsid[] =
43 "$FreeBSD: head/bin/pax/cache.c 90110 2002-02-02 06:48:10Z imp $";
43 "$FreeBSD: head/bin/pax/cache.c 90113 2002-02-02 07:07:59Z imp $";
44#endif /* not lint */
45
46#include <sys/types.h>
47#include <sys/stat.h>
48#include <string.h>
49#include <stdio.h>
50#include <pwd.h>
51#include <grp.h>

--- 119 unchanged lines hidden (view full) ---

171 * the stored name (if valid or invalid match). We use a simple hash table.
172 * Return
173 * Pointer to stored name (or a empty string)
174 */
175
176char *
177name_uid(uid_t uid, int frc)
178{
44#endif /* not lint */
45
46#include <sys/types.h>
47#include <sys/stat.h>
48#include <string.h>
49#include <stdio.h>
50#include <pwd.h>
51#include <grp.h>

--- 119 unchanged lines hidden (view full) ---

171 * the stored name (if valid or invalid match). We use a simple hash table.
172 * Return
173 * Pointer to stored name (or a empty string)
174 */
175
176char *
177name_uid(uid_t uid, int frc)
178{
179 register struct passwd *pw;
180 register UIDC *ptr;
179 struct passwd *pw;
180 UIDC *ptr;
181
182 if ((uidtb == NULL) && (uidtb_start() < 0))
183 return("");
184
185 /*
186 * see if we have this uid cached
187 */
188 ptr = uidtb[uid % UID_SZ];

--- 53 unchanged lines hidden (view full) ---

242 * the stored name (if valid or invalid match). We use a simple hash table.
243 * Return
244 * Pointer to stored name (or a empty string)
245 */
246
247char *
248name_gid(gid_t gid, int frc)
249{
181
182 if ((uidtb == NULL) && (uidtb_start() < 0))
183 return("");
184
185 /*
186 * see if we have this uid cached
187 */
188 ptr = uidtb[uid % UID_SZ];

--- 53 unchanged lines hidden (view full) ---

242 * the stored name (if valid or invalid match). We use a simple hash table.
243 * Return
244 * Pointer to stored name (or a empty string)
245 */
246
247char *
248name_gid(gid_t gid, int frc)
249{
250 register struct group *gr;
251 register GIDC *ptr;
250 struct group *gr;
251 GIDC *ptr;
252
253 if ((gidtb == NULL) && (gidtb_start() < 0))
254 return("");
255
256 /*
257 * see if we have this gid cached
258 */
259 ptr = gidtb[gid % GID_SZ];

--- 52 unchanged lines hidden (view full) ---

312 * caches the uid for a given user name. We use a simple hash table.
313 * Return
314 * the uid (if any) for a user name, or a -1 if no match can be found
315 */
316
317int
318uid_name(char *name, uid_t *uid)
319{
252
253 if ((gidtb == NULL) && (gidtb_start() < 0))
254 return("");
255
256 /*
257 * see if we have this gid cached
258 */
259 ptr = gidtb[gid % GID_SZ];

--- 52 unchanged lines hidden (view full) ---

312 * caches the uid for a given user name. We use a simple hash table.
313 * Return
314 * the uid (if any) for a user name, or a -1 if no match can be found
315 */
316
317int
318uid_name(char *name, uid_t *uid)
319{
320 register struct passwd *pw;
321 register UIDC *ptr;
322 register int namelen;
320 struct passwd *pw;
321 UIDC *ptr;
322 int namelen;
323
324 /*
325 * return -1 for mangled names
326 */
327 if (((namelen = strlen(name)) == 0) || (name[0] == '\0'))
328 return(-1);
329 if ((usrtb == NULL) && (usrtb_start() < 0))
330 return(-1);

--- 45 unchanged lines hidden (view full) ---

376 * caches the gid for a given group name. We use a simple hash table.
377 * Return
378 * the gid (if any) for a group name, or a -1 if no match can be found
379 */
380
381int
382gid_name(char *name, gid_t *gid)
383{
323
324 /*
325 * return -1 for mangled names
326 */
327 if (((namelen = strlen(name)) == 0) || (name[0] == '\0'))
328 return(-1);
329 if ((usrtb == NULL) && (usrtb_start() < 0))
330 return(-1);

--- 45 unchanged lines hidden (view full) ---

376 * caches the gid for a given group name. We use a simple hash table.
377 * Return
378 * the gid (if any) for a group name, or a -1 if no match can be found
379 */
380
381int
382gid_name(char *name, gid_t *gid)
383{
384 register struct group *gr;
385 register GIDC *ptr;
386 register int namelen;
384 struct group *gr;
385 GIDC *ptr;
386 int namelen;
387
388 /*
389 * return -1 for mangled names
390 */
391 if (((namelen = strlen(name)) == 0) || (name[0] == '\0'))
392 return(-1);
393 if ((grptb == NULL) && (grptb_start() < 0))
394 return(-1);

--- 42 unchanged lines hidden ---
387
388 /*
389 * return -1 for mangled names
390 */
391 if (((namelen = strlen(name)) == 0) || (name[0] == '\0'))
392 return(-1);
393 if ((grptb == NULL) && (grptb_start() < 0))
394 return(-1);

--- 42 unchanged lines hidden ---