Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the indent command of Linux

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the Linux indent command how to use the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe you will have something to gain after reading this Linux indent command article, let's take a look.

Linux common commands indent commands can identify the original code file of C and format it to facilitate programmers to read, modify and other operations.

Indent formats the source files of C language

Syntax indent (option) (source file) or indent (option) (source file) (- o target file) option-bad: add a blank line in the declaration area;-bap: add a blank line;-bbb: add a blank line after the comment;-bc: in the declaration paragraph, wrap if a comma appears -bl:if (or else, for, etc.) is different from the "{" line of the subsequent execution section, and "}" has its own line-bli sets the number of cells indented by {};-br:if (or else, for, etc.) goes with the "{" of the subsequent execution section, and "}" forms its own line;-bs: leave a space after sizeof;-c: place comments in the field specified on the right side of the program -cd: place comments in the specified field on the right side of the declaration;-cdb: the comment symbol is on its own line;-ce: place else after "}" (the end of the if execution section);-ci::: specify the number of spaces to indent after line breaks when the description is too long;-cli: the number of lines indented by switch when using case;-cp: place comments in the fields specified to the right of else and elseif narratives;-cs: leave a space after case. -d: set the number of indents for comments that are not placed on the right side of the code;-di: place variables in the declaration section in the specified field;-fc1: format comments at the front of each line;-fca: format all comments;-gnu: use the specified GNU format, which is the default value for this parameter;-I: set the number of spaces for indentation;-ip: set the number of indents for parameters -kr: specifies the format in which Kernighan&Ritchie is used;-lp: arranges the contents of each starting line in parentheses vertically when the statement is too long and contains parentheses;-nbad: do not add blank lines after declaring sections;-nbap: do not add blank lines after the program;-nbbb: do not add blank lines after comment paragraphs;-nbc: do not wrap lines in declaration paragraphs, even if commas occur. -ncdb: comment symbols do not form a line;-nce: do not put else after "}";-ncs: do not leave a space after case;-nfc1: do not format comments placed at the beginning of each line;-nfca: do not format any comments;-nip: do not indent parameters;-nlp: when the narrative is too long to wrap, and the narrative contains parentheses, do not arrange each line of the starting field in parentheses vertically. -npcs: do not add spaces after calling the function name;-npro: do not read the indent configuration file ".indent.pro";-npsl: put the program type on the same line as the program name;-nsc: do not add an asterisk to the left side of the comment;-nsob: do not deal with extra blank lines;-nss: if the for or while section has only one line, do not add a space before the semicolon;-nv: do not display detailed information. -orig: use berkeley format;-pcs: add a space between the calling function name and "{";-psl: put the program type on the first line of the program name;-sc: add an asterisk to the left of each line of comment;-sob: delete extra blank lines;-ss: if there is only one line in the for or swile section, add a space before the semicolon;-st: display the result on the standard output device -T: indentation of data type name;-ts: set the length of tab;-v: display detailed execution process;-- version: display version information. The example uses the indent command to add a space after all the sizeof in the C language source file "test.c", and enter the following command:

After indent-bs / home/rootlocal/ Desktop / test.c executes the above command, the user can open the specified source file to see if a space has been added after the sizeof. Because there are so many parameters in this command, users can choose the appropriate parameters to use according to their actual needs.

This is the end of the article on "how to use the indent command of Linux". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to use the indent command of Linux". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report