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