07: C: Fix some warnings
This commit is contained in:
parent
6060b590d3
commit
3e5e62fe7b
1 changed files with 5 additions and 3 deletions
|
@ -55,19 +55,20 @@ int main(void) {
|
|||
char l[64];
|
||||
entry *root = calloc(1, sizeof(entry));
|
||||
root->isdir++;
|
||||
entry *current;
|
||||
entry *current = root;
|
||||
size_t S = 0, G = 0, required = 0;
|
||||
|
||||
while (fgets(l, 64, stdin)) {
|
||||
l[strlen(l) - 1] = '\0';
|
||||
if (l[0] == '$') {
|
||||
if (l[2] == 'c')
|
||||
if (l[2] == 'c') {
|
||||
if (l[5] == '/')
|
||||
current = root;
|
||||
else if (l[5] == '.')
|
||||
current = current->parent;
|
||||
else
|
||||
current = findent(current, 1, l + 5);
|
||||
}
|
||||
} else if (l[0] == 'd') {
|
||||
if (!findent(current, 1, l + 4))
|
||||
addent(current, 1, l + 4);
|
||||
|
@ -89,11 +90,12 @@ int main(void) {
|
|||
current->n_entries--;
|
||||
current = (current->entries++)[0];
|
||||
} else {
|
||||
if (current->isdir)
|
||||
if (current->isdir) {
|
||||
if (current->size < 100000)
|
||||
S += current->size;
|
||||
else if (current->size >= required && (current->size < G || !G))
|
||||
G = current->size;
|
||||
}
|
||||
|
||||
current = current->parent;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue