diff --git a/clite/commands.js b/clite/commands.js index b8664c2..a69d836 100644 --- a/clite/commands.js +++ b/clite/commands.js @@ -147,6 +147,8 @@ Options: if (st.type != stdio.types.FT_DIR) { writeNodeData(st,fd); stdio.close(fd); + if (!one && !long) + stdio.write(io.stdout,'\n'); return; } var e; diff --git a/clite/core.js b/clite/core.js index 88b3429..87e72be 100644 --- a/clite/core.js +++ b/clite/core.js @@ -1312,7 +1312,6 @@ cat -l /usr/share/introduction clite.user.hasAltLogin = function() { let r = false; data.users.forEach(function(u) { - console.log(u.name+':'+u.pass); if (u.name != 'root' && u.pass != 'x') r = true; }); @@ -2613,7 +2612,6 @@ clite.vfs = { return true; } clite.vfs.restoreFile = function(path) { - console.log('restore: '+path); var b = clite.state.bios.io.read(2); if (!b) return false; diff --git a/clite/shell.js b/clite/shell.js index ba2c58f..6dd9272 100644 --- a/clite/shell.js +++ b/clite/shell.js @@ -932,12 +932,12 @@ Options: }); if (add == '') { // test for commands - var pparts = env.PATH.split(':'); + let pparts = env.PATH.split(':'); pparts.forEach(function(pp) { if (add != '') return; - var fd = stdio.open('/bin',stdio.flags.O_SEARCH|stdio.flags.O_DIRECTORY); - var f; + let fd = stdio.open('/bin',stdio.flags.O_SEARCH|stdio.flags.O_DIRECTORY); + let f = null; while (add == '' && (f = stdio.read(fd)) != null) { if (f.substring(0,a.length) == a) { add = f.substring(a.length)+' '; @@ -946,8 +946,29 @@ Options: stdio.close(fd); }); } - }else{ + }else if (a != '') { // TODO: path fill + let p = clite.resolvePath(a); + if (p[0] == '/') { + let d = stdlib.dirname(p); + let b = stdlib.basename(p); + if (d == '') + d = '/'; + let fd = stdio.open(d,stdio.flags.O_SEARCH|stdio.flags.O_DIRECTORY); + if (fd) { + let f = null; + while (add == '' && (f = stdio.read(fd)) != null) { + if (f.substring(0,b.length) == b) { + add = f.substring(b.length); + let fp = d+'/'+f; + let st = stdio.stat(fp); + if (st && st.type != stdio.types.FT_DIR) + add += ' '; + } + } + stdio.close(fd); + } + } } if (add == '') return null; @@ -991,6 +1012,8 @@ Options: if (ct != null) { c = ct; cc = c.length; + }else{ + stdio.write(io.stdout,'\b \b'); } break; case '\n': // enter @@ -1034,7 +1057,7 @@ Options: } break; default: - if (typeof str === 'string') { + if (typeof str === 'string' && str.length == 1) { c += str; cc++; history.setCurrent(c);