mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-25 06:42:27 +00:00
Make improvements
- Expand redbean UNIX module - Expand redbean documentation - Ensure Lua copyright is embedded in binary - Increase the PATH_MAX limit especially on NT - Use column major sorting for linenoise completions - Fix some suboptimalities in redbean's new UNIX API - Figured out right flags for Multics newline in raw mode
This commit is contained in:
parent
cf3174dc74
commit
2046c0d2ae
305 changed files with 6602 additions and 4221 deletions
2
third_party/python/Modules/termios.c
vendored
2
third_party/python/Modules/termios.c
vendored
|
@ -603,7 +603,7 @@ PyInit_termios(void)
|
|||
if (IXANY) PyModule_AddIntConstant(m, "IXANY", IXANY);
|
||||
if (IXOFF) PyModule_AddIntConstant(m, "IXOFF", IXOFF);
|
||||
if (IMAXBEL) PyModule_AddIntConstant(m, "IMAXBEL", IMAXBEL);
|
||||
if (OPOST) PyModule_AddIntConstant(m, "OPOST", OPOST);
|
||||
PyModule_AddIntConstant(m, "OPOST", OPOST);
|
||||
if (OLCUC) PyModule_AddIntConstant(m, "OLCUC", OLCUC);
|
||||
if (ONLCR) PyModule_AddIntConstant(m, "ONLCR", ONLCR);
|
||||
if (OCRNL) PyModule_AddIntConstant(m, "OCRNL", OCRNL);
|
||||
|
|
10
third_party/python/pyobj.c
vendored
10
third_party/python/pyobj.c
vendored
|
@ -35,6 +35,7 @@
|
|||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "libc/zip.h"
|
||||
#include "third_party/getopt/getopt.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
|
@ -658,16 +659,19 @@ Objectify(void)
|
|||
if (ispkg) {
|
||||
elfwriter_zip(elf, zipdir, zipdir, strlen(zipdir),
|
||||
pydata, 0, 040755, timestamp, timestamp,
|
||||
timestamp, nocompress, image_base);
|
||||
timestamp, nocompress, image_base,
|
||||
kZipCdirHdrLinkableSize);
|
||||
}
|
||||
if (!binonly) {
|
||||
elfwriter_zip(elf, gc(xstrcat("py:", modname)), zipfile,
|
||||
strlen(zipfile), pydata, pysize, st.st_mode, timestamp,
|
||||
timestamp, timestamp, nocompress, image_base);
|
||||
timestamp, timestamp, nocompress, image_base,
|
||||
kZipCdirHdrLinkableSize);
|
||||
}
|
||||
elfwriter_zip(elf, gc(xstrcat("pyc:", modname)), gc(xstrcat(zipfile, 'c')),
|
||||
strlen(zipfile) + 1, pycdata, pycsize, st.st_mode, timestamp,
|
||||
timestamp, timestamp, nocompress, image_base);
|
||||
timestamp, timestamp, nocompress, image_base,
|
||||
kZipCdirHdrLinkableSize);
|
||||
elfwriter_align(elf, 1, 0);
|
||||
elfwriter_startsection(elf, ".yoink", SHT_PROGBITS,
|
||||
SHF_ALLOC | SHF_EXECINSTR);
|
||||
|
|
11
third_party/python/repl.c
vendored
11
third_party/python/repl.c
vendored
|
@ -87,7 +87,7 @@ CompleteModule(const char *s, const char *p, linenoiseCompletions *c)
|
|||
PyObject *m, *f, *g, *i, *v, *n;
|
||||
plen = strlen(p);
|
||||
for (it = PyImport_Inittab; it->name; ++it) {
|
||||
if (startswith(it->name, p)) {
|
||||
if (startswithi(it->name, p)) {
|
||||
AddCompletion(c, xasprintf("%s%s", s, it->name + plen));
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ CompleteModule(const char *s, const char *p, linenoiseCompletions *c)
|
|||
while ((v = PyIter_Next(i))) {
|
||||
if ((n = PyObject_GetAttrString(v, "name"))) {
|
||||
if (((name = PyUnicode_AsUTF8AndSize(n, &namelen)) &&
|
||||
namelen >= plen && !bcmp(name, p, plen))) {
|
||||
namelen >= plen && !memcasecmp(name, p, plen))) {
|
||||
AddCompletion(c, xasprintf("%s%s", s, name + plen));
|
||||
}
|
||||
Py_DECREF(n);
|
||||
|
@ -125,7 +125,7 @@ CompleteDict(const char *b, const char *q, const char *p,
|
|||
for (i = 0; PyDict_Next(o, &i, &k, &v);) {
|
||||
if ((v != Py_None && PyUnicode_Check(k) &&
|
||||
(s = PyUnicode_AsUTF8AndSize(k, &m)) &&
|
||||
m >= q - p && !bcmp(s, p, q - p))) {
|
||||
m >= q - p && !memcasecmp(s, p, q - p))) {
|
||||
AddCompletion(c, xasprintf("%.*s%.*s", p - b, b, m, s));
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,10 @@ CompleteDir(const char *b, const char *q, const char *p,
|
|||
if ((i = PyObject_GetIter(d))) {
|
||||
while ((k = PyIter_Next(i))) {
|
||||
if (((s = PyUnicode_AsUTF8AndSize(k, &m)) &&
|
||||
m >= q - p && !bcmp(s, p, q - p))) {
|
||||
m >= q - p && !memcasecmp(s, p, q - p) &&
|
||||
!(q - p == 0 && m > 4 &&
|
||||
(s[0+0] == '_' && s[0+1] == '_' &&
|
||||
s[m-1] == '_' && s[m-2] == '_')))) {
|
||||
AddCompletion(c, xasprintf("%.*s%.*s", p - b, b, m, s));
|
||||
}
|
||||
Py_DECREF(k);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue