File: iscmd.c

package info (click to toggle)
wcalc 2.3.1-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,444 kB
  • ctags: 926
  • sloc: ansic: 8,993; objc: 1,946; lex: 798; sh: 766; yacc: 623; makefile: 79
file content (41 lines) | stat: -rw-r--r-- 1,432 bytes parent folder | download | duplicates (3)
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
#include <string.h>
#include "iscmd.h"
#ifdef MEMWATCH
#include "memwatch.h"
#endif

const char *commands[] = {
    "b", "bin", "binary", "store", "q", "d", "dec", "decimal",
    "dsep", "e", "eng", "engineering", "cons", "conservative",
    "h", "hex", "hexadecimal", "x", "help", "hlimit", "ints",
    "li", "list", "listvars", "o", "oct", "octal", "open", "p",
    "pre", "prefix", "prefixes", "pref", "prefs", "preferences",
    "r", "rad", "radians", "rou", "round", "rounding", "re",
    "remember", "remember_errors", "bits", "save", "tsep", "c",
    "convert", "conv", "base", "verbose", "explain", "cmod",
    0
};

const char *qcommands[] = {
    "\\b", "\\bin", "\\binary", "\\store", "\\q", "\\d", "\\dec", "\\decimal",
    "\\dsep", "\\e", "\\eng", "\\engineering", "\\cons", "\\conservative",
    "\\h", "\\hex", "\\hexadecimal", "\\x", "\\help", "\\hlimit", "\\ints",
    "\\li", "\\list", "\\listvars", "\\o", "\\oct", "\\octal", "\\open", "\\p",
    "\\pre", "\\prefix", "\\prefixes", "\\pref", "\\prefs", "\\preferences",
    "\\r", "\\rad", "\\radians", "\\rou", "\\round", "\\rounding", "\\re",
    "\\remember", "\\remember_errors", "\\bits", "\\save", "\\tsep", "\\c",
    "\\convert", "\\conv", "\\base", "\\verbose", "\\explain", "\\cmod",
    0
};

int iscmd(const char *str)
{
    size_t i;

    for (i = 0; commands[i]; i++) {
	if (strcmp(commands[i], str) == 0) {
	    return 1;
	}
    }
    return 0;
}