My Favorite C/C++ indent (TAB=4, Allman Style) since 2005
代碼:
# --------------------------
# Install indent & astyle in RHEL/Fedora/CentOS/AlmaLinux/Ubuntu/Debian
# --------------------------
$ dnf install indent astyle
$ apt install indent astyle
# --------------------------
# then reformat your example.c
# --------------------------
$ indent -nbad -bap -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli4 -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l95 -lp -npcs -nprs -npsl -saf -sai -saw -nsc -nsob -nss -ut -ts4 example.c
$ astyle --style=allman example.c
(2023-02-17 18:47)