Skip to content

Commit cc37e94

Browse files
committed
[filesystem] Treat filename as case insensitive
1 parent 62c0b12 commit cc37e94

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/kernel/syscall/file_handler.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ int fh_switch(int operation) {
1111
}
1212

1313
int file_handler_find(char *filename, union FFSFileEntry *entry) {
14+
// search for filename case insensitive as keyboard driver currently
15+
// doesn't support shift or caps lock.
1416
int file_id = 0;
1517
while (file_id < FS_FFS_FILEENTRY_COUNT) {
1618
int err = fetch_file_entry(
1719
FFS_UNIQUE_PARITION_ID, file_id, entry);
18-
if(!err && strcmp(filename, entry->content.filename)==0) {
20+
if(!err && strcmpi(filename, entry->content.filename)==0) {
1921
// match
2022
return file_id;
2123
}

src/usr/local/src/cat.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
#include <string.h>
44

55
void process(char filename[]) {
6-
printf("file: %s\n", filename);
7-
86
FILE *handler = fopen(filename, "r");
97
if(handler==NULL) {
10-
printf("file open: failed: %s\n", filename);
8+
printf("failed to open '%s' file.\n", filename);
119
return;
1210
}
13-
puts("content: \n");
1411
char buffer[80];
1512
for (size_t i = 0; i < 20; i++) {
1613
if (!fgets(buffer, sizeof(buffer), handler)) {

tests/app/cat_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
QEMU_SCREENSHOT_NAME="cat_test.ppm"
66

7-
python3 -m tests.qemu.monitor -p ${MONITOR_PORT:?} -sc run cat
7+
python3 -m tests.qemu.monitor -p ${MONITOR_PORT:?} -sc run cat readme.md
88

99
test_create_screen_dump
1010
test_screen_content $LINENO "Experimental OS"

0 commit comments

Comments
 (0)