From c9455664ebb413b0ac4c5349af3bf64ca00bf150 Mon Sep 17 00:00:00 2001 From: robocop Date: Mon, 20 Jul 2009 12:44:11 +0000 Subject: [PATCH] Misc (obsolete utilities) --- src/msgs/change_msgs.epp | 9 ++++-- src/msgs/enter_msgs.epp | 66 +++++++++++++++++++++------------------- 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/src/msgs/change_msgs.epp b/src/msgs/change_msgs.epp index 58e5158b34..0a29ea475c 100644 --- a/src/msgs/change_msgs.epp +++ b/src/msgs/change_msgs.epp @@ -67,11 +67,14 @@ int main( int argc, char **argv) * Top level routine. * **************************************/ - char facility[20], text[256], module[32], routine[32]; - char sql_class[32], sql_sub_class[32]; + char facility[20], text[256]; + BASED_ON MESSAGES.ROUTINE routine; + BASED_ON MESSAGES.MODULE module; + BASED_ON SYSTEM_ERRORS.SQL_CLASS sql_class; + BASED_ON SYSTEM_ERRORS.SQL_SUBCLASS sql_sub_class; + BASED_ON SYSTEM_ERRORS.GDS_SYMBOL symbol; SCHAR input[200]; char yesno[100]; - char symbol[30]; char nstring[32]; SSHORT count; SSHORT sql_number; diff --git a/src/msgs/enter_msgs.epp b/src/msgs/enter_msgs.epp index 6a8bebf1cc..aaf2da5c11 100644 --- a/src/msgs/enter_msgs.epp +++ b/src/msgs/enter_msgs.epp @@ -43,12 +43,12 @@ DATABASE DB = "msg.fdb"; static void ascii_str_upper(UCHAR*); -static bool get_sql_class(UCHAR *); +static bool get_sql_class(char*); static bool get_sql_code(SSHORT *); -static bool get_sql_subclass(UCHAR *); +static bool get_sql_subclass(char*); static bool store_sql_msg(); static bool translate(const UCHAR*, UCHAR*, SSHORT); -static bool get_symbol( UCHAR *); +static bool get_symbol( char*); const int FAC_SQL_POSITIVE = 14; const int FAC_SQL_NEGATIVE = 13; @@ -75,10 +75,13 @@ int main( int argc, char **argv) /* Note that the lengths of these variables are based on the lengths of the * fields in the message database */ - UCHAR facility[20], text[256], module[32], routine[32]; - UCHAR sql_class[32], sql_sub_class[32]; - UCHAR symbol[30], pub[1]; - UCHAR nstring[32]; + UCHAR facility[20], text[256]; + BASED_ON MESSAGES.ROUTINE routine; + BASED_ON MESSAGES.MODULE module; + BASED_ON SYSTEM_ERRORS.SQL_CLASS sql_class; + BASED_ON SYSTEM_ERRORS.SQL_SUBCLASS sql_sub_class; + BASED_ON SYSTEM_ERRORS.GDS_SYMBOL symbol; + UCHAR pub[1]; SSHORT count; SSHORT sql_num; bool public_msg; @@ -92,7 +95,6 @@ int main( int argc, char **argv) memset(sql_sub_class, 0, sizeof(sql_sub_class)); memset(symbol, 0, sizeof(symbol)); memset(pub, 0, sizeof(pub)); - memset(nstring, 0, sizeof(nstring)); printf("\nHit Ctrl-D (or Ctrl-Z) at prompt to exit level\n"); printf @@ -127,10 +129,10 @@ int main( int argc, char **argv) for (;;) { printf(" Module: "); - if (!gets((char*) module)) + if (!gets(module)) break; printf(" Routine: "); - if (!gets((char*) routine)) + if (!gets(routine)) break; printf(" Text: "); if (!gets((char*) text)) @@ -151,7 +153,7 @@ int main( int argc, char **argv) public_msg = true; printf(" Symbol: "); - if (!gets((char*) symbol)) + if (!gets(symbol)) break; if (public_msg) @@ -175,15 +177,15 @@ int main( int argc, char **argv) S.SQL_CODE = sql_num; - strcpy(S.GDS_SYMBOL, (char*) symbol); + strcpy(S.GDS_SYMBOL, symbol); if (sql_class[0]) { - strcpy(S.SQL_CLASS, (char*) sql_class); + strcpy(S.SQL_CLASS, sql_class); S.SQL_CLASS.NULL = FALSE; } else S.SQL_CLASS.NULL = TRUE; if (sql_sub_class[0]) { - strcpy(S.SQL_SUBCLASS, (char*) sql_sub_class); + strcpy(S.SQL_SUBCLASS, sql_sub_class); S.SQL_SUBCLASS.NULL = FALSE; } else @@ -195,9 +197,9 @@ int main( int argc, char **argv) STORE Y IN MESSAGES USING Y.FAC_CODE = X.FAC_CODE; Y.NUMBER = X.MAX_NUMBER; - strcpy(Y.MODULE, (char*) module); - strcpy(Y.ROUTINE, (char*) routine); - strcpy(Y.SYMBOL, (char*) symbol); + strcpy(Y.MODULE, module); + strcpy(Y.ROUTINE, routine); + strcpy(Y.SYMBOL, symbol); if (!translate(text, (UCHAR*) Y.TEXT, sizeof(Y.TEXT))) { printf ("Message too long: max length: %d\n", @@ -249,7 +251,7 @@ static void ascii_str_upper( UCHAR * str) } -static bool get_sql_class( UCHAR * sql_class) +static bool get_sql_class( char* sql_class) { /************************************** * @@ -265,15 +267,15 @@ static bool get_sql_class( UCHAR * sql_class) while (true) { printf(" SQLCLASS: "); - gets((char*) sql_class); - const SSHORT length = strlen((char*) sql_class); - if (length == 0 || !isalnum(sql_class[0])) + gets(sql_class); + const SSHORT length = strlen(sql_class); + if (length == 0 || !isalnum((UCHAR) sql_class[0])) break; if (length == 2) return true; - else - fprintf(stderr, "Sqlclass is two characters!\n"); + + fprintf(stderr, "Sqlclass is two characters!\n"); } return false; @@ -367,7 +369,7 @@ static bool get_sql_code( SSHORT * sql_code) } -static bool get_sql_subclass( UCHAR * sql_sub_class) +static bool get_sql_subclass( char* sql_sub_class) { /************************************** * @@ -383,9 +385,9 @@ static bool get_sql_subclass( UCHAR * sql_sub_class) while (true) { printf(" SQLSUBCLASS: "); - gets((char*) sql_sub_class); - const SSHORT length = strlen((char*) sql_sub_class); - if (length == 0 || !isalnum(sql_sub_class[0])) + gets(sql_sub_class); + const SSHORT length = strlen(sql_sub_class); + if (length == 0 || !isalnum((UCHAR) sql_sub_class[0])) break; if (length == 3) @@ -400,7 +402,7 @@ static bool get_sql_subclass( UCHAR * sql_sub_class) } -static bool get_symbol( UCHAR * symbol) +static bool get_symbol( char* symbol) { /************************************** * @@ -417,11 +419,11 @@ static bool get_symbol( UCHAR * symbol) while (true) { fprintf(stderr, "Symbols are required for system errors!\n"); printf(" Symbol: "); - gets((char*) symbol); - if (!strlen((char*) symbol) || !isalnum(symbol[0])) + gets(symbol); + if (!strlen(symbol) || !isalnum((UCHAR) symbol[0])) return false; - else - return true; + + return true; } }