Rev 2711 | Rev 2755 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2711 | Rev 2737 | ||
---|---|---|---|
Line 78... | Line 78... | ||
78 | return "read() failed.\n"; |
78 | return "read() failed.\n"; |
79 | 79 | ||
80 | if (!quiet) |
80 | if (!quiet) |
81 | printf("read %d bytes: \"%.*s\", fd=%d\n", cnt, cnt, buf, fd0); |
81 | printf("read %d bytes: \"%.*s\", fd=%d\n", cnt, cnt, buf, fd0); |
82 | 82 | ||
- | 83 | close(fd0); |
|
- | 84 | ||
83 | DIR *dirp; |
85 | DIR *dirp; |
84 | struct dirent *dp; |
86 | struct dirent *dp; |
85 | 87 | ||
- | 88 | if (!quiet) |
|
- | 89 | printf("scanning the root directory...\n"); |
|
- | 90 | ||
- | 91 | dirp = opendir("/"); |
|
- | 92 | if (!dirp) |
|
- | 93 | return "opendir() failed\n"; |
|
- | 94 | while ((dp = readdir(dirp))) |
|
- | 95 | printf("discovered node %s in /\n", dp->d_name); |
|
- | 96 | closedir(dirp); |
|
- | 97 | ||
- | 98 | if (unlink("/mydir/myfile")) |
|
- | 99 | return "unlink() failed.\n"; |
|
- | 100 | ||
- | 101 | if (!quiet) |
|
- | 102 | printf("unlinked file /mydir/myfile\n"); |
|
- | 103 | ||
- | 104 | if (rmdir("/mydir")) |
|
- | 105 | return "rmdir() failed.\n"; |
|
- | 106 | ||
- | 107 | if (!quiet) |
|
- | 108 | printf("removed directory /mydir\n"); |
|
- | 109 | ||
- | 110 | if (!quiet) |
|
- | 111 | printf("scanning the root directory...\n"); |
|
- | 112 | ||
86 | dirp = opendir("/"); |
113 | dirp = opendir("/"); |
87 | if (!dirp) |
114 | if (!dirp) |
88 | return "opendir() failed."; |
115 | return "opendir() failed\n"; |
89 | while ((dp = readdir(dirp))) |
116 | while ((dp = readdir(dirp))) |
90 | printf("discovered node %s in /\n", dp->d_name); |
117 | printf("discovered node %s in /\n", dp->d_name); |
91 | closedir(dirp); |
118 | closedir(dirp); |
92 | 119 | ||
93 | return NULL; |
120 | return NULL; |