LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

cb

C source code beautifier

TLDR

Beautify C code from a file
$ cb < [path/to/source.c] > [path/to/output.c]
copy
Format using Kernighan & Ritchie style
$ cb -s < [path/to/source.c]
copy
Set maximum line length
$ cb -l [80] < [path/to/source.c]
copy
Join case labels onto single lines
$ cb -j < [path/to/source.c]
copy
Display version information
$ cb -V
copy

SYNOPSIS

cb [-s] [-j] [-l length] [-V] [file ...]

DESCRIPTION

cb (C Beautifier) is a classic Unix utility that reformats C source code for improved readability. It reads from its arguments or standard input and writes beautified code to standard output, making it suitable for use in pipelines.The tool performs lexical formatting without full syntactic analysis, adjusting indentation, spacing, and line breaks to display the structure of the code.

PARAMETERS

-s

Write code in Kernighan & Ritchie style from The C Programming Language
-j
Put split lines back together
-l length
Split lines that are longer than length
-V
Print version information to standard error

INSTALL

sudo apk add clipboard
copy
brew install clipboard
copy

CAVEATS

The cb command performs only lexical analysis and may produce incorrect formatting with complex preprocessor macros that alter code structure. It supports only C code, not C++ or other languages.On modern Linux distributions, cb is often not installed by default and is considered largely obsolete.

HISTORY

The cb command originated in early Unix systems at Bell Labs as a simple tool for standardizing C code formatting. It has since been superseded by more sophisticated formatters like indent, astyle, and clang-format that provide fuller syntactic understanding and greater configurability.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid