Category: Developer Tooling & Host Tools
Inspiration
Every QNX utility carries a built-in usage message that use <program> prints. Developers write it in an #ifdef __USAGE … #endif block and embed it with usemsg. Nothing checks that block, so options get added to getopt() and never documented, documented options disappear from the code, %C ends up in the wrong column, and a stray apostrophe breaks the compile.
What it does
usecheck reads C sources and shell scripts and:
- cross-checks the usage message against getopt(): undocumented options, documented-but-unimplemented options ("illegal option" for users), and options whose argument doesn't match (
p:vs-pshown without a value) - validates the usemsg grammar from the QNX SDP 8.0 Utilities Reference:
%%,%-command,%=language,%C<tab>in column 1, command/language nesting, the 400-line x 1024-character limit, unclosed#ifdef __USAGE - flags the classic odd-single-quote problem in uncommented blocks (QNX cookbook, "Usage messages")
- warns when a program with main() has no usage message at all
- renders the message exactly as
useprints it (--render,--lang), including%C<tab>substitution and tab-continuation alignment, so you can review it without building, embedding and running it on a target
How it uses QNX
It implements the usage-message format defined by the QNX SDP 8.0 usemsg and use utilities (C sources and shell scripts) and supports the host-side QNX workflow: run it in CI before usemsg -c myprog myprog.c embeds the message into the QNX binary. Where to look: src/usage.ts (extraction, grammar, rendering, getopt cross-check), examples/sensord.c (every problem planted), test/usage.test.js.
How we built it
TypeScript, zero runtime dependencies, 12 unit tests. Runs on Linux, macOS and Windows hosts, and needs no QNX license.
How it differs from our other entry (ifslint)
ifslint checks OS image buildfiles (mkifs). usecheck checks program source code and the usage messages built into QNX executables, a different file format, different QNX utilities and a different stage of the workflow.
Built with AI assistance (Claude); grammar checked against the QNX SDP 8.0 usemsg and use references.