chamesle

chamesle.org: the site of Chamesle, a small Linux distribution
git clone https://github.com/tortr-rs/chamesle
Log | Files | Refs | README

handbook-rifle.html (5549B)


      1 <!doctype html>
      2 <html lang="en">
      3 <head>
      4 <meta charset="utf-8">
      5 <meta name="viewport" content="width=device-width, initial-scale=1">
      6 <title>rifle - Chamesle</title>
      7 <meta name="description" content="rifle is the coreutils of Chamesle on x86_64 in one C file, rifle.c, on c.h, a one-file libc. It has no GNU code in it and no">
      8 <link rel="canonical" href="https://chamesle.org/handbook-rifle.html">
      9 <meta property="og:type" content="website">
     10 <meta property="og:site_name" content="Chamesle">
     11 <meta property="og:title" content="rifle - Chamesle">
     12 <meta property="og:description" content="rifle is the coreutils of Chamesle on x86_64 in one C file, rifle.c, on c.h, a one-file libc. It has no GNU code in it and no">
     13 <meta property="og:url" content="https://chamesle.org/handbook-rifle.html">
     14 <link rel="stylesheet" href="style.css?25">
     15 <link rel="icon" href="img/logo.png">
     16 </head>
     17 <body>
     18 
     19 <div id="page">
     20 
     21 <div id="top">
     22 <h1><a href="./"><img src="img/banner.png" alt="Chamesle Linux" width="223" height="56"></a></h1>
     23 </div>
     24 
     25 <div id="nav">
     26 <a href="./">Home</a> |
     27 <a href="download.html">Download</a> |
     28 <b>Handbook</b> |
     29 <a href="packages.html">Packages</a> |
     30 <a href="new.html">News</a> |
     31 <a href="board.html">Board</a> |
     32 <a href="chat.html">Chat</a> |
     33 <a href="source.html">Source</a> |
     34 <a href="https://x22.chamesle.org/">X22</a> |
     35 <a href="https://github.com/tortr-rs/mag">mag</a> |
     36 <a href="about.html">About</a>
     37 </div>
     38 
     39 <main>
     40 <p><a href="handbook-mag.html">&larr; mag</a> | <a href="docs.html">Contents</a> | <a href="handbook-base.html">The base system &rarr;</a></p>
     41 <h2>5. rifle</h2>
     42 <h2 id="s5-1">5.1 What it is</h2>
     43 <p>rifle is the coreutils of Chamesle on x86_64 in one C file, <code>rifle.c</code>, on <code>c.h</code>, a one-file libc. It has no GNU code in it and no libc under it. It sorts and compares by bytes, always; there are no locales.</p>
     44 <p>There is one program. <code>cat</code>, <code>ls</code>, <code>cp</code> and the other commands are links to it, and it runs whichever name it was called by. You type <code>cat</code>, not <code>rifle cat</code>.</p>
     45 <h2 id="s5-2">5.2 The tools</h2>
     46 <pre>[ arch base32 base64 basename cat chgrp chmod chown chroot cksum comm cp cut date dd df dirname du echo env
     47 expand expr factor false fold groups head hostid hostname id install join link ln logname ls md5sum mkdir
     48 mkfifo mknod mktemp mv nice nl nohup nproc od paste printenv printf pwd readlink realpath rm rmdir seq
     49 sha1sum sha224sum sha256sum sha384sum sha512sum shuf sleep sort split stat sum sync tac tail tee test
     50 timeout touch tr true truncate tsort tty uname unexpand uniq unlink wc whoami yes</pre>
     51 <p>By what they do:</p>
     52 <table>
     53 <tr><th>group</th><th>tools</th></tr>
     54 <tr><td>files and directories</td><td><code>cp mv rm ln link unlink mkdir rmdir mkfifo mknod mktemp touch install truncate dd sync</code></td></tr>
     55 <tr><td>permissions and owners</td><td><code>chmod chown chgrp</code></td></tr>
     56 <tr><td>looking at files</td><td><code>ls stat du df cat tac head tail od nl wc cksum sum</code></td></tr>
     57 <tr><td>text</td><td><code>cut paste join comm sort uniq tr fold expand unexpand split shuf tsort tee</code></td></tr>
     58 <tr><td>checksums and encodings</td><td><code>md5sum sha1sum sha224sum sha256sum sha384sum sha512sum base32 base64</code></td></tr>
     59 <tr><td>names and paths</td><td><code>basename dirname pwd readlink realpath</code></td></tr>
     60 <tr><td>scripts and processes</td><td><code>echo printf printenv env test [ expr seq true false yes sleep nice nohup timeout chroot</code></td></tr>
     61 <tr><td>system and users</td><td><code>arch uname hostname hostid id groups whoami logname date nproc tty</code></td></tr>
     62 <tr><td>numbers</td><td><code>factor</code> (up to 64 bits)</td></tr>
     63 </table>
     64 <p>Not there yet: <code>stty</code>, <code>who</code> and friends, <code>fmt</code>, <code>pr</code>, <code>csplit</code>, <code>numfmt</code>, <code>shred</code>, <code>stdbuf</code>, <code>ptx</code>, <code>pathchk</code>, <code>dircolors</code>.</p>
     65 <h2 id="s5-3">5.3 Building</h2>
     66 <p>The <code>rifle</code> package has it built. From the sources:</p>
     67 <pre>cd $HOME/src/rifle
     68 ./build.sh</pre>
     69 <p>builds <code>rifle</code> with clang and lld (<code>CC</code> overrides <code>cc</code>) and makes the links in <code>bin/</code>. To put the links anywhere:</p>
     70 <pre>rifle --install /usr/bin
     71 rifle --list                   the names it knows</pre>
     72 <h2 id="s5-4">5.4 Tests</h2>
     73 <pre>tests/run.sh                   all the cases
     74 tests/run.sh sort              the cases that have `sort` in them</pre>
     75 <p>Each case in <code>tests/cases</code> runs once under GNU coreutils and once under rifle, and what they print and how they exit are compared. The machine that runs the tests therefore has GNU coreutils for the comparison; the installed system does not. <code>./build.sh</code> has to have run first. A case that starts with <code>@ro</code> runs with the whole file system read-only under <code>bwrap</code>, and is skipped when <code>bwrap</code> is missing.</p>
     76 <hr>
     77 <p><a href="handbook-mag.html">&larr; mag</a> | <a href="docs.html">Contents</a> | <a href="handbook-base.html">The base system &rarr;</a></p>
     78 </main>
     79 
     80 <hr>
     81 <div id="foot">
     82 Something wrong on this page? Tell us on the <a href="board.html">board</a>.<br>
     83 Chamesle installs with <code>chamesle-install</code>, or by hand from the <a href="docs.html">handbook</a>.<br>
     84 <a href="https://ko-fi.com/L6N725GI1V">Ko-fi</a><br>
     85 <a href="#" id="edit-link">Edit text</a><br>
     86 $Date: 2026-11-23 $
     87 </div>
     88 
     89 </div>
     90 
     91 <script src="edit.js"></script>
     92 </body>
     93 </html>