File: mkxcmd.c

package info (click to toggle)
ppxp 0.99120923-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,812 kB
  • ctags: 3,704
  • sloc: ansic: 24,532; tcl: 3,992; makefile: 517; sh: 80
file content (34 lines) | stat: -rw-r--r-- 736 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
#include <stdio.h>
#include <string.h>
#include <sys/types.h>

#include "sysmsg.h"

#include "xcmd.h.in"
#include "xcmdlist.h"

int
main()
{
    unsigned n, c;
    char buf[256], *np;

    printf("/*\n"
	   " * Do not Edit!!\n"
	   " * This file is generated automatically by mkxcmd.c\n"
	   " */\n\n"
	   "typedef\tu_int8_t\txcmd_t;\n\n");
    strcpy(buf, "XCMD_");
    np = buf + strlen(buf);
    for (n = 0; n < NUM_XCMD; n ++) {
	if (!strcmp(xcmdList[n].name, "."))
	    strcpy(np, "DOT");
	else
	    strcpy(np, xcmdList[n].name);
	for (c = 0; c < strlen(np); c ++) np[c] &= ~' ';
	printf("#define\t%s\t0x%x\n", buf, n);
    }
    printf("#define\tXCMD_MAX\t%d\n", n);
    printf("\n/* #include xcmd.h.in */\n\n");
    return(0);
}