static int pb_complete(int argc, char **argv) { int i, ret, fd; while ((i = getopt(argc, argv, "d:m:")) != EOF) { switch (i) { case 'd': device = optarg; break; case 'm': mount_point = optarg; break; default: usage_complete(); return SYSEXIT_PARAM; } } argc -= optind; argv += optind; GET_DD(argc, argv); if (argc != 0 || fill_opts()) { usage_complete(); return SYSEXIT_PARAM; } ret = get_balloon(mount_point, NULL, &fd); if (ret) return ret; return ploop_balloon_complete(device); }
static void parse_args(int argc, char *argv[]) { int c; for (;;) { c = getopt(argc, argv, "c:hm:"); if (c < 0) break; switch (c) { case 'c': channel_nr = atoi(optarg); if (!channel_nr) { fprintf(stderr, "Invalid channel_nr\n"); exit(EXIT_FAILURE); } break; case 'h': usage_complete(); exit(EXIT_SUCCESS); case 'm': module_nr = atoi(optarg); break; } } }
static void parse_args(int argc, char *argv[]) { int c; for (;;) { c = getopt(argc, argv, "ac:e:fhvl:m:ns:t"); if (c < 0) break; switch (c) { case 'a': acquire = 1; fetch = 0; break; case 'c': channel_nr = strtoul(optarg, NULL, 0); break; case 'e': nr_events = strtoul(optarg, NULL, 0); break; case 'f': acquire = 0; fetch = 1; break; case 'h': usage_complete(); exit(EXIT_SUCCESS); case 'v': print_version(); exit(EXIT_SUCCESS); case 'l': ev_length = strtoul(optarg, NULL, 0); break; case 'm': module_nr = strtol(optarg, NULL, 0); break; case 'n': no_wait = 1; break; case 's': segment_nr = strtoul(optarg, NULL, 0); break; case 't': acquire = 0; fetch = 1; show_tstamps = 1; break; } } }
static void parse_args(int argc, char *argv[]) { int c; for (;;) { c = getopt(argc, argv, "hm:"); if (c < 0) break; switch (c) { case 'h': usage_complete(); exit(EXIT_SUCCESS); case 'm': module_nr = atoi(optarg); break; } } }
static void parse_args(int argc, char *argv[]) { int c; for (;;) { c = getopt(argc, argv, "hvm:"); if (c < 0) break; switch (c) { case 'h': usage_complete(); exit(EXIT_SUCCESS); case 'v': print_version(); exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; } } }
static void parse_args(int argc, char *argv[]) { float freq; int c; for (;;) { c = getopt(argc, argv, "f:hvm:s:"); if (c < 0) break; switch (c) { case 'f': if (!sscanf(optarg, "%g", &freq)) { fprintf(stderr, "Invalid frequency input\n"); exit(EXIT_FAILURE); } clkfreq = freq * 1000000; break; case 'h': usage_complete(); exit(EXIT_SUCCESS); case 'v': print_version(); exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; case 's': if (strcmp(optarg, "internal") == 0) clksrc = SIS33_CLKSRC_INTERNAL; else if (strcmp(optarg, "external") == 0) clksrc = SIS33_CLKSRC_EXTERNAL; else { fprintf(stderr, "Unknown clock source '%s'\n", optarg); exit(EXIT_FAILURE); } break; } } }
static void parse_args(int argc, char *argv[]) { int c; for (;;) { c = getopt(argc, argv, "a:d:hm:"); if (c < 0) break; switch (c) { case 'a': auto_mode = strtol(optarg, NULL, 0); break; case 'd': delay = strtol(optarg, NULL, 0); break; case 'h': usage_complete(); exit(EXIT_SUCCESS); case 'm': module_nr = strtol(optarg, NULL, 0); break; } } }
int main(int argc,char *argv[]) { char *cp; char host[49]; char tmpb[CMD_BUF_SIZE]; int c; #if NEWS printf("xmemtest: See <news> command\n"); printf("xmemtest: Type h for help\n"); #endif pname = argv[0]; printf("%s: Compiled %s %s\n",pname,__DATE__,__TIME__); for (;;) { c = getopt(argc, argv, "c:h"); if (c < 0) break; switch (c) { case 'c': if (set_conf_path(optarg)) printf("\nWarning: path invalid or too long\n"); break; case 'h': usage_complete(); exit(0); } } xmem = XmemOpen(); if (xmem == 0) { printf("\nWARNING: Could not open driver"); printf("\n\n"); } else { printf("Driver opened OK: Using XMEM module: 1\n\n"); } ReadSegTable(0); ReadNodeTableFile(0); printf("\n"); bzero((void *) host,49); gethostname(host,48); while (True) { if (xmem) sprintf(prompt,"%s:Xmem[%02d]",host,cmdindx+1); else sprintf(prompt,"%s:NoDriver:Xmem[%02d]",host,cmdindx+1); cmdbuf = &(history[cmdindx][0]); if (strlen(cmdbuf)) printf("{%s} ",cmdbuf); printf("%s",prompt); bzero((void *) tmpb,CMD_BUF_SIZE); if (gets(tmpb)==NULL) exit(1); cp = &(tmpb[0]); if (*cp == '!') { cmdindx = strtoul(++cp,&cp,0) -1; if (cmdindx >= HISTORIES) cmdindx = 0; cmdbuf = &(history[cmdindx][0]); continue; } else if (*cp == '.') { printf("Execute:%s\n",cmdbuf); fflush(stdout); } else if ((*cp == '\n') || (*cp == '\0')) { cmdindx++; if (cmdindx >= HISTORIES) { printf("\n"); cmdindx = 0; } cmdbuf = &(history[cmdindx][0]); continue; } else if (*cp == '?') { printf("History:\n"); printf("\t!<1..24> Goto command\n"); printf("\tCR Goto next command\n"); printf("\t. Execute current command\n"); printf("\this Show command history\n"); continue; } else { cmdindx++; if (cmdindx >= HISTORIES) { printf("\n"); cmdindx = 0; } strcpy(cmdbuf,tmpb); } bzero((void *) val_bufs,sizeof(val_bufs)); GetAtoms(cmdbuf); DoCmd(0); } }