本文整理汇总了C++中search_path类的典型用法代码示例。如果您正苦于以下问题:C++ search_path类的具体用法?C++ search_path怎么用?C++ search_path使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了search_path类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
program_name = argv[0];
int opt;
static const struct option long_options[] = {
{ "help", no_argument, 0, CHAR_MAX + 1 },
{ "version", no_argument, 0, 'v' },
{ NULL, 0, 0, 0 }
};
while ((opt = getopt_long(argc, argv, "CI:rtv", long_options, NULL)) != EOF)
switch (opt) {
case 'v':
printf("GNU soelim (groff) version %s\n", Version_string);
exit(0);
break;
case 'C':
compatible_flag = 1;
break;
case 'I':
include_search_path.command_line_dir(optarg);
break;
case 'r':
raw_flag = 1;
break;
case 't':
tex_flag = 1;
break;
case CHAR_MAX + 1: // --help
usage(stdout);
exit(0);
break;
case '?':
usage(stderr);
exit(1);
break;
default:
assert(0);
}
int nbad = 0;
if (optind >= argc)
nbad += !do_file("-");
else
for (int i = optind; i < argc; i++)
nbad += !do_file(argv[i]);
if (ferror(stdout) || fflush(stdout) < 0)
fatal("output error");
return nbad != 0;
}
开发者ID:att,项目名称:uwin,代码行数:48,代码来源:soelim.cpp
示例2: main
int main(int argc, char **argv)
{
setlocale(LC_NUMERIC, "C");
program_name = argv[0];
string env;
static char stderr_buf[BUFSIZ];
setbuf(stderr, stderr_buf);
int c;
static const struct option long_options[] = {
{ "help", no_argument, 0, CHAR_MAX + 1 },
{ "version", no_argument, 0, 'v' },
{ NULL, 0, 0, 0 }
};
while ((c = getopt_long(argc, argv, "b:c:F:gI:lmp:P:vw:", long_options, NULL))
!= EOF)
switch(c) {
case 'b':
// XXX check this
broken_flags = atoi(optarg);
bflag = 1;
break;
case 'c':
if (sscanf(optarg, "%d", &ncopies) != 1 || ncopies <= 0) {
error("bad number of copies `%s'", optarg);
ncopies = 1;
}
break;
case 'F':
font::command_line_font_dir(optarg);
break;
case 'g':
guess_flag = 1;
break;
case 'I':
include_search_path.command_line_dir(optarg);
break;
case 'l':
landscape_flag = 1;
break;
case 'm':
manual_feed_flag = 1;
break;
case 'p':
if (!font::scan_papersize(optarg, 0,
&user_paper_length, &user_paper_width))
error("invalid custom paper size `%1' ignored", optarg);
break;
case 'P':
env = "GROPS_PROLOGUE";
env += '=';
env += optarg;
env += '\0';
if (putenv(strsave(env.contents())))
fatal("putenv failed");
break;
case 'v':
printf("GNU grops (groff) version %s\n", Version_string);
exit(0);
break;
case 'w':
if (sscanf(optarg, "%d", &linewidth) != 1 || linewidth < 0) {
error("bad linewidth `%1'", optarg);
linewidth = -1;
}
break;
case CHAR_MAX + 1: // --help
usage(stdout);
exit(0);
break;
case '?':
usage(stderr);
exit(1);
break;
default:
assert(0);
}
font::set_unknown_desc_command_handler(handle_unknown_desc_command);
SET_BINARY(fileno(stdout));
if (optind >= argc)
do_file("-");
else {
for (int i = optind; i < argc; i++)
do_file(argv[i]);
}
return 0;
}
开发者ID:DemonFang,项目名称:groff,代码行数:86,代码来源:ps.cpp
示例3: do_file
int do_file(const char *filename)
{
char *file_name_in_path = 0;
FILE *fp = include_search_path.open_file_cautious(filename,
&file_name_in_path);
int err = errno;
string whole_filename(file_name_in_path ? file_name_in_path : filename);
whole_filename += '\0';
a_delete file_name_in_path;
if (fp == 0) {
error("can't open `%1': %2", whole_filename.contents(), strerror(err));
return 0;
}
current_filename = whole_filename.contents();
current_lineno = 1;
set_location();
enum { START, MIDDLE, HAD_DOT, HAD_s, HAD_so, HAD_l, HAD_lf } state = START;
for (;;) {
int c = getc(fp);
if (c == EOF)
break;
switch (state) {
case START:
if (c == '.')
state = HAD_DOT;
else {
putchar(c);
if (c == '\n') {
current_lineno++;
state = START;
}
else
state = MIDDLE;
}
break;
case MIDDLE:
putchar(c);
if (c == '\n') {
current_lineno++;
state = START;
}
break;
case HAD_DOT:
if (c == 's')
state = HAD_s;
else if (c == 'l')
state = HAD_l;
else {
putchar('.');
putchar(c);
if (c == '\n') {
current_lineno++;
state = START;
}
else
state = MIDDLE;
}
break;
case HAD_s:
if (c == 'o')
state = HAD_so;
else {
putchar('.');
putchar('s');
putchar(c);
if (c == '\n') {
current_lineno++;
state = START;
}
else
state = MIDDLE;
}
break;
case HAD_so:
if (c == ' ' || c == '\n' || compatible_flag) {
string line;
for (; c != EOF && c != '\n'; c = getc(fp))
line += c;
current_lineno++;
line += '\n';
line += '\0';
do_so(line.contents());
state = START;
}
else {
fputs(".so", stdout);
putchar(c);
state = MIDDLE;
}
break;
case HAD_l:
if (c == 'f')
state = HAD_lf;
else {
putchar('.');
putchar('l');
putchar(c);
if (c == '\n') {
current_lineno++;
state = START;
//.........这里部分代码省略.........
开发者ID:att,项目名称:uwin,代码行数:101,代码来源:soelim.cpp
示例4: strlen
FILE *font::open_file(const char *nm, char **pathp)
{
char *filename = new char[strlen(nm) + strlen(device) + 5];
sprintf(filename, "dev%s/%s", device, nm);
FILE *fp = font_path.open_file(filename, pathp);
a_delete filename;
return fp;
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:8,代码来源:fontfile.cpp
示例5: fatal
static unsigned int get_resolution(void)
{
char *pathp;
FILE *f;
unsigned int res;
f = font_path.open_file("devps/DESC", &pathp);
a_delete pathp;
if (f == 0)
fatal("can't open devps/DESC");
while (get_line(f)) {
int n = sscanf(linebuf, "res %u", &res);
if (n >= 1) {
fclose(f);
return res;
}
}
fatal("can't find `res' keyword in devps/DESC");
return 0;
}
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:19,代码来源:pre-html.cpp
示例6: command_line_font_dir
void font::command_line_font_dir(const char *dir)
{
font_path.command_line_dir(dir);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:4,代码来源:fontfile.cpp
示例7: scanArguments
static int scanArguments(int argc, char **argv)
{
const char *command_prefix = getenv("GROFF_COMMAND_PREFIX");
if (!command_prefix)
command_prefix = PROG_PREFIX;
char *troff_name = new char[strlen(command_prefix) + strlen("troff") + 1];
strcpy(troff_name, command_prefix);
strcat(troff_name, "troff");
int c, i;
static const struct option long_options[] = {
{ "help", no_argument, 0, CHAR_MAX + 1 },
{ "version", no_argument, 0, 'v' },
{ NULL, 0, 0, 0 }
};
while ((c = getopt_long(argc, argv, "+a:bdD:eF:g:hi:I:j:lno:prs:S:vVx:y",
long_options, NULL))
!= EOF)
switch(c) {
case 'a':
textAlphaBits = min(max(MIN_ALPHA_BITS, atoi(optarg)),
MAX_ALPHA_BITS);
if (textAlphaBits == 3) {
error("cannot use 3 bits of antialiasing information");
exit(1);
}
break;
case 'b':
// handled by post-grohtml (set background color to white)
break;
case 'd':
#if defined(DEBUGGING)
debug = TRUE;
#endif
break;
case 'D':
image_dir = optarg;
break;
case 'e':
eqn_flag = TRUE;
break;
case 'F':
font_path.command_line_dir(optarg);
break;
case 'g':
graphicAlphaBits = min(max(MIN_ALPHA_BITS, atoi(optarg)),
MAX_ALPHA_BITS);
if (graphicAlphaBits == 3) {
error("cannot use 3 bits of antialiasing information");
exit(1);
}
break;
case 'h':
// handled by post-grohtml
break;
case 'i':
image_res = atoi(optarg);
break;
case 'I':
image_template = optarg;
break;
case 'j':
// handled by post-grohtml (set job name for multiple file output)
break;
case 'l':
// handled by post-grohtml (no automatic section links)
break;
case 'n':
// handled by post-grohtml (generate simple heading anchors)
break;
case 'o':
vertical_offset = atoi(optarg);
break;
case 'p':
show_progress = TRUE;
break;
case 'r':
// handled by post-grohtml (no header and footer lines)
break;
case 's':
// handled by post-grohtml (use font size n as the html base font size)
break;
case 'S':
// handled by post-grohtml (set file split level)
break;
case 'v':
printf("GNU pre-grohtml (groff) version %s\n", Version_string);
exit(0);
case 'V':
// handled by post-grohtml (create validator button)
break;
case 'x':
// html dialect
if (strcmp(optarg, "x") == 0)
dialect = xhtml;
else if (strcmp(optarg, "4") == 0)
dialect = html4;
else
printf("unsupported html dialect %s (defaulting to html4)\n", optarg);
break;
case 'y':
//.........这里部分代码省略.........
开发者ID:SvenDowideit,项目名称:clearlinux,代码行数:101,代码来源:pre-html.cpp
注:本文中的search_path类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论