Write a Book in a Day—No Writing Skills Needed (5)

1 Name: Rosalind Chestnut : 2025-09-06 09:18 ID:T4XSuWgK

Hi,

We have a promotional offer for your website 3chen.org.

Why should you care? Because Book In A Day lets you turn your ideas into a polished, professional book in just hours—not months. No writing skills, no expensive editors, no formatting headaches. Simply follow the AI-driven, step-by-step system and you’re done! Publish your book, build authority, and start earning—effortlessly, swiftly, and stress-free.

See it in action: http://smartexperts.pro/BookInADay

You are receiving this message because we believe our offer may be relevant to you.
If you do not wish to receive further communications from us, please click here to UNSUBSCRIBE:
https://smartexperts.pro/unsub?domain=3chen.org
Address: Address: 1464 Lewis Street Roselle, IL 60177
Looking out for you, Michael Turner.

2 Name: Anon : 2025-09-08 21:15 ID:vlt8WjHN

# Long options
The GNU implementation of `getopts_long()` has become a de facto standard of itself.
There are some things I like about it:
* how -W is handled

I also take multiple issues with it:
* alternative argument syntaxes
* abbreviations
* short/long argument inconsistency
* `getopt_long_only` exists
* `.flag` exists

Explanations below.

Short options support the `-aparam`.
Long options support the `--arg=param` syntax.
You could very well make `-a=p` and `--a=p` do different things, but I digress.
You do not need either of these except for historical novelty.

Abbreviations sort of miss the point of short vs long options,
but the real problem is that now introducing a new flag may break any script,
as any script could use an abbreviation.

In all sane programs, short and long argument pairs are equivalent.
This should be trivial, since that's what defines a pair: their shared behaviour.
However, `getopts_long` doesn't care.
You could specify `-a` to take an argument and `--arg` as no\_argument.
Now -to not crash your code- you must check the value of `longindex` in your case
before shooting the user in the foot.
As far as I can tell, this is the only use for `longindex` too.
Unless you consider adding a `--arg-2` and `--arg-3` to switch inside your switch.

`getopt_long_only` is a nightmare.
Contrary to its name, it does parse short options.
The thing it actually changes is *how* they are parsed.
The `-` prefix now becomes legal for long options
and they are evaluated before long options.
Mind you, option packing is supported.
This leaves us with the absurd situation where
if we arrange short options such that they so happen to spell out a long option,
it is a long option now!

For the visual types:
```C
// suddenly -ex is not equivalent to -e -x, -x -e or -xe
struct option long_options[] = {
{ "ex", no_argument, NULL, 'X' },
{ 0, 0, 0, 0 },
};

int c;
while ((c = getopt_long_only(argc, argv, "ex", long_options, NULL)) != -1) {
switch (c) {
case 'e': case 'x': case 'X': {
C = c;
} break;
}
}
```

The option structure's flag field is used to trade
expressive imperative grammar for the most restrictive declarative grammar imaginable.
This could be a valid opinion, however you are almost guaranteed to mix the two grammars,
throwing away the readability of both.
Or, if not, it's not really the `getopts` API you need, is it?

3 Name: Anon : 2025-09-08 21:15 ID:vlt8WjHN

## How many people use the flag field?
A stunning 9%.
I was honestly expecting significantly less.
Below is the data of my research.

> [!NOTE]
> Collected from github using the query `getopt_long language:C`.

> [!NOTE]
> Forks of the same projects have been removed.

> [!NOTE]
> Projects where the long options struct[] were empty
> or I could not find the definition reasonably fast, have been excluded.

