diff options
| author | H. Peter Anvin <hpa@zytor.com> | 2010-03-06 15:13:36 -0800 |
|---|---|---|
| committer | H. Peter Anvin <hpa@zytor.com> | 2010-03-06 15:13:36 -0800 |
| commit | 67d39f0d29bcd982a2976d9c1649cd891ab5405c (patch) | |
| tree | 97018507e18eab6623d7e4034542bf366eb259cc | |
| parent | dfcce638fab9ff25660ebf5207000964a1aa64ef (diff) | |
| download | syslinux-4.00-pre35.tar.gz | |
dir.c32: allow "dir" without an argument to mean "dir ."syslinux-4.00-pre35
People logically expect "dir" to display the current directory.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| -rw-r--r-- | com32/modules/dir.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/com32/modules/dir.c b/com32/modules/dir.c index cb83f97b..10fa5c2b 100644 --- a/com32/modules/dir.c +++ b/com32/modules/dir.c @@ -147,19 +147,25 @@ nomem: int main(int argc, char *argv[]) { + int rv; + openconsole(&dev_rawcon_r, &dev_stdcon_w); - if (argc != 2) { - printf("Usage: dir directory\n"); - return 0; - } - if (getscreensize(1, &rows, &cols)) { /* Unknown screen size? */ rows = 24; cols = 80; } - return display_directory(argv[1]); + if (argc < 2) + rv = display_directory("."); + else if (argc == 2) + rv = display_directory(argv[1]); + else { + printf("Usage: dir directory\n"); + rv = 1; + } + + return rv ? 1 : 0; } |
