/* Copyright (c) 1979 Regents of the University of California */
* Look for a particular file name in everyone's home directory.
* Author: Kurt Shoens (UCB) 1/11/79
char *pwfile
= "/etc/passwd";
char namebuf
[BUFSIZ
], home
[BUFSIZ
], word
[BUFSIZ
];
fprintf(stderr
, "Usage: %s name ...\n", *argv
);
if (freopen(pwfile
, "r", stdin
) == NULL
) {
while (gets(namebuf
) != NULL
) {
cp
= home
+ strlen(home
);
if (stat(home
, &sbuf
) >= 0)
* Find from the given passwd line the user's home directory
for (cp
= pwline
, c
= 0; c
< 5 && *cp
; c
+= *cp
++ == ':')
for (cp2
= home
; *cp
&& *cp
!= ':'; *cp2
++ = *cp
++)