lex(1) on Solnix vs Linux and the BSDs
On Solnix, lex is the illumos lex at /usr/bin/lex, a separate implementation. On FreeBSD, lex is flex. The option sets differ. -w and -e mean EUC support on Solnix, but -w means 'suppress warnings' on FreeBSD, and Solnix has none of flex's long options or -s, -i, -l, -P, -o and -S.
The manual pages
- Solnix: lex(1) from
pkgs.solnix.illumos-world-man· illumos.org - FreeBSD: lex(1) 15.1-RELEASE
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
lex
What Solnix runs
A default Solnix system runs the illumos lex at /usr/bin/lex, published in pkgs.solnix.illumos-world-man. No other variants are shipped. The page does not say whether flex is available as a separate package.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| FreeBSD | implementation | Solnix lex is the illumos lex. FreeBSD lex is a name for flex, 'fast lexical analyzer generator', and the page documents flex options. Both write lex.yy.c by default. Source: Solnix lex(1) NAME, DESCRIPTION; FreeBSD lex(1) NAME, DESCRIPTION |
| FreeBSD | -w meaning | Solnix lex -w generates a program that handles EUC characters, with yytext[] as wchar_t[]. FreeBSD flex -w (--nowarn) suppresses warning messages. The same flag has unrelated effects.Source: Solnix lex(1) -w; FreeBSD lex(1) -w, --nowarn |
| FreeBSD | -e and EUC support | Solnix lex has -e for EUC characters, with yytext[] as unsigned char[]; it cannot be combined with -w. The FreeBSD synopsis and option list have no -e.Source: Solnix lex(1) SYNOPSIS, -e; FreeBSD lex(1) SYNOPSIS |
| FreeBSD | -c and -n | On Solnix, -c selects C-language actions (the default) and -n suppresses the -v statistics summary. On FreeBSD both are do-nothing, deprecated options kept for POSIX compliance. -n does not change FreeBSD output.Source: Solnix lex(1) -c, -n; FreeBSD lex(1) -c, -n |
| FreeBSD | -v statistics | Both write a statistics summary to standard error with -v. Solnix ties it to table sizes in the lex source: -n is implied if no sizes are given and -v is absent. FreeBSD's summary starts with the flex version and the flags used.Source: Solnix lex(1) -v, -n; FreeBSD lex(1) -v, --verbose |
| FreeBSD | Solnix-only options | Solnix has -Q[y|n] to put version information into lex.yy.c (-Qn is the default), -V to print version information on standard error, and -Y directory for an alternate driver-file directory. The FreeBSD synopsis has no -Q or -Y.Source: Solnix lex(1) -Q, -V, -Y; FreeBSD lex(1) SYNOPSIS |
| FreeBSD | flex-only options | FreeBSD flex has -s (no default rule), -i (case-insensitive scanner), -l (AT&T lex compatibility mode), -b, -d, -f, -F, -p, -B, -I, -C, -o output, -P prefix and -S skeleton. The Solnix page documents none of these.Source: FreeBSD lex(1) SYNOPSIS, OPTIONS; Solnix lex(1) SYNOPSIS |
| FreeBSD | long options | FreeBSD flex accepts long options such as --stdout, --verbose, --help and --version. The Solnix page documents only single-letter options, so a script using --stdout for -t fails on Solnix.Source: FreeBSD lex(1) SYNOPSIS, -t --stdout; Solnix lex(1) SYNOPSIS, OPTIONS |
| FreeBSD | input files | On Solnix, several file operands are concatenated into one lex program, and a file operand of - means standard input, as does no operand. FreeBSD reads standard input when no file names are given; the visible text does not mention -. Source: Solnix lex(1) OPERANDS; FreeBSD lex(1) DESCRIPTION |
| FreeBSD | locale handling | Solnix says lex is not fully internationalized for regular expressions in the source or the generated analyzer. It lists LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES and NLSPATH as affecting lex. The FreeBSD text in the bundle lists no environment variables. Source: Solnix lex(1) USAGE, ENVIRONMENT VARIABLES; FreeBSD lex(1) (no ENVIRONMENT section in bundle) |
| FreeBSD | exit status | Solnix lex returns 0 on success and >0 on error, and the state of lex.yy.c is unspecified after a non-zero exit. The FreeBSD text in the bundle does not document exit status. Source: Solnix lex(1) DESCRIPTION, EXIT STATUS; FreeBSD lex(1) (no EXIT STATUS in bundle) |
Standards
- POSIX: lex is a POSIX.1-2024 utility.
- Solnix: Interface Stability: Standard. The page says generated C programs conform to the ISO C standard.
- FreeBSD:
-cand-nare described as do-nothing options included for POSIX compliance;-lgives maximum but not full compatibility with the original AT&T lex.
Writing portable scripts
- Use only
-t,-vand file operands in portable scripts. Redirect output yourself if you need a fixed name. Avoid-w,-e,-nand-c, which differ between illumos lex and flex. - Do not rely on long options,
-s,-i,-l,-oor-P. They exist only in the FreeBSD flex text, not in the Solnix page.
Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.