| User | Project | Flag used? |
| ---- | ------- | ---------- |
| svpcom | c1cap | no |
| JamesSCrook | pma | no |
| eugenefil | qdl | no |
| kdrag0n | passt-virtcontainer | yes |
| dgouders | lsp | no |
| open-mesh-mirror | alfred | no |
| generic-github-user | CA2 | no |
| gportay | iamroot | no |
| n7nix | dantracker | no |
| Electrajailbreak | electra-patched | no |
| nelhage | barnowl | no |
| thinkingsand | rat | no |
| SDL-Hercules-390 | hyperion | no |
| saeedtx | mlx5ctl | no |
| jeremija | htop | no |
| keyehzy | dos | no |
| rsenn | c-utils | yes |
| stffrdhrn | junk | no |
| DDNStorage | fio-public | no |
| standage | smr | no |
| dl9pf | httptunnel | no |
| deepankarsharma | ftq | no |
| MoofiaSantoos | Implementation\_of\_cat\_function | no |
| cryptobuks | n2n | no |
| jcadduono | adroid\_external\_bbe | no |
| balabit-deps | balabit-os-7-net-tools | no |
| rampageX | net-tools | no |
| ACTPic | feurezeug | no |
| Senjai | fzy | no |
| gbraad-amiga | uade-rmc | no |
| rouming | dla | no |
| drmocm | DD\_SX8\_SDR | no |
| jollen | ldt | yes |
| alfille | sumofsquares | no |
| ns30shel | NES\_Emulator\_CSIS330\_Term\_Project | no |
| perillamint | bti | no |
| crisnicogonzalez | Base64-Encode-Decode-MIPS | no |
| avagin | procps-task-diag | no |
| keithnoguchi | lsp | no |
| bpineau | stud | yes |
| nkk71 | multirom\_adbd | no |
| ibara | opengit | no |
| glenvt18 | vdr-from-ftp | no |
| rymarmary | coursework\_images | no |
| loongson | risu | yes |
| rafalmiel | simple-video-viewer | no |
| tanuj-maheshwari | ssdsim | no |
| jyd519 | fileutil-ls | no |
| tsurutan | sample\_c | no |
| msteinert | BIO-xor | no |
| dreiss | triggerhappy | no |
| chbarts | web | no |
| hbars | rpinas | no |
| shanezhiu | c-src | yes |
| sanmai | EZ-WifiBroadcast | yes |
| zhelih | bicliquer | no |
| 2n | 2n.c | no |
| avionic-design | adak | no |
| huaicheng | sio | no |
| rocky-luo | cv | no |
| lromor | avx-sandbox | no |
| zhuanyeshiti | rty | no |
| lollipopman | procps | no |
| madams51703 | SGA\_Direct\_memory\_access | no |
| jschiefer | ka9q-radio | no |
| koutsie | kkcube | no |
| sebastinas | yafc | no |
| hpc | Parallel-coreutils | no |
| mslusarz | csv-nix-tools | no |
| pgspider | pgspider | no |
| teuben | nemo | no |
| goj | coreutils | no |
| jaymzh | concordance | no |
| LLNL | scr | no |
| microsoft | Freeflow | no |
| ghedo | pflask | no |
| polardb | polardbx-engine | no |
| openSUSE | mksusecd | no |
| 386bsd | 386bsd | no |
| ultravideo | uvg266 | no |
| openss7 | openss7 | no |
| openzfsonwindows | ZFSin | no |
| cyrusimap | cyrus-imapd | no |
| liblouis | liblouis | yes |
| rhboot | shim | no |
| zyearn | zaver | no |
| owntone | owntone-server | no |
| SchedMD | slurm | no |
| systemd | systemd | no |
| soderstrom-rikard | adi-toolchain | no |
| Hypfer | i7z | no |
| RoundofThree | gdb | yes |
| xbianonpi | xbian-package-vdr | no |
| Olatunde16 | alx-system\_engineering-devops | no |
| ecki | net-tools | no |
| BGBEAST | libmsr | no |
| foolean | blum-blum-shub | no |
| zjcszn | embeded-lib | no |
| Bu661e | OperatingSystem | no |
| crossmeta | busybox | no |

4 Name: Anon : 2025-09-08 21:17 ID:vlt8WjHN

Yes, this is most definitely the thread I wanted to reply to.
I am -in fact- NOT confused by textboardware.

5 Name: email email emailious master of shitty text boards : 2025-09-08 21:43 ID:E9bHe9Jd

based bot shitting on 3chen I VILL have a book shadowwritten for no particular reason and waste money doing it and have literally no one ever ever read it.
Name: Link:
Leave these fields empty (spam trap):
More options...
Verification: