summaryrefslogtreecommitdiffstats
path: root/private/ntos/boot/lib/blmisc.c
blob: a3fb773b4e09ef653b58bc8441a45077036068cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*++

Copyright (c) 1991  Microsoft Corporation

Module Name:

    blmisc.c

Abstract:

    This module contains miscellaneous routines for use by
    the boot loader and setupldr.

Author:

    David N. Cutler (davec) 10-May-1991

Revision History:

--*/

#include "bootlib.h"

//
// Value indicating whether a dbcs locale is active.
// If this value is non-0 we use alternate display routines, etc,
// and fetch messages in this language.
//
ULONG DbcsLangId;

PCHAR
BlGetArgumentValue (
    IN ULONG Argc,
    IN PCHAR Argv[],
    IN PCHAR ArgumentName
    )

/*++

Routine Description:

    This routine scans the specified argument list for the named argument
    and returns the address of the argument value. Argument strings are
    specified as:

        ArgumentName=ArgumentValue

    Argument names are specified as:

        ArgumentName=

    The argument name match is case insensitive.

Arguments:

    Argc - Supplies the number of argument strings that are to be scanned.

    Argv - Supplies a pointer to a vector of pointers to null terminated
        argument strings.

    ArgumentName - Supplies a pointer to a null terminated argument name.

Return Value:

    If the specified argument name is located, then a pointer to the argument
    value is returned as the function value. Otherwise, a value of NULL is
    returned.

--*/

{

    PCHAR Name;
    PCHAR String;

    //
    // Scan the argument strings until either a match is found or all of
    // the strings have been scanned.
    //

    while (Argc > 0) {
        String = Argv[Argc - 1];
        if (String != NULL) {
            Name = ArgumentName;
            while ((*Name != 0) && (*String != 0)) {
                if (toupper(*Name) != toupper(*String)) {
                    break;
                }

                Name += 1;
                String += 1;
            }

            if ((*Name == 0) && (*String == '=')) {
                return String + 1;
            }

            Argc -= 1;
        }
    }

    return NULL;
}

//
// Line draw chars -- different scheme in Far East vs. SBCS
//
UCHAR
GetGraphicsChar(
    IN GraphicsChar WhichOne
    )
{
#ifdef _X86_
    UCHAR TextGetGraphicsCharacter(GraphicsChar);

    return(TextGetGraphicsCharacter(WhichOne));
#else
    //
    // ARC machines don't support dbcs for now
    //
    static UCHAR ArcGraphicsChars[GraphicsCharMax] = { (UCHAR)'\311',   // right-down
                                                       (UCHAR)'\273',   // left-down
                                                       (UCHAR)'\310',   // right-up
                                                       (UCHAR)'\274',   // left-up
                                                       (UCHAR)'\272',   // vertical
                                                       (UCHAR)'\315'    // horizontal
                                                     };

    return(((unsigned)WhichOne < (unsigned)GraphicsCharMax) ? ArcGraphicsChars[WhichOne] : ' ');
#endif
}