comparison rvinterf/etmsync/fsread.c @ 13:46ad66a231af

fc-fsio: finally one can type ls -l and not just the ll abbreviation
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 03 Oct 2016 06:15:04 +0000
parents e7502631a0f9
children d332fbf5c145
comparison
equal deleted inserted replaced
12:869ce9f61a67 13:46ad66a231af
48 default: 48 default:
49 printf("?%c %s\n", readonly, pathname); 49 printf("?%c %s\n", readonly, pathname);
50 } 50 }
51 } 51 }
52 52
53 cmd_ll(argc, argv) 53 do_ls_long(lsarg)
54 char **argv; 54 char *lsarg;
55 { 55 {
56 struct stat_info stat; 56 struct stat_info stat;
57 u_char rdstate[4]; 57 u_char rdstate[4];
58 char rdbuf[MAX_FN_COMPONENT+1], childpath[MAX_FULL_PATHNAME+1], *childp; 58 char rdbuf[MAX_FN_COMPONENT+1], childpath[MAX_FULL_PATHNAME+1], *childp;
59 int nument, i, rc; 59 int nument, i, rc;
60 60
61 if (validate_ffs_pathname(argv[1]) < 0) 61 if (validate_ffs_pathname(lsarg) < 0)
62 return(ERROR_USAGE); /* err msg already printed */ 62 return(ERROR_USAGE); /* err msg already printed */
63 rc = do_xlstat(argv[1], &stat); 63 rc = do_xlstat(lsarg, &stat);
64 if (rc) 64 if (rc)
65 return(rc); 65 return(rc);
66 if (stat.type != OT_DIR) { 66 if (stat.type != OT_DIR) {
67 ll_print_line(argv[1], &stat); 67 ll_print_line(lsarg, &stat);
68 return(0); 68 return(0);
69 } 69 }
70 rc = do_opendir(argv[1], rdstate, &nument); 70 rc = do_opendir(lsarg, rdstate, &nument);
71 if (rc) 71 if (rc)
72 return(rc); 72 return(rc);
73 if (!nument) { 73 if (!nument) {
74 printf("<empty dir>\n"); 74 printf("<empty dir>\n");
75 return(0); 75 return(0);
76 } 76 }
77 childp = pathname_for_ffs_child(argv[1], childpath); 77 childp = pathname_for_ffs_child(lsarg, childpath);
78 if (!childp) { 78 if (!childp) {
79 printf("error: non-empty dir at the limit of pathname depth\n"); 79 printf("error: non-empty dir at the limit of pathname depth\n");
80 return(ERROR_TARGET); 80 return(ERROR_TARGET);
81 } 81 }
82 for (i = 0; i < nument; i++) { 82 for (i = 0; i < nument; i++) {
94 return(rc); 94 return(rc);
95 } 95 }
96 ll_print_line(childpath, &stat); 96 ll_print_line(childpath, &stat);
97 } 97 }
98 return(0); 98 return(0);
99 }
100
101 cmd_ll(argc, argv)
102 char **argv;
103 {
104 return do_ls_long(argv[1]);
99 } 105 }
100 106
101 void 107 void
102 hexdump_line(offset, buf, len) 108 hexdump_line(offset, buf, len)
103 u_char *buf; 109 u_char *buf;