mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
Improve linenoise and get it working on Windows
Some progress has been made on introducing completion but there's been difficulties using the Python C API to get local shell variables.
This commit is contained in:
parent
968474d291
commit
5029e20bef
23 changed files with 408 additions and 209 deletions
|
@ -16,15 +16,11 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/fmt/fmt.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "tool/build/lib/psk.h"
|
||||
|
||||
/**
|
||||
|
@ -32,23 +28,9 @@
|
|||
*/
|
||||
void *GetRunitPsk(void) {
|
||||
int fd;
|
||||
char *r, *p;
|
||||
struct stat st;
|
||||
const char *a, *b;
|
||||
char *r, p[PATH_MAX + 1];
|
||||
if ((a = getenv("HOME"))) {
|
||||
b = "";
|
||||
} else if (IsWindows()) {
|
||||
a = getenv("HOMEDRIVE");
|
||||
b = getenv("HOMEPATH");
|
||||
if (!a || !b) {
|
||||
a = "C:";
|
||||
b = "";
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "need $HOME\n");
|
||||
exit(1);
|
||||
}
|
||||
snprintf(p, sizeof(p), "%s%s/.runit.psk", a, b);
|
||||
p = gc(xasprintf("%s/.runit.psk", gc(xhomedir())));
|
||||
if (stat(p, &st) == -1 || st.st_size != 32) {
|
||||
fprintf(stderr, "need o//examples/getrandom.com -bn32 >~/.runit.psk\n");
|
||||
exit(1);
|
||||
|
|
|
@ -1216,6 +1216,27 @@ static optimizesize void ReadKeyboard(void) {
|
|||
case 'S': /* \eOS is F4 */
|
||||
pf4_ = !pf4_;
|
||||
break;
|
||||
case 'T': /* \eOT is F5 */
|
||||
pf5_ = !pf5_;
|
||||
break;
|
||||
case 'U': /* \eOU is F6 */
|
||||
pf6_ = !pf6_;
|
||||
break;
|
||||
case 'V': /* \eOV is F7 */
|
||||
pf7_ = !pf7_;
|
||||
break;
|
||||
case 'W': /* \eOW is F8 */
|
||||
pf8_ = !pf8_;
|
||||
break;
|
||||
case 'Y': /* \eOY is F10 */
|
||||
pf10_ = !pf10_;
|
||||
break;
|
||||
case 'Z': /* \eOZ is F11 */
|
||||
pf11_ = !pf11_;
|
||||
break;
|
||||
case '[': /* \eO[ is F12 */
|
||||
pf12_ = !pf12_;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue