MCPcopy Create free account
hub / github.com/NetHack/NetHack / process_options

Function process_options

sys/share/pcmain.c:512–630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510}
511
512static void
513process_options(int argc, char *argv[])
514{
515 int i;
516
517 /*
518 * Process options.
519 */
520 while (argc > 1 && argv[1][0] == '-') {
521 argv++;
522 argc--;
523 switch (argv[0][1]) {
524 case 'a':
525 if (argv[0][2]) {
526 if ((i = str2align(&argv[0][2])) >= 0)
527 flags.initalign = i;
528 } else if (argc > 1) {
529 argc--;
530 argv++;
531 if ((i = str2align(argv[0])) >= 0)
532 flags.initalign = i;
533 }
534 break;
535 case 'D':
536 wizard = TRUE, discover = FALSE;
537 break;
538 case 'X':
539 discover = TRUE, wizard = FALSE;
540 break;
541#ifdef NEWS
542 case 'n':
543 iflags.news = FALSE;
544 break;
545#endif
546 case 'u':
547 if (argv[0][2])
548 (void) strncpy(svp.plname, argv[0] + 2, sizeof(svp.plname) - 1);
549 else if (argc > 1) {
550 argc--;
551 argv++;
552 (void) strncpy(svp.plname, argv[0], sizeof(svp.plname) - 1);
553 } else
554 raw_print("Player name expected after -u");
555 break;
556#ifndef AMIGA
557 case 'I':
558 case 'i':
559 if (!strncmpi(argv[0] + 1, "IBM", 3)) {
560 load_symset("IBMGraphics", PRIMARYSET);
561 load_symset("RogueIBM", ROGUESET);
562 switch_symbols(TRUE);
563 }
564 break;
565 /* case 'D': */
566 case 'd':
567 if (!strncmpi(argv[0] + 1, "DEC", 3)) {
568 load_symset("DECGraphics", PRIMARYSET);
569 switch_symbols(TRUE);

Callers 1

pcmainFunction · 0.70

Calls 11

str2alignFunction · 0.85
raw_printFunction · 0.85
load_symsetFunction · 0.85
switch_symbolsFunction · 0.85
str2gendFunction · 0.85
str2roleFunction · 0.85
str2raceFunction · 0.85
nhusageFunction · 0.70
nethack_exitFunction · 0.70
strncmpiFunction · 0.50
raw_printfFunction · 0.50

Tested by

no test coverage detected