mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-02 17:28:30 +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
|
@ -19,8 +19,8 @@
|
|||
#include "libc/macros.internal.h"
|
||||
|
||||
.macro .e e s
|
||||
.long \e - kStrSignal
|
||||
.long 1f - kStrSignal
|
||||
.long \e - kSignalNames
|
||||
.long 1f - kSignalNames
|
||||
.rodata.str1.1
|
||||
1: .string "\s"
|
||||
.previous
|
||||
|
@ -29,7 +29,7 @@
|
|||
.section .rodata
|
||||
.align 4
|
||||
.underrun
|
||||
kStrSignal:
|
||||
kSignalNames:
|
||||
.e SIGHUP,"HUP"
|
||||
.e SIGINT,"INT"
|
||||
.e SIGQUIT,"QUIT"
|
||||
|
@ -65,6 +65,6 @@ kStrSignal:
|
|||
.e SIGRTMIN,"RTMIN"
|
||||
.e SIGEMT,"EMT"
|
||||
.e SIGPWR,"PWR"
|
||||
.long 0
|
||||
.endobj kStrSignal,globl,hidden
|
||||
.long -123
|
||||
.endobj kSignalNames,globl,hidden
|
||||
.overrun
|
|
@ -53,7 +53,7 @@ static inline int pntz(size_t p[2]) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* smoothsort_shl() and smoothsort_shr() need n > 0 */
|
||||
// smoothsort_shl() and smoothsort_shr() need n > 0
|
||||
static inline void smoothsort_shl(size_t p[2], int n) {
|
||||
if (n >= CHAR_BIT * sizeof(size_t)) {
|
||||
n -= CHAR_BIT * sizeof(size_t);
|
||||
|
@ -163,7 +163,7 @@ static void smoothsort(struct SmoothSort *s, void *base, size_t nel,
|
|||
if (!size) return;
|
||||
head = base;
|
||||
high = head + size - width;
|
||||
/* Precompute Leonardo numbers, scaled by element width */
|
||||
// precompute Leonardo numbers, scaled by element width
|
||||
for (s->lp[0] = s->lp[1] = width, i = 2;
|
||||
(s->lp[i] = s->lp[i - 2] + s->lp[i - 1] + width) < size; i++) {
|
||||
}
|
||||
|
|
|
@ -192,7 +192,6 @@ wchar_t *wmempcpy(wchar_t *, const wchar_t *, size_t) memcpyesque;
|
|||
wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t) memcpyesque;
|
||||
void *tinymemccpy(void *, const void *, int, size_t) memcpyesque;
|
||||
void *memmem(const void *, size_t, const void *, size_t) libcesque nosideeffect;
|
||||
char *strerror(int) returnsnonnull dontthrow nocallback;
|
||||
long a64l(const char *);
|
||||
char *l64a(long);
|
||||
|
||||
|
@ -262,14 +261,12 @@ wint_t towctrans(wint_t, wctrans_t);
|
|||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
|
||||
char *strsignal(int) returnsnonnull libcesque;
|
||||
char *strerror(int) returnsnonnull dontthrow nocallback;
|
||||
const char *strerrno(int) nosideeffect libcesque;
|
||||
const char *strerdoc(int) nosideeffect libcesque;
|
||||
int strerror_r(int, char *, size_t) dontthrow nocallback;
|
||||
int strerror_wr(int, uint32_t, char *, size_t) dontthrow nocallback;
|
||||
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
/* gcc rewrites to memset otherwise :'( */
|
||||
void __bzero(void *, size_t) asm("bzero") memcpyesque;
|
||||
#define bzero(DEST, SIZE) \
|
||||
((void)((__builtin_constant_p(SIZE)) ? memset(DEST, 0, SIZE) \
|
||||
: __bzero(DEST, SIZE)))
|
||||
#endif /* __GNUC__ && !__STRICT_ANSI__ */
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_STR_STR_H_ */
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/fmt/kerrornames.internal.h"
|
||||
#include "libc/fmt/magnumstrs.internal.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
|
@ -35,15 +35,12 @@ static char g_strsignal[12];
|
|||
* @see sigaction()
|
||||
*/
|
||||
char *strsignal(int sig) {
|
||||
int i;
|
||||
const char *s;
|
||||
strcpy(g_strsignal, "SIG");
|
||||
if (sig) {
|
||||
for (i = 0; kStrSignal[i].x; ++i) {
|
||||
if (sig == *(const int *)((uintptr_t)kStrSignal + kStrSignal[i].x)) {
|
||||
strcpy(g_strsignal + 3,
|
||||
(const char *)((uintptr_t)kStrSignal + kStrSignal[i].s));
|
||||
return g_strsignal;
|
||||
}
|
||||
if ((s = GetMagnumStr(kSignalNames, sig))) {
|
||||
strcpy(g_strsignal + 3, s);
|
||||
return g_strsignal;
|
||||
}
|
||||
}
|
||||
if (!sig) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue