I need a way to auto-indent blocks on a C source file within theterminal. According to the norms.Before:int main() {puts(Hello world);}After:int main(){puts(Hello world);}
Command that indents lines of a C source file
text processing;c;source;indentation
The classic Unix tool for this job is indent (e.g., GNUindent). Called in K&R mode, itwill indent your example code as you asked (assuming you actually wantputs indented):$ indent -kr <sample.cint main(){    puts(Hello world);}A more modern solution may be clang-format(http://clang.llvm.org/docs/ClangFormat.html), which can be configuredin many ways according to a style file.