| 12345678910111213141516171819202122232425262728293031323334 |
- #include <stdio.h>
- #include <unistd.h>
- #include <string.h>
- #include <errno.h>
- #include <sys/fcntl.h>
- #include <sys/types.h>
- #include "cfs.h"
- int main(int argc, const char **argv) {
- char *fname = (char *) argv[1];
- int fd;
- if (!fname) {
- printf("usage: lsdir device. \n");
- return 1;
- }
- fd = open(fname, O_RDWR);
- if (fd < 0) {
- printf("failed when trying to open %s: %s\n", fname, strerror(errno));
- return 1;
- }
- cfs_init(fd);
- cfs_lsdir(rootdir);
- close(fd);
- return 0;
- }
|