Current directory is assumed when no directory is given on the commandline (more du-like), and give a proper error if a given dir exceeds PATH_MAX
git-svn-id: svn://blicky.net/ncdu/trunk@43 ce56bc8d-f834-0410-b703-f827bd498a76
Этот коммит содержится в:
родитель
fec2f9a1c0
Коммит
57be9e2905
@ -1,6 +1,7 @@
|
|||||||
svn - ?
|
svn - ?
|
||||||
- Fixed incorrect apparent size on directory refresh
|
- Fixed incorrect apparent size on directory refresh
|
||||||
- Browsing keys now work while file info window is displayed
|
- Browsing keys now work while file info window is displayed
|
||||||
|
- Current directory is assumed when no directory is specified
|
||||||
|
|
||||||
1.4 - 2008-09-10
|
1.4 - 2008-09-10
|
||||||
- Removed the startup window
|
- Removed the startup window
|
||||||
|
11
src/main.c
11
src/main.c
@ -43,7 +43,6 @@ void parseCli(int argc, char **argv) {
|
|||||||
sflags = 0;
|
sflags = 0;
|
||||||
sdelay = 100;
|
sdelay = 100;
|
||||||
bflags = BF_SIZE | BF_DESC;
|
bflags = BF_SIZE | BF_DESC;
|
||||||
sdir[0] = '\0';
|
|
||||||
|
|
||||||
/* read from commandline */
|
/* read from commandline */
|
||||||
for(i=1; i<argc; i++) {
|
for(i=1; i<argc; i++) {
|
||||||
@ -88,14 +87,12 @@ void parseCli(int argc, char **argv) {
|
|||||||
} else {
|
} else {
|
||||||
sdir[PATH_MAX - 1] = 0;
|
sdir[PATH_MAX - 1] = 0;
|
||||||
strncpy(sdir, argv[i], PATH_MAX);
|
strncpy(sdir, argv[i], PATH_MAX);
|
||||||
if(sdir[PATH_MAX - 1] != 0)
|
if(sdir[PATH_MAX - 1] != 0) {
|
||||||
sdir[0] = 0;
|
printf("Error: path length exceeds PATH_MAX\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!sdir[0]) {
|
|
||||||
printf("Please specify a directory.\nSee '%s -h' for more information.\n", argv[0]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user