Linux command
cb 命令
文本
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Beautify C code from a file
cb < [path/to/source.c] > [path/to/output.c]
Format using Kernighan & Ritchie style
cb -s < [path/to/source.c]
Set maximum line length
cb -l [80] < [path/to/source.c]
Join case labels onto single lines
cb -j < [path/to/source.c]
Display version information
cb -V
说明
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.
参数
- -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
FAQ
What is the cb command used for?
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.
How do I run a basic cb example?
Run `cb < [path/to/source.c] > [path/to/output.c]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -s do in cb?
Write code in Kernighan & Ritchie style from The C Programming Language