return
strcmp(name, ".") == 0 ||
strcmp(name, "..") == 0 ||
- (ignore_dotfiles && name[0] == '.' && name[1] != '/');
+ (ignore_dotfiles && name[0] == '.' && name[1] != '/');
}
size_sum_t entry_size(const char *name) {
};
int main(int argc, char **argv) {
- int c;
+ int c, l;
struct entry_node *root;
struct winsize win;
if (optind < argc) {
while (optind < argc) {
- if(argv[optind][strlen(argv[optind]) - 1] == '/') {
- argv[optind][strlen(argv[optind]) - 1] = '\0';
+ l = strlen(argv[optind]);
+ if(l > 0 && argv[optind][l - 1] == '/') {
+ argv[optind][l - 1] = '\0';
root = push_dir_content(argv[optind++], root);
} else {
root = push_entry(argv[optind++], root);