{DEC,IBM,MAC}graphics (2 of 2: unixmain)
Unix command line processing required that the initial 'd' of "-DECgraphics" be lowercase so that it wouldn't conflict with -D for wizard mode. This retains -D for wizard mode and now also recognizes "-debug" (case insensitive, but full 5 letters necessary) for the same thing, and allows "-DECgraphics" to be capitalized as it is throughout the rest of the program (actual matching is case-insensitive, so "-dec" and "-decgraphics" still work. It now requires that anything after "DEC" match the rest of that string instead of accepting "-DECanthing" as a synonym for "-DECgraphics". Likewise for "-IBMgraphics": when more than 3 letters are supplied, the extra ones must be an initial substring of "graphics" rather than arbitrary characters. The raw_printf() warnings don't actually work as intended, but that isn't a change from the old behavior so I've left them in for now.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.5 unixmain.c $NHDT-Date: 1426966705 2015/03/21 19:38:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */
|
||||
/* NetHack 3.5 unixmain.c $NHDT-Date: 1427074144 2015/03/23 01:29:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.45 $ */
|
||||
/* NetHack 3.5 unixmain.c $Date: 2012/01/27 20:15:31 $ $Revision: 1.42 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -324,7 +324,7 @@ process_options(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int i;
|
||||
int i, l;
|
||||
|
||||
/*
|
||||
* Process options.
|
||||
@@ -332,11 +332,25 @@ char *argv[];
|
||||
while(argc > 1 && argv[1][0] == '-'){
|
||||
argv++;
|
||||
argc--;
|
||||
l = (int)strlen(*argv);
|
||||
/* must supply at least 4 chars to match "-XXXgraphics" */
|
||||
if (l < 4) l = 4;
|
||||
|
||||
switch(argv[0][1]){
|
||||
case 'D':
|
||||
wizard = TRUE, discover = FALSE;
|
||||
case 'd':
|
||||
if ((argv[0][1] == 'D' && !argv[0][2])
|
||||
|| !strcmpi(*argv, "-debug")) {
|
||||
wizard = TRUE, discover = FALSE;
|
||||
} else if (!strncmpi(*argv, "-DECgraphics", l)) {
|
||||
load_symset("DECGraphics", PRIMARY);
|
||||
switch_symbols(TRUE);
|
||||
} else {
|
||||
raw_printf("Unknown option: %s", *argv);
|
||||
}
|
||||
break;
|
||||
case 'X':
|
||||
|
||||
discover = TRUE, wizard = FALSE;
|
||||
break;
|
||||
#ifdef NEWS
|
||||
@@ -356,17 +370,12 @@ char *argv[];
|
||||
break;
|
||||
case 'I':
|
||||
case 'i':
|
||||
if (!strncmpi(argv[0]+1, "IBM", 3)) {
|
||||
if (!strncmpi(*argv, "-IBMgraphics", l)) {
|
||||
load_symset("IBMGraphics", PRIMARY);
|
||||
load_symset("RogueIBM", ROGUESET);
|
||||
switch_symbols(TRUE);
|
||||
}
|
||||
break;
|
||||
/* case 'D': */
|
||||
case 'd':
|
||||
if (!strncmpi(argv[0]+1, "DEC", 3)) {
|
||||
load_symset("DECGraphics", PRIMARY);
|
||||
switch_symbols(TRUE);
|
||||
} else {
|
||||
raw_printf("Unknown option: %s", *argv);
|
||||
}
|
||||
break;
|
||||
case 'p': /* profession (role) */
|
||||
|
||||
Reference in New Issue
Block a user