6708109.patch revision 1068
--- buttons.c 2009-10-16 14:39:48.000000000 -0700
+++ buttons.c 2011-01-28 20:32:24.195046596 -0800
@@ -36,6 +36,8 @@ from the X Consortium.
* Created: October 27, 1987
*/
+#include <libintl.h>
+#include <X11/Xlocale.h>
#include "globals.h"
#include "vendor.h"
@@ -47,6 +49,7 @@ from the X Consortium.
static void CreateOptionMenu(ManpageGlobals * man_globals, Widget parent);
static void CreateSectionMenu(ManpageGlobals * man_globals, Widget parent);
+static void CreateMoreMenu(ManpageGlobals * man_globals, Widget parent);
static void StartManpage(ManpageGlobals * man_globals, Boolean help, Boolean page);
static Widget * ConvertNamesToWidgets(Widget parent, char ** names);
@@ -57,6 +60,7 @@ static Widget * ConvertNamesToWidgets(Wi
*/
#define TOPARGS 5
+#define MAX_MENU 30
Widget top; /* needed in PopupWarning, misc.c */
@@ -213,7 +217,7 @@ Boolean full_instance)
{
Arg arglist[MANPAGEARGS]; /* An argument list for widget creation */
Cardinal num_args; /* The number of arguments in the list. */
- Widget mytop, pane, hpane, mysections; /* Widgets */
+ Widget mytop, pane, hpane, mysections, sect1; /* Widgets */
ManPageWidgets * mpw = &(man_globals->manpagewidgets);
num_args = (Cardinal) 0;
@@ -240,8 +244,13 @@ Boolean full_instance)
num_args++;
XtSetValues(mytop, arglist, num_args);
+#ifdef SUNSOFT
+ pane = XtCreateManagedWidget("Manpage_Vpane", panedWidgetClass, mytop, NULL,
+ (Cardinal) 0);
+#else
pane = XtCreateManagedWidget("vertPane", panedWidgetClass, mytop, NULL,
(Cardinal) 0);
+#endif
/* Create menu bar. */
@@ -259,15 +268,24 @@ Boolean full_instance)
mysections = XtCreateManagedWidget("sections", menuButtonWidgetClass,
hpane, arglist, num_args);
+ if(sections > MAX_MENU){
+ num_args = 0;
+ XtSetArg(arglist[num_args], XtNmenuName, MORE_MENU); num_args++;
+ sect1 = XtCreateManagedWidget("More...", menuButtonWidgetClass,
+ hpane, arglist, num_args);
+ }
+
XtSetArg(arglist[0], XtNlabel, SHOW_BOTH);
XtSetValues(man_globals->both_screens_entry, arglist, (Cardinal) 1);
if (full_instance) {
MakeSearchWidget(man_globals, mytop);
CreateSectionMenu(man_globals, mytop);
+ if(sections > MAX_MENU) CreateMoreMenu(man_globals, mytop);
MakeSaveWidgets(man_globals, mytop);
} else {
XtSetSensitive(mysections, FALSE);
+ if(sections > MAX_MENU) XtSetSensitive(sect1, FALSE);
XtSetArg(arglist[0], XtNsensitive, FALSE);
XtSetValues(man_globals->dir_entry, arglist, ONE);
XtSetValues(man_globals->manpage_entry, arglist, ONE);
@@ -281,8 +299,13 @@ Boolean full_instance)
XtSetValues(man_globals->print_entry, arglist, ONE);
#endif /* INCLUDE_XPRINT_SUPPORT */
+#ifdef SUNSOFT
+ man_globals->label = XtCreateManagedWidget(MANNAME, labelWidgetClass,
+ hpane, NULL, (Cardinal) 0);
+#else
man_globals->label = XtCreateManagedWidget("manualTitle", labelWidgetClass,
hpane, NULL, (Cardinal) 0);
+#endif
/* Create Directory */
@@ -330,7 +353,7 @@ StartManpage(ManpageGlobals * man_global
if (page || help) {
if (help)
- strcpy(man_globals->manpage_title, "Xman Help");
+ strcpy(man_globals->manpage_title, gettext("Xman Help"));
if (man_globals->both_shown) {
XtManageChild(dir);
@@ -519,7 +542,7 @@ CreateSectionMenu(ManpageGlobals * man_g
menu = XtCreatePopupShell(SECTION_MENU, simpleMenuWidgetClass, parent,
NULL, (Cardinal) 0);
- for (i = 0 ; i < sections ; i ++) {
+ for (i = 0 ; i < ((sections <= MAX_MENU) ? sections:sections/2) ; i ++) {
num_args = 0;
XtSetArg(args[num_args], XtNlabel, manual[i].blabel); num_args++;
sprintf(entry_name, "section%d", i);
@@ -535,6 +558,37 @@ CreateSectionMenu(ManpageGlobals * man_g
}
}
+static void
+CreateMoreMenu(man_globals, parent)
+ManpageGlobals * man_globals;
+Widget parent;
+{
+ Widget menu, entry;
+ int i;
+ MenuStruct * menu_struct;
+ Arg args[1];
+ Cardinal num_args;
+ char entry_name[BUFSIZ];
+
+ menu = XtCreatePopupShell(MORE_MENU, simpleMenuWidgetClass, parent,
+ NULL, (Cardinal) 0);
+
+ for (i = sections/2-1 ; i < sections ; i ++) {
+ num_args = 0;
+ XtSetArg(args[num_args], XtNlabel, manual[i].blabel); num_args++;
+ sprintf(entry_name, "section%d", i);
+
+ entry = XtCreateManagedWidget(entry_name, smeBSBObjectClass,
+ menu, args, num_args);
+ menu_struct = (MenuStruct *) XtMalloc(sizeof(MenuStruct));
+ menu_struct->data = (caddr_t) man_globals;
+ menu_struct->number = i;
+ XtAddCallback(entry, XtNcallback, DirPopupCallback, (caddr_t) menu_struct);
+ XtAddCallback(entry, XtNdestroyCallback,MenuDestroy, (caddr_t)menu_struct);
+
+ }
+}
+
/* Function Name: CreateList
* Description: this function prints a label in the directory list
* Arguments: section - the manual section.
@@ -579,7 +633,7 @@ MakeDirectoryBox(ManpageGlobals *man_glo
return;
name = manual[section].blabel; /* Set the section name */
- sprintf(label_name,"Directory of: %s",name);
+ snprintf(label_name, sizeof(label_name), gettext("Directory of: %s"),name);
man_globals->section_name[section] = StrAlloc(label_name);
num_args = 0;
@@ -677,7 +731,7 @@ FormUpWidgets(Widget parent, char ** ful
if (long_widget == (Widget) NULL) { /* Make sure we found one. */
PopupWarning(GetGlobals(parent),
- "Could not find longest widget, aborting...");
+ gettext("Could not find longest widget, aborting..."));
XtFree((char *)full_widgets);
XtFree((char *)half_widgets);
return;
@@ -745,7 +799,8 @@ ConvertNamesToWidgets(Widget parent, cha
if (*temp_ids == NULL) {
char error_buf[BUFSIZ];
- sprintf(error_buf, "Could not find widget named '%s'", *names);
+ snprintf(error_buf, sizeof(error_buf),
+ gettext("Could not find widget named '%s'"), *names);
PrintError(error_buf);
XtFree((char *)ids);
return(NULL);
--- defs.h 2009-10-16 14:39:48.000000000 -0700
+++ defs.h 2011-01-28 20:32:24.195247147 -0800
@@ -51,6 +51,7 @@ from the X Consortium.
#define OPTION_MENU "optionMenu" /* Name of the Option Menu. */
#define SECTION_MENU "sectionMenu" /* Name of the Section Menu. */
+#define MORE_MENU "moreMenu" /* Name of the More... Menu. */
#define HELP_BUTTON "helpButton" /* Name of top help button */
#define QUIT_BUTTON "quitButton" /* Name of top quit button */
--- handler.c 2009-11-06 17:58:29.000000000 -0800
+++ handler.c 2011-01-28 20:32:24.173913473 -0800
@@ -43,6 +43,8 @@ from the X Consortium.
#include <sys/stat.h>
#include "globals.h"
#include "vendor.h"
+#include <libintl.h>
+#include <X11/Xlocale.h>
#ifdef INCLUDE_XPRINT_SUPPORT
#include "printdialog.h"
#include "print.h"
@@ -309,8 +311,10 @@ SaveFormattedPage(Widget w, XEvent * eve
char cmdbuf[BUFSIZ], error_buf[BUFSIZ];
if (*num_params != 1) {
- XtAppWarning(XtWidgetToApplicationContext(w),
- "Xman - SaveFormattedPage: This action routine requires one argument.");
+ snprintf(error_buf, sizeof(error_buf),
+ gettext("%s This action routine requires one argument."),
+ "Xman - SaveFormattedPage:");
+ XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
return;
}
@@ -347,12 +351,12 @@ SaveFormattedPage(Widget w, XEvent * eve
/* make sure the formatted man page is fully accessible by the world */
if (chmod(man_globals->save_file, CHMOD_MODE) != 0) {
sprintf(error_buf,
- "Couldn't set permissions on formatted man page '%s'.\n",
+ gettext("Couldn't set permissions on formatted man page '%s'.\n"),
man_globals->save_file);
PopupWarning( man_globals, error_buf);
}
} else {
- sprintf(error_buf, "Error while executing the command '%s'.\n",
+ sprintf(error_buf, gettext("Error while executing the command '%s'.\n"),
cmdbuf);
PopupWarning( man_globals, error_buf);
}
@@ -362,7 +366,7 @@ SaveFormattedPage(Widget w, XEvent * eve
break;
default:
sprintf(error_buf,"%s %s", "Xman - SaveFormattedPagee:",
- "Unknown argument must be either 'Save' or 'Cancel'.");
+ gettext("Unknown argument must be either 'Save' or 'Cancel'."));
PopupWarning(man_globals, error_buf);
return;
}
@@ -397,8 +401,10 @@ GotoPage(Widget w, XEvent * event, Strin
Boolean sensitive;
if (*num_params != 1) {
- XtAppWarning(XtWidgetToApplicationContext(w),
- "Xman - GotoPage: This action routine requires one argument.");
+ snprintf(error_buf, sizeof(error_buf),
+ gettext("%s This action routine requires one argument."),
+ gettext("Xman - GotoPage:"));
+ XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
return;
}
@@ -431,8 +437,8 @@ GotoPage(Widget w, XEvent * event, Strin
man_globals->dir_shown = TRUE;
break;
default:
- sprintf(error_buf,"%s %s", "Xman - GotoPage: Unknown argument must be",
- "either Manpage or Directory.");
+ sprintf(error_buf,"%s %s", gettext("Xman - GotoPage: Unknown argument must be"),
+ gettext("either Manpage or Directory."));
XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
return;
}
@@ -550,13 +556,16 @@ void
Search(Widget w, XEvent * event, String * params, Cardinal * num_params)
{
ManpageGlobals * man_globals = GetGlobals(w);
+ char error_buf[BUFSIZ];
FILE * file = NULL;
XtPopdown( XtParent(XtParent(w)) ); /* popdown the search widget */
if ( (*num_params < 1) || (*num_params > 2) ) {
- XtAppWarning(XtWidgetToApplicationContext(w),
- "Xman - Search: This action routine requires one or two arguments.");
+ snprintf(error_buf, sizeof(error_buf),
+ gettext("%s This action routine requires one or two arguments."),
+ gettext("Xman - Search:"));
+ XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
return;
}
@@ -574,8 +583,10 @@ Search(Widget w, XEvent * event, String
file = NULL;
break;
default:
- XtAppWarning(XtWidgetToApplicationContext(w),
- "Xman - Search: First parameter unknown.");
+ snprintf(error_buf, sizeof(error_buf),
+ gettext("%s First parameter unknown."),
+ gettext("Xman - Search:"));
+ XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
file = NULL;
break;
}
@@ -600,8 +611,9 @@ Search(Widget w, XEvent * event, String
}
break;
default:
- XtAppWarning(XtWidgetToApplicationContext(w),
- "Xman - Search: Second parameter unknown.");
+ snprintf(error_buf, sizeof(error_buf),
+ gettext("%s Second parameter unknown."), "Xman - Search:");
+ XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
break;
}
else {
--- help.c 2009-10-16 14:39:48.000000000 -0700
+++ help.c 2011-01-28 20:32:24.173431338 -0800
@@ -36,6 +36,8 @@ from the X Consortium.
* Created: January 19, 1988
*/
+#include <libintl.h>
+#include <X11/Xlocale.h>
#include "globals.h"
/* Function Name: MakeHelpWidget.
@@ -66,7 +68,7 @@ MakeHelpWidget(void)
return(FALSE);
}
- ChangeLabel(man_globals->label, "Xman Help");
+ ChangeLabel(man_globals->label, gettext("Xman Help"));
XtManageChild( man_globals->manpagewidgets.manpage );
XtRealizeWidget( help_widget );
@@ -99,7 +101,7 @@ OpenHelpfile(ManpageGlobals * man_global
if( (help_file_ptr = fopen(resources.help_file, "r")) == NULL ) {
PopupWarning(man_globals,
- "Could not open help file, NO HELP WILL BE AVALIABLE.");
+ gettext("Could not open help file, NO HELP WILL BE AVALIABLE."));
return(FALSE);
}
--- main.c 2009-10-16 14:39:48.000000000 -0700
+++ main.c 2011-01-28 20:32:24.172597167 -0800
@@ -37,6 +37,8 @@ from the X Consortium.
* Created: October 22, 1987
*/
+#include <libintl.h>
+#include <X11/Xlocale.h>
#include "globals.h"
#ifndef ZERO
#include <X11/Xaw/Cardinals.h>
@@ -146,6 +148,7 @@ int main(int argc, char ** argv)
{
XtAppContext app_con;
+ char *domaindir;
saved_argc = argc;
saved_argv = (char **)XtMalloc(argc * sizeof(char *));
bcopy(argv, saved_argv, argc * sizeof(char *));
@@ -158,6 +161,13 @@ int main(int argc, char ** argv)
wm_delete_window = XInternAtom(XtDisplay(initial_widget), "WM_DELETE_WINDOW",
False);
+ textdomain("xman");
+
+ if((domaindir = getenv("TEXTDOMAINDIR")) == NULL) {
+ domaindir = "/usr/X11/share/locale";
+ }
+ bindtextdomain("xman", domaindir);
+
manglobals_context = XStringToContext(MANNAME);
AdjustDefResources();
@@ -174,10 +184,10 @@ int main(int argc, char ** argv)
XtAppAddActions(app_con, xman_actions, XtNumber(xman_actions));
- PrintError("Failed to get the directory font.");
+ PrintError(gettext("Failed to get the directory font."));
#ifdef DEBUG
- printf("debugging mode\n");
+ printf(gettext("debugging mode\n"));
#endif
/*
@@ -195,7 +205,7 @@ int main(int argc, char ** argv)
default_height /= 4;
if ( (sections = Man()) == 0 )
- PrintError("There are no manual sections to display, check your MANPATH.");
+ PrintError(gettext("There are no manual sections to display, check your MANPATH."));
MakeTopBox();
@@ -219,7 +229,7 @@ int main(int argc, char ** argv)
}
/* Function Name: ArgError
- * Description: Prints error message about unknow arguments.
+ * Description: Prints error message about unknown arguments.
* Arguments: argc, argv - args not understood.
* Returns: none.
*/
@@ -229,42 +239,53 @@ ArgError(int argc, char ** argv)
{
int i;
- static char **syntax, *syntax_def[] = {
- "-help", "Print this message",
- "-helpfile <filename>", "Specifies the helpfile to use.",
- "-bothshown", "Show both the directory and manpage at once.",
- "-notopbox", "Starts with manpage rather than topbox.",
- "-geometry <geom>", "Specifies the geometry of the top box.",
- "=<geom>", "Specifies the geometry of the top box.",
- "-pagesize <geom>", "Specifies the geometry of the manual page.",
- "-bw <pixels>", "Width of all window borders.",
- "-borderwidth <pixels>", "Width of all window borders.",
- "-bd <color>", "Color of all window borders.",
- "-bordercolor <color>", "Color of all window borders.",
- "-fg <color>", "Foreground color for the application.",
- "-foreground <color>", "Foreground color for the application.",
- "-bg <color>", "Background color for the application.",
- "-background <color>", "Background color for the application.",
- "-display <display name>", "Specify a display that is not the default",
- "-fn <font>", "Font to be used for button and label text.",
- "-font <font>", "Font to be used for button and label text.",
- "-name <name>", "Change the name used for retrieving resources.",
- "-title <name>", "Change the name without affecting resources.",
- "-xrm <resource>", "Specifies a resource on the command line.",
- NULL, NULL,
- };
-
- syntax = syntax_def;
-
for (i = 1; i < argc ; i++)
- (void) printf("This argument is unknown to Xman: %s\n", argv[i]);
+ (void) printf(gettext("This argument is unknown to Xman: %s\n"), argv[i]);
- (void) printf("\nKnown arguments are:\n");
+ (void) printf(gettext("\nKnown arguments are:\n"));
- while ( *syntax != NULL ) {
- printf("%-30s - %s\n", syntax[0], syntax[1]);
- syntax += 2;
- }
+ printf("-help - %s\n",
+ gettext("Print this message"));
+ printf("-helpfile %s - %s\n", gettext("<filename> "),
+ gettext("Specifies the helpfile to use."));
+ printf("-bothshown - %s\n",
+ gettext("Show both the directory and manpage at once."));
+ printf("-notopbox - %s\n",
+ gettext("Starts with manpage rather than topbox."));
+ printf("-geometry %s - %s\n", gettext("<geom> "),
+ gettext("Specifies the geometry of the top box."));
+ printf("=%s - %s\n", gettext("<geom> "),
+ gettext("Specifies the geometry of the top box."));
+ printf("-pagesize %s - %s\n", gettext("<geom> "),
+ gettext("Specifies the geometry of the manual page."));
+ printf("-bw %s - %s\n", gettext("<pixels> "),
+ gettext("Width of all window borders."));
+ printf("-borderwidth %s - %s\n", gettext("<pixels> "),
+ gettext("Width of all window borders."));
+ printf("-bd %s - %s\n", gettext("<color> "),
+ gettext("Color of all window borders."));
+ printf("-bordercolor %s - %s\n", gettext("<color> "),
+ gettext("Color of all window borders."));
+ printf("-fg %s - %s\n", gettext("<color> "),
+ gettext("Foreground color for the application."));
+ printf("-foreground %s - %s\n", gettext("<color> "),
+ gettext("Foreground color for the application."));
+ printf("-bg %s - %s\n", gettext("<color> "),
+ gettext("Background color for the application."));
+ printf("-background %s - %s\n", gettext("<color> "),
+ gettext("Background color for the application."));
+ printf("-display %s - %s\n", gettext("<display name> "),
+ gettext("Specify a display that is not the default"));
+ printf("-fn %s - %s\n", gettext("<font> "),
+ gettext("Font to be used for button and label text."));
+ printf("-font %s - %s\n", gettext("<font> "),
+ gettext("Font to be used for button and label text."));
+ printf("-name %s - %s\n", gettext("<name> "),
+ gettext("Change the name used for retrieving resources."));
+ printf("-title %s - %s\n", gettext("<name> "),
+ gettext("Change the name without affecting resources."));
+ printf("-xrm %s - %s\n", gettext("<resource> "),
+ gettext("Specifies a resource on the command line."));
}
/* Function Name: AdjustDefResources
--- man.c 2009-10-16 14:39:48.000000000 -0700
+++ man.c 2011-01-28 20:32:24.173179002 -0800
@@ -31,7 +31,8 @@ from the X Consortium.
*/
/* $XFree86: xc/programs/xman/man.c,v 1.8 2003/04/09 20:31:31 herrb Exp $ */
-
+#include <libintl.h>
+#include <X11/Xlocale.h>
#include "globals.h"
#include "vendor.h" /* vendor-specific defines and data */
@@ -171,7 +172,7 @@ Man(void)
manual = (Manual *) XtRealloc ( (char *) manual,
(sizeof(Manual) * num_alloced));
if (manual == NULL)
- PrintError("Could not allocate memory for manual sections.");
+ PrintError(gettext("Could not allocate memory for manual sections."));
}
InitManual( manual + sect, list->label );
manual[sect].flags = list->flags;
@@ -198,10 +199,10 @@ Man(void)
*/
if (sect == 0)
- PrintError("No manual pages found.");
+ PrintError(gettext("No manual pages found."));
manual = (Manual *) XtRealloc( (char *) manual, (sizeof(Manual) * sect));
if (manual == NULL)
- PrintError("Could not allocate memory for manual sections.");
+ PrintError(gettext("Could not allocate memory for manual sections."));
return(sect); /* return the number of man sections. */
}
@@ -223,7 +224,7 @@ SortList(SectionList ** list)
SectionList *head, *last, *inner, *old;
if (*list == NULL)
- PrintError("No manual sections to read, exiting.");
+ PrintError(gettext("No manual sections to read, exiting."));
/*
* First step
@@ -426,7 +427,7 @@ ReadCurrentSection(Manual * local_manual
if((dir = opendir(path)) == NULL) {
#ifdef DEBUG
- snprintf(error_buf, sizeof(error_buf), "Can't open directory %s", path);
+ snprintf(error_buf, sizeof(error_buf), gettext("Can't open directory %s"), path);
PopupWarning(NULL, error_buf);
#endif /* DEBUG */
return;
@@ -512,7 +513,7 @@ ReadCurrentSection(Manual * local_manual
local_manual->entries_less_paths[nentries] =
rindex(local_manual->entries[nentries], '/');
if ( local_manual->entries_less_paths[nentries] == NULL )
- PrintError("Internal error while cataloging manual pages.");
+ PrintError(gettext("Internal error while cataloging manual pages."));
++ nentries;
}
@@ -540,7 +541,7 @@ SortAndRemove(Manual *man, int number)
register int i2 = 0;
#ifdef DEBUG
- printf("sorting section %d - %s\n", i, man->blabel);
+ printf(gettext("sorting section %d - %s\n"), i, man->blabel);
#endif /* DEBUG */
s1 = (char **)malloc(man->nentries * sizeof(char *));
@@ -571,14 +572,14 @@ SortAndRemove(Manual *man, int number)
j = 0;
l2 = man->entries_less_paths[j++];
if ( l2 == NULL )
- PrintError("Internal error while removing duplicate manual pages.");
+ PrintError(gettext("Internal error while removing duplicate manual pages."));
while ( j < nentm1 )
{
l1 = l2;
l2 = man->entries_less_paths[j++];
if ( l2 == NULL )
- PrintError("Internal error while removing duplicate manual pages."
- );
+ PrintError(gettext("Internal error while removing duplicate manual pages."
+ ));
if ( streq(l1,l2) )
{
j2 = j-1;
@@ -980,7 +981,7 @@ DumpManual(int number)
register int i,j;
for ( i = 0; i < number; i++) {
- printf("label: %s\n", manual[i].blabel);
+ printf("gettext(label: %s\n"), manual[i].blabel);
for (j = 0; j < manual[i].nentries; j++)
printf("%s\n", manual[i].entries[j]);
}
--- misc.c 2009-10-16 14:39:48.000000000 -0700
+++ misc.c 2011-01-28 20:32:24.196139861 -0800
@@ -41,6 +41,8 @@ from the X Consortium.
# include "config.h"
#endif
+#include <libintl.h>
+#include <X11/Xlocale.h>
#include "globals.h"
#include "vendor.h"
@@ -98,7 +100,7 @@ PopupWarning(ManpageGlobals * man_global
char buffer[BUFSIZ];
Boolean hasPosition;
- snprintf( buffer, sizeof(buffer), "Xman Warning: %s", string);
+ snprintf( buffer, sizeof(buffer), gettext("Xman Warning: %s"), string);
hasPosition = FALSE;
if (top)
{
@@ -140,7 +142,7 @@ PopupWarning(ManpageGlobals * man_global
void
PrintError(char * string)
{
- fprintf(stderr,"Xman Error: %s\n",string);
+ fprintf(stderr,gettext("Xman Error: %s\n"),string);
exit(EXIT_FAILURE);
}
@@ -202,7 +204,7 @@ FindManualFile(ManpageGlobals * man_glob
temp = CreateManpageName(entry, 0, 0);
snprintf(man_globals->manpage_title, sizeof(man_globals->manpage_title),
- "The current manual page is: %s.", temp);
+ gettext("The current manual page is: %s."), temp);
XtFree(temp);
ParseEntry(entry, path, section, page);
@@ -328,14 +330,14 @@ Uncompress(ManpageGlobals * man_globals,
return(NULL);
else if ((file = fopen(tmp_file, "r")) == NULL) {
- sprintf(error_buf, "Something went wrong in retrieving the %s",
- "uncompressed manual page try cleaning up /tmp.");
+ sprintf(error_buf, gettext("Something went wrong in retrieving the %s"),
+ gettext("uncompressed manual page try cleaning up /tmp."));
PopupWarning(man_globals, error_buf);
}
#else
if (!UncompressNamed(man_globals, filename, tmp_file, &file)) {
- sprintf(error_buf, "Something went wrong in retrieving the %s",
- "uncompressed manual page try cleaning up /tmp.");
+ sprintf(error_buf, gettext("Something went wrong in retrieving the %s"),
+ gettext("uncompressed manual page try cleaning up /tmp."));
PopupWarning(man_globals, error_buf);
return(NULL);
}
@@ -373,7 +375,7 @@ UncompressNamed(ManpageGlobals * man_glo
if (stat(filename, &junk) != 0) { /* Check for existance of the file. */
if (errno != ENOENT) {
snprintf(error_buf, sizeof(error_buf),
- "Error while stating file %s, errno = %d", filename, errno);
+ gettext("Error while stating file %s, errno = %d"), filename, errno);
PopupWarning(man_globals, error_buf);
}
return(FALSE);
@@ -390,7 +392,7 @@ UncompressNamed(ManpageGlobals * man_glo
#else
fd = mkstemp(tmp);
if (fd < 0) {
- PopupWarning(man_globals, "Error creating a temp file");
+ PopupWarning(man_globals, gettext("Error creating a temp file"));
return FALSE;
}
*output_fd = fdopen(fd, "r");
@@ -420,7 +422,7 @@ UncompressNamed(ManpageGlobals * man_glo
return(TRUE);
snprintf(error_buf, sizeof(error_buf),
- "Error while uncompressing, command was: %s", cmdbuf);
+ gettext("Error while uncompressing, command was: %s"), cmdbuf);
PopupWarning(man_globals, error_buf);
return(FALSE);
}
@@ -516,7 +518,7 @@ Format(ManpageGlobals * man_globals, cha
#endif
/* We Really could not find it, this should never happen, yea right. */
snprintf(error_buf, sizeof(error_buf),
- "Could not open manual page, %s", entry);
+ gettext("Could not open manual page, %s"), entry);
PopupWarning(man_globals, error_buf);
XtPopdown( XtParent(man_globals->standby) );
return(NULL);
@@ -573,6 +575,19 @@ Format(ManpageGlobals * man_globals, cha
ParseEntry(entry, path, sect, NULL);
#ifndef HANDLE_ROFFSEQ
+#ifdef SFORMAT /* Handle Solaris SGML pages */
+ if (sect[0] == 's') {
+#ifndef HAS_MKSTEMP
+ snprintf(cmdbuf, sizeof(cmdbuf), "cd %s ; %s %s | %s %s > %s %s",
+ path, SFORMAT, filename, TBL, FORMAT, man_globals->tempfile,
+ "2> /dev/null");
+#else
+ snprintf(cmdbuf, sizeof(cmdbuf), "cd %s ; %s %s | %s %s >> %s %s",
+ path, SFORMAT, filename, TBL, FORMAT, man_globals->tempfile,
+ "2> /dev/null");
+#endif
+ } else {
+#endif /* SFORMAT */
#ifndef HAS_MKSTEMP
snprintf(cmdbuf, sizeof(cmdbuf), "cd %s ; %s %s %s > %s %s", path, TBL,
filename, FORMAT, man_globals->tempfile, "2> /dev/null");
@@ -580,10 +595,13 @@ Format(ManpageGlobals * man_globals, cha
snprintf(cmdbuf, sizeof(cmdbuf), "cd %s ; %s %s %s >> %s %s", path, TBL,
filename, FORMAT, man_globals->tempfile, "2> /dev/null");
#endif
+#ifdef SFORMAT
+ }
+#endif
#else
/* Handle more flexible way of specifying the formatting pipeline */
if (! ConstructCommand(cmdbuf, path, filename, man_globals->tempfile)) {
- sprintf(error_buf, "Constructed command was too long!");
+ sprintf(error_buf, gettext("Constructed command was too long!"));
PopupWarning(man_globals, error_buf);
file = NULL;
}
@@ -592,15 +610,15 @@ Format(ManpageGlobals * man_globals, cha
if(system(cmdbuf) != 0) { /* execute search. */
snprintf(error_buf, sizeof(error_buf),
- "Something went wrong trying to run the command: %s", cmdbuf);
+ gettext("Something went wrong trying to run the command: %s"), cmdbuf);
PopupWarning(man_globals, error_buf);
file = NULL;
}
else {
#ifndef HAS_MKSTEMP
if ((file = fopen(man_globals->tempfile,"r")) == NULL) {
- sprintf(error_buf, "Something went wrong in retrieving the %s",
- "temp file, try cleaning up /tmp");
+ sprintf(error_buf, gettext("Something went wrong in retrieving the %s"),
+ gettext("temp file, try cleaning up /tmp"));
PopupWarning(man_globals, error_buf);
}
else {
@@ -1071,7 +1089,7 @@ AddCursor(Widget w, Cursor cursor)
Colormap c_map;
if (!XtIsRealized(w)) {
- PopupWarning(NULL, "Widget is not realized, no cursor added.\n");
+ PopupWarning(NULL, gettext("Widget is not realized, no cursor added.\n"));
return;
}
@@ -1182,14 +1200,14 @@ ParseEntry(char *entry, char *path, char
c = rindex(temp, '/');
if (c == NULL)
- PrintError("index failure in ParseEntry.");
+ PrintError(gettext("index failure in ParseEntry."));
*c++ = '\0';
if (page != NULL)
strcpy(page, c);
c = rindex(temp, '/');
if (c == NULL)
- PrintError("index failure in ParseEntry.");
+ PrintError(gettext("index failure in ParseEntry."));
*c++ = '\0';
#if defined(SFORMAT) && defined(SMAN)
/* sgmltoroff sometimes puts an extra ./ in the path to .so entries */
@@ -1236,12 +1254,12 @@ GetGlobals(Widget w)
if (temp == NULL)
XtAppError(XtWidgetToApplicationContext(w),
- "Xman: Could not locate widget in tree, exiting");
+ gettext("Xman: Could not locate widget in tree, exiting"));
if (XFindContext(XtDisplay(w), XtWindow(w),
manglobals_context, &data) != XCSUCCESS)
XtAppError(XtWidgetToApplicationContext(w),
- "Xman: Could not find global data, exiting");
+ gettext("Xman: Could not find global data, exiting"));
return( (ManpageGlobals *) data);
}
@@ -1263,7 +1281,7 @@ SaveGlobals(Widget w, ManpageGlobals * g
if (XSaveContext(XtDisplay(w), XtWindow(w), manglobals_context,
(caddr_t) globals) != XCSUCCESS)
XtAppError(XtWidgetToApplicationContext(w),
- "Xman: Could not save global data, are you out of memory?");
+ gettext("Xman: Could not save global data, are you out of memory?"));
}
/* Function Name: RemoveGlobals
@@ -1281,5 +1299,5 @@ RemoveGlobals(Widget w)
if (XDeleteContext(XtDisplay(w), XtWindow(w),
manglobals_context) != XCSUCCESS)
XtAppError(XtWidgetToApplicationContext(w),
- "Xman: Could not remove global data?");
+ gettext("Xman: Could not remove global data?"));
}
--- search.c 2009-10-16 14:39:48.000000000 -0700
+++ search.c 2011-01-28 20:32:24.196499890 -0800
@@ -30,7 +30,8 @@ from the X Consortium.
*/
/* $XFree86: xc/programs/xman/search.c,v 1.5 2001/01/27 17:24:27 herrb Exp $ */
-
+#include <libintl.h>
+#include <X11/Xlocale.h>
#include "globals.h"
#include "vendor.h"
@@ -70,7 +71,7 @@ MakeSearchWidget(ManpageGlobals * man_gl
arglist, num_args);
if ( (text = XtNameToWidget(dialog, "value")) == (Widget) NULL)
- PopupWarning(NULL, "Could not find text widget in MakeSearchWidget.");
+ PopupWarning(NULL, gettext("Could not find text widget in MakeSearchWidget."));
else
XtSetKeyboardFocus(dialog, text);
@@ -86,7 +87,7 @@ MakeSearchWidget(ManpageGlobals * man_gl
if ( ((command = XtNameToWidget(dialog, MANUALSEARCH)) == (Widget) NULL) ||
((cancel = XtNameToWidget(dialog, CANCEL)) == (Widget) NULL) )
PopupWarning(NULL,
- "Could not find manual search widget in MakeSearchWidget.");
+ gettext("Could not find manual search widget in MakeSearchWidget."));
else {
static char * half_size[] = {
MANUALSEARCH, APROPOSSEARCH, NULL
@@ -121,7 +122,7 @@ ManpageGlobals * man_globals)
return(XawDialogGetValueString(dialog));
PopupWarning(man_globals,
- "Could not get the search string, no search will be preformed.");
+ gettext("Could not get the search string, no search will be preformed."));
return(NULL);
}
@@ -165,16 +166,16 @@ DoSearch(ManpageGlobals * man_globals, i
/* If the string is empty or starts with a space then do not search */
if ( streq(search_string,"") ) {
- PopupWarning(man_globals, "Search string is empty.");
+ PopupWarning(man_globals, gettext("Search string is empty."));
return(NULL);
}
if (strlen(search_string) >= BUFSIZ) {
- PopupWarning(man_globals, "Search string too long.");
+ PopupWarning(man_globals, gettext("Search string too long."));
return(NULL);
}
if (search_string[0] == ' ') {
- PopupWarning(man_globals, "First character cannot be a space.");
+ PopupWarning(man_globals, gettext("First character cannot be a space."));
return(NULL);
}
@@ -210,7 +211,7 @@ DoSearch(ManpageGlobals * man_globals, i
}
snprintf(label, sizeof(label),
- "Results of apropos search on: %s", search_string);
+ gettext("Results of apropos search on: %s"), search_string);
#ifdef NO_MANPATH_SUPPORT /* not quite correct, but the best I can do. */
snprintf(cmdbuf, sizeof(cmdbuf), APROPOS_FORMAT, search_string, mantmp);
@@ -219,7 +220,7 @@ DoSearch(ManpageGlobals * man_globals, i
#endif
if(system(cmdbuf) != 0) { /* execute search. */
- snprintf(error_buf, sizeof(error_buf), "Something went wrong trying to run %s\n",cmdbuf);
+ snprintf(error_buf, sizeof(error_buf), gettext("Something went wrong trying to run %s\n"),cmdbuf);
PopupWarning(man_globals, error_buf);
}
@@ -228,7 +229,7 @@ DoSearch(ManpageGlobals * man_globals, i
#else
if((file = fopen(mantmp,"r")) == NULL)
#endif
- PrintError("lost temp file? out of temp space?");
+ PrintError(gettext("lost temp file? out of temp space?"));
/*
* Since we keep the FD open we can unlink the file safely, this
@@ -237,7 +238,7 @@ DoSearch(ManpageGlobals * man_globals, i
unlink(mantmp);
- snprintf(string_buf, sizeof(string_buf), "%s: nothing appropriate", search_string);
+ snprintf(string_buf, sizeof(string_buf), gettext("%s: nothing appropriate"), search_string);
/*
* Check first LOOKLINES lines for "nothing appropriate".
@@ -276,7 +277,7 @@ DoSearch(ManpageGlobals * man_globals, i
else { /* MANUAL SEACH */
file = DoManualSearch(man_globals, search_string);
if (file == NULL) {
- snprintf(string_buf, sizeof(string_buf), "No manual entry for %s.", search_string);
+ snprintf(string_buf, sizeof(string_buf), gettext("No manual entry for %s."), search_string);
ChangeLabel(man_globals->label, string_buf);
if (man_globals->label == NULL)
PopupWarning(man_globals, string_buf);
@@ -290,7 +291,7 @@ DoSearch(ManpageGlobals * man_globals, i
dialog = XtNameToWidget(man_globals->search_widget, DIALOG);
if (dialog == NULL)
- PopupWarning(man_globals, "Could not clear the search string.");
+ PopupWarning(man_globals, gettext("Could not clear the search string."));
XtSetArg(arglist[0], XtNvalue, "");
XtSetValues(dialog, arglist, (Cardinal) 1);
@@ -377,7 +378,7 @@ int number)
head = rindex(first[ global_number + check ], '/');
if (head == NULL)
- PrintError("index failure in BEntrySearch");
+ PrintError(gettext("index failure in BEntrySearch"));
head++;
tail = rindex(head, '.');
--- vendor.c 2009-10-16 14:39:48.000000000 -0700
+++ vendor.c 2011-01-28 20:32:24.196781956 -0800
@@ -34,6 +34,8 @@ from the X Consortium.
#include "globals.h"
#include "vendor.h"
+#include <libintl.h>
+#include <X11/Xlocale.h>
typedef struct sectionName {
char * name;
@@ -100,21 +102,74 @@ static SectionNameRec SectionNames[] = {
{"(1m) Maintenance Commands", "1m"},
{"(1s) SunOS Specific Commands", "1s"},
{"(2) System Calls", "2"},
- {"(3) C Library Functions", "3"},
+ {"(3) Introduction to Library Functions", "3"},
+ {"(3adm) General Administrative Library Functions", "3adm"},
+ {"(3aio) Asynchronous I/O Library Functions", "3aio"},
{"(3b) SunOS/BSD Compatibility Functions", "3b"},
+ {"(3bsm) Security and Auditing Library Functions", "3bsm"},
{"(3c) C Library Functions", "3c"},
- {"(3e) ELF Library Functions", "3e"},
+ {"(3cfgadm) Configuration Administration Library Functions", "3cfgadm"},
+ {"(3crypt) Encryption and Decryption Library", "3crypt"},
+ {"(3curses) Curses Library Functions", "3curses"},
+ {"(3devid) Device ID Library Functions", "3devid"},
+ {"(3devinfo) Device Information Library Functions", "3devinfo"},
+ {"(3dl) Dynamic Linking Library Functions", "3dl"},
+ {"(3dmi) DMI Library Functions", "3dmi"},
+ {"(3door) Door Library Functions", "3door"},
+ {"(3e) C Library Functions", "3e"},
+ {"(3elf) ELF Library Functions", "3elf"},
+ {"(3ext) Extended Library Functions", "3ext"},
{"(3g) C Library Functions", "3g"},
- {"(3i) Wid Character Functions", "3i"},
+ {"(3gen) String Pattern-Matching Library Functions", "3gen"},
+ {"(3head) Headers", "3head"},
+ {"(3i) Wide Character Functions", "3i"},
{"(3k) Kernel VM Library Functions", "3k"},
- {"(3m) Mathematical Library", "3m"},
+ {"(3krb) Kerberos Library Functions", "3krb"},
+ {"(3kstat) Kernel Statistics Library Functions", "3kstat"},
+ {"(3kvm) Kernel VM Library Functions", "3kvm"},
+ {"(3layout) Layout Services Library Functions", "3layout"},
+ {"(3ldap) LDAP Library Functions", "3ldap"},
+ {"(3lib) Interface Libraries", "3lib"},
+ {"(3libucb) SunOS/BSD Compatibility Interface Libraries", "3libucb"},
+ {"(3m) Mathematical Library Functions", "3m"},
+ {"(3mail) User Mailbox Library Functions", "3mail"},
+ {"(3malloc) Memory Allocation Library Functions", "3malloc"},
+ {"(3mp) Integer Mathematical Library Functions", "3mp"},
{"(3n) Network Functions", "3n"},
- {"(3r) RPC Services Library", "3r"},
+ {"(3nsl) Networking Services Library Functions", "3nsl"},
+ {"(3pam) PAM Library Functions", "3pam"},
+ {"(3plot) Graphics Interface Library Functions", "3plot"},
+ {"(3proc) Process Control Library Functions", "3proc"},
+ {"(3r) Realtime Library", "3r"},
+ {"(3rac) Remote Asynchronous Calls Library Functions", "3rac"},
+ {"(3resolv) Resolver Library Functions", "3resolv"},
+ {"(3rpc) RPC Library Functions", "3rpc"},
+ {"(3rt) Realtime Library Functions", "3rt"},
{"(3s) Standard I/O Functions", "3s"},
+ {"(3sched) LWP Scheduling Library Functions", "3sched"},
+ {"(3sec) File Access Control Library Functions", "3sec"},
+ {"(3secdb) Security Attributes Database Library Functions", "3secdb"},
+ {"(3snmp) SNMP Library Functions", "3snmp"},
+ {"(3socket) Sockets Library Functions", "3socket"},
#if OSMINORVERSION == 5
- {"(3t) Threads Library", "3t"},
+ {"(3t) Threads Library Functions", "3t"},
#endif
+ {"(3thr) Threads Library Functions", "3thr"},
+ {"(3tnf) TNF Library Functions", "3tnf"},
+ {"(3ucb) SunOS/BSD Compatibility Library Functions", "3ucb"},
+ {"(3volmgt) Volume Management Library Functions", "3volmgt"},
{"(3x) Miscellaneous Library Functions", "3x"},
+ {"(3xc) X/Open Curses Library Functions", "3xc"},
+ {"(3xcurses) X/Open Curses Library Functions", "3xcurses"},
+ {"(3xfn) XFN Interface Library Functions", "3xfn"},
+ {"(3xn) X/Open Networking Services Library Functions", "3xn"},
+ {"(3xnet) X/Open Networking Services Library Functions", "3xnet"},
+ {"(3X11) X Window System: Xlib Functions", "3X11"},
+ {"(3Xext) X Window System: Protocol Extension Functions", "3Xext"},
+ {"(3Xi) X Window System: Input Extension Functions", "3Xi"},
+ {"(3Xmu) X Window System: Miscellaneous Utility Functions", "3Xmu"},
+ {"(3Xp) X Window System: Print Extension Functions", "3Xp"},
+ {"(3Xt) X Window System: Toolkit Intrinsics Functions", "3Xt"},
{"(4) File Formats", "4"},
{"(4b) Misc. Reference Manual Pages", "4b"},
{"(5) Environments, Tables, and TROFF Macros", "5"},
@@ -133,6 +188,7 @@ static SectionNameRec SectionNames[] = {
{"(9s) DDI and DKI Data Structures", "9s"},
{"(l) Local", "l"},
{"(n) New", "n"},
+ {"(o) Old", "o"}
};
#else
@@ -188,10 +244,10 @@ char * path)
for (i=0; i < numSections; i++) {
sprintf(file, "%s%s", SEARCHDIR, SectionNames[i].suffix);
- AddNewSection(list, path, file, SectionNames[i].name, TRUE);
+ AddNewSection(list, path, file, gettext(SectionNames[i].name), TRUE);
#ifdef SEARCHOTHER
sprintf(file, "%s%s", SEARCHOTHER, SectionNames[i].suffix);
- AddNewSection(list, path, file, SectionNames[i].name, TRUE);
+ AddNewSection(list, path, file, gettext(SectionNames[i].name), TRUE);
#endif
}
#endif
@@ -252,7 +308,7 @@ char *path)
int flags = (int) *p++;
while (*p != NULL) {
sprintf(file, "%s%s", SEARCHDIR, *p++);
- AddNewSection(list, path, file, message, flags);
+ AddNewSection(list, path, file, gettext(message), flags);
}
p++;
}