indent is a code cleanup tool , can facilitate the rapid code formatting.
This is my code than the customary style, there are many other online
parameter:
-nbad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs -nprs -npsl -saf -sai -saw -nsc -nsob -nss
usage:
indent [-nbad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs -nprs -npsl -saf -sai -saw -nsc -nsob -nss] MutexBuffer.c
Parameter really very much, each time you enter a lot of trouble, so use the alias alias into the system configuration file, it will be a lot easier to use.
Here begin the configuration:
Some Linux version looks like a built-in, no-install yum
yum install indent
Root user switch to open the / etc / bashrc file
su root
gedit /etc/bashrc
I have tried to edit the / etc / profile file, but want it to take effect, you need to re-enter the command prior to each use
source /etc/profile
. This principle is higher than bashrc file priority, not quite sure why./ Etc / profile: set the environment variable information for each user of the system, the first time the user logs on, the file is executed.
/ Etc / bashrc: This file contains information about the bash shell bash, every time you open a new shell, the file is read.
At the end of the file, enter the following command
alias format="indent -nbad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs -nprs -npsl -saf -sai -saw -nsc -nsob -nss"
Once saved, execute the following command, just modify the environment variables to take effect.
source /etc/bashrc
Then you can use it
format MutexBuffer.c
After the shutdown restart, it is in force -
[Reference article: https://blog.csdn.net/u011068702/article/details/53932530 ]