File:  [CSRG BSD Unix] / 43BSDReno / share / man / tools / noso.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:57 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43reno
BSD 4.3reno

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>

main(argc, argv)
	char *argv[];
{
	struct stat sb;
	register char *cp;
	int i, fd, count = 0;
	char buf[10];

	for (cp = "", i = 1; i < argc; cp = " ", i++) {
		if (lstat(argv[i], &sb) < 0)
			continue;
		if ((sb.st_mode & S_IFMT) != S_IFREG)
			continue;
		fd = open(argv[i], O_RDONLY);
		if (fd < 0) {
			perror(argv[i]);
			continue;
		}
		if (read(fd, buf, 3) != 3) {
			close(fd);
			continue;
		}
		if (strncmp(buf, ".so", 3))
			count++, printf("%s%s", cp, argv[i]);
		close(fd);
	}
	if (count > 0)
		putchar('\n');
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.