本文整理汇总了C++中printhelp函数的典型用法代码示例。如果您正苦于以下问题:C++ printhelp函数的具体用法?C++ printhelp怎么用?C++ printhelp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printhelp函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: printf
void *interpretor( void *arg )
{
char command[256];
CUBE *cube = (CUBE*)arg;
printf(
"Welcome to the Rubik's Cube Simulotor vers 0.1\n"
"*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\n"
);
printhelp(NULL);
for(;;) {
fgets(command,256,stdin);
command[strlen(command)-1]=0;
if(!strcmp(command,"help")) {
printhelp(NULL);
} else if(!strncmp(command,"help ",5)) {
printhelp(command+5);
} else if(!strcmp(command,"reset")) {
Reset(cube);
printf("OK\n");
} else if(!strcmp(command,"scramble")) {
Scramble(cube);
printf("OK\n");
} else if(!strcmp(command,"exit")) {
exit(0);
} else if(!strcmp(command,"test")) {
test(cube);
printf("OK\n");
} else if((!strcmp(command,"rxy"))||(!strcmp(command,"ryx"))) {
r_xy(cube);
printf("OK\n");
} else if((!strcmp(command,"rxy'"))||(!strcmp(command,"rxy-"))||
(!strcmp(command,"ryx'"))||(!strcmp(command,"ryx-"))) {
r_xy_inv(cube);
printf("OK\n");
} else if((!strcmp(command,"rxz"))||(!strcmp(command,"rzx"))) {
r_xz(cube);
printf("OK\n");
} else if((!strcmp(command,"rxz'"))||(!strcmp(command,"rxz-"))||
(!strcmp(command,"rzx'"))||(!strcmp(command,"rzx-"))) {
r_xz_inv(cube);
printf("OK\n");
} else if((!strcmp(command,"ryz"))||(!strcmp(command,"rzy"))) {
r_xy(cube);
printf("OK\n");
} else if((!strcmp(command,"ryz'"))||(!strcmp(command,"ryz-"))||
(!strcmp(command,"rzy'"))||(!strcmp(command,"rzy-"))) {
r_xy_inv(cube);
printf("OK\n");
} else if(check(command)) {
Exec(cube,command);
printf("OK\n");
} else {
printf("Invalid command\n");
}
}
#ifndef _WIN32
pthread_exit(0);
#endif //_WIN32
}
开发者ID:AceResolution,项目名称:03-RubiksCube,代码行数:60,代码来源:interpretor.c
示例2: main
int main(int argc, char *argv[])
{
short int x;
FILE *fp;
if ( ( argc < 2 ) ) { printhelp(); }
if ( ( strIs(argv[1], "-h") ) |
( strIs(argv[1], "--help") ) |
( strIs(argv[1], "/?") )
) printhelp();
for ( x = 1 ; x < argc ; x++ )
{
fp = fopen(argv[x], "r");
if ( fp == NULL )
{
perror("Error");
exit(errno);
}
extractAcctounts(fp);
}
decrypt();
outPasswds();
return 0;
}
开发者ID:0x24bin,项目名称:exploit-database,代码行数:27,代码来源:21781.c
示例3: process_command
void process_command()
{
map<string, param>::iterator p;
for (int i = 1; i < fArgc; i++) {
if (fArgv[i][0] == '-') {
if ( (strcmp(fArgv[i], "-help") == 0)
|| (strcmp(fArgv[i], "-h") == 0)
|| (strcmp(fArgv[i], "--help") == 0) ) {
printhelp();
exit(1);
}
p = fKeyParam.find(fArgv[i]);
if (p == fKeyParam.end()) {
cout << fArgv[0] << " : unrecognized option " << fArgv[i] << "\n";
printhelp();
exit(1);
}
char* end;
*(p->second.fZone) = float(strtod(fArgv[i+1], &end));
i++;
} else {
fFiles.push_back(fArgv[i]);
}
}
}
开发者ID:gauravchawla03,项目名称:Stanford,代码行数:25,代码来源:sndfile.cpp
示例4: main
int main(int argc, char* argv[])
{
if( argc < 3 )
return printhelp(NULL);
bool vertexShader = false, freename = false;
glslopt_target languageTarget = kGlslTargetOpenGL;
const char* source = 0;
char* dest = 0;
for( int i=1; i < argc; i++ )
{
if( argv[i][0] == '-' )
{
if( 0 == strcmp("-v", argv[i]) )
vertexShader = true;
else if( 0 == strcmp("-f", argv[i]) )
vertexShader = false;
else if( 0 == strcmp("-1", argv[i]) )
languageTarget = kGlslTargetOpenGL;
else if( 0 == strcmp("-2", argv[i]) )
languageTarget = kGlslTargetOpenGLES20;
else if( 0 == strcmp("-3", argv[i]) )
languageTarget = kGlslTargetOpenGLES30;
}
else
{
if( source == 0 )
source = argv[i];
else if( dest == 0 )
dest = argv[i];
}
}
if( !source )
return printhelp("Must give a source");
if( !init(languageTarget) )
{
printf("Failed to initialize glslopt!\n");
return 1;
}
if ( !dest ) {
dest = (char *) calloc(strlen(source)+5, sizeof(char));
snprintf(dest, strlen(source)+5, "%s.out", source);
freename = true;
}
int result = 0;
if( !compileShader(dest, source, vertexShader) )
result = 1;
if( freename ) free(dest);
term();
return result;
}
开发者ID:raymond-w-ko,项目名称:glsl-optimizer,代码行数:58,代码来源:Main.cpp
示例5: main
int main( int argc, char *argv[] ) {
int i;
/* first set all the parameters */
printf( "Enter n (0 for help): " ); scanf( "%d", &n );
if (n == 0) { printhelp(); return(0); }
printf( "Enter format (0,1,2,3): " ); scanf( "%d", &out_format );
printf( "Enter MaxChild, lb , ub: " ); scanf( "%d%d%d", &mc, &lb, &ub );
if(out_format==1) outputP = 1;
if(out_format==2) outputL = 1;
if(out_format==3) {outputP = 1; outputL = 1;}
num = 0;
/* mc = n; */
if (ub < n-1 && lb < ub) omit = 1;
for( i=1; i<=n; i++) chi[i]=0;
/* now start the program */
if (lb > n || n > MaxSize-1) printf("Error: Invalid parameter!\n"); else
for (i=1; i<=lb+1; i++) {
par[i] = L[i] = nextp[i] = i-1;
rChi[i] = i+1; chi[par[i]] = 1;
}
rChi[lb+1] = 0;
if (lb < ub) Gen(lb+2, 0, 0);
if (lb == ub) Gen(lb+2,lb+1,1);
if (lb > ub) {
printf("lower bound must be <= upper bound!\n");
return( 1 );
}
printf("Total = %4d\n",num);
return( 0 );
}
开发者ID:rforge,项目名称:mstree,代码行数:33,代码来源:RootedTree.c
示例6: cmdline
static void cmdline(int argc, char **argv)
{
int flags, opt;
int nsecs, tfnd;
const char *options = "hvl:";
nsecs = 0;
tfnd = 0;
flags = 0;
while ((opt = getopt(argc, argv, options)) != -1) {
switch (opt) {
case 'v':
printversion(argv[0]);
exit(0);
break;
case 'l':
g_dbglvl = atoi(optarg);
if (g_dbglvl<0 || g_dbglvl>MAXDBGLVL) {
fprintf(stderr, "Error unsuported debug level %d.\n", g_dbglvl);
exit(1);
}
break;
case 'h':
default:
printhelp(argv[0]);
exit(1);
break;
}
}
}
开发者ID:SimonFischinger,项目名称:sc_sncn_ethercat,代码行数:34,代码来源:main.c
示例7: main
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
a.setWindowIcon(QIcon(":/sbicon.png"));
a.setStyle(QStyleFactory::create("Fusion"));
a.setApplicationName("Soundbench");
a.setApplicationDisplayName("Soundbench");
a.setApplicationVersion(QString::fromStdString(std::to_string(SBVERSION_MAJOR)+'.'+std::to_string(SBVERSION_MINOR)+'.'+std::to_string(SBVERSION_PATCH)));
//Parse some arguments.
std::string arg;
if (argc == 2) {
arg = argv[1];
if (arg == "--help" || arg == "-h") {
printhelp();
return 0;
}
}
std::cerr << "Soundbench " << SBVERSION << " (" << SBVERSION_CODENAME << ")\n";
std::cerr << "Version Series: " << SBVERSION_MAJOR << '.' << SBVERSION_MINOR << ".x\n";
if (arg == "--version" || arg == "-v")
return 0;
sb::ConfigManager* cfg = new sb::ConfigManager;
sb::Soundbench* sb = cfg->initSoundbench();
SoundbenchUI sbui(sb, cfg);
sbui.show();
std::cerr << "Soundbench loaded.\n";
int ret = a.exec();
delete sb;
delete cfg;
return ret;
}
开发者ID:TheRabbitologist,项目名称:Soundbench,代码行数:32,代码来源:main.cpp
示例8: main
int main(int argc,char ** argv)
{
int index=0;
struct option argarr[]={
{
"port",1,NULL,'P'
},
{
"mgroup",1,NULL,'M'
},
{
"player",1,NULL,'p'
},
{
"help",1,NULL,'H'
},
{
NULL,0,NULL,0
}
};
/*
*初始化
*级别: 默认值 ,配置文件,环境变量,命令行参数
*
*/
int c;
while(1)
{
c= getopt_long(argc,argv,"P:M:p:H",argarr,&index)
if(c<0)
switch(c)
{
case 'p':
client_conf.revport=optarg;
break;
case 'M'
client_conf.mgroup=optarg;
break;
case 'p'
client_conf.player_cmd=optarg;
break;
case 'H'
printhelp();
exit(0);
break;
default:
abort();
break;
}
}
pip();
fork();
// 子继承调用解码器
// 父进程 从网络上收包 发送给子进程
exit(0);
}
开发者ID:bxy0505,项目名称:netradio,代码行数:60,代码来源:client.c
示例9: main
int main(int argc, char *argv[]){
LARGE_INTEGER frequency;
LARGE_INTEGER t1, t2;
double elapsedTime;
int ret = 0;
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&t1);
if(argc != 2){
printhelp();
return EXIT_FAILURE;
}
startLogger("log.txt");
readSettingsFromConfigFile(argv[1]);
setUpSpectrum();
logIt(DEBUG, "pathToSlice=%s", cfg.pathToSlice);
logIt(DEBUG, "pathToOutputReconstruction=%s", cfg.pathToOutputReconstruction);
setUpAttenuation();
logIt(INFO, "Everything set up successfully. Starting simulation...");
ret = simulation(cfg.pathToSlice, cfg.pathToOutputSinogram);
reconstruction(cfg.pathToOutputSinogram, cfg.pathToOutputReconstruction);
QueryPerformanceCounter(&t2);
elapsedTime = (double)(t2.QuadPart - t1.QuadPart) / frequency.QuadPart;
logIt(INFO, "Total computation time: %f seconds.", elapsedTime);
logIt(INFO, "Reconstructed image saved as %s. Exiting...", cfg.pathToOutputReconstruction);
logIt(DEBUG, "main(int argc, char *argv[]) finished.");
stopLogger();
return ret;
}
开发者ID:Axelius,项目名称:CTSim,代码行数:33,代码来源:Run.c
示例10: main
int main(int argc, char **argv) {
int ch; /* Option character */
while (1) {
ch = getopt(argc, argv, "c");
if (-1 == ch) {
/* No more options, break out of while loop. */
break;
}
switch (ch) {
case 'c':
printcommand = true;
break;
default:
printhelp();
exit(0);
} /* switch ch */
} /* while 1 */
init();
wm_state = getatom("WM_STATE");
findhidden();
cleanup();
exit(0);
}
开发者ID:notaudrey,项目名称:qtwm2,代码行数:26,代码来源:hidden.c
示例11: main
int main(void){
char str[100], input[100];
// Prints Intro
printf("Simple Calculator\n");
// Prints the input prompt, along with goto label to jump back to input
inputPrompt:
printf(">>>");
fgets(str,sizeof(str),stdin);
sscanf(str, "%[^\n]",input);
// printf("The input is: %s\n",input);
/* Checks to see if the user wants to quit */
if(strcmp(input, "q") == 0 || strcmp(input,"Q") == 0){
printf(" Goodbye!");
exit(0);
}
/* Checks to see if the user asked for help */
else if(strcmp(input,"h") == 0 || strcmp(input,"H") == 0){
printhelp();
}
/* If the string entered has passed all pre-checks, then send off to functions dealing with arithmetic */
else{
/* Send the user input to the function that will standardise the whitespaces to use as delimiters
* (make sure there is only ever one whitespace at most) */
standardiseWhitespaces(input);
// printf("After White spaces: %s\n",input);
/* Run through a bunch of checks, print an error message and go back to the input prompt if something is found */
if(operatorsIncorrect(input) == TRUE || tooManyPoints(input) == TRUE || invalidCharacters(input) == TRUE) {
printf(" Error: Illegal input!\n");
goto inputPrompt;
}
if(divideByZero(input) == TRUE){
printf(" Error: Divide by zero!\n");
goto inputPrompt;
}
/* Converts any e's to scientific notation */
convertFromScientificNotation(input);
// printf("After Scientific Notation: %s\n",input);
/* Put string through function to turn it in to post-fix notation */
convertToPostfix(input);
// printf("After postfix: %s\n",input);
/* Puts the postfix notation string in to the arithmetic function, which then interprets the equation, solves it , then prints it */
printf(" %lf\n",arithmetic(input));
}
/* Goes to the start of the program where it prompts for input */
goto inputPrompt;
}
开发者ID:Mugy,项目名称:calculatorAssignment,代码行数:59,代码来源:calculator.c
示例12: main
int main(int argc, char *argv[])
{
if(argc < 2)
{
printhelp();
return 0;
}
try
{
if(strcmp(argv[1], "copyU8") == 0 && argc > 3) copy(argv[2], argv[3], 8);
else if(strcmp(argv[1], "copyS8") == 0 && argc > 3) copy(argv[2], argv[3], 9);
else if(strcmp(argv[1], "copyS16") == 0 && argc > 3) copy(argv[2], argv[3], 17);
else if(strcmp(argv[1], "copyU16") == 0 && argc > 3) copy(argv[2], argv[3], 16);
else if(strcmp(argv[1], "copyF32") == 0 && argc > 3) copy(argv[2], argv[3], 32);
else if(strcmp(argv[1], "copyF64") == 0 && argc > 3) copy(argv[2], argv[3], 64);
else if(strcmp(argv[1], "rescaleIntensity") == 0 && argc > 5) rescaleIntensity(argv[2], argv[3], atof(argv[4]), atof(argv[5]));
else if(strcmp(argv[1], "gaussianFilter") == 0 && argc > 4) gaussianFilter(argv[2], argv[3], atof(argv[4]));
else if(strcmp(argv[1], "hessianFilter") == 0 && argc > 4) hessianFilter(argv[2], argv[3], atof(argv[4]));
else if(strcmp(argv[1], "tensorHessianFilter") == 0 && argc > 4) hessianFilter(argv[2], argv[3], atof(argv[4]));
else if(strcmp(argv[1], "floodFill") == 0 && argc > 8) floodFill(argv[2], argv[3], atof(argv[4]), atof(argv[5]), atoi(argv[6]), atoi(argv[7]), atoi(argv[8]));
else if(strcmp(argv[1], "threshold") == 0 && argc > 5) threshold(argv[2], argv[3], atof(argv[4]), atof(argv[5]));
else if(strcmp(argv[1], "multiscaleHessian") == 0 && argc > 6) multiscaleHessian(argv[2], argv[3], atof(argv[4]), atof(argv[5]), atoi(argv[6]));
else if(strcmp(argv[1], "minIntensity") == 0 && argc > 2) minIntensity(argv[2]);
else if(strcmp(argv[1], "maxIntensity") == 0 && argc > 2) maxIntensity(argv[2]);
else if(strcmp(argv[1], "upscaleForCenteredSkeleton") == 0 && argc > 3) upscaleForCenteredSkeleton(argv[2], argv[3]);
else if(strcmp(argv[1], "skeletonFromBinary") == 0 && argc > 3) skeletonFromBinary(argv[2], argv[3]);
else if(strcmp(argv[1], "centeredSkeleton") == 0 && argc > 3) centeredSkeleton(argv[2], argv[3]);
else if(strcmp(argv[1], "whiteForegroundHoleFill") == 0 && argc > 3) whiteForegroundHoleFill(argv[2], argv[3]);
else if(strcmp(argv[1], "blackForegroundHoleFill") == 0 && argc > 3) blackForegroundHoleFill(argv[2], argv[3]);
else if(strcmp(argv[1], "whiteTopHat") == 0 && argc > 4) whiteTopHat(argv[2], argv[3], atof(argv[4]));
else if(strcmp(argv[1], "blackTopHat") == 0 && argc > 4) blackTopHat(argv[2], argv[3], atof(argv[4]));
else if(strcmp(argv[1], "dilate") == 0 && argc > 4) dilate(argv[2], argv[3], atof(argv[4]));
else if(strcmp(argv[1], "erode") == 0 && argc > 4) erode(argv[2], argv[3], atof(argv[4]));
else if(strcmp(argv[1], "skeletonToTreeIntSpace") == 0 && argc > 4) skeletonToTreeIntSpace(argv[2], argv[3], atoi(argv[4]));
else if(strcmp(argv[1], "skeletonToTree") == 0 && argc > 4) skeletonToTree(argv[2], argv[3], atoi(argv[4]));
else if(strcmp(argv[1], "estimateDiameters") == 0 && argc > 5) estimateDiameters(argv[2], argv[3], argv[4], atoi(argv[5]));
else if(strcmp(argv[1], "skeletonToTreeIntSpace") == 0 && argc > 3) skeletonToTreeIntSpace(argv[2], argv[3], 0);
else if(strcmp(argv[1], "skeletonToTree") == 0 && argc > 3) skeletonToTree(argv[2], argv[3], 0);
else if(strcmp(argv[1], "estimateDiameters") == 0 && argc > 4) estimateDiameters(argv[2], argv[3], argv[4], 0);
else if(strcmp(argv[1], "info") == 0 && argc > 1) info(argv[0]);
else std::cout << "Unknown command " << argv[1] << " or invalid arguments" << std::endl;
}
catch( itk::ExceptionObject & err )
{
std::cerr << "ITK exception" << std::endl;
std::cerr << err << std::endl;
return -2;
}
catch(...)
{
std::cerr << "Unknown exception" << std::endl;
return -1;
}
return 0;
}
开发者ID:piotr-szczypinski,项目名称:VesselTree,代码行数:58,代码来源:vknife.cpp
示例13: main
int main(int argc, char **argv)
{
int z;
int opt;
int port;
int buffersize = 256;
char buffer[buffersize];
int addrSize = 128;
char addr[addrSize];
memset (addr, '\0', addrSize);
int cmdSize = 256;
char command[cmdSize];
memset (command, '\0', cmdSize);
//Defaults
sprintf(addr,"127.0.0.1");
port = 4949;
//INCLUDED ARGUMENTS FROM CLI
while((opt = getopt(argc, argv, "a:p:c:v:")) > 0)
{
switch(opt)
{
case 'a':
snprintf(addr, addrSize-1, "%s", (char*) optarg);
break;
case 'p':
port = atoi(optarg);
break;
case 'c':
snprintf(command, cmdSize-1, "%s", (char*) optarg);
break;
case 'v':
printf("coffeec version 2.5\n");
default:
printhelp();
exit(0);
}
}
if(strlen(command)<=0)
{
fprintf(stderr, "No command given\n");
return 0;
}
z = sendMessage(addr, port, command, buffer, buffersize);
if(z)
printf("Received response %s\n",buffer);
else
printf("ERROR : command failed");
exit(1);
}
开发者ID:nvanfleet,项目名称:Coffeec,代码行数:58,代码来源:main.c
示例14: printhelp
// Print using a preorder traversal
void printhelp(GTNode<E>* root) {
if (root->isLeaf()) cout << "Leaf: ";
else cout << "Internal: ";
cout << root->value() << "\n";
// Now process the children of "root"
for (GTNode<E>* temp = root->leftmostChild();
temp != NULL; temp = temp->rightSibling())
printhelp(temp);
}
开发者ID:LeqiaoP1,项目名称:DSAA_Cpp,代码行数:10,代码来源:genmain.cpp
示例15: main
int main(int argc, char **argv)
{
int opt;
char conf_path[D_CONF_PATH_LEN + 1] = {0};
while((opt = getopt(argc, argv, "f:h")) != EOF) {
switch(opt) {
case 'f':
fprintf(stderr, "Conf path: %s\n", optarg);
strncpy(conf_path, optarg, D_CONF_PATH_LEN);
break;
case 'h':
default:
printhelp(argv[0]);
exit(EXIT_FAILURE);
}
}
signal(SIGTERM, sig_handler);
signal(SIGINT, sig_handler);
if (mst_config_load(conf_path) != 0) {
fprintf(stderr, "Exiting...\n");
exit(EXIT_FAILURE);
}
mst_config_dump(&g_mst_conf);
//exit(EXIT_SUCCESS);
mst_init_shm_cntrs();
mst_mm_init();
mst_config_init();
mst_log_init();
mst_levent_init();
//mst_timer_init();
mst_tun_init();
mst_timer_init();
mst_init_epoll_queue();
mst_init_nw_queue();
mst_init_tun_queue();
if (mst_setup_network()) {
exit(EXIT_FAILURE);
}
//mst_loop_network();
mst_init_network();
mst_loop_timer(NULL);
fprintf(stderr, "Something caused exit....\n");
return 0;
}
开发者ID:hi2arun,项目名称:mstunnel,代码行数:56,代码来源:main.c
示例16: main
int
main()
{
uart_init(0); // init the UART before we can printf
volatile char c;
int i,j;
char browse_buf[256];
spi_master = 0;
slave = 1;
spi_core_slave_select(spi_master, 0); // Deselect slaves
// Clear the read FIFO
while (spi_core_data_avail(spi_master))
c = spi_core_read_data(spi_master);
programming_file_start = (unsigned long) &spiprogram_data;
programming_file_end = (unsigned long) &end_spiprogram_data;
programming_file_length = programming_file_end - programming_file_start;
// SPI core 0, should already be configured to read out data
// when we reset.
printf("\n\n\tSPI flash programming app\n\n");
while(1){
printf("[p,v,s,h] > ");
c = uart_getc(DEFAULT_UART);
printf("%c",c);
printf("\n");
if (c == 'h')
printhelp();
else if (c == 's')
print_spi_status();
else if (c == 'p')
program_spi(spi_master, slave, (char *) &spiprogram_data, programming_file_length);
else if (c == 'v')
verify_spi(spi_master, slave, (char *) &spiprogram_data, programming_file_length);
else if ( c== 'r')
{
printf("Read page\n");
spi_read_block(spi_master, slave, ((console_get_num())<<8),
256,
browse_buf);
console_browse_buffer(browse_buf);
}
}
return 0;
}
开发者ID:DayUpWoniu,项目名称:orpsoc,代码行数:56,代码来源:spiflash-program.c
示例17: dropbearconvert_main
int dropbearconvert_main(int argc, char ** argv) {
#else
int main(int argc, char ** argv) {
#endif
int intype, outtype;
const char* infile;
const char* outfile;
crypto_init();
seedrandom();
#if DEBUG_TRACE
/* It's hard for it to get in the way _too_ much */
debug_trace = 1;
#endif
/* get the commandline options */
if (argc != 5) {
fprintf(stderr, "All arguments must be specified\n");
goto usage;
}
/* input type */
if (argv[1][0] == 'd') {
intype = KEYFILE_DROPBEAR;
} else if (argv[1][0] == 'o') {
intype = KEYFILE_OPENSSH;
} else {
fprintf(stderr, "Invalid input key type\n");
goto usage;
}
/* output type */
if (argv[2][0] == 'd') {
outtype = KEYFILE_DROPBEAR;
} else if (argv[2][0] == 'o') {
outtype = KEYFILE_OPENSSH;
} else {
fprintf(stderr, "Invalid output key type\n");
goto usage;
}
/* we don't want output readable by others */
umask(077);
infile = argv[3];
outfile = argv[4];
return do_convert(intype, infile, outtype, outfile);
usage:
printhelp(argv[0]);
return 1;
}
开发者ID:AlexMarlo,项目名称:dropbear,代码行数:55,代码来源:dropbearconvert.c
示例18: parsecmdline
void parsecmdline(int argc, char **argv) {
port = 7000;
strcpy(host, "127.0.0.1");
strcpy(inputfile, "seq");
strcpy(savefile, "");
usevis = 0;
Neq = 10000;
beta = 1.0;
node = 0;
Nc = 10;
key[0] = (unsigned short)getpid();
key[1] = (unsigned short)time(NULL);
key[2] = (unsigned short)getuid();
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-h") == 0) {
strcpy(host, argv[i+1]);
i++;
} else if (strcmp(argv[i], "-p") == 0) {
sscanf(argv[i+1], "%d", &port);
i++;
} else if (strcmp(argv[i], "-i") == 0) {
strcpy(inputfile, argv[i+1]);
i++;
} else if (strcmp(argv[i], "-k") == 0) {
sscanf(argv[i+1], "%hu", &key[0]);
sscanf(argv[i+2], "%hu", &key[1]);
sscanf(argv[i+3], "%hu", &key[2]);
i += 3;
} else if (strcmp(argv[i], "-e") == 0) {
sscanf(argv[i+1], "%ld", &Neq);
i++;
} else if (strcmp(argv[i], "-v") == 0) {
usevis = 1;
} else if (strcmp(argv[i], "-w") == 0) {
strcpy(savefile, argv[i+1]);
i++;
} else if (strcmp(argv[i], "-b") == 0) {
sscanf(argv[i+1], "%lf", &beta);
i++;
} else if (strcmp(argv[i], "-n") == 0) {
sscanf(argv[i+1], "%d", &node);
i++;
} else if (strcmp(argv[i], "-c") == 0) {
sscanf(argv[i+1], "%d", &Nc);
i++;
} else {
printf("bad command line parameter %s\n", argv[i]);
printhelp();
exit(0);
}
}
}
开发者ID:honey66clover,项目名称:DNAClientServer,代码行数:55,代码来源:wlmc_args.c
示例19: main
int main(int argc, char **argv) {
char *datadir;
int inpnum;
//setseeds(3,3);
datadir= getenv("SMAQDATA");
if(datadir !=NULL) {
strcpy(dirname, datadir);
};
if(argc != 2){
printhelp();
return 1;
};
inpnum = atoi(argv[1]);
if(((inpnum<1 )|| (inpnum>48)) && ((inpnum<101 )|| (inpnum>148)) &&
((inpnum<51 )|| (inpnum>74)) ){
printhelp();
return 2;
}
signal(SIGUSR1, gotsignal); siginterrupt(SIGUSR1, 0);
initSMAQ();
inputsSMAQ(0,inpnum);
vmeclose();
return 0;
}
开发者ID:AakaFosfor,项目名称:trigger,代码行数:24,代码来源:smaq2.c
示例20: dropbearconvert_main
int dropbearconvert_main(int argc, char ** argv) {
#else
int main(int argc, char ** argv) {
#endif
int intype, outtype;
const char* infile;
const char* outfile;
/* get the commandline options */
if (argc != 5) {
fprintf(stderr, "All arguments must be specified\n");
goto usage;
}
/* input type */
if (argv[1][0] == 'd') {
intype = KEYFILE_DROPBEAR;
} else if (argv[1][0] == 'o') {
intype = KEYFILE_OPENSSH;
} else {
fprintf(stderr, "Invalid input key type\n");
goto usage;
}
/* output type */
if (argv[2][0] == 'd') {
outtype = KEYFILE_DROPBEAR;
} else if (argv[2][0] == 'o') {
outtype = KEYFILE_OPENSSH;
} else {
fprintf(stderr, "Invalid output key type\n");
goto usage;
}
/* we don't want output readable by others */
umask(077);
infile = argv[3];
outfile = argv[4];
return do_convert(intype, infile, outtype, outfile);
usage:
printhelp(argv[0]);
return 1;
}
开发者ID:zipangotes,项目名称:DSL-G624T_GPL_code,代码行数:47,代码来源:dropbearconvert.c
注:本文中的printhelp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论