Home | History | Annotate | Line # | Download | only in tools
      1  1.3    perry /*	$NetBSD: noso.c,v 1.3 1998/01/09 08:05:06 perry Exp $	*/
      2  1.3    perry 
      3  1.1      mrg #include <stdio.h>
      4  1.1      mrg #include <sys/types.h>
      5  1.1      mrg #include <sys/stat.h>
      6  1.1      mrg #include <sys/file.h>
      7  1.1      mrg 
      8  1.1      mrg main(argc, argv)
      9  1.1      mrg 	char *argv[];
     10  1.1      mrg {
     11  1.1      mrg 	struct stat sb;
     12  1.1      mrg 	register char *cp;
     13  1.1      mrg 	int i, fd, count = 0;
     14  1.1      mrg 	char buf[10];
     15  1.1      mrg 
     16  1.1      mrg 	for (cp = "", i = 1; i < argc; cp = " ", i++) {
     17  1.1      mrg 		if (lstat(argv[i], &sb) < 0)
     18  1.1      mrg 			continue;
     19  1.2  mycroft 		if (!S_ISREG(sb.st_mode))
     20  1.1      mrg 			continue;
     21  1.1      mrg 		fd = open(argv[i], O_RDONLY);
     22  1.1      mrg 		if (fd < 0) {
     23  1.1      mrg 			perror(argv[i]);
     24  1.1      mrg 			continue;
     25  1.1      mrg 		}
     26  1.1      mrg 		if (read(fd, buf, 3) != 3) {
     27  1.1      mrg 			close(fd);
     28  1.1      mrg 			continue;
     29  1.1      mrg 		}
     30  1.1      mrg 		if (strncmp(buf, ".so", 3))
     31  1.1      mrg 			count++, printf("%s%s", cp, argv[i]);
     32  1.1      mrg 		close(fd);
     33  1.1      mrg 	}
     34  1.1      mrg 	if (count > 0)
     35  1.1      mrg 		putchar('\n');
     36  1.1      mrg }
     37