Tuesday, January 20, 2009

大杂烩:GNU binutils strings/ 好看的man page / gcc 语言标准选项 / source-highlight 与 less 结合

strings filename:

from man page:

DESCRIPTION
       For  each  file  given,  GNU  strings  prints  the  printable character
       sequences that are at least 4 characters long (or the number given with
       the  options  below)  and are followed by an unprintable character.  By
       default, it only prints the strings from  the  initialized  and  loaded
       sections  of  object  files;  for  other  types of files, it prints the
       strings from the whole file.

       strings is mainly useful  for  determining  the  contents  of  non-text
       files.


---------------------------------------

export PAGER=most

方案一: woman

方案二:vim

function man() {  /usr/bin/man $* | col -b | /usr/bin/vim -R -c 'set ft=man
nomod nolist' - ; }

之后
man ls

方案三 : 定义less显示escape sequence的颜色:
http://wiki.clug.org.za/wiki/Colour_on_the_command_line#Colourful_manpages_.28RedHat_style.29
# For colourful man pages (CLUG-Wiki style)
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'

---------------------------------------

使用
gcc -Wall -pedantic -ansi
可以启用许多警告和额外的检查以检验程序是否符合C语言标准。

---------------------------------------
source-highlight 与 less 结合

http://linuxtoy.org/archives/less-highlight.html

注意source-highlight版本太低则不支持default.lang(我的2.4.5就不支持,于是弄了个2.11)

No comments: