免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
1234下一页
最近访问板块 发新帖
查看: 6798 | 回复: 31
打印 上一主题 下一主题

看代码,经常到/usr/include/下面狂翻头文件定义,痛苦啊! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-03-23 16:19 |只看该作者 |倒序浏览
大家有没有什么好工具介绍一下, 我要查一个数据结构,能很快找到在那个文件里定义的

谢谢了

论坛徽章:
0
2 [报告]
发表于 2007-03-23 16:22 |只看该作者

     The lstat() function is identical to stat() except when the named file is
     a symbolic link, in which case lstat() returns information about the link
     itself, not the file the link references.  Unlike other file system ob-
     jects, symbolic links do not have an owner, group, access mode, times,
     etc.  Instead, these attributes are taken from the directory that con-
     tains the link.  The only attributes returned from an lstat() that refer
     to the symbolic link itself are the file type (S_IFLNK), size, blocks,
     and link count (always 1).

     The fstat() function obtains the same information about an open file
     known by the file descriptor fd.

     The sb argument is a pointer to a stat() structure as defined by
     <sys/stat.h> (shown below) and into which information is placed concern-
     ing the file.

     struct stat {
         dev_t      st_dev;    /* device inode resides on */
         ino_t      st_ino;    /* inode's number */
         mode_t     st_mode;   /* inode's mode */
         nlink_t    st_nlink;  /* number of hard links to the file */
         uid_t      st_uid;    /* user ID of owner */
/usr/share/man/cat2/stat.0 29%

论坛徽章:
0
3 [报告]
发表于 2007-03-23 16:25 |只看该作者
啊? 什么意思呢?

论坛徽章:
0
4 [报告]
发表于 2007-03-23 16:25 |只看该作者
K
vi下

论坛徽章:
0
5 [报告]
发表于 2007-03-23 16:27 |只看该作者
大哥啊, 能不能说详细些呢? 我用emacs,但是我更希望能直接在控制台下搜索。 谢谢了!

论坛徽章:
0
6 [报告]
发表于 2007-03-23 16:34 |只看该作者
原帖由 chopin1998 于 2007-3-23 16:25 发表
啊? 什么意思呢?


     The lstat() function is identical to stat() except when the named file is
     a symbolic link, in which case lstat() returns information about the link
     itself, not the file the link references.  Unlike other file system ob-
     jects, symbolic links do not have an owner, group, access mode, times,
     etc.  Instead, these attributes are taken from the directory that con-
     tains the link.  The only attributes returned from an lstat() that refer
     to the symbolic link itself are the file type (S_IFLNK), size, blocks,
     and link count (always 1).

     The fstat() function obtains the same information about an open file
     known by the file descriptor fd.

     The sb argument is a pointer to a stat() structure as defined by
     <sys/stat.h> (shown below) and into which information is placed concern-
     ing the file.

     struct stat {
         dev_t      st_dev;    /* device inode resides on */
         ino_t      st_ino;    /* inode's number */
         mode_t     st_mode;   /* inode's mode */
         nlink_t    st_nlink;  /* number of hard links to the file */
         uid_t      st_uid;    /* user ID of owner */
/usr/share/man/cat2/stat.0 29%

论坛徽章:
0
7 [报告]
发表于 2007-03-23 16:37 |只看该作者
你说说用man, ?
可是比如我想查timeval找个数据结构的定义, man不到啊,man -k也找不到

论坛徽章:
0
8 [报告]
发表于 2007-03-23 16:48 |只看该作者
原帖由 chopin1998 于 2007-3-23 16:37 发表
你说说用man, ?
可是比如我想查timeval找个数据结构的定义, man不到啊,man -k也找不到


这是编程的时候经常用到的一个结构体。你如果能熟悉程序的编写,就应该知道,它应用在 select()、gettimeofday() 等调用中,属于系统对时间的结构化定义,那么应该到 /usr/include/sys/time.h 里找。

假如能在手边常备几本基础书籍作为参考,我相信你应该不会遇到太大的麻烦了。比如 K&R 和 APUE,这两本书的附录都很有用。另外,看书的时候别忘了使用索引。比如你需要找到关于 struct timeval 的定义和应用,那么直接在 APUE 的索引里找 timeval 就能发现了。

.

论坛徽章:
0
9 [报告]
发表于 2007-03-23 16:52 |只看该作者
vim+cscope

vimrc中用
  1. nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
复制代码

设个宏

论坛徽章:
0
10 [报告]
发表于 2007-03-23 16:57 |只看该作者
谢谢! 书我有的,但是LinuX的头发生了很多变化,我只是想要一个能方便搜索/usr/include的东西或者方法
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP