1
0
This commit is contained in:
dtb 2021-08-06 15:31:31 -04:00
parent d4de83a921
commit 32623ec3dd

View File

@ -43,6 +43,7 @@ exit 0
This happens to be nearly identical in source to the implementation used by NetBSD. This happens to be nearly identical in source to the implementation used by NetBSD.
</P> </P>
<P> <P>
Python has the same 0 byte <CODE>true(1)</CODE> implementation feature as most shells.
Here's <CODE><I>false</I>(1)</CODE> in Python rather than <CODE>true(1)</CODE> to demonstrate how exiting with an arbitrary exit status can be done: Here's <CODE><I>false</I>(1)</CODE> in Python rather than <CODE>true(1)</CODE> to demonstrate how exiting with an arbitrary exit status can be done:
</P> </P>
<PRE><CODE CLASS="language-python" DATA-LANG="python"> <PRE><CODE CLASS="language-python" DATA-LANG="python">
@ -56,6 +57,8 @@ In some shells, <CODE>true(1)</CODE> is a shell built-in command, so running <CO
GNU <CODE>true(1)</CODE>, from the GNU coreutils, deserves a special mention, as it's eighty lines long and directly includes four C header files. GNU <CODE>true(1)</CODE>, from the GNU coreutils, deserves a special mention, as it's eighty lines long and directly includes four C header files.
This is not a joke. This is not a joke.
Their <CODE>true.c</CODE> is 2.3 kilobytes, parses the arguments <CODE>--help</CODE> and <CODE>--version</CODE> (only if either are the first argument to the program), and I don't know how big the executable ends up being because the first thing I do when I take control of a GNU system is <CODE>printf "#/bin/sh\nexit 0\n"|dd of="$(which true)";chmod +x "$(which true)"</CODE> (<B>use at your own risk</B>). Their <CODE>true.c</CODE> is 2.3 kilobytes, parses the arguments <CODE>--help</CODE> and <CODE>--version</CODE> (only if either are the first argument to the program), and I don't know how big the executable ends up being because the first thing I do when I take control of a GNU system is <CODE>printf "#/bin/sh\nexit 0\n"|dd of="$(which true)";chmod +x "$(which true)"</CODE> (<B>use at your own risk</B>).
This implementation is not POSIX compliant.
</P>
<H2>Cited media and further reading</H2><UL> <H2>Cited media and further reading</H2><UL>
<LI>Articles<UL> <LI>Articles<UL>
<LI><A HREF="https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html">Brian Raiter - A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux</A></LI> <LI><A HREF="https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html">Brian Raiter - A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux</A></LI>