# Tools

Various handy Fossil-related utilities.

## Tools related to building Fossil

* `makemake.tcl` generates `src/main.mk` and the makefiles in `win/`.
  `www/makefile.wiki` describes the build.
* `translate.c` turns the `@` lines of HTML in `src/*.c` into C.
  `makeheaders.c` writes the header for each source file; `makeheaders.html`
  documents it. `mkindex.c` builds the tables of commands, web pages and
  settings from specially formatted comments. `mkversion.c` writes
  `VERSION.h`. `mkbuiltin.c` turns the files built into Fossil, such as skins
  and JavaScript, into C arrays.
* `sqlcompattest.c` is the program `configure --disable-internal-sqlite`
  compiles to check that the system SQLite is new enough.
* `emcc.sh.in` is the template `configure` uses to write `emcc.sh`, the
  wrapper for the Emscripten compiler that `make wasm` runs.
  `randomize-js-names.tcl` then renames `extsrc/pikchr.wasm` and
  `extsrc/pikchr.js` so that browsers do not use a stale cached copy.
* `codecheck1.c` checks the printf-style format strings in the source, and
  warns of strings that could inject SQL or HTML.

## Tools for Fossil's documentation

* `man_page_command_list.tcl` writes the list of common commands for
  `fossil.1`.
* `encode_math.sh` renders the equations in `art/encode*.tex` with mimetex.
  Those `.tex` files aren't in the tree.

## Tools for testing Fossil

* `powerloss/powerloss.c` is an `LD_PRELOAD` library for Linux/BSD that stops
  a program at each point where its SQLite database files could reach the
  disk. `test/powerloss.test` runs Fossil commands under it, and
  `powerloss/powerloss.sh` runs `fossil commit` under it by hand. See
  [README-POWERLOSS.md](./powerloss/README-POWERLOSS.md).
* `testbuild.sh` makes a build with ASan and UBSan, or a build that records
  coverage, and prints the branch coverage of each source file.
  `test/README.md` describes its use.
* `fossil-stress.tcl` sends HTTP requests to a Fossil server as fast as it
  can.
* `fake-smtpd.tcl` listens like an SMTP server and prints the conversation,
  for testing the email relay method.

## Helpful tools for Fossil users

* `fslsrv` is an example wrapper that starts `fossil server`, as per
  `www/server/any/none.md`.
* `find-fossil-cgis.tcl` finds the CGI scripts that launch Fossil under a
  directory.
* `email-sender.tcl` forwards each email Fossil has queued in a database to
  `/usr/sbin/sendmail`, and `email-monitor.tcl` prints the "To:" line of each
  message as it arrives. `decode-email.c` prints a raw email message in
  readable form.
* `skintxt2config.c` converts skin files into `fossil config import` format.
* `fossil-autocomplete.bash` and `fossil-autocomplete.zsh` are autocomplete
  scripts for Bash and Zsh.
* `fossil-diff-log` prints the diff of each version of requested files,
  similar to `git log -p`.
* `fossilwiki` is a script to report empty, orphaned and unlinked wiki pages,
  and broken wiki links.
* `co-rsync.tcl` copies the uncommitted changes in a check-out to another
  machine over SSH.
* `cvs2fossil/` is a non-working CVS importer from 2007. It calls Fossil
  commands that no longer exist.
