Add glob and some finer tuning of documentation

This commit is contained in:
Justine Tunney 2020-06-21 00:10:11 -07:00
parent 799e24a87b
commit d51409ccd9
77 changed files with 1321 additions and 736 deletions

View file

@ -62,6 +62,7 @@
char *symbol_;
char *outpath_;
char *yoink_;
const size_t kMinCompressSize = 32;
const char kNoCompressExts[][8] = {".gz", ".xz", ".jpg", ".png",
@ -70,13 +71,14 @@ const char kNoCompressExts[][8] = {".gz", ".xz", ".jpg", ".png",
noreturn void PrintUsage(int rc, FILE *f) {
fprintf(f, "%s%s%s\n", "Usage: ", program_invocation_name,
" [-o FILE] [-s SYMBOL] [FILE...]\n");
" [-o FILE] [-s SYMBOL] [-y YOINK] [FILE...]\n");
exit(rc);
}
void GetOpts(int *argc, char ***argv) {
int opt;
while ((opt = getopt(*argc, *argv, "?ho:s:")) != -1) {
yoink_ = "__zip_start";
while ((opt = getopt(*argc, *argv, "?ho:s:y:")) != -1) {
switch (opt) {
case 'o':
outpath_ = optarg;
@ -84,6 +86,9 @@ void GetOpts(int *argc, char ***argv) {
case 's':
symbol_ = optarg;
break;
case 'y':
yoink_ = optarg;
break;
case '?':
case 'h':
PrintUsage(EXIT_SUCCESS, stdout);
@ -273,8 +278,7 @@ void PullEndOfCentralDirectoryIntoLinkage(struct ElfWriter *elf) {
elfwriter_align(elf, 1, 0);
elfwriter_startsection(elf, ".yoink", SHT_PROGBITS,
SHF_ALLOC | SHF_EXECINSTR);
elfwriter_yoink(elf, "__zip_start");
elfwriter_yoink(elf, "__zip_end");
elfwriter_yoink(elf, yoink_);
elfwriter_finishsection(elf);
}