dtksh: Use ksh93 translate over augmented version

We can reduce our differences from upstream ksh by simply using their
ERROR_translate() function instead of our janky and obsolete msg_translate,
we also move DtGetMessage() to msgs.c and lockedfiledescriptors and,
unlockfiledescriptors to extra.c to lessen modifications to init.c, which
all changes will hopefully be moved elsewhere in the future
This commit is contained in:
Chase
2020-10-13 16:43:56 -05:00
committed by Jon Trulson
parent 3443543744
commit 461d326bbe
10 changed files with 369 additions and 837 deletions

View File

@@ -28,7 +28,13 @@
#include <nl_types.h>
#endif
#include "msgs.h"
#include "error.h"
char *_DtGetMessage(char *filename, char *s)
{
char * loc = getenv("LANG");
return(ERROR_translate(loc, 0, _CLIENT_CAT_NAME, s));
}
char *
GetSharedMsg(
@@ -39,147 +45,147 @@ GetSharedMsg(
switch (msgId)
{
case DT_BAD_FIELD_NAME:
msg = GETMESSAGE(11,1, "Cannot find a field named '%s' in the structure '%s'");
msg = GETMESSAGE("Cannot find a field named '%s' in the structure '%s'");
break;
case DT_CONV_BUF_OVFL:
msg = GETMESSAGE(11,2, "DtkshCvtCallbackToString: An internal conversion buffer overflowed");
msg = GETMESSAGE("DtkshCvtCallbackToString: An internal conversion buffer overflowed");
break;
case DT_HASHING_FAILURE:
msg = GETMESSAGE(11,3, "Hashing failure for resource '%s' in widget class '%s'");
msg = GETMESSAGE("Hashing failure for resource '%s' in widget class '%s'");
break;
case DT_NO_FUNC_NAME:
msg = GETMESSAGE(11,4, "No function name was supplied");
msg = GETMESSAGE("No function name was supplied");
break;
case DT_TK_NOT_INIT:
msg = GETMESSAGE(11,5, "The command cannot be executed; the toolkit has not been initialized");
msg = GETMESSAGE("The command cannot be executed; the toolkit has not been initialized");
break;
case DT_WIDGET_CREATE_FAILED:
msg = GETMESSAGE(11,6, "The creation of widget '%s' failed");
msg = GETMESSAGE("The creation of widget '%s' failed");
break;
case DT_BAD_DISPLAY:
msg = GETMESSAGE(11,7, "The display parameter is invalid: %s");
msg = GETMESSAGE("The display parameter is invalid: %s");
break;
case DT_BAD_ATOM:
msg = GETMESSAGE(11,8, "The following property atom is invalid: %s");
msg = GETMESSAGE("The following property atom is invalid: %s");
break;
case DT_UNDEF_RESOURCE:
msg = GETMESSAGE(11,9, "The following resource is not defined for widget '%s': %s");
msg = GETMESSAGE("The following resource is not defined for widget '%s': %s");
break;
case DT_BAD_POSITION:
msg = GETMESSAGE(11,10, "The position specified is invalid: %s");
msg = GETMESSAGE("The position specified is invalid: %s");
break;
case DT_BAD_FONT:
msg = GETMESSAGE(11,11, "The specified font is invalid: %s");
msg = GETMESSAGE("The specified font is invalid: %s");
break;
case DT_BAD_WIDGET_HANDLE:
msg = GETMESSAGE(11,12, "The widget handle '%s' does not refer to an existing widget");
msg = GETMESSAGE("The widget handle '%s' does not refer to an existing widget");
break;
case DT_CMD_WIDGET:
msg = GETMESSAGE(11,13, "The widget must be a 'command' widget");
msg = GETMESSAGE("The widget must be a 'command' widget");
break;
case DT_MAIN_WIN_WIDGET:
msg = GETMESSAGE(11,14, "The widget must be a 'mainWindow' widget");
msg = GETMESSAGE("The widget must be a 'mainWindow' widget");
break;
case DT_SCALE_WIDGET:
msg = GETMESSAGE(11,15, "The widget must be a 'scale' widget");
msg = GETMESSAGE("The widget must be a 'scale' widget");
break;
case DT_SCROLLBAR_WIDGET:
msg = GETMESSAGE(11,16, "The widget must be a 'scrollBar' widget");
msg = GETMESSAGE("The widget must be a 'scrollBar' widget");
break;
case DT_TOGGLE_WIDGET:
msg = GETMESSAGE(11,17, "The widget must be a 'toggleButton' widget or gadget");
msg = GETMESSAGE("The widget must be a 'toggleButton' widget or gadget");
break;
case DT_BAD_WINDOW:
msg = GETMESSAGE(11,18, "The window parameter is invalid: %s");
msg = GETMESSAGE("The window parameter is invalid: %s");
break;
case DT_ALLOC_FAILURE:
msg = GETMESSAGE(11,19, "Unable to allocate required memory; exiting");
msg = GETMESSAGE("Unable to allocate required memory; exiting");
break;
case DT_NO_PARENT:
msg = GETMESSAGE(11,20, "Unable to find the parent widget");
msg = GETMESSAGE("Unable to find the parent widget");
break;
case DT_UNDEF_SYMBOL:
msg = GETMESSAGE(11,21, "Unable to locate the symbol '%s'");
msg = GETMESSAGE("Unable to locate the symbol '%s'");
break;
case DT_UNDEF_TYPE:
msg = GETMESSAGE(11,22, "Unable to locate the type '%s'");
msg = GETMESSAGE("Unable to locate the type '%s'");
break;
case DT_BAD_DECL:
msg = GETMESSAGE(11,23, "Unable to parse the declaration '%s'; using 'unsigned long'");
msg = GETMESSAGE("Unable to parse the declaration '%s'; using 'unsigned long'");
break;
case DT_UNKNOWN_CHILD_TYPE:
msg = GETMESSAGE(11,24, "Unknown child type: %s");
msg = GETMESSAGE("Unknown child type: %s");
break;
case DT_UNKNOWN_OPTION:
msg = GETMESSAGE(11,25, "Unrecognized option flag: %s");
msg = GETMESSAGE("Unrecognized option flag: %s");
break;
case DT_USAGE_WIDGET_POS:
msg = GETMESSAGE(11,26, "Usage: %s widget position");
msg = GETMESSAGE("Usage: %s widget position");
break;
case DT_USAGE_WIDGET_TIME:
msg = GETMESSAGE(11,27, "Usage: %s widget time");
msg = GETMESSAGE("Usage: %s widget time");
break;
case DT_USAGE_WIDGET:
msg = GETMESSAGE(11,28, "Usage: %s widget");
msg = GETMESSAGE("Usage: %s widget");
break;
case DTKSH_ERROR:
msg = GETMESSAGE(11,29, "dtksh error");
msg = GETMESSAGE("dtksh error");
break;
case DT_WARNING:
msg = GETMESSAGE(11,30, "dtksh warning");
msg = GETMESSAGE("dtksh warning");
break;
case DT_USAGE_DISPLAY_WINDOW:
msg = GETMESSAGE(11,31, "Usage: %s display window");
msg = GETMESSAGE("Usage: %s display window");
break;
case DT_USAGE_DISPLAY_WINDOW_VAR:
msg = GETMESSAGE(11,32, "Usage: %s display window variable");
msg = GETMESSAGE("Usage: %s display window variable");
break;
case DT_USAGE_DISPLAY_ROOT_VAR:
msg = GETMESSAGE(11,33, "Usage: %s display rootWindow variable");
msg = GETMESSAGE("Usage: %s display rootWindow variable");
break;
case DT_BAD_TIMEOUT:
msg = GETMESSAGE(11,34, "The timeout parameter is invalid: %s");
msg = GETMESSAGE("The timeout parameter is invalid: %s");
break;
case DT_BAD_MESSAGE:
msg = GETMESSAGE(11,35, "The msg parameter is invalid: %s");
msg = GETMESSAGE("The msg parameter is invalid: %s");
break;
case DT_BAD_PATTERN:
msg = GETMESSAGE(11,36, "The patterns parameter is invalid: %s");
msg = GETMESSAGE("The patterns parameter is invalid: %s");
break;
}
return(msg);