x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
option.c - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\DarkPuzzle\libs\bullet_sdk\jam-2.5\option.c
旋转
特效
属性
历史版本
/* * Copyright 1993, 1995 Christopher Seiwald. * * This file is part of Jam - see jam.c for Copyright information. */ /* * option.c - command line option processing * * {o >o * \<>) "Process command line options as defined in
. * Return the number of argv[] elements used up by options, * or -1 if an invalid option flag was given or an argument * was supplied for an option that does not require one." * * 11/04/02 (seiwald) - const-ing for string literals */ # include "jam.h" # include "option.h" int getoptions( int argc, char **argv, const char *opts, option *optv ) { int i; int optc = N_OPTS; memset( (char *)optv, '\0', sizeof( *optv ) * N_OPTS ); for( i = 0; i < argc; i++ ) { char *arg; if( argv[i][0] != '-' || !isalpha( argv[i][1] ) ) break; if( !optc-- ) { printf( "too many options (%d max)\n", N_OPTS ); return -1; } for( arg = &argv[i][1]; *arg; arg++ ) { const char *f; for( f = opts; *f; f++ ) if( *f == *arg ) break; if( !*f ) { printf( "Invalid option: -%c\n", *arg ); return -1; } optv->flag = *f; if( f[1] != ':' ) { optv++->val = "true"; } else if( arg[1] ) { optv++->val = &arg[1]; break; } else if( ++i < argc ) { optv++->val = argv[i]; break; } else { printf( "option: -%c needs argument\n", *f ); return -1; } } } return i; } /* * Name: getoptval() - find an option given its character */ const char * getoptval( option *optv, char opt, int subopt ) { int i; for( i = 0; i < N_OPTS; i++, optv++ ) if( optv->flag == opt && !subopt-- ) return optv->val; return 0; }
option.c
网页地址
文件地址
上一页
49/73
下一页
下载
( 1 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.