2011-02-26 2 views

답변

2

요약

, 그것은 /usr/include/bits/fcntl.h에 있어야합니다.

#define O_RDONLY 00 

당신은 rgrep, 또는 ctagsVim, 또는 cpp, 또는 cwhere을 사용하여 찾을 수 있습니다.


rgrep

가장 간단한 방법은 rgrep, grep -R 별칭으로 사용하는 것입니다.

$ rgrep O_WRONLY . 
./X11/Xw32defs.h:# define O_WRONLY _O_WRONLY 
./linux/fs.h: * to O_WRONLY and O_RDWR via the strange trick in __dentry_open() 
./linux/smbno.h:#define SMB_O_WRONLY 0x0001 
./asm-generic/fcntl.h:#define O_WRONLY 00000001 
./security/_pam_macros.h: if ((fd = open(_PAM_LOGFILE, O_WRONLY|O_NOFOLLOW|O_APPEND)) != -1) { 
./security/_pam_macros.h: if ((fd = open(_PAM_LOGFILE, O_WRONLY|O_APPEND)) != -1) { 
./security/_pam_macros.h: if ((fd = open(_PAM_LOGFILE, O_WRONLY|O_NOFOLLOW|O_APPEND)) != -1) { 
./security/_pam_macros.h: if ((fd = open(_PAM_LOGFILE, O_WRONLY|O_APPEND)) != -1) { 
./bits/fcntl.h:#define O_WRONLY  01 

ctags를

또는, /usr/include에서 ctags -R를 실행 한 다음 vim -t O_WRONLY을 실행할 수 있습니다.

또는 조금 더 나은,하지만 더 입력 :

find . /usr/include -name "*.h" | 
ctags -f - -L - | 
grep "^O_WRONLY " | 
cut -d " " -f 1,2,3 | 
sed -e 's# /\^# #;s#\$/\;"$##' 

CPP

내가 cpp을 사용하고 발견하는 가장 좋은 방법.

당신이 필요한 #include들과 YOUR_SOURCE_FILE라는 소스 파일이 가정하고, 실행 해보십시오 :

cpp -dD YOUR_SOURCE_FILE | less 

를 그런 다음 #define, 예를 들어, 검색 /O_WRONLY 위의 첫 번째 파일 이름을 찾으려면 위로 스크롤하십시오. 이 경우 :

# 27 "/usr/include/bits/fcntl.h" 2 3 4 

man fcntl에 언급 된 세 개의 헤더 파일을 포함하는 경우 O_WRONLY/usr/include/bits/fcntl.h에서 포착되고 있음을 의미한다.desc가 설치되어

$ cwhere O_WRONLY sys/types.h sys/stat.h fcntl.h 
/usr/include/bits/fcntl.h: #define O_WRONLY 01 

Download cwhere here

경우, 당신은 단지의 이름을 입력 할 수 있습니다


나는 자동화 cwhere라는 스크립트 cpp를 실행 한

을 cwhere 해당 기능을 사용하는 #define, 예. 확장 된 파일을 확인

$ cwhere O_WRONLY 'fcntl()' 
/usr/include/bits/fcntl.h: #define O_WRONLY 01 

Download desc here

+0

은 유용했다. :) – John

+0

왜 2 개의 fcntl.h 파일이 있는지 궁금합니다. 하나는 usr/include에 있고 다른 하나는 usr/include/bits에 있습니다. – John

+0

누구나 왜 그런 생각을 가지고 있습니까? – John

관련 문제