mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +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
|
@ -34,6 +34,7 @@
|
|||
#include "libc/sysv/consts/prot.h"
|
||||
#include "libc/time/time.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "libc/zip.h"
|
||||
#include "third_party/getopt/getopt.h"
|
||||
#include "tool/build/lib/elfwriter.h"
|
||||
#include "tool/build/lib/stripcomponents.h"
|
||||
|
@ -48,6 +49,7 @@ int64_t image_base_;
|
|||
int strip_components_;
|
||||
const char *path_prefix_;
|
||||
struct timespec timestamp;
|
||||
size_t kZipCdirHdrLinkableSizeBootstrap;
|
||||
|
||||
wontreturn void PrintUsage(int rc, FILE *f) {
|
||||
fprintf(f, "%s%s%s\n", "Usage: ", program_invocation_name,
|
||||
|
@ -60,7 +62,8 @@ void GetOpts(int *argc, char ***argv) {
|
|||
int opt;
|
||||
yoink_ = "__zip_start";
|
||||
image_base_ = IMAGE_BASE_VIRTUAL;
|
||||
while ((opt = getopt(*argc, *argv, "?0nhBN:C:P:o:s:y:b:")) != -1) {
|
||||
kZipCdirHdrLinkableSizeBootstrap = kZipCdirHdrLinkableSize;
|
||||
while ((opt = getopt(*argc, *argv, "?0nhBL:N:C:P:o:s:y:b:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'o':
|
||||
outpath_ = optarg;
|
||||
|
@ -91,6 +94,9 @@ void GetOpts(int *argc, char ***argv) {
|
|||
case '0':
|
||||
nocompress_ = true;
|
||||
break;
|
||||
case 'L':
|
||||
kZipCdirHdrLinkableSizeBootstrap = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case '?':
|
||||
case 'h':
|
||||
PrintUsage(EXIT_SUCCESS, stdout);
|
||||
|
@ -135,7 +141,8 @@ void ProcessFile(struct ElfWriter *elf, const char *path) {
|
|||
}
|
||||
}
|
||||
elfwriter_zip(elf, name, name, strlen(name), map, st.st_size, st.st_mode,
|
||||
timestamp, timestamp, timestamp, nocompress_, image_base_);
|
||||
timestamp, timestamp, timestamp, nocompress_, image_base_,
|
||||
kZipCdirHdrLinkableSizeBootstrap);
|
||||
if (st.st_size) CHECK_NE(-1, munmap(map, st.st_size));
|
||||
close(fd);
|
||||
}
|
||||
|
@ -149,7 +156,8 @@ void PullEndOfCentralDirectoryIntoLinkage(struct ElfWriter *elf) {
|
|||
}
|
||||
|
||||
void CheckFilenameKosher(const char *path) {
|
||||
CHECK_LE(strlen(path), PATH_MAX);
|
||||
CHECK_LE(kZipCfileHdrMinSize + strlen(path),
|
||||
kZipCdirHdrLinkableSizeBootstrap);
|
||||
CHECK(!startswith(path, "/"));
|
||||
CHECK(!strstr(path, ".."));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue