summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin E Martin <kem@kem.org>2004-09-02 08:40:33 +0000
committerKevin E Martin <kem@kem.org>2004-09-02 08:40:33 +0000
commit545064318591f8c27701da0af0ebc5d9fd1b2ec5 (patch)
tree1e1234a8e9f631a3eb48db7372d1017385b4b951
parent50a3e1e4269fe2ef6c97ff40a6dc02d074e7ba95 (diff)
Restore xman and xedit changes that were previously reverted, and makerel-0-6-1lg3d-rel-0-7-0lg3d-baseXORG-6_8_1XORG-6_8_0XORG-6_7_99_904
Xprint support optional (Bug #1273, Roland Mainz).
-rw-r--r--ScrollByL.c33
-rw-r--r--ScrollByL.h4
-rw-r--r--ScrollByLP.h4
-rw-r--r--Xman-noxprint.ad195
-rw-r--r--Xman-xprint.ad292
-rw-r--r--buttons.c33
-rw-r--r--defs.h7
-rw-r--r--handler.c123
-rw-r--r--main.c11
-rw-r--r--man.h39
-rw-r--r--misc.c13
-rw-r--r--search.c2
-rw-r--r--version.h2
13 files changed, 713 insertions, 45 deletions
diff --git a/ScrollByL.c b/ScrollByL.c
index 9f8c359..c679145 100644
--- a/ScrollByL.c
+++ b/ScrollByL.c
@@ -93,6 +93,10 @@ static XtResource resources[] = {
Offset(symbol_font), XtRString, MANPAGE_SYMBOL},
{XtNfile, XtCFile, XtRFile, sizeof(FILE *),
Offset(file), XtRImmediate, (caddr_t) NULL},
+ {XtNNumTotalLines, XtCNumTotalLines, XtRInt, sizeof(int),
+ Offset(lines), XtRImmediate, (caddr_t) 0},
+ {XtNNumVisibleLines, XtCNumVisibleLines, XtRInt, sizeof(int),
+ Offset(num_visible_lines), XtRImmediate, (caddr_t) 0},
};
#undef Offset
@@ -104,6 +108,7 @@ static XtResource resources[] = {
*
****************************************************************/
+static void CreateScrollbar(Widget w);
static Boolean ScrollVerticalText(Widget w, int new_line, Boolean force_redisp);
static void Layout(Widget w);
static void LoadFile(Widget w);
@@ -197,6 +202,8 @@ Layout(Widget w)
Widget bar;
Position bar_bw;
+ CreateScrollbar(w);
+
/*
* For now always show the bar.
*/
@@ -222,6 +229,8 @@ Layout(Widget w)
XtResizeWidget(bar, bar->core.width, height, bar->core.border_width);
SetThumbHeight(w);
+
+ sblw->scroll.num_visible_lines = height / sblw->scroll.font_height + 1;
}
/* ARGSUSED */
@@ -277,22 +286,20 @@ static void
PaintText(Widget w, int y_loc, int height)
{
ScrollByLineWidget sblw = (ScrollByLineWidget) w;
- int start_line, num_lines, location;
+ int start_line, location;
start_line = y_loc / sblw->scroll.font_height + sblw->scroll.line_pointer;
if (start_line >= sblw->scroll.lines)
return;
- num_lines = height / sblw->scroll.font_height + 1;
-
/*
* Only integer arithmetic makes this possible.
*/
location = y_loc / sblw->scroll.font_height * sblw->scroll.font_height;
- PrintText(w, start_line, num_lines, location);
+ PrintText(w, start_line, sblw->scroll.num_visible_lines, location);
}
/* Function Name: Page
@@ -384,7 +391,7 @@ int new_line,
Boolean force_redisp)
{
ScrollByLineWidget sblw = (ScrollByLineWidget) w;
- int num_lines = (int)w->core.height / sblw->scroll.font_height + 1;
+ int num_lines = sblw->scroll.num_visible_lines;
int max_lines, old_line;
Boolean move_thumb = FALSE;
@@ -598,8 +605,6 @@ VerticalScroll(Widget w, XtPointer client_data, XtPointer call_data)
SetThumb( (Widget) sblw);
}
-int h_width; /* main font width */
-
/* ARGSUSED */
static void
Initialize(Widget req, Widget new, ArgList args, Cardinal *num_args)
@@ -619,12 +624,9 @@ Initialize(Widget req, Widget new, ArgList args, Cardinal *num_args)
atomNum = XInternAtom(XtDisplay(req), "FIGURE_WIDTH", False);
if (XGetFontProperty(sblw->scroll.normal_font, atomNum, &figWidth))
- h_width = figWidth;
+ sblw->scroll.h_width = figWidth;
else
- h_width = XTextWidth(sblw->scroll.normal_font, "$", 1);
-
-
-
+ sblw->scroll.h_width = XTextWidth(sblw->scroll.normal_font, "$", 1);
} /* Initialize. */
/* Function Name: CreateGCs
@@ -721,7 +723,7 @@ static Boolean
SetValuesHook(Widget w, ArgList args, Cardinal *num_args)
{
Boolean ret = TRUE;
- int i;
+ Cardinal i;
for (i = 0; i < *num_args; i++) {
if (strcmp(XtNfile, args[i].name) == 0) {
@@ -819,6 +821,7 @@ LoadFile(Widget w)
* Copy the file into memory.
*/
+ fseek(file, 0L, SEEK_SET);
if (fread(page, sizeof(char), fileinfo.st_size, file) == 0)
XtAppError(XtWidgetToApplicationContext(w),
"SBLW LoadFile: Failure in fread.");
@@ -1021,7 +1024,7 @@ PrintText(Widget w, int start_line, int num_lines, int location)
italicflag = FALSE;
x_loc = sblw->scroll.offset + sblw->scroll.indent;
h_col = h_col + 8 - (h_col%8);
- x_loc += h_width * h_col;
+ x_loc += sblw->scroll.h_width * h_col;
break;
case ' ':
@@ -1042,7 +1045,7 @@ PrintText(Widget w, int start_line, int num_lines, int location)
x_loc = sblw->scroll.offset + sblw->scroll.indent;
h_col += (h_c - c);
- x_loc += h_width * h_col;
+ x_loc += sblw->scroll.h_width * h_col;
c = h_c - 1;
break;
diff --git a/ScrollByL.h b/ScrollByL.h
index cdf8e2e..0283893 100644
--- a/ScrollByL.h
+++ b/ScrollByL.h
@@ -60,8 +60,12 @@ from the X Consortium.
#define XtNmanualFontBold "manualFontBold"
#define XtNmanualFontItalic "manualFontItalic"
#define XtNmanualFontSymbol "manualFontSymbol"
+#define XtNNumTotalLines "numTotalLines"
+#define XtNNumVisibleLines "numVisibleLines"
#define XtCIndent "Indent"
+#define XtCNumTotalLines "NumTotalLines"
+#define XtCNumVisibleLines "NumVisibleLines"
/* Class record constants */
diff --git a/ScrollByLP.h b/ScrollByLP.h
index 0947707..25402d7 100644
--- a/ScrollByLP.h
+++ b/ScrollByLP.h
@@ -68,6 +68,7 @@ typedef struct _ScrollByLinePart {
* normal_font,
* italic_font,
* symbol_font;
+ int h_width; /* Main font width */
/* variables not in resource list. */
@@ -80,7 +81,8 @@ typedef struct _ScrollByLinePart {
GC bold_gc, normal_gc, italic_gc, symbol_gc; /* gc for drawing. */
char ** top_line; /* The top line of the file. */
- int lines; /* number of line in the file. */
+ int lines; /* Total number of line in the file. */
+ int num_visible_lines; /* Number of lines visible */
} ScrollByLinePart;
/****************************************************************
diff --git a/Xman-noxprint.ad b/Xman-noxprint.ad
new file mode 100644
index 0000000..3f08b02
--- /dev/null
+++ b/Xman-noxprint.ad
@@ -0,0 +1,195 @@
+*input: True
+
+*topBox: True
+*topBox.Title: Xman
+*topBox.IconName: Xman
+
+*manualBrowser.Title: Manual Page
+*manualBrowser.IconName: Manual Page
+*manualBrowser.geometry: 600x600
+
+*manualFontBold: -*-courier-bold-r-*-*-*-120-*-*-*-*-*-*
+*manualFontItalic: -*-courier-medium-o-*-*-*-120-*-*-*-*-*-*
+*manualFontNormal: -*-courier-medium-r-*-*-*-120-*-*-*-*-*-*
+*manualFontSymbol: -*-symbol-*-*-*-*-*-120-*-*-*-*-*-*
+!*directoryFontNormal: -*-courier-medium-r-*-*-*-120-*-*-*-*-*-*
+*directoryFontNormal: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-*-*
+!*directoryFontNormal: -*-lucida-bold-r-*-*-*-120-*-*-*-*-*-*
+
+!*SimpleMenu.BackingStore: Always
+!*SimpleMenu.SaveUnder: Off
+
+*horizPane.orientation: horizontal
+*horizPane*showGrip: False
+*horizPane.min: 22
+*horizPane.max: 22
+*topLabel.BorderWidth: 0
+*search*label.BorderWidth: 0
+
+*search*dialog*value: Xman
+
+!*optionMenu.Label: Options
+!*sectionMenu.Label: Sections
+
+*horizPane*options.Label: Options
+*horizPane*sections.Label: Sections
+
+*helpButton.Label: Help
+*helpButton.Tip: Open help browser
+
+*quitButton.Label: Quit
+*quitButton.Tip: Quit Xman
+
+*manpageButton.Label: Manual Page
+*manpageButton.Tip: Open new manpage browser
+
+*topLabel.Label: Manual Browser
+
+!*SimpleMenu*menuLabel*vertSpace: 100
+!*SimpleMenu*menuLabel*leftMargin: 20
+
+*displayDirectory.Label: Display Directory
+*displayManualPage.Label: Display Manual Page
+*help.Label: Help
+*help.geometry: 600x600
+*search.Label: Search
+*removeThisManpage.Label: Remove This Manpage
+*help*removeThisManpage.Label: Remove Help
+*openNewManpage.Label: Open New Manpage
+*showVersion.Label: Show Version
+*quit.Label: Quit
+
+*pleaseStandBy*Label: Formatting Manual Page, Please Stand By...
+
+*search*dialog.Label: Type string to search for:
+*search*apropos.Label: Apropos
+*search*manualPage.Label: Manual Page
+*search*cancel.Label: Cancel
+
+*likeToSave*dialog.Label: Would you like to save this formatted Manual Page?
+*likeToSave*yes.Label: Yes
+*likeToSave*no.Label: No
+
+*translations: #override \
+ Ctrl<Key>q: Quit() \n\
+ Ctrl<Key>c: Quit() \n\
+ Ctrl<Key>n: CreateNewManpage() \n\
+ Ctrl<Key>h: PopupHelp() \n\
+ Ctrl<Key>s: PopupSearch()
+
+*help*Paned.manualPage.translations:#override \
+ Ctrl<Btn1Down>: \
+ XawPositionSimpleMenu(optionMenu) \
+ MenuPopup(optionMenu) \n\
+ Ctrl<Key>q: Quit() \n\
+ Ctrl<Key>c: Quit() \n\
+ Ctrl<Key>r: RemoveThisManpage() \n\
+ Ctrl<Key>n: CreateNewManpage() \n\
+ Ctrl<Key>h: PopupHelp() \n\
+ Ctrl<Key>d: GotoPage(Directory) \n\
+ Ctrl<Key>m: GotoPage(ManualPage) \n\
+ Ctrl<Key>v: ShowVersion() \n\
+ <Key>Prior: Page(Back) \n\
+ <Key>Next : Page(Forward) \n\
+ Shift<Btn4Down>,<Btn4Up>: Page(Line,-1) \n\
+ Shift<Btn5Down>,<Btn5Up>: Page(Line,1) \n\
+ Ctrl<Btn4Down>,<Btn4Up>: Page(Back) \n\
+ Ctrl<Btn5Down>,<Btn5Up>: Page(Forward) \n\
+ None<Btn4Down>,<Btn4Up>: Page(Line,-5) \n\
+ None<Btn5Down>,<Btn5Up>: Page(Line,5)
+
+*manualBrowser*manualPage.translations: #override \
+ Ctrl<Btn1Down>: \
+ XawPositionSimpleMenu(optionMenu) \
+ MenuPopup(optionMenu) \n\
+ Ctrl<Btn2Down>: \
+ XawPositionSimpleMenu(sectionMenu) \
+ MenuPopup(sectionMenu) \n\
+ Shift<Btn2Down>,<Btn2Up>:GotoPage(Directory)\n\
+ Ctrl<Key>q: Quit() \n\
+ Ctrl<Key>c: Quit() \n\
+ Ctrl<Key>r: RemoveThisManpage() \n\
+ Ctrl<Key>n: CreateNewManpage() \n\
+ Ctrl<Key>h: PopupHelp() \n\
+ Ctrl<Key>d: GotoPage(Directory) \n\
+ Ctrl<Key>m: GotoPage(ManualPage) \n\
+ Ctrl<Key>v: ShowVersion() \n\
+ <Key>Prior: Page(Back) \n\
+ <Key>Next : Page(Forward) \n\
+ Shift<Btn4Down>,<Btn4Up>: Page(Line,-1) \n\
+ Shift<Btn5Down>,<Btn5Up>: Page(Line,1) \n\
+ Ctrl<Btn4Down>,<Btn4Up>: Page(Back) \n\
+ Ctrl<Btn5Down>,<Btn5Up>: Page(Forward) \n\
+ None<Btn4Down>,<Btn4Up>: Page(Line,-5) \n\
+ None<Btn5Down>,<Btn5Up>: Page(Line,5) \n\
+ Ctrl<Key>s: PopupSearch()
+
+!*manualBrowser*directory.background: Grey80
+*manualBrowser*directory.translations: #override \
+ Ctrl<Btn1Down>: \
+ XawPositionSimpleMenu(optionMenu) \
+ MenuPopup(optionMenu) \n\
+ Ctrl<Btn2Down>: \
+ XawPositionSimpleMenu(sectionMenu) \
+ MenuPopup(sectionMenu) \n\
+ Shift<Btn2Down>,<Btn2Up>: GotoPage(Manpage) \n\
+ Ctrl<Key>q: Quit() \n\
+ Ctrl<Key>c: Quit() \n\
+ Ctrl<Key>r: RemoveThisManpage() \n\
+ Ctrl<Key>n: CreateNewManpage() \n\
+ Ctrl<Key>h: PopupHelp() \n\
+ Ctrl<Key>d: GotoPage(Directory) \n\
+ Ctrl<Key>m: GotoPage(ManualPage) \n\
+ Ctrl<Key>v: ShowVersion() \n\
+ Ctrl<Key>s: PopupSearch()
+
+*manualBrowser*search*manualPage.translations: #augment \
+ <Btn1Down>,<Btn1Up>: Search(Manpage) reset()
+
+*manualBrowser*search*apropos.translations: #augment \
+ <Btn1Down>,<Btn1Up>: Search(Apropos) reset()
+
+*manualBrowser*search*cancel*translations: #augment \
+ <Btn1Down>,<Btn1Up>: Search(Cancel) reset()
+
+*manualBrowser*search*value*translations: #override \
+ <Key>Return: Search(Manpage) \n\
+ Ctrl<Key>m: Search(Manpage)
+
+*topBox*search*manualPage.translations: #augment \
+ <Btn1Down>,<Btn1Up>: Search(Manpage, Open) reset()
+
+*topBox*search*apropos.translations: #augment \
+ <Btn1Down>,<Btn1Up>: Search(Apropos, Open) reset()
+
+*topBox*search*cancel*translations: #augment \
+ <Btn1Down>,<Btn1Up>: Search(Cancel, Open) reset()
+
+*topBox*search*value*translations: #override \
+ <Key>Return: Search(Manpage, Open) \n\
+ Ctrl<Key>m: Search(Manpage, Open)
+
+*manualBrowser*likeToSave*yes.translations: #override \
+ <Btn1Down>,<Btn1Up>: SaveFormattedPage(Save) reset() \n\
+ <Key>y: SaveFormattedPage(Save) \n\
+ <Key>n: SaveFormattedPage(Cancel)
+
+*manualBrowser*likeToSave*no.translations: #override \
+ <Btn1Down>,<Btn1Up>: SaveFormattedPage(Cancel) reset() \n\
+ <Key>y: SaveFormattedPage(Save) \n\
+ <Key>n: SaveFormattedPage(Cancel)
+
+*manualBrowser*likeToSave*translations: #override \
+ <Key>y: SaveFormattedPage(Save) \n\
+ <Key>n: SaveFormattedPage(Cancel)
+
+*helpButton.translations: #augment \
+ <Btn1Down>,<Btn1Up>: PopupHelp() reset()
+
+*quitButton.translations: #augment \
+ <Btn1Down>,<Btn1Up>: Quit() reset()
+
+*manpageButton.translations: #augment \
+ <Btn1Down>,<Btn1Up>: CreateNewManpage() reset()
+
+! EOF.
diff --git a/Xman-xprint.ad b/Xman-xprint.ad
new file mode 100644
index 0000000..8b342a2
--- /dev/null
+++ b/Xman-xprint.ad
@@ -0,0 +1,292 @@
+*input: True
+
+*topBox: True
+*topBox.Title: Xman
+*topBox.IconName: Xman
+
+*manualBrowser.Title: Manual Page
+*manualBrowser.IconName: Manual Page
+*manualBrowser.geometry: 600x600
+
+*manualFontBold: -*-courier-bold-r-*-*-*-120-*-*-*-*-*-*
+*manualFontItalic: -*-courier-medium-o-*-*-*-120-*-*-*-*-*-*
+*manualFontNormal: -*-courier-medium-r-*-*-*-120-*-*-*-*-*-*
+*manualFontSymbol: -*-symbol-*-*-*-*-*-120-*-*-*-*-*-*
+!*directoryFontNormal: -*-courier-medium-r-*-*-*-120-*-*-*-*-*-*
+*directoryFontNormal: -*-helvetica-medium-r-*-*-*-120-*-*-*-*-*-*
+!*directoryFontNormal: -*-lucida-bold-r-*-*-*-120-*-*-*-*-*-*
+
+!*SimpleMenu.BackingStore: Always
+!*SimpleMenu.SaveUnder: Off
+
+*horizPane.orientation: horizontal
+*horizPane*showGrip: False
+*horizPane.min: 22
+*horizPane.max: 22
+*topLabel.BorderWidth: 0
+*search*label.BorderWidth: 0
+
+*search*dialog*value: Xman
+
+!*optionMenu.Label: Options
+!*sectionMenu.Label: Sections
+
+*horizPane*options.Label: Options
+*horizPane*sections.Label: Sections
+
+*helpButton.Label: Help
+*helpButton.Tip: Open help browser
+
+*quitButton.Label: Quit
+*quitButton.Tip: Quit Xman
+
+*manpageButton.Label: Manual Page
+*manpageButton.Tip: Open new manpage browser
+
+*topLabel.Label: Manual Browser
+
+!*SimpleMenu*menuLabel*vertSpace: 100
+!*SimpleMenu*menuLabel*leftMargin: 20
+
+*displayDirectory.Label: Display Directory
+*displayManualPage.Label: Display Manual Page
+*help.Label: Help
+*help.geometry: 600x600
+*search.Label: Search
+*removeThisManpage.Label: Remove This Manpage
+*help*removeThisManpage.Label: Remove Help
+*openNewManpage.Label: Open New Manpage
+*printManualPage.Label: Print This Manpage
+*showVersion.Label: Show Version
+*quit.Label: Quit
+
+*pleaseStandBy*Label: Formatting Manual Page, Please Stand By...
+
+*search*dialog.Label: Type string to search for:
+*search*apropos.Label: Apropos
+*search*manualPage.Label: Manual Page
+*search*cancel.Label: Cancel
+
+*likeToSave*dialog.Label: Would you like to save this formatted Manual Page?
+*likeToSave*yes.Label: Yes
+*likeToSave*no.Label: No
+
+*translations: #override \
+ Ctrl<Key>q: Quit() \n\
+ Ctrl<Key>c: Quit() \n\
+ Ctrl<Key>n: CreateNewManpage() \n\
+ Ctrl<Key>h: PopupHelp() \n\
+ Ctrl<Key>s: PopupSearch()
+
+*help*Paned.manualPage.translations:#override \
+ Ctrl<Btn1Down>: \
+ XawPositionSimpleMenu(optionMenu) \
+ MenuPopup(optionMenu) \n\
+ Ctrl<Key>q: Quit() \n\
+ Ctrl<Key>c: Quit() \n\
+ Ctrl<Key>r: RemoveThisManpage() \n\
+ Ctrl<Key>n: CreateNewManpage() \n\
+ Ctrl<Key>h: PopupHelp() \n\
+ Ctrl<Key>d: GotoPage(Directory) \n\
+ Ctrl<Key>m: GotoPage(ManualPage) \n\
+ Ctrl<Key>p: PrintThisManpage() \n\
+ Ctrl<Key>v: ShowVersion() \n\
+ <Key>Prior: Page(Back) \n\
+ <Key>Next : Page(Forward) \n\
+ Shift<Btn4Down>,<Btn4Up>: Page(Line,-1) \n\
+ Shift<Btn5Down>,<Btn5Up>: Page(Line,1) \n\
+ Ctrl<Btn4Down>,<Btn4Up>: Page(Back) \n\
+ Ctrl<Btn5Down>,<Btn5Up>: Page(Forward) \n\
+ None<Btn4Down>,<Btn4Up>: Page(Line,-5) \n\
+ None<Btn5Down>,<Btn5Up>: Page(Line,5)
+
+*manualBrowser*manualPage.translations: #override \
+ Ctrl<Btn1Down>: \
+ XawPositionSimpleMenu(optionMenu) \
+ MenuPopup(optionMenu) \n\
+ Ctrl<Btn2Down>: \
+ XawPositionSimpleMenu(sectionMenu) \
+ MenuPopup(sectionMenu) \n\
+ Shift<Btn2Down>,<Btn2Up>:GotoPage(Directory)\n\
+ Ctrl<Key>q: Quit() \n\
+ Ctrl<Key>c: Quit() \n\
+ Ctrl<Key>r: RemoveThisManpage() \n\
+ Ctrl<Key>n: CreateNewManpage() \n\
+ Ctrl<Key>h: PopupHelp() \n\
+ Ctrl<Key>d: GotoPage(Directory) \n\
+ Ctrl<Key>m: GotoPage(ManualPage) \n\
+ Ctrl<Key>p: PrintThisManpage() \n\
+ Ctrl<Key>v: ShowVersion() \n\
+ <Key>Prior: Page(Back) \n\
+ <Key>Next : Page(Forward) \n\
+ Shift<Btn4Down>,<Btn4Up>: Page(Line,-1) \n\
+ Shift<Btn5Down>,<Btn5Up>: Page(Line,1) \n\
+ Ctrl<Btn4Down>,<Btn4Up>: Page(Back) \n\
+ Ctrl<Btn5Down>,<Btn5Up>: Page(Forward) \n\
+ None<Btn4Down>,<Btn4Up>: Page(Line,-5) \n\
+ None<Btn5Down>,<Btn5Up>: Page(Line,5) \n\
+ Ctrl<Key>s: PopupSearch()
+
+!*manualBrowser*directory.background: Grey80
+*manualBrowser*directory.translations: #override \
+ Ctrl<Btn1Down>: \
+ XawPositionSimpleMenu(optionMenu) \
+ MenuPopup(optionMenu) \n\
+ Ctrl<Btn2Down>: \
+ XawPositionSimpleMenu(sectionMenu) \
+ MenuPopup(sectionMenu) \n\
+ Shift<Btn2Down>,<Btn2Up>: GotoPage(Manpage) \n\
+ Ctrl<Key>q: Quit() \n\
+ Ctrl<Key>c: Quit() \n\
+ Ctrl<Key>r: RemoveThisManpage() \n\
+ Ctrl<Key>n: CreateNewManpage() \n\
+ Ctrl<Key>h: PopupHelp() \n\
+ Ctrl<Key>d: GotoPage(Directory) \n\
+ Ctrl<Key>m: GotoPage(ManualPage) \n\
+ Ctrl<Key>v: ShowVersion() \n\
+ Ctrl<Key>s: PopupSearch()
+
+*manualBrowser*search*manualPage.translations: #augment \
+ <Btn1Down>,<Btn1Up>: Search(Manpage) reset()
+
+*manualBrowser*search*apropos.translations: #augment \
+ <Btn1Down>,<Btn1Up>: Search(Apropos) reset()
+
+*manualBrowser*search*cancel*translations: #augment \
+ <Btn1Down>,<Btn1Up>: Search(Cancel) reset()
+
+*manualBrowser*search*value*translations: #override \
+ <Key>Return: Search(Manpage) \n\
+ Ctrl<Key>m: Search(Manpage)
+
+*topBox*search*manualPage.translations: #augment \
+ <Btn1Down>,<Btn1Up>: Search(Manpage, Open) reset()
+
+*topBox*search*apropos.translations: #augment \
+ <Btn1Down>,<Btn1Up>: Search(Apropos, Open) reset()
+
+*topBox*search*cancel*translations: #augment \
+ <Btn1Down>,<Btn1Up>: Search(Cancel, Open) reset()
+
+*topBox*search*value*translations: #override \
+ <Key>Return: Search(Manpage, Open) \n\
+ Ctrl<Key>m: Search(Manpage, Open)
+
+*manualBrowser*likeToSave*yes.translations: #override \
+ <Btn1Down>,<Btn1Up>: SaveFormattedPage(Save) reset() \n\
+ <Key>y: SaveFormattedPage(Save) \n\
+ <Key>n: SaveFormattedPage(Cancel)
+
+*manualBrowser*likeToSave*no.translations: #override \
+ <Btn1Down>,<Btn1Up>: SaveFormattedPage(Cancel) reset() \n\
+ <Key>y: SaveFormattedPage(Save) \n\
+ <Key>n: SaveFormattedPage(Cancel)
+
+*manualBrowser*likeToSave*translations: #override \
+ <Key>y: SaveFormattedPage(Save) \n\
+ <Key>n: SaveFormattedPage(Cancel)
+
+*helpButton.translations: #augment \
+ <Btn1Down>,<Btn1Up>: PopupHelp() reset()
+
+*quitButton.translations: #augment \
+ <Btn1Down>,<Btn1Up>: Quit() reset()
+
+*manpageButton.translations: #augment \
+ <Btn1Down>,<Btn1Up>: CreateNewManpage() reset()
+
+! Use "white" as background for printing
+*printshell*background: white
+
+! Print dialog
+*printdialogshell*geometry: 600x120
+*printdialogshell*title: Print
+*printdialogshell*main*ok.fromVert: innerform
+*printdialogshell*main*ok.label: Print
+*printdialogshell*main*ok.tip: Print
+*printdialogshell*main*setup.fromHoriz: ok
+*printdialogshell*main*setup.fromVert: innerform
+*printdialogshell*main*setup.label: Setup...
+*printdialogshell*main*setup.tip: Configure print job options (page size, orientation, etc.)
+*printdialogshell*main*cancel.fromHoriz: setup
+*printdialogshell*main*cancel.fromVert: innerform
+*printdialogshell*main*cancel.label: Cancel
+*printdialogshell*main*cancel.tip: Cancel printing
+*printdialogshell*main*desclabel.label: Printer Description:
+*printdialogshell*main*desclabel.tip: Short description of printer
+*printdialogshell*main*desc.fromHoriz: desclabel
+*printdialogshell*main*desc.tip: Short description of printer
+*printdialogshell*main*info.fromHoriz: desc
+*printdialogshell*main*info.label: Printer info...
+*printdialogshell*main*info.tip: Display additional information about this printer
+*printdialogshell*main*namelabel.fromVert: desclabel
+*printdialogshell*main*namelabel.label: Printer Name:
+*printdialogshell*main*namelabel.tip: Name of selected printer
+*printdialogshell*main*name.fromHoriz: namelabel
+*printdialogshell*main*name.fromVert: desclabel
+*printdialogshell*main*name.tip: Name of selected printer
+*printdialogshell*main*selectprinter.fromHoriz: name
+*printdialogshell*main*selectprinter.fromVert: desclabel
+*printdialogshell*main*selectprinter.label: Select Printer...
+*printdialogshell*main*selectprinter.label: Select Printer...
+*printdialogshell*main*selectprinter.tip: Select a different printer
+*printdialogshell*main*filenamelabel.fromVert: namelabel
+*printdialogshell*main*filenamelabel.label: File Name:
+*printdialogshell*main*filenamelabel.tip: File where the output should be stored
+*printdialogshell*main*filename.fromHoriz: filenamelabel
+*printdialogshell*main*filename.fromVert: namelabel
+*printdialogshell*main*filename.tip: File where the output should be stored
+*printdialogshell*main*selectfile.fromHoriz: filename
+*printdialogshell*main*selectfile.fromVert: namelabel
+*printdialogshell*main*selectfile.label: Select File...
+*printdialogshell*main*selectfile.tip: Select file where the output should be stored
+*printdialogshell*main*printtoprinter.fromVert: filenamelabel
+*printdialogshell*main*printtoprinter.label: Print to Printer
+*printdialogshell*main*printtoprinter.tip: Send print job to printer
+*printdialogshell*main*printtofile.fromVert: filenamelabel
+*printdialogshell*main*printtofile.fromHoriz: printtoprinter
+*printdialogshell*main*printtofile.label: Print to File
+*printdialogshell*main*printtofile.tip: Save print job in a file
+
+! Print job options dialog
+*printdialogshell*setup*geometry: 600x400
+*printdialogshell*setup*title: Print: Print job options
+*printdialogshell*setup*ok.fromVert: list
+*printdialogshell*setup*ok.label: OK
+*printdialogshell*setup*ok.tip: Commit changes
+*printdialogshell*setup*cancel.fromHoriz: ok
+*printdialogshell*setup*cancel.fromVert: list
+*printdialogshell*setup*cancel.label: Cancel
+*printdialogshell*setup*cancel.tip: Cancel and reset to defaults
+*printdialogshell*setup*paperlist.tip: Select paper size
+*printdialogshell*setup*resolutionlist.fromHoriz: paperlist
+*printdialogshell*setup*resolutionlist.tip: Select page resolution
+*printdialogshell*setup*orientationlist.fromHoriz: resolutionlist
+*printdialogshell*setup*orientationlist.tip: Select page orientation
+*printdialogshell*setup*plexlist.fromHoriz: orientationlist
+*printdialogshell*setup*plexlist.tip: Select page plex mode (simplex, duplex, etc.)
+*printdialogshell*setup*jobcopieslabel.fromVert: paperlist
+*printdialogshell*setup*jobcopieslabel.tip: Set number of job copies
+*printdialogshell*setup*jobcopieslabel.label: Job Copies:
+*printdialogshell*setup*jobcopies.fromHoriz: jobcopieslabel
+*printdialogshell*setup*jobcopies.fromVert: paperlist
+*printdialogshell*setup*jobcopies.tip: Set number of job copies
+
+! Printer selection
+*printdialogshell*printerselection*geometry: 400x150
+*printdialogshell*printerselection*title: Print: Select printer
+*printdialogshell*printerselection*ok.fromVert: list
+*printdialogshell*printerselection*ok.label: OK
+*printdialogshell*printerselection*ok.tip: Switch printer
+*printdialogshell*printerselection*cancel.fromHoriz: ok
+*printdialogshell*printerselection*cancel.fromVert: list
+*printdialogshell*printerselection*cancel.label: Cancel
+*printdialogshell*printerselection*cancel.tip: Cancel printer selection
+*printdialogshell*printerselection*list.tip: Select printer name from list
+
+! Select job file
+*printdialogshell*selectfile*geometry: 400x80
+*printdialogshell*selectfile*title: Print: Select job file
+*printdialogshell*selectfile*dialog.label: Select Filename:
+
+! EOF.
diff --git a/buttons.c b/buttons.c
index d30d52f..59ad39b 100644
--- a/buttons.c
+++ b/buttons.c
@@ -121,13 +121,7 @@ MakeTopBox(void)
/* add WM_COMMAND property */
XSetCommand(XtDisplay(top), XtWindow(top), saved_argv, saved_argc);
- man_globals = (ManpageGlobals*) XtMalloc( (Cardinal) sizeof(ManpageGlobals));
- man_globals->label = NULL;
- man_globals->search_widget = NULL;
- man_globals->manpagewidgets.directory = NULL;
- man_globals->manpagewidgets.manpage = NULL;
- man_globals->manpagewidgets.box = NULL;
- man_globals->current_directory = 0;
+ man_globals = (ManpageGlobals*) XtCalloc(ONE, (Cardinal) sizeof(ManpageGlobals));
MakeSearchWidget(man_globals, top);
MakeSaveWidgets(man_globals, top);
@@ -283,6 +277,11 @@ Boolean full_instance)
XtSetValues(man_globals->both_screens_entry, arglist, ONE);
}
+#ifdef INCLUDE_XPRINT_SUPPORT
+ XtSetArg(arglist[0], XtNsensitive, True);
+ XtSetValues(man_globals->print_entry, arglist, ONE);
+#endif /* INCLUDE_XPRINT_SUPPORT */
+
man_globals->label = XtCreateManagedWidget("manualTitle", labelWidgetClass,
hpane, NULL, (Cardinal) 0);
@@ -435,6 +434,9 @@ CreateOptionMenu(ManpageGlobals * man_globals, Widget parent)
BOTH_SCREENS,
REMOVE_MANPAGE,
OPEN_MANPAGE,
+#ifdef INCLUDE_XPRINT_SUPPORT
+ PRINT_MANPAGE,
+#endif /* INCLUDE_XPRINT_SUPPORT */
SHOW_VERSION,
QUIT
};
@@ -469,16 +471,33 @@ CreateOptionMenu(ManpageGlobals * man_globals, Widget parent)
case 6:
man_globals->open_entry = entry;
break;
+#ifdef INCLUDE_XPRINT_SUPPORT
+ case 7:
+ man_globals->print_entry = entry;
+ break;
+ case 8:
+ man_globals->version_entry = entry;
+ break;
+ case 9:
+ man_globals->quit_entry = entry;
+ break;
+#else /* !INCLUDE_XPRINT_SUPPORT */
case 7:
man_globals->version_entry = entry;
break;
case 8:
man_globals->quit_entry = entry;
break;
+#endif /* !INCLUDE_XPRINT_SUPPORT */
default:
+ Error(("CreateOptionMenu: Unknown id=%d\n", i));
break;
}
}
+
+#ifdef INCLUDE_XPRINT_SUPPORT
+ XtVaSetValues(man_globals->print_entry, XtNsensitive, FALSE, NULL);
+#endif /* INCLUDE_XPRINT_SUPPORT */
}
/* Function Name: CreateSectionMenu
diff --git a/defs.h b/defs.h
index 3077f79..ec4d068 100644
--- a/defs.h
+++ b/defs.h
@@ -67,7 +67,11 @@ from the X Consortium.
/* Names of the menu buttons */
+#ifdef INCLUDE_XPRINT_SUPPORT
+#define NUM_OPTIONS 10 /* Number of menu options. */
+#else /* !INCLUDE_XPRINT_SUPPORT */
#define NUM_OPTIONS 9 /* Number of menu options. */
+#endif /* !INCLUDE_XPRINT_SUPPORT */
#define DIRECTORY "displayDirectory"
#define MANPAGE "displayManualPage"
@@ -76,6 +80,9 @@ from the X Consortium.
#define BOTH_SCREENS "showBothScreens"
#define REMOVE_MANPAGE "removeThisManpage"
#define OPEN_MANPAGE "openNewManpage"
+#ifdef INCLUDE_XPRINT_SUPPORT
+#define PRINT_MANPAGE "printManualPage"
+#endif /* INCLUDE_XPRINT_SUPPORT */
#define SHOW_VERSION "showVersion"
#define QUIT "quit"
diff --git a/handler.c b/handler.c
index 8a8f4f9..bff4ba4 100644
--- a/handler.c
+++ b/handler.c
@@ -40,6 +40,10 @@ from the X Consortium.
#include <sys/stat.h>
#include "globals.h"
#include "vendor.h"
+#ifdef INCLUDE_XPRINT_SUPPORT
+#include "printdialog.h"
+#include "print.h"
+#endif /* INCLUDE_XPRINT_SUPPORT */
static void PutUpManpage(ManpageGlobals * man_globals, FILE * file);
static void ToggleBothShownState(ManpageGlobals * man_globals);
@@ -79,6 +83,10 @@ OptionCallback(Widget w, XtPointer pointer, XtPointer junk)
RemoveThisManpage(XtParent(w), NULL, NULL, NULL);
else if ( w == man_globals->open_entry) /* Open new manpage */
CreateNewManpage(XtParent(w), NULL, NULL, NULL);
+#ifdef INCLUDE_XPRINT_SUPPORT
+ else if ( w == man_globals->print_entry) /* Print current manpage */
+ PrintThisManpage(XtParent(w), NULL, NULL, NULL);
+#endif /* INCLUDE_XPRINT_SUPPORT */
else if ( w == man_globals->version_entry) /* Get version */
ShowVersion(XtParent(w), NULL, NULL, NULL);
else if ( w == man_globals->quit_entry) /* Quit. */
@@ -215,7 +223,9 @@ DirectoryHandler(Widget w, XtPointer global_pointer, XtPointer ret_val)
file = FindManualFile(man_globals, man_globals->current_directory,
ret_struct->list_index);
PutUpManpage(man_globals, file);
- fclose(file);
+ if ((file != NULL) && (file != man_globals->curr_file)) {
+ fclose(file);
+ }
}
/* Function Name: DirPopupCallback
@@ -431,8 +441,7 @@ GotoPage(Widget w, XEvent * event, String * params, Cardinal * num_params)
void
Quit(Widget w, XEvent * event, String * params, Cardinal * num_params)
{
- XCloseDisplay(XtDisplay(w));
- exit(0);
+ XtAppSetExitFlag(XtWidgetToApplicationContext(w));
}
/* Function Name: PopupHelp
@@ -589,9 +598,113 @@ Search(Widget w, XEvent * event, String * params, Cardinal * num_params)
else {
PutUpManpage(man_globals, file);
}
- if (file != NULL)
- fclose(file);
+ if ((file != NULL) && (file != man_globals->curr_file)) {
+ fclose(file);
+ }
+}
+
+#ifdef INCLUDE_XPRINT_SUPPORT
+static void
+printshellDestroyXtProc(Widget w, XtPointer client_data, XtPointer callData)
+{
+ ManpageGlobals *mg = GetGlobals(w);
+ XawPrintDialogClosePrinterConnection(mg->printdialog, False);
+}
+
+static void
+printOKXtProc(Widget w, XtPointer client_data, XtPointer callData)
+{
+ XawPrintDialogCallbackStruct *pdcs = (XawPrintDialogCallbackStruct *)callData;
+ Cardinal n;
+ Arg args[2];
+ ManpageGlobals *mg = GetGlobals(w);
+ Widget topwindow = mg->This_Manpage;
+ FILE *file;
+
+ Log(("printOKXtProc: OK.\n"));
+
+ /* Get file object */
+ n = 0;
+ XtSetArg(args[n], XtNfile, &file); n++;
+ XtGetValues(mg->manpagewidgets.manpage, args, n);
+ Assertion(file != NULL, (("printOKXtProc: file == NULL.\n")));
+
+ DoPrintManpage("Xman",
+ file, topwindow,
+ pdcs->pdpy, pdcs->pcontext, printshellDestroyXtProc,
+ mg->manpage_title,
+ pdcs->printToFile?pdcs->printToFileName:NULL);
+
+ XtPopdown(mg->printdialog_shell);
+}
+
+static void
+printCancelXtProc(Widget w, XtPointer client_data, XtPointer callData)
+{
+ ManpageGlobals * mg = GetGlobals(w);
+
+ Log(("printCancelXtProc: cancel.\n"));
+ XtPopdown(mg->printdialog_shell);
+
+ Log(("destroying print dialog shell...\n"));
+ XtDestroyWidget(mg->printdialog_shell);
+ mg->printdialog_shell = NULL;
+ mg->printdialog = NULL;
+ Log(("... done\n"));
+}
+
+/* Function Name: PrintThisManpage
+ * Description: Print the current manual page.
+ * Arguments: mg - manpage globals
+ * Returns: none.
+ */
+
+/*ARGSUSED*/
+void
+PrintThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params)
+{
+ ManpageGlobals *mg = GetGlobals(w);
+ Dimension width, height;
+ Position x, y;
+ Widget parent = mg->This_Manpage;
+ Widget topwindow = mg->This_Manpage;
+ Log(("print!\n"));
+
+ if (!mg->printdialog) {
+ int n;
+ Arg args[20];
+
+ n = 0;
+ XtSetArg(args[n], XtNallowShellResize, True); n++;
+ mg->printdialog_shell = XtCreatePopupShell("printdialogshell",
+ transientShellWidgetClass,
+ topwindow, args, n);
+ n = 0;
+ mg->printdialog = XtCreateManagedWidget("printdialog", printDialogWidgetClass,
+ mg->printdialog_shell, args, n);
+ XtAddCallback(mg->printdialog, XawNOkCallback, printOKXtProc, NULL);
+ XtAddCallback(mg->printdialog, XawNCancelCallback, printCancelXtProc, NULL);
+
+ XtRealizeWidget(mg->printdialog_shell);
+ }
+
+ /* Center dialog */
+ XtVaGetValues(mg->printdialog_shell,
+ XtNwidth, &width,
+ XtNheight, &height,
+ NULL);
+
+ x = (Position)(XWidthOfScreen( XtScreen(parent)) - width) / 2;
+ y = (Position)(XHeightOfScreen(XtScreen(parent)) - height) / 3;
+
+ XtVaSetValues(mg->printdialog_shell,
+ XtNx, x,
+ XtNy, y,
+ NULL);
+
+ XtPopup(mg->printdialog_shell, XtGrabNonexclusive);
}
+#endif /* INCLUDE_XPRINT_SUPPORT */
/* Function Name: ShowVersion
* Description: Show current version.
diff --git a/main.c b/main.c
index 29ceb72..a5e6174 100644
--- a/main.c
+++ b/main.c
@@ -41,7 +41,7 @@ from the X Consortium.
#include <X11/Xaw/Cardinals.h>
#endif /* ZERO */
-#if !defined(lint) && !defined(SABER) && 0
+#if !defined(lint) && !defined(SABER)
static char version[] = XMAN_VERSION; /* via strings. */
#endif
@@ -125,6 +125,9 @@ XtActionsRec xman_actions[] = {
{"CreateNewManpage", CreateNewManpage},
{"RemoveThisManpage", RemoveThisManpage},
{"SaveFormattedPage", SaveFormattedPage},
+#ifdef INCLUDE_XPRINT_SUPPORT
+ {"PrintThisManpage", PrintThisManpage},
+#endif /* INCLUDE_XPRINT_SUPPORT */
{"ShowVersion", ShowVersion},
};
@@ -168,7 +171,7 @@ int main(int argc, char ** argv)
if ( (argc != 1) || (resources.show_help_syntax) ) {
ArgError(argc, argv);
- exit(1);
+ return EXIT_FAILURE;
}
XtAppAddActions(app_con, xman_actions, XtNumber(xman_actions));
@@ -215,7 +218,7 @@ int main(int argc, char ** argv)
XtAppMainLoop(app_con);
- exit(0);
+ return EXIT_SUCCESS;
}
/* Function Name: ArgError
@@ -288,7 +291,7 @@ AdjustDefResources(void)
if (!(my_resources[i].default_addr =
malloc(strlen(xwinhome) + sizeof("/lib/X11/xman.help")))) {
fprintf(stderr, "malloc failure\n");
- exit(1);
+ exit(EXIT_FAILURE);
}
sprintf(my_resources[i].default_addr, "%s/lib/X11/xman.help", xwinhome);
}
diff --git a/man.h b/man.h
index ea8054a..c284b36 100644
--- a/man.h
+++ b/man.h
@@ -1,5 +1,5 @@
/* $XConsortium: man.h,v 1.31 94/12/16 21:36:53 gildea Exp $ */
-/* $XdotOrg: xc/programs/xman/man.h,v 1.3 2004/05/22 19:20:06 alanc Exp $ */
+/* $XdotOrg: xc/programs/xman/man.h,v 1.6 2004/07/29 00:40:35 gisburn Exp $ */
/*
Copyright (c) 1987, 1988 X Consortium
@@ -43,6 +43,7 @@ from the X Consortium.
/* Std system and C header files */
#include <stdio.h>
+#include <limits.h>
#include <X11/Xfuncs.h>
#include <X11/Xos.h>
@@ -72,6 +73,17 @@ from the X Consortium.
#include "version.h"
#include "defs.h"
+/* Turn a NULL pointer string into an empty string */
+#define NULLSTR(x) (((x)!=NULL)?(x):(""))
+
+#define Error(x) { printf x ; exit(EXIT_FAILURE); }
+#define Assertion(expr, msg) { if (!(expr)) { Error msg } }
+#ifdef DEBUG
+# define Log(x) { if(True) printf x; }
+#else
+# define Log(x) { if(False) printf x; }
+#endif /* DEBUG */
+
/*
* Assigning values here allows the user of Bitwise Or.
*/
@@ -132,12 +144,19 @@ typedef struct _ManpageGlobals{
help_button, /* The help button. */
option_menu, /* The option menu. */
text_widget; /* text widget containing search string. */
-
- /* Widgets (Objects really) for the command menu entries. */
-
- Widget dir_entry, manpage_entry, help_entry,
- search_entry, both_screens_entry, remove_entry, open_entry,
- version_entry, quit_entry;
+
+ /* Widgets (Objects really) for the command menu entries. */
+
+ Widget dir_entry, manpage_entry, help_entry,
+ search_entry, both_screens_entry, remove_entry,
+ open_entry, print_entry, version_entry, quit_entry;
+
+#ifdef INCLUDE_XPRINT_SUPPORT
+ /* Print objects and data */
+ Widget printdialog_shell; /* Shell for the print dialog */
+ Widget printdialog; /* Print dialog */
+#endif /*INCLUDE_XPRINT_SUPPORT */
+ /* Misc. */
char manpage_title[80]; /* The label to use for the current manpage. */
@@ -157,6 +176,7 @@ typedef struct _ManpageGlobals{
Widget This_Manpage; /* a pointer to the root of
this manpage. */
+ FILE *curr_file; /* Current file shown in manpage widget */
} ManpageGlobals;
@@ -221,6 +241,9 @@ void Quit(Widget w, XEvent * event, String * params, Cardinal * num_params);
void RemoveThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params);
void SaveFormattedPage(Widget w, XEvent * event, String * params, Cardinal * num_params);
void Search(Widget w, XEvent * event, String * params, Cardinal * num_params);
+#ifdef INCLUDE_XPRINT_SUPPORT
+void PrintThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params);
+#endif /* INCLUDE_XPRINT_SUPPORT */
void ShowVersion(Widget w, XEvent * event, String * params, Cardinal * num_params);
/* help.c */
@@ -233,7 +256,6 @@ Bool ReadManConfig(char manpath[]);
int Man(void);
/* misc.c */
-FILE * DoSearch(ManpageGlobals * man_globals, int type);
FILE * FindManualFile(ManpageGlobals * man_globals, int section_num, int entry_num);
ManpageGlobals * GetGlobals(Widget w);
void AddCursor(Widget w, Cursor cursor);
@@ -248,6 +270,7 @@ void ParseEntry(char *entry, char *path, char *sect, char *page);
FILE * Format(ManpageGlobals * man_globals, char * entry);
/* search */
+FILE * DoSearch(ManpageGlobals * man_globals, int type);
void MakeSearchWidget(ManpageGlobals * man_globals, Widget parent);
/* tkfunctions.c */
diff --git a/misc.c b/misc.c
index 105da90..e99aaa9 100644
--- a/misc.c
+++ b/misc.c
@@ -1,5 +1,5 @@
/* $XConsortium: misc.c,v 1.31 94/12/16 21:36:53 gildea Exp $ */
-/* $XdotOrg: xc/programs/xman/misc.c,v 1.3 2004/05/22 19:20:06 alanc Exp $ */
+/* $XdotOrg: xc/programs/xman/misc.c,v 1.4 2004/06/08 02:44:35 gisburn Exp $ */
/*
Copyright (c) 1987, 1988 X Consortium
@@ -138,7 +138,7 @@ void
PrintError(char * string)
{
fprintf(stderr,"Xman Error: %s\n",string);
- exit(1);
+ exit(EXIT_FAILURE);
}
/* Function Name: OpenFile
@@ -153,8 +153,15 @@ OpenFile(ManpageGlobals * man_globals, FILE * file)
{
Arg arglist[1];
Cardinal num_args = 0;
+
+ if (man_globals->curr_file) {
+#if 0 /* Ownership rules need to be fixed first */
+ fclose(man_globals->curr_file);
+#endif
+ }
+ man_globals->curr_file = file;
- XtSetArg(arglist[num_args], XtNfile, file); num_args++;
+ XtSetArg(arglist[num_args], XtNfile, man_globals->curr_file); num_args++;
XtSetValues(man_globals->manpagewidgets.manpage, arglist, num_args);
}
diff --git a/search.c b/search.c
index 48d048a..542d2de 100644
--- a/search.c
+++ b/search.c
@@ -265,7 +265,7 @@ DoSearch(ManpageGlobals * man_globals, int type)
strcpy(man_globals->manpage_title,label);
ChangeLabel(man_globals->label,label);
- fseek(file, 0L, 0); /* reset file to point at top. */
+ fseek(file, 0L, SEEK_SET); /* reset file to point at top. */
}
else { /* MANUAL SEACH */
file = DoManualSearch(man_globals, search_string);
diff --git a/version.h b/version.h
index d715308..f1f0250 100644
--- a/version.h
+++ b/version.h
@@ -29,4 +29,4 @@ from the X Consortium.
*/
-#define XMAN_VERSION "Xman Version 3.2.0 - X11R6.7.1"
+#define XMAN_VERSION "Xman Version 3.2.0 - X11R6.8"