| 1 |
/* |
| 2 |
* This is an incomplete C program preamble aimed to extract |
| 3 |
* constants' values. The complete source is generated by |
| 4 |
* CREATE_CONSTANTS_C.COM. |
| 5 |
* |
| 6 |
* NOTE: THIS CODE IS SPECIFIC TO OPENVMS 7.2 OR ABOVE PLATFORMS |
| 7 |
* |
| 8 |
*/ |
| 9 |
|
| 10 |
#include <stdlib.h> |
| 11 |
#include <stdio.h> |
| 12 |
#include <string.h> |
| 13 |
#include <errno.h> |
| 14 |
#include <xti.h> |
| 15 |
#include <netdb.h> |
| 16 |
#include <in.h> |
| 17 |
#include <inet.h> |
| 18 |
#include <socket.h> |
| 19 |
#include <ctype.h> |
| 20 |
#include <unixio.h> |
| 21 |
#include <tcpip$inetdef.h> |
| 22 |
|
| 23 |
|
| 24 |
static char * |
| 25 |
capitalize (char *name) |
| 26 |
{ |
| 27 |
int beginning = 1; |
| 28 |
char *result = (char *) malloc (strlen (name) + 1); |
| 29 |
char *ptr; |
| 30 |
for (ptr = result; *name; ptr++, name++) { |
| 31 |
*ptr = *name; |
| 32 |
if (beginning) { |
| 33 |
beginning = 0; |
| 34 |
} else if (*ptr == '_') { |
| 35 |
beginning = 1; |
| 36 |
} else if (isupper(*ptr)) { |
| 37 |
*ptr = tolower(*ptr); |
| 38 |
} |
| 39 |
} |
| 40 |
*ptr = '\0'; |
| 41 |
return result; |
| 42 |
} |
| 43 |
|
| 44 |
static void |
| 45 |
output (char *name, int value) |
| 46 |
{ |
| 47 |
char *capitalized = capitalize (name); |
| 48 |
if (value >= 0) { |
| 49 |
printf (" %-20s : constant := 16#%04X#;\n", capitalized, value); |
| 50 |
} else { |
| 51 |
printf (" %-20s : constant := %d;\n", capitalized, value); |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
int |
| 56 |
main (int argc, char *argv[]) |
| 57 |
{ |