马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
在学习mupdf,在getopt.c文件中有段代码,是函数吗,请朋友们指教,
代码如下,有疑问的在最下面“int chr;”后面一对大括号#ifndef _NO_PROTO
# define _NO_PROTO
#endif
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#if !defined __STDC__ || !__STDC__
# ifndef const
# define const
# endif
#endif
#include <stdio.h>
#define GETOPT_INTERFACE_VERSION 2
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
# include <gnu-versions.h>
# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
# define ELIDE_CODE
# endif
#endif
#ifndef ELIDE_CODE
#ifdef __GNU_LIBRARY__
# include <stdlib.h>
# include <unistd.h>
#endif
#ifdef VMS
# include <unixlib.h>
# if HAVE_STRING_H - 0
# include <string.h>
# endif
#endif
#ifndef _
# if defined HAVE_LIBINTL_H || defined _LIBC
# include <libintl.h>
# ifndef _
# define _(msgid) gettext (msgid)
# endif
# else
# define _(msgid) (msgid)
# endif
#endif
#include "getopt.h"
char *optarg;
int optind = 1;
int __getopt_initialized;
static char *nextchar;
int opterr = 1;
int optopt = '?';
static enum
{
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} ordering;
static char *posixly_correct;
#ifdef __GNU_LIBRARY__
# include <string.h>
# define my_index strchr
#else
# if HAVE_STRING_H
# include <string.h>
# else
# include <strings.h>
# endif
#ifndef getenv
extern char *getenv();
#endif
static char *
my_index(str, chr)
const char *str;
int chr;
{
while (*str)
{
if (*str == chr)
return (char *)str;
str++;
}
return 0;
}
|