getopt 함수의 정의를 찾고싶습니다.

jinushun의 이미지

getopt 함수의 정의를 찾고있는데요

#if (defined __STDC__ && __STDC__) || defined __cplusplus
# ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
# else /* not __GNU_LIBRARY__ */
extern int getopt ();
# endif /* __GNU_LIBRARY__ */

# ifndef __need_getopt
extern int getopt_long (int ___argc, char *const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind);
extern int getopt_long_only (int ___argc, char *const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind);

/* Internal only. Users should not call this directly. */
extern int _getopt_internal (int ___argc, char *const *___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind,
int __long_only);
# endif
#else /* not __STDC__ */
extern int getopt ();
# ifndef __need_getopt
extern int getopt_long ();
extern int getopt_long_only ();

extern int _getopt_internal ();
# endif
#endif /* __STDC__ */

#ifdef __cplusplus
}
#endif

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

위는 getopt.h 에 있습니다.

근데 getopt.c 에보면 getopt 가 없고

smb_getopt() 로 정의가 되어있는데요

도대체 getopt 는 어디에 있습니까.

그댈 갖다쓸 일이 있어서요. :cry:

getopt 가 smb_getop 로 define 된것도 찾아봐도 없던데

아시는분 가르침을 주시면 감사하겠습니다.

수고하세요

aqwerf의 이미지

혹시 kernel source를 뒤진 건 아닌지요..

getopt()는 kernel code가 아니라 glibc 에 있는 c library 함수입니다.