简体   繁体   English

如何告诉Mac OS X 10.5上的/ usr / bin / indent格式化我的C代码K&R风格?

[英]How do I tell /usr/bin/indent on Mac OS X 10.5 to format my C code K&R style?

On Linux I am used to running indent -kr ... to indent C files. 在Linux上,我习惯于运行indent -kr ...来缩进C文件。 /usr/bin/indent on Mac OS X 10.5 does not support the -kr option. Mac OS X 10.5上的/ usr / bin / indent不支持-kr选项。 Does anyone have a ~/.indent.pro file that would produce results closest to K&R style? 有没有人有〜/ .indent.pro文件可以产生最接近K&R风格的结果? Thanks! 谢谢!

You can always just get the original gnu indent program and use -kr option. 你总是可以获得原始的gnu缩进程序并使用-kr选项。 This is probably best as you will have exact results on both machines. 这可能是最好的,因为您将在两台机器上获得精确的结果。 But still, if you want to use OS X, this are the flags that make up the -kr option: 但是,如果你想使用OS X,这是构成-kr选项的标志:

-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 -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

MacPortsFink都有GNU缩进包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM