FreeBSD/usr.bin/catman/catman.c
/*
 * Tests to see if the given directory has already been visited.
 */
Tests to see if the given directory has already been visited.
Tests to see if the given directory has already been visited .
static int
already_visited(char *mandir, char *dir, int count_visit)
{
	struct stat st;
	if (stat(dir, &st) < 0) {
		if (mandir != NULL)
			warn("%s/%s", mandir, dir);
		else
			warn("%s", dir);
		exit_code = 1;
		return 1;
	}
	if (find_hashtable(visited, st.st_ino, st.st_dev) != NULL) {
		if (mandir != NULL)
			warnx("already visited %s/%s", mandir, dir);
		else
			warnx("already visited %s", dir);
		return 1;
	}
	if (count_visit)
		insert_hashtable(visited, st.st_ino, st.st_dev, "");
	return 0;
}
static int already_visited ( char * mandir , char * dir , int count_visit ) { struct stat st ; if ( stat ( dir , & st ) < 0 ) { if ( mandir != NULL ) warn ( " " , mandir , dir ) ; else warn ( " " , dir ) ; exit_code = 1 ; return 1 ; } if ( find_hashtable ( visited , st . st_ino , st . st_dev ) != NULL ) { if ( mandir != NULL ) warnx ( " " , mandir , dir ) ; else warnx ( " " , dir ) ; return 1 ; } if ( count_visit ) insert_hashtable ( visited , st . st_ino , st . st_dev , " " ) ; return 0 ; }
Tests to see if the given directory has already been visited.
Tests to see if the given directory has already been visited .