diff -Nru gman-0.9.3/ChangeLog gman-0.9.3/ChangeLog --- gman-0.9.3/ChangeLog 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/ChangeLog 2002-05-21 06:39:34.000000000 +0000 @@ -1,4 +1,4 @@ -ChangeLog for Gman by Xinkai Wang +ChangeLog for G-man by Xinkai Wang v0.9.2 (31.Mar 2001) - CGI front-end for man2html (gman.pl) added. diff -Nru gman-0.9.3/context.c gman-0.9.3/context.c --- gman-0.9.3/context.c 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/context.c 2002-05-21 06:39:34.000000000 +0000 @@ -122,7 +122,7 @@ void AppContext::display_values() { - int i,j; + int i,j,k; printf("values:\n"); j = names->get_size(); for(i = 0; i Wed, 18 Jan 2012 15:15:05 +0100 + +gman (0.9.3-5.2) unstable; urgency=low + + * Non-maintainer upload. + * Switched from mozilla to sensible-browser. + * Added evince as choice since this is gnome/GTK+ app. + * Updated manpath default values to current situation. + * Updated policy version, used 3.0 (quilt) format, and + made some lintian touch-ups. + + -- Osamu Aoki Wed, 04 Jan 2012 00:48:23 +0900 + gman (0.9.3-5.1ubuntu1) oneiric; urgency=low * Reorder libraries to fix FTBFS with ld --as-needed (LP: #770780) diff -Nru gman-0.9.3/debian/compat gman-0.9.3/debian/compat --- gman-0.9.3/debian/compat 1970-01-01 00:00:00.000000000 +0000 +++ gman-0.9.3/debian/compat 2011-11-13 13:36:26.000000000 +0000 @@ -0,0 +1 @@ +8 diff -Nru gman-0.9.3/debian/control gman-0.9.3/debian/control --- gman-0.9.3/debian/control 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/debian/control 2012-01-18 14:16:24.000000000 +0000 @@ -3,13 +3,13 @@ Priority: optional Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Josip Rodin -Build-Depends: debhelper (>= 5), libglib2.0-dev, libgtk2.0-dev -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 8), libglib2.0-dev, libgtk2.0-dev +Standards-Version: 3.9.2 Package: gman Architecture: any -Depends: ${shlibs:Depends}, man-db, xterm | x-terminal-emulator -Suggests: gv, man2html, httpd +Depends: ${misc:Depends}, ${shlibs:Depends}, man-db, xterm | x-terminal-emulator +Suggests: gv, man2html, httpd, sensible-browser, evince Provides: man-browser Description: small man(1) front-end for X Gman is a simple front-end for the manual page system. The most basic job @@ -19,8 +19,8 @@ one external viewer windows can be launched at the same time. . The default manual page viewer is a terminal window with the original - man(1). It can also launch gv, or a link to a CGI script which utilizes - man2html, for viewing manual pages using a web browser. + man(1). It can also launch gv, evince, or a link to a CGI script which + utilizes man2html, for viewing manual pages using a web browser. . There is an index search function to look for the man pages that one needs. It's simple, but it's useful. diff -Nru gman-0.9.3/debian/patches/evince.patch gman-0.9.3/debian/patches/evince.patch --- gman-0.9.3/debian/patches/evince.patch 1970-01-01 00:00:00.000000000 +0000 +++ gman-0.9.3/debian/patches/evince.patch 2012-01-03 16:32:40.000000000 +0000 @@ -0,0 +1,100 @@ +Author: Osamu Aoki +Description: Use Evince +--- a/gman.1x ++++ b/gman.1x +@@ -40,6 +40,12 @@ + .sp + This requires GhostView (command "gv") to be available on your system. + .TP ++.B Evince ++gman will present man pages in an Evince window for you to view and print ++the man page. ++.sp ++This requires GNOME Evince (command "evince") to be available on your system. ++.TP + .B LocalBrowse + gman will launch a web browser window to show you the man page. + .sp +--- a/gman.c ++++ b/gman.c +@@ -91,6 +91,7 @@ + context->set_default_value("show_mode","int",(void*)0); // 0 = xterm, 1 = ghostview + context->set_default_value("xterm_command","char*",(void*)"x-terminal-emulator"); + context->set_default_value("gv_command","char*",(void*)"gv"); ++ context->set_default_value("evince_command","char*",(void*)"evince"); + context->set_default_value("browser_command","char*",(void*)"sensible-browser"); // kfm also works + context->set_default_value("cgi_host","char*",(void*)"localhost"); + context->set_default_value("cgi_location","char*",(void*)"/cgi-bin/gman.pl"); +--- a/mandata.c ++++ b/mandata.c +@@ -275,6 +275,26 @@ + _exit(0); + } + break; ++ case 2: ++ sprintf(loc_name," ~/.gman.%s.ps ",get_display_name(buffer1)); ++ sprintf(buffer,"man -t "); ++ len = strlen(buffer); ++ attach(buffer+len,man_path->GetPath(),file_name); ++ strcat(buffer," >> "); ++ strcat(buffer,loc_name); ++ strcat(buffer," ; "); ++ strcat(buffer,(char*)context->get_value("evince_command")); ++ strcat(buffer,loc_name); ++ strcat(buffer," ; rm "); ++ strcat(buffer,loc_name); ++ //g_warning(buffer); ++ if(!fork()) ++ { ++ //printf(buffer); ++ system(buffer); ++ _exit(0); ++ } ++ break; + /* + case 2: + sprintf(loc_name," ~/.gman.%s.html ",get_display_name(buffer1)); +@@ -304,7 +324,7 @@ + } + break; + */ +- case 2: ++ case 3: + sprintf(loc_name," ~/.gman.%s.html ",get_display_name(buffer1)); + //g_warning(loc_name); + strcpy(buffer,"/usr/lib/cgi-bin/gman.pl "); +@@ -329,7 +349,7 @@ + _exit(0); + } + break; +- case 3: ++ case 4: + sprintf(buffer,(char*)context->get_value("browser_command")); + len = strlen(buffer); + strcat(buffer," \"http://"); +--- a/menu.c ++++ b/menu.c +@@ -78,8 +78,9 @@ + {"/_View", NULL, NULL, 0, ""}, + {"/View/x_Term", "T", (void (*)())show_mode_callback, 0, ""}, + {"/View/_GhostView", "G", (void (*)())show_mode_callback, 1, "/View/xTerm"}, +- {"/View/_LocalBrowse", "L", (void (*)())show_mode_callback, 2, "/View/xTerm"}, +- {"/View/_NetBrowse", "N", (void (*)())show_mode_callback, 3, "/View/xTerm"}, ++ {"/View/_Evince", "E", (void (*)())show_mode_callback, 2, "/View/xTerm"}, ++ {"/View/_LocalBrowse", "L", (void (*)())show_mode_callback, 3, "/View/xTerm"}, ++ {"/View/_NetBrowse", "N", (void (*)())show_mode_callback, 4, "/View/xTerm"}, + {"/_Options", NULL, NULL, 0, ""}, + {"/Options/Status bar", NULL, (void (*)())status_bar_callback, 0, ""}, + {"/Options/sep1", NULL, NULL, 0, ""}, +@@ -164,8 +165,9 @@ + searching_mode_buttons[1] = gtk_item_factory_get_widget(item_factory, "/Options/Key word search"); + show_mode_buttons[0] = gtk_item_factory_get_widget(item_factory, "/View/xTerm"); + show_mode_buttons[1] = gtk_item_factory_get_widget(item_factory, "/View/GhostView"); +- show_mode_buttons[2] = gtk_item_factory_get_widget(item_factory, "/View/LocalBrowse"); +- show_mode_buttons[3] = gtk_item_factory_get_widget(item_factory, "/View/NetBrowse"); ++ show_mode_buttons[2] = gtk_item_factory_get_widget(item_factory, "/View/Evince"); ++ show_mode_buttons[3] = gtk_item_factory_get_widget(item_factory, "/View/LocalBrowse"); ++ show_mode_buttons[4] = gtk_item_factory_get_widget(item_factory, "/View/NetBrowse"); + status_bar_button = gtk_item_factory_get_widget(item_factory, "/Options/Status bar"); + // gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(section_buttons[4]),1); + updata_menu_buttons(0); diff -Nru gman-0.9.3/debian/patches/fix-ftbfs-with-binutils-gold.patch gman-0.9.3/debian/patches/fix-ftbfs-with-binutils-gold.patch --- gman-0.9.3/debian/patches/fix-ftbfs-with-binutils-gold.patch 1970-01-01 00:00:00.000000000 +0000 +++ gman-0.9.3/debian/patches/fix-ftbfs-with-binutils-gold.patch 2012-01-18 14:14:09.000000000 +0000 @@ -0,0 +1,16 @@ +Description: Fix FTBFS with binutils-gold +Author: Angel Abad +Bug-Ubuntu: https://launchpad.net/bugs/770780 +Forwarded: no + +--- a/Makefile ++++ b/Makefile +@@ -17,7 +17,7 @@ + GTK_LIBS = $(shell pkg-config --libs gtk+-2.0) + + gman: $(objectfiles) +- $(CC) -lpthread $(GTK_LIBS) -rdynamic $(objectfiles) -o gman ++ $(CC) -rdynamic $(objectfiles) -o gman -lpthread $(GTK_LIBS) + + %.o: %.c %.h + gman.o: gman.c gman.h menu.h diff -Nru gman-0.9.3/debian/patches/gnome-terminal.patch gman-0.9.3/debian/patches/gnome-terminal.patch --- gman-0.9.3/debian/patches/gnome-terminal.patch 1970-01-01 00:00:00.000000000 +0000 +++ gman-0.9.3/debian/patches/gnome-terminal.patch 2012-01-03 17:56:34.000000000 +0000 @@ -0,0 +1,15 @@ +Author: Osamu Aoki +Description: Drop -n option since gnome terminal does not like it +--- a/mandata.c ++++ b/mandata.c +@@ -241,9 +241,8 @@ + char buffer2[BUFFER_SIZE]; + switch ((long)context->get_value("show_mode")) { + case 0: +- sprintf(buffer,"%s -T '%s manual page' -n '%s - GMan' -e man ", ++ sprintf(buffer,"%s -T '%s manual page' -e man ", + (char*)context->get_value("xterm_command"), +- get_display_name(buffer1), + get_display_name(buffer1)); + len = strlen(buffer); + attach(buffer+len,man_path->GetPath(),file_name); diff -Nru gman-0.9.3/debian/patches/manpath.patch gman-0.9.3/debian/patches/manpath.patch --- gman-0.9.3/debian/patches/manpath.patch 1970-01-01 00:00:00.000000000 +0000 +++ gman-0.9.3/debian/patches/manpath.patch 2012-01-03 16:58:31.000000000 +0000 @@ -0,0 +1,35 @@ +Author: Osamu Aoki +Description: Adjust manpath to current values +--- a/gman.1x ++++ b/gman.1x +@@ -74,7 +74,7 @@ + .br + show_warning = 0 + .br +-man_paths = /usr/man:/usr/local/man:/usr/X11R6/man ++man_paths = /usr/local/man:/usr/local/share/man:/usr/share/man + .sp + For more information, see init_context() function in gman.c for all the + options avialiable. +--- a/gman.c ++++ b/gman.c +@@ -82,7 +82,7 @@ + context = new AppContext(); + // context->set_default_value("v_size",(void*)400); + context->set_default_value("debuging","int",(void*)0); +- context->set_default_value("man_paths","char*",(void*)"/usr/share/man:/usr/X11R6/man:/usr/man:/usr/local/man"); ++ context->set_default_value("man_paths","char*",(void*)"/usr/local/man:/usr/local/share/man:/usr/share/man"); + context->set_default_value("display_section_policy","int",(void*)0); + context->set_default_value("display_section","int",(void*)3); + context->set_default_value("searching_mode","int",(void*)0); +--- a/t2.c ++++ b/t2.c +@@ -744,7 +744,7 @@ + item_list_length = 0; + item_list_count = 0; + +- man_paths = new ManPath("/usr/X11/man/"); ++ man_paths = new ManPath("/usr/share/man/"); + printf("GetSize = %d\n",man_paths->GetSize('a')); + + item_list_length = item_list_count = man_paths->GetSize('a'); diff -Nru gman-0.9.3/debian/patches/pre-0.9.3-5.1.patch gman-0.9.3/debian/patches/pre-0.9.3-5.1.patch --- gman-0.9.3/debian/patches/pre-0.9.3-5.1.patch 1970-01-01 00:00:00.000000000 +0000 +++ gman-0.9.3/debian/patches/pre-0.9.3-5.1.patch 2012-01-03 16:33:20.000000000 +0000 @@ -0,0 +1,1055 @@ +Author: Josip Rodin and Barry deFreese +Description: Combined patches from 0.9.3-1 to 0.9.3-5.1 +diff --git a/ChangeLog b/ChangeLog +index ed28b96..eb5817d 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,4 +1,4 @@ +-ChangeLog for G-man by Xinkai Wang ++ChangeLog for Gman by Xinkai Wang + + v0.9.2 (31.Mar 2001) + - CGI front-end for man2html (gman.pl) added. +diff --git a/Makefile b/Makefile +index 9fb583c..6a0ea23 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,55 +1,39 @@ + # Gman Makefile + # You can adjust the following variables. ++ + CXX = g++ +-CXXFLAGS = -DVERSION=\"0.9.3\" `gtk-config --cflags` -O2 -Wall ++CXXFLAGS = -DVERSION=\"0.9.3\" $(shell pkg-config --cflags gtk+-2.0) -O2 -Wall $(DEBUG) + CC = $(CXX) $(CXXFLAGS) + +-GNOMELIB = #`gnome-config --libs gnomeui` +-GTKLIB = -L/usr/lib/ `gtk-config --libs` + prefix = /usr +-cgi_bin_prefix = /var/www/cgi-bin ++cgi_bin_prefix = ${prefix}/lib/cgi-bin + + # There shouldn't be any need to edit anything below this point. + all: gman + +-gman: menu.o mandata.o util.o gman.o list.o context.o task.o taskfunc.o window2.o +- $(CXX) -lgtk -lgdk -lpthread $(GTKLIB) menu.o mandata.o util.o gman.o list.o context.o task.o taskfunc.o window2.o -o gman ++objectfiles = menu.o mandata.o util.o gman.o list.o context.o task.o \ ++ taskfunc.o window2.o + +-gman.o: gman.c menu.h +- $(CC) -c gman.c ++GTK_LIBS = $(shell pkg-config --libs gtk+-2.0) + +-menu.o: menu.c mandata.h util.h +- $(CC) -c menu.c -o menu.o ++gman: $(objectfiles) ++ $(CC) -lpthread $(GTK_LIBS) -rdynamic $(objectfiles) -o gman + ++%.o: %.c %.h ++gman.o: gman.c gman.h menu.h ++menu.o: menu.c menu.h mandata.h util.h + mandata.o: mandata.c mandata.h util.h mandatadef.h +- $(CC) -c mandata.c -o mandata.o +- +-util.o: util.c util.h +- $(CC) -c util.c -o util.o +- +-list.o: list.c list.h +- $(CC) -c list.c +- +-context.o: context.c context.h +- $(CC) -c context.c +- +-task.o: task.c task.h +- $(CC) -c task.c +- +-taskfunc.o: taskfunc.c taskfunc.h +- $(CC) -c taskfunc.c +- +-window2.o: window2.c window2.h +- $(CC) -c window2.c + + clean: +- rm -f *.o *~ gman ++ rm -f $(objectfiles) gman ++ ++distclean: clean ++ rm -f *.o *~ + + install: + test -d $(prefix)/bin || mkdir -p $(prefix)/bin +- test -d $(prefix)/man/man1 || mkdir -p $(prefix)/man/man1 +- test -d $(cgi_bin_prefix)/gman || mkdir -p $(cgi_bin_prefix)/gman +- install -s -m 755 gman $(prefix)/bin +- install -s -m 755 gman.pl $(prefix)/bin/gman.cgi +- install -m 644 gman.1x $(prefix)/man/man1 +- install -s -m 755 gman.pl $(ci_bin_prefix)/gman ++ test -d $(prefix)/share/man/man1 || mkdir -p $(prefix)/share/man/man1 ++ test -d $(cgi_bin_prefix) || mkdir -p $(cgi_bin_prefix) ++ install -m 755 gman $(prefix)/bin/ ++ install -m 755 gman.pl $(cgi_bin_prefix)/gman.pl ++ install -m 644 gman.1x $(prefix)/share/man/man1 +diff --git a/README b/README +index 64d213a..0b866eb 100644 +--- a/README ++++ b/README +@@ -71,7 +71,7 @@ To do + + * autoconf support, especially if GNOME support is included. + * use of gettext for easier translation to other languages. +- * improvment for the parser when reading the ~/.gman file (context.c). ++ * improvement for the parser which reads the ~/.gman file (context.c). + * internal method of displaying manual pages, not with xterm. + + Your comments and suggestions will be the most important for gman +diff --git a/context.c b/context.c +index 4f339a4..9c60bd0 100644 +--- a/context.c ++++ b/context.c +@@ -122,7 +122,7 @@ void AppContext::restore_all() + + void AppContext::display_values() + { +- int i,j,k; ++ int i,j; + printf("values:\n"); + j = names->get_size(); + for(i = 0; i"GhostView" and gman will present man pages with a +-ghostview window for you to view and print the man page. ++This requires GhostView (command "gv") to be available on your system. ++.TP ++.B LocalBrowse ++gman will launch a Mozilla window to show you the man page. + .sp +-Tips: If you have netscape on your system, you may set +-"View"->"LocalBrowse" and gman will launch a netscape window to show +-you the man page. ++This requires man2html and Mozilla (command "mozilla") to be available on your ++system. ++.TP ++.B NetBrowse ++In this mode, you can view the pages with Mozilla and navigate from ++one man page to another by clicking the links in the man pages. + .sp +-Tips: If you have netscape and apache server running ( defult +-cgi-bin directory is "/var/www/cgi-bin") , you may enjoy the full +-NetBrowse mode by set "View"->"NetBrowse". In this mode, you can view +-the pages with netscape browser and navigate from one man page to +-another (by click the links in the man pages). This mode is very +-useful. ++This requires man2html, Mozilla (command "mozilla") and a HTTP server ++running on localhost. + + .SH FILES + .TP +@@ -71,8 +78,13 @@ options avialiable. + .BR man (1), + .BR man (7), + .BR xterm (1). ++ + .SH AUTHOR + .B Gman +-was written by a smart gay named Xinkai Wang . Home page of gman is at: ++was written by a smart guy named Xinkai Wang . ++.PP ++Home page of gman is at: + .br +-.I http://homex.coolconnect.com/user/xkwang/gman/ ++.UR ++http://homex.coolconnect.com/user/xkwang/gman/ ++.UE +diff --git a/gman.c b/gman.c +index 52613fd..36cd661 100644 +--- a/gman.c ++++ b/gman.c +@@ -42,13 +42,12 @@ TaskGroup * task_group; + int main(int argc, char *argv[]) + { + GtkWidget *window; +- pthread_t th_init_data; + + pthread_mutex_init(>k_lock,NULL); + pthread_mutex_init(&context_lock,NULL); + pthread_mutex_init(&loading_man_path_lock,NULL); + init_context(); +- debuging = (int)context->get_value("debuging"); ++ debuging = (long)context->get_value("debuging"); + pthread_mutex_lock(>k_lock); + gtk_init (&argc, &argv); + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); +@@ -83,18 +82,18 @@ void init_context() + context = new AppContext(); + // context->set_default_value("v_size",(void*)400); + context->set_default_value("debuging","int",(void*)0); +- context->set_default_value("man_paths","char*",(void*)"/usr/man:/usr/local/man:/usr/X11R6/man"); ++ context->set_default_value("man_paths","char*",(void*)"/usr/share/man:/usr/X11R6/man:/usr/man:/usr/local/man"); + context->set_default_value("display_section_policy","int",(void*)0); + context->set_default_value("display_section","int",(void*)3); + context->set_default_value("searching_mode","int",(void*)0); + context->set_default_value("show_status_bar","int",(void*)0); + context->set_default_value("show_warning","int",(void*)0); + context->set_default_value("show_mode","int",(void*)0); // 0 = xterm, 1 = ghostview +- context->set_default_value("xterm_command","char*",(void*)"xterm"); // rxvt, Eterm also works ++ context->set_default_value("xterm_command","char*",(void*)"x-terminal-emulator"); + context->set_default_value("gv_command","char*",(void*)"gv"); +- context->set_default_value("browser_command","char*",(void*)"netscape"); // kfm also works ++ context->set_default_value("browser_command","char*",(void*)"mozilla"); // kfm also works + context->set_default_value("cgi_host","char*",(void*)"localhost"); +- context->set_default_value("cgi_location","char*",(void*)"/cgi-bin/gman/gman.pl"); ++ context->set_default_value("cgi_location","char*",(void*)"/cgi-bin/gman.pl"); + context->set_default_value("print_command","char*",(void*)"lpr"); // not in use + + attach(buffer,getenv("HOME"),".gman"); +diff --git a/gman.pl b/gman.pl +index 850e5af..052b7e8 100755 +--- a/gman.pl ++++ b/gman.pl +@@ -1,18 +1,30 @@ +-#!/usr/bin/perl +-use strict(all); ++#!/usr/bin/perl -w ++use strict; + +-my $cgi_path = "/cgi-bin/gman/gman.pl"; +-my $man2html = "man2html -M $cgi_path"; +-my $path = `man -w @ARGV`; +-my $tmp_file = "/tmp/gman.$ARGV[1].$ARGV[0]"; ++if (@ARGV != 2) { ++ print <<_EOF_; ++Content-type: text/html ++ ++gman.pl: invalid use ++ ++

gman.pl cannot be used without arguments.

++ ++_EOF_ ++ die; ++} + ++my $section = $ARGV[0]; # should also have some sanity check ++my $name = $ARGV[1]; ++my $man2html = "/usr/lib/cgi-bin/man/man2html"; ++my $path = `man -w $section $name`; chomp $path; $path =~ s/\s*$//; + +-if (!&file_exist($path)) { +- my $name = lc($ARGV[1]); +- $path = `man -w $ARGV[0] $name`; +-# print "check point 0.9\n"; ++unless (-s "$path") { ++ warn "not -s $path\n"; ++ $name = lc $name; ++ $path = `man -w $section $name`; chomp $path; $path =~ s/\s*$//; + } +-if (!&file_exist($path)) { ++unless (-s "$path") { ++ warn "not -s $path\n"; + print <404 Not Found + +

Not Found

+-The requested man page $ARGV[1]($ARGV[0]) was not found on this server.

++The requested man page $name($section) was not found on this server. + + end_of_line + die; + } +-my $page; +-if ($path =~ /gz$/) { +- my $file = `gzip -cd $path`; +- open (TEMPFILE,">$tmp_file"); +- print TEMPFILE $file; +- close (TEMPFILE); +- $page = `$man2html $tmp_file`; +- `rm $tmp_file`; +-} else { +- $page = `$man2html $path`; ++ ++unless (-e "$man2html") { ++ warn "$man2html missing\n"; ++ print < ++ ++man2html missing ++ ++

man2html missing

++ ++

You have to install man2html in order to use this mode in gman. ++ ++ ++end_of_line ++ die; + } + +-$page =~ s/This document was created by\s*man2html<\/A>,\s*using the manual pages.
/This document was created by +-
man2html<\/A> for gman<\/A>, +-using the manual pages.
/; ++my $page = `$man2html $path`; ++ ++# $page =~ s/^Content-type: text\/html\n\n// if (not run as cgi...); ++ ++$page =~ s/(This document was created by\n
man2html<\/a>)(,\nusing the manual pages.
)/$1 for
gman<\/a>$2/io; ++ + print $page; +-#print `cat /home/wxk/src/gtk/gman.html`; +- +-sub file_exist { +- open (FILE,$_[0]); +- my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, +- $atime,$mtime,$ctime,$blksize,$blocks) = stat(FILE); +- close(FILE); +- +-# print "check point 0.5, size = $size, $_[0]\n"; +- if ($size == 0 or $size eq null) { +- return 0; +- } else { +- return 1; +- } +-} +diff --git a/mandata.c b/mandata.c +index 540b48c..94412a8 100644 +--- a/mandata.c ++++ b/mandata.c +@@ -30,7 +30,6 @@ + + void attach (char *dest, const char *dirname, const char *name); + static int section_translate_c_to_n(const char* c); +-static int ManItemComp(ManItem ** a,ManItem ** b); + static int is_zip_suffix(char* c); + + char buffer1[BUFFER_SIZE]; +@@ -40,7 +39,6 @@ char buffer2[BUFFER_SIZE]; + ManPath::ManPath(char* _path_name) + { + int i; +- int len; + active = 1; + path_name = my_strdup(_path_name); + for (i=0;id_name); + //printf("LoadManPath: %s\n",name); + val = stat (buffer1, &state); +- if (val < 0) fprintf(stderr,"error number %d, in get state %s",errno,buffer1); ++ if (val < 0) fprintf(stderr,"error getting state of %s: %s\n",buffer1,strerror(errno)); + else if (S_ISDIR(state.st_mode) && !strncmp(item->d_name,"man",3)) LoadManSubPath(item->d_name); + else + { +@@ -151,7 +149,7 @@ int ManPath::LoadManSubPath(char * sub_name) + attach(buffer1,buffer2,item->d_name); + //printf("LoadManSubPath: %s\n",full_name); + val = stat (buffer1, &state); +- if (val < 0) fprintf(stderr,"error number %d, in get state %s\n",errno,buffer1); ++ if (val < 0) fprintf(stderr,"error getting state of %s: %s\n",buffer1,strerror(errno)); + else if (S_ISDIR(state.st_mode)) continue; + else + { +@@ -166,6 +164,7 @@ int ManPath::LoadManSubPath(char * sub_name) + } + } + closedir(dirp); ++ return 0; + } + + ManItem * ManPath::search_man_item(char * name, char * sect) +@@ -236,15 +235,15 @@ void * ManItem::get_man_path() {return (void *)man_path;} + + void ManItem::active_man_page(void) + { +- int i; + int len; + char buffer[2*BUFFER_SIZE]; + char loc_name[BUFFER_SIZE]; + char buffer2[BUFFER_SIZE]; +- switch ((int)context->get_value("show_mode")) { ++ switch ((long)context->get_value("show_mode")) { + case 0: +- sprintf(buffer,"%s -T '%s manual page' -n GMan -e man ", ++ sprintf(buffer,"%s -T '%s manual page' -n '%s - GMan' -e man ", + (char*)context->get_value("xterm_command"), ++ get_display_name(buffer1), + get_display_name(buffer1)); + len = strlen(buffer); + attach(buffer+len,man_path->GetPath(),file_name); +@@ -295,6 +294,7 @@ void ManItem::active_man_page(void) + strcat(buffer,loc_name); + strcat(buffer," ; rm ~/.gman.tmp ; sleep 120; rm "); + strcat(buffer,loc_name); ++ fprintf(stderr, "running: %s\n", buffer); + g_warning(buffer); + if(!fork()) + { +@@ -307,7 +307,7 @@ void ManItem::active_man_page(void) + case 2: + sprintf(loc_name," ~/.gman.%s.html ",get_display_name(buffer1)); + //g_warning(loc_name); +- strcpy(buffer,"gman.cgi "); ++ strcpy(buffer,"/usr/lib/cgi-bin/gman.pl "); + strcat(buffer," "); + strcat(buffer,get_section_name(buffer2)); + strcat(buffer," "); +@@ -320,6 +320,7 @@ void ManItem::active_man_page(void) + strcat(buffer,loc_name); + strcat(buffer," ; sleep 120; rm "); + strcat(buffer,loc_name); ++ fprintf(stderr, "running: %s\n", buffer); + //g_warning(buffer); + if(!fork()) + { +@@ -339,6 +340,7 @@ void ManItem::active_man_page(void) + strcat(buffer,"+"); + strcat(buffer,get_display_name(loc_name)); + strcat(buffer,"\""); ++ fprintf(stderr, "running: %s\n", buffer); + //g_warning(buffer); + if(!fork()) + { +@@ -349,7 +351,7 @@ void ManItem::active_man_page(void) + break; + default: + if(context->get_value("show_warning")) +- g_print("unexpected \'show_mode\' : %d ",(int)context->get_value("show_mode")); ++ g_print("unexpected \'show_mode\' : %ld ",(long)context->get_value("show_mode")); + return; + } + //g_warning(buffer); +diff --git a/menu.c b/menu.c +index 3a455a4..9ac4e3c 100644 +--- a/menu.c ++++ b/menu.c +@@ -33,8 +33,6 @@ + #include "window2.h" + #include "taskfunc.h" + +-static int print_hello(GtkWidget *w, gpointer data); +-static int test_callback(GtkWidget *w, gpointer data); + static int window_resize_callback(GtkWidget *w, GtkAllocation *size, gpointer data); + static int section_policy_callback(GtkWidget *w, gpointer data); + static int section_select_callback(GtkWidget *w, gpointer data); +@@ -60,36 +58,35 @@ static int button_clicked_callback(GtkWidget *,gpointer); + + static GtkItemFactoryEntry menu_items[] = { + {"/_File", NULL, NULL, 0, ""}, +- {"/File/_Quit", "Q", (void (*)(...))app_quit, 0, NULL}, ++ {"/File/_Quit", "Q", (void (*)())app_quit, 0, NULL}, + {"/_Sections", NULL, NULL, 0, ""}, + {"/Sections/tearoff1", NULL, NULL, 0, "" }, +- {"/Sections/_All", NULL, (void (*)(...))section_policy_callback, 0, ""}, +- {"/Sections/all _But", NULL, (void (*)(...))section_policy_callback, 1, "/Sections/All"}, +- {"/Sections/_Only", NULL, (void (*)(...))section_policy_callback, 2, "/Sections/All"}, ++ {"/Sections/_All", NULL, (void (*)())section_policy_callback, 0, ""}, ++ {"/Sections/all _But", NULL, (void (*)())section_policy_callback, 1, "/Sections/All"}, ++ {"/Sections/_Only", NULL, (void (*)())section_policy_callback, 2, "/Sections/All"}, + {"/Sections/sep1", NULL, NULL, 0, ""}, +- {"/Sections/_1: User Commands", NULL, (void (*)(...))section_select_callback, 1<<0, ""}, +- {"/Sections/_2: System Calls", NULL, (void (*)(...))section_select_callback, 1<<1, ""}, +- {"/Sections/_3: Subroutines", NULL, (void (*)(...))section_select_callback, 1<<2, ""}, +- {"/Sections/_4: Devices", NULL, (void (*)(...))section_select_callback, 1<<3, ""}, +- {"/Sections/_5: File Formats", NULL, (void (*)(...))section_select_callback, 1<<4, ""}, +- {"/Sections/_6: Games", NULL, (void (*)(...))section_select_callback, 1<<5, ""}, +- {"/Sections/_7: Miscellaneous", NULL, (void (*)(...))section_select_callback, 1<<6, ""}, +- {"/Sections/_8: Sys.Administration",NULL, (void (*)(...))section_select_callback, 1<<7, ""}, +- {"/Sections/_l: Local", NULL, (void (*)(...))section_select_callback, 1<<8, ""}, +- {"/Sections/_n: New", NULL, (void (*)(...))section_select_callback, 1<<9, ""}, ++ {"/Sections/_1: User Commands", NULL, (void (*)())section_select_callback, 1<<0, ""}, ++ {"/Sections/_2: System Calls", NULL, (void (*)())section_select_callback, 1<<1, ""}, ++ {"/Sections/_3: Subroutines", NULL, (void (*)())section_select_callback, 1<<2, ""}, ++ {"/Sections/_4: Devices", NULL, (void (*)())section_select_callback, 1<<3, ""}, ++ {"/Sections/_5: File Formats", NULL, (void (*)())section_select_callback, 1<<4, ""}, ++ {"/Sections/_6: Games", NULL, (void (*)())section_select_callback, 1<<5, ""}, ++ {"/Sections/_7: Miscellaneous", NULL, (void (*)())section_select_callback, 1<<6, ""}, ++ {"/Sections/_8: Sys.Administration",NULL, (void (*)())section_select_callback, 1<<7, ""}, ++ {"/Sections/_l: Local", NULL, (void (*)())section_select_callback, 1<<8, ""}, ++ {"/Sections/_n: New", NULL, (void (*)())section_select_callback, 1<<9, ""}, + {"/_View", NULL, NULL, 0, ""}, +- {"/View/x_Term", "T", (void (*)(...))show_mode_callback, 0, ""}, +- {"/View/_GhostView", "G", (void (*)(...))show_mode_callback, 1, "/View/xTerm"}, +- {"/View/_LocalBrowse", "L", (void (*)(...))show_mode_callback, 2, "/View/xTerm"}, +- {"/View/_NetBrowse", "N", (void (*)(...))show_mode_callback, 3, "/View/xTerm"}, ++ {"/View/x_Term", "T", (void (*)())show_mode_callback, 0, ""}, ++ {"/View/_GhostView", "G", (void (*)())show_mode_callback, 1, "/View/xTerm"}, ++ {"/View/_LocalBrowse", "L", (void (*)())show_mode_callback, 2, "/View/xTerm"}, ++ {"/View/_NetBrowse", "N", (void (*)())show_mode_callback, 3, "/View/xTerm"}, + {"/_Options", NULL, NULL, 0, ""}, +- {"/Options/Status bar", NULL, (void (*)(...))status_bar_callback, 0, ""}, ++ {"/Options/Status bar", NULL, (void (*)())status_bar_callback, 0, ""}, + {"/Options/sep1", NULL, NULL, 0, ""}, +- {"/Options/_Index search", "I", (void (*)(...))search_mode_callback, 0, ""}, +- {"/Options/_Key word search", "K", (void (*)(...))search_mode_callback, 1, "/Options/Index search"}, ++ {"/Options/_Index search", "I", (void (*)())search_mode_callback, 0, ""}, ++ {"/Options/_Key word search", "K", (void (*)())search_mode_callback, 1, "/Options/Index search"}, + {"/Options/sep2", NULL, NULL, 0, ""}, +- {"/Options/Man _Paths...", NULL, (void (*)(...))edit_paths_callback, 0, NULL}, +- // {"/Options/Test", NULL, (void (*)(...))test_callback, 0, NULL}, ++ {"/Options/Man _Paths...", NULL, (void (*)())edit_paths_callback, 0, NULL}, + {"/_Help", NULL, NULL, 0, ""}, + {"/_Help/About", NULL, GTK_SIGNAL_FUNC(window_help_about_callback),0,NULL} + }; +@@ -116,7 +113,7 @@ char * *man_items_buffer; + int man_items_count; + int clist_selected_row; + List * man_paths_to_be_load; +-char * keyword; ++const char * keyword; + + void updata_menu_buttons(int); + +@@ -144,7 +141,8 @@ void get_main_menu(GtkWidget *window, GtkWidget ** menubar) { + gtk_item_factory_create_items(item_factory, nmenu_items, menu_items, NULL); + + /* Attach the new accelerator group to the window. */ +- gtk_accel_group_attach (accel_group, GTK_OBJECT (window)); ++/* gtk_accel_group_attach (accel_group, GTK_OBJECT (window)); */ ++ gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); + + if (menubar) + /* Finally, return the actual menu bar created by the item factory. */ +@@ -176,32 +174,32 @@ void get_main_menu(GtkWidget *window, GtkWidget ** menubar) { + /*flag = 0 means not to invoke call backs when changing the states of buttons.*/ + void updata_menu_buttons(int flag) + { +- int i,j,k,k2; +- k = (int)context->get_value("display_section_policy"); ++ long i,j,k,k2; ++ k = (long)context->get_value("display_section_policy"); + if(k>0 && k<=2) + if(!((GtkCheckMenuItem*)(section_select[k]))->active){ + if(!flag) signal_menu_change++; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(section_select[k]),1); + } +- k = (int)context->get_value("display_section"); ++ k = (long)context->get_value("display_section"); + for (i = 0;i<10;i++) + if(!(k&(1<active)) { + if(!flag) signal_menu_change++; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(section_buttons[i]),k&(1<get_value("searching_mode"); ++ k = (long)context->get_value("searching_mode"); + if(k>0 && k<=1) + if(!(((GtkCheckMenuItem*)(searching_mode_buttons[k]))->active)) { + if(!flag) signal_menu_change++; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(searching_mode_buttons[k]),1); + } +- k = (int)context->get_value("show_mode"); ++ k = (long)context->get_value("show_mode"); + if(k>0 && k<=3) + if(!(((GtkCheckMenuItem*)(show_mode_buttons[k]))->active)) { + if(!flag) signal_menu_change++; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show_mode_buttons[k]),1); + } +- k2 = (int)context->get_value("show_status_bar"); ++ k2 = (long)context->get_value("show_status_bar"); + i = k2&(1<active); + if((i&&!j) || (!i&&j)) { +@@ -223,10 +221,10 @@ static GtkWidget *statusbar2; + + static void updata_widget_show(int flag) + { +- int k,k2; ++ long k,k2; + +- k = (int)context->get_value("searching_mode"); +- k2 = (int)context->get_value("show_status_bar"); ++ k = (long)context->get_value("searching_mode"); ++ k2 = (long)context->get_value("show_status_bar"); + + if(k2&(1<get_value("h_size"), +- (int)context->get_value("v_size")); ++ (long)context->get_value("h_size"), ++ (long)context->get_value("v_size")); + + gtk_widget_set_usize(GTK_WIDGET(window),200,150); + main_vbox = gtk_vbox_new(FALSE, 1); +@@ -386,7 +382,8 @@ void init_main_window(GtkWidget * window) + + + /******************* tools functions ******************/ +-int search_array_for_text(char ** array, int count, char * text) ++/*int search_array_for_text(char ** array, int count, char * text) */ ++int search_array_for_text(char ** array, int count, const char * text) + { + int i; + for (i=0;i0 ;i++); +@@ -423,8 +420,8 @@ void entry_activate_callback(GtkWidget * w,gpointer data) + int i; + GtkWidget * clist = (GtkWidget *)data; + i = search_array_for_text(man_items_buffer, +- man_items_count, +- gtk_entry_get_text(GTK_ENTRY(w))); ++ man_items_count, ++ gtk_entry_get_text(GTK_ENTRY(w))); + if (i == -1) return; + gtk_clist_moveto(GTK_CLIST(clist),i,0,0.1,0.0); + GTK_CLIST(clist)->focus_row = i; +@@ -446,54 +443,32 @@ void entry_changed_callback(GtkWidget * w,gpointer data) + gtk_clist_select_row(GTK_CLIST(clist),i,0); + } + +-static int print_hello(GtkWidget *w, gpointer data) { +- if(signal_menu_change>0) {signal_menu_change--;return 1;} +- g_message("Hello, World! %x\n",data); +- return 0; +-} +- +-static int print_page(GtkWidget *w, gpointer data) { +- if(signal_menu_change>0) {signal_menu_change--;return 1;} +- g_message("Hello, World! %x\n",data); +- return 0; +-} +- +-static int test_callback(GtkWidget *w, gpointer data) { +- int i,j; +- if(signal_menu_change>0) {signal_menu_change--;return 1;} +- j = man_paths->get_size(); +- for(i = 0;iget_value(i))); +- delete (man_paths); +- init_man_data(); +- return 0; +-} +- + static int section_policy_callback(GtkWidget *w, gpointer data) { + // static int signal; +- int k,k2; +- k2 = (int) data; ++ long k,k2; ++ k2 = (long) data; + if(!((GtkCheckMenuItem*)(section_select[k2]))->active) return 1; + // g_message("Hello, World! %x\n signal = %d",data,signal_menu_change); + if(signal_menu_change>0) {signal_menu_change--;return 1;} + //if(!signal) {signal++;return 1;} + //signal--; +- k = (int) context->get_value("display_section_policy"); ++ k = (long) context->get_value("display_section_policy"); + if(k == k2) return 1; + pthread_mutex_lock(&context_lock); + context->set_value("display_section_policy","int",(void*)k2); + pthread_mutex_unlock(&context_lock); + task_set_active(task_extract_man_data); + task_set_active(task_add_data_to_clist); ++ return 0; + } + + static int section_select_callback(GtkWidget *w, gpointer data) { +- int var; ++ long var; + if(signal_menu_change>0) {signal_menu_change--;return 1;} + + pthread_mutex_lock(&context_lock); +- var = (int)context->get_value("display_section"); +- var ^= (int)data; ++ var = (long)context->get_value("display_section"); ++ var ^= (long)data; + context->set_value("display_section","int",(void*)var); + if (context->get_value("display_section_policy")) { + task_set_active(task_extract_man_data); +@@ -501,6 +476,7 @@ static int section_select_callback(GtkWidget *w, gpointer data) { + } + pthread_mutex_unlock(&context_lock); + // g_message("Hello, World! %x\n",data); ++ return 0; + } + + static void app_quit(GtkWidget *w, gpointer data) { +@@ -517,12 +493,12 @@ static void app_quit(GtkWidget *w, gpointer data) { + context->set_value("man_paths","char*",my_strdup(buffer)); + attach(buffer,getenv("HOME"),".gman"); + if((fd = fopen(buffer,"w"))) { +- context->save(fd,"automatically made by G-man"); ++ context->save(fd,"automatically made by Gman"); + fclose(fd); + } +- // context->save(stdout,"automatically made by G-man"); ++ // context->save(stdout,"automatically made by Gman"); + +- gtk_exit((int)data); ++ gtk_exit((long)data); + } + + static int window_resize_callback(GtkWidget *w, GtkAllocation * size, gpointer data) +@@ -544,7 +520,6 @@ static void window_help_about_callback (GtkWidget *widget, gpointer data) + { + + GtkWidget *button; +- GdkFont *font; + + about_window = gtk_dialog_new (); + gtk_window_set_position (GTK_WINDOW (about_window), GTK_WIN_POS_MOUSE); +@@ -576,6 +551,12 @@ static void window_help_about_callback (GtkWidget *widget, gpointer data) + gtk_label_new ("Copyright (C) 1999 Xinkai Wang"), + FALSE, FALSE, 5); + ++ char *tmp = g_strdup_printf("Credits: %s", authors[0]); ++ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about_window)->vbox), ++ gtk_label_new (tmp), ++ FALSE, FALSE, 5); ++ g_free(tmp); ++ + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about_window)->vbox), + gtk_label_new ("Comments and suggestions are extremely welcomed!"), + FALSE, FALSE, 5); +@@ -594,10 +575,10 @@ static void window_help_about_callback (GtkWidget *widget, gpointer data) + + static int status_bar_callback (GtkWidget *widget, gpointer data) + { +- int k,k2; ++ long k,k2; + if(signal_menu_change>0) {signal_menu_change--;return 1;} +- k2 = (int) context->get_value("show_status_bar"); +- k = (int) context->get_value("searching_mode"); ++ k2 = (long) context->get_value("show_status_bar"); ++ k = (long) context->get_value("searching_mode"); + if(((GtkCheckMenuItem*)(status_bar_button))->active) k2 = k2 | (1<active) return 1; + if(signal_menu_change>0) {signal_menu_change--;return 1;} + //if(!signal) {signal++;return 1;} + //signal--; +- k = (int) context->get_value("searching_mode"); ++ k = (long) context->get_value("searching_mode"); + if(k == k2) return 1; + pthread_mutex_lock(&context_lock); + context->set_value("searching_mode","int",(void*)k2); +@@ -627,13 +608,13 @@ static int search_mode_callback (GtkWidget *widget, gpointer data) + + static int show_mode_callback (GtkWidget *widget, gpointer data) + { +- int k,k2; +- k2 = (int) data; ++ long k,k2; ++ k2 = (long) data; + if(!((GtkCheckMenuItem*)(show_mode_buttons[k2]))->active) return 1; + if(signal_menu_change>0) {signal_menu_change--;return 1;} + //if(!signal) {signal++;return 1;} + //signal--; +- k = (int) context->get_value("show_mode"); ++ k = (long) context->get_value("show_mode"); + if(k == k2) return 1; + pthread_mutex_lock(&context_lock); + context->set_value("show_mode","int",(void*)k2); +@@ -651,7 +632,7 @@ static void entry4_activate_callback(GtkWidget *w,gpointer data) + + static void entry4_changed_callback(GtkWidget *w,gpointer data) + { +- char * tmp; ++ const char * tmp; + tmp = gtk_entry_get_text(GTK_ENTRY(entry4)); + gtk_widget_set_sensitive(search_button,strlen(tmp) >= 3); + +@@ -659,9 +640,10 @@ static void entry4_changed_callback(GtkWidget *w,gpointer data) + + static int button_clicked_callback(GtkWidget * w,gpointer data) + { +- int i = (int) data; ++ long i = (long) data; + switch (i) { + case 1: task_set_stop(task_key_word_search);break; + case 2: task_set_active(task_key_word_search);break; + } ++ return 0; + } +diff --git a/task.c b/task.c +index 2ffedf0..6124f95 100644 +--- a/task.c ++++ b/task.c +@@ -30,7 +30,7 @@ static void task_group_set_active(TaskGroup *); + + TaskGroup * task_group_new() + { +- int retcode; ++ //int retcode; + TaskGroup * task_group = (TaskGroup*)g_malloc(sizeof(TaskGroup)); + task_group->tasks = new List; + task_group->state = 0; +@@ -44,7 +44,7 @@ TaskGroup * task_group_new() + + Task * task_new(TaskGroup * task_group, float priority, TaskRunFunc task_func, gpointer data) + { +- int i,j,k; ++ int i,j; + Task * task; + g_return_val_if_fail((priority>0.0 && priority <1.0)&&(task_group != NULL)&&(task_func != NULL),(Task*)NULL); + +@@ -106,18 +106,18 @@ static void * task_group_running(TaskGroup * task_group) + { + int i,j; + int have_task; +- int state,k; ++ int state; + Task * task; + + do { + have_task = 0; + task = (Task *)NULL; +- int flag; ++ long flag = 0; + pthread_mutex_lock(&task_group->lock); + j = task_group->tasks->get_size(); + for(i = 0; itasks->get_item(i))->signals[0]->get_size()) { +- flag = ((int)task->signals[0]->get_item(0) & ~1) | (task->state & 1); ++ flag = ((long)task->signals[0]->get_item(0) & ~1) | (task->state & 1); + task->signals[0]->delete_item(0); + have_task++; + } +@@ -126,7 +126,7 @@ static void * task_group_running(TaskGroup * task_group) + have_task++; + } + else if (task->signals[1]->get_size()) { +- flag = ((int)task->signals[1]->get_item(1) & ~1); ++ flag = ((long)task->signals[1]->get_item(1) & ~1); + task->signals[1]->delete_item(0); + have_task++; + } +diff --git a/taskfunc.c b/taskfunc.c +index 82025cd..dd7b102 100644 +--- a/taskfunc.c ++++ b/taskfunc.c +@@ -18,7 +18,6 @@ + /********************* init_man_data *************************/ + int init_man_data() + { +- ManPath * path; + char * path_name,*p1,*p2; + int end = 0; + man_paths = new Dictionary; +@@ -42,10 +41,10 @@ int extract_man_data() + int display_section_ID; + + pthread_mutex_lock(&context_lock); +- switch ((int)context->get_value("display_section_policy")) { ++ switch ((long)context->get_value("display_section_policy")) { + case 0: display_section_ID = ~0;break; +- case 1: display_section_ID = ~(int)(context->get_value("display_section"));break; +- case 2: display_section_ID = (int)context->get_value("display_section"); break; ++ case 1: display_section_ID = ~(long)(context->get_value("display_section"));break; ++ case 2: display_section_ID = (long)context->get_value("display_section"); break; + default: fprintf(stderr,"warning: init_man_data: \"display_section_policy\" " + "have invalid value %d",context->get_value("display_section_policy")); + display_section_ID = ~0; +@@ -73,11 +72,10 @@ int add_data_to_clist(int flag) + { + gchar *text[2]; + static int i; +- int j,k; ++ int j; + ManItem ** buffer; + static char ** pointer; + char a[100],b[20]; +- int display_section_ID; + + text[0] = a; text[1] = b; + buffer = (ManItem**) man_items_buffer; +@@ -160,9 +158,9 @@ static char section[BUF_SIZE/4]; + static int parser_whatis(int fd) + { + static int init = 0; +- int i,j,k,end; ++ int i,k,end; + static char buffer[BUF_SIZE]; +- char a,b,c; ++ char c; + + if(!init) { + names = new List; +@@ -285,7 +283,6 @@ List * keyword_search_list; + static int key_word_search_taskfunc(int flag) + { + static int init = 0; +- static char * parameter; + static int process_ID; + static int pipes[2]; + static List * paths; +@@ -335,12 +332,10 @@ static int key_word_search_taskfunc(int flag) + } else { + path = (char*) paths->get_item(0); + paths->delete_item(0); +- strcpy(buffer,"grep "); ++ strcat(buffer,"whatis -w \"*"); + strcat(buffer,keyword); +- strcat(buffer," "); +- attach(file_name,path,"whatis"); +- strcat(buffer,file_name); +- strcat(buffer," "); ++ strcat(buffer,"*\" "); ++ fprintf (stderr, "%s\n", file_name); + + g_return_val_if_fail(!pipe(pipes),0); + process_ID = fork(); +@@ -377,7 +372,8 @@ static int key_word_search_taskfunc(int flag) + man_item = (ManItem*)man_path->search_man_item(s,section); + //g_print("point 1\n"); + if(context->get_value("show_warning")) +- if (!man_item) g_warning("man item: %s (%s) could not found",names->get_item(i),section); ++ if (!man_item) ++ g_warning("man item: %s (%s) could not be found in %s",names->get_item(i),section,path); + text[0] = (char*)names->get_item(i); + //g_print("point 2\n"); + if(i == j-1) text[2] = comment; +diff --git a/util.c b/util.c +index 24c36f3..bdcc32f 100644 +--- a/util.c ++++ b/util.c +@@ -24,7 +24,6 @@ + #include + #include + #include +-#include + + #include "util.h" + #include "gripedefs.h" +diff --git a/window2.c b/window2.c +index bda5ec9..c90a19d 100644 +--- a/window2.c ++++ b/window2.c +@@ -2,6 +2,7 @@ + /******************** window2.c **************************/ + + #include ++#include + #include + #include "menu.h" + #include "list.h" +@@ -222,7 +223,7 @@ static int window2_button_callback(GtkWidget *w, gpointer data) + GtkWidget * x, *apply_button,*add_new_button; + gchar * c, *c2; + int i; +- int select = (int)data; ++ long select = (long)data; + gchar * clist_item[3]; + // printf("point2 data = %d\n",select); + apply_button = (GtkWidget*)gtk_object_get_data(GTK_OBJECT(window2),"button2"); +@@ -239,9 +240,9 @@ static int window2_button_callback(GtkWidget *w, gpointer data) + break; + case 3: //Add New + x = (GtkWidget*)gtk_object_get_data(GTK_OBJECT(window2),"entry2"); +- c = gtk_entry_get_text(GTK_ENTRY(x)); ++ c = (gchar *)gtk_entry_get_text(GTK_ENTRY(x)); + if(!strcmp(c,"")) { +- g_print("g-man: path name can not be empty\n"); ++ g_print("gman: path name can not be empty\n"); + break; + } + if (man_paths->have_item(c)) break; +@@ -268,7 +269,7 @@ static int window2_button_callback(GtkWidget *w, gpointer data) + gtk_widget_set_sensitive(apply_button,1); + break; + default: +- g_print("g-man: sorry... this function not implementd yet, please wait for the future version\n"); ++ g_print("gman: sorry... this function not implemented yet\n"); + }; + return 1; + } diff -Nru gman-0.9.3/debian/patches/sensible-browser.patch gman-0.9.3/debian/patches/sensible-browser.patch --- gman-0.9.3/debian/patches/sensible-browser.patch 1970-01-01 00:00:00.000000000 +0000 +++ gman-0.9.3/debian/patches/sensible-browser.patch 2012-01-03 16:30:06.000000000 +0000 @@ -0,0 +1,36 @@ +Author: Osamu Aoki +Description: Use sensible-browser +--- a/gman.1x ++++ b/gman.1x +@@ -41,16 +41,16 @@ + This requires GhostView (command "gv") to be available on your system. + .TP + .B LocalBrowse +-gman will launch a Mozilla window to show you the man page. ++gman will launch a web browser window to show you the man page. + .sp +-This requires man2html and Mozilla (command "mozilla") to be available on your ++This requires man2html and web browser (command "sensible-browser") to be available on your + system. + .TP + .B NetBrowse +-In this mode, you can view the pages with Mozilla and navigate from ++In this mode, you can view the pages with web browser and navigate from + one man page to another by clicking the links in the man pages. + .sp +-This requires man2html, Mozilla (command "mozilla") and a HTTP server ++This requires man2html, web browser (command "sensible-browser") and a HTTP server + running on localhost. + + .SH FILES +--- a/gman.c ++++ b/gman.c +@@ -91,7 +91,7 @@ + context->set_default_value("show_mode","int",(void*)0); // 0 = xterm, 1 = ghostview + context->set_default_value("xterm_command","char*",(void*)"x-terminal-emulator"); + context->set_default_value("gv_command","char*",(void*)"gv"); +- context->set_default_value("browser_command","char*",(void*)"mozilla"); // kfm also works ++ context->set_default_value("browser_command","char*",(void*)"sensible-browser"); // kfm also works + context->set_default_value("cgi_host","char*",(void*)"localhost"); + context->set_default_value("cgi_location","char*",(void*)"/cgi-bin/gman.pl"); + context->set_default_value("print_command","char*",(void*)"lpr"); // not in use diff -Nru gman-0.9.3/debian/patches/series gman-0.9.3/debian/patches/series --- gman-0.9.3/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ gman-0.9.3/debian/patches/series 2012-01-18 14:13:10.000000000 +0000 @@ -0,0 +1,6 @@ +pre-0.9.3-5.1.patch +sensible-browser.patch +evince.patch +manpath.patch +gnome-terminal.patch +fix-ftbfs-with-binutils-gold.patch diff -Nru gman-0.9.3/debian/rules gman-0.9.3/debian/rules --- gman-0.9.3/debian/rules 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/debian/rules 2012-01-03 17:14:38.000000000 +0000 @@ -2,12 +2,15 @@ # Derived from debhelper's sample rules file. #export DH_VERBOSE=1 -export DH_COMPAT=5 ifneq "$(findstring debug,$(DEB_BUILD_OPTIONS))" "" DEBUG := -g endif +build-arch: build + +build-indep: build + build: gman gman: dh_testdir @@ -22,7 +25,7 @@ install: build dh_testdir dh_testroot - dh_clean -k + dh_prep $(MAKE) install prefix=$(CURDIR)/debian/gman/usr binary-indep: @@ -46,4 +49,4 @@ dh_builddeb binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install +.PHONY: build clean binary-indep binary-arch binary install build-arch build-indep diff -Nru gman-0.9.3/debian/source/format gman-0.9.3/debian/source/format --- gman-0.9.3/debian/source/format 1970-01-01 00:00:00.000000000 +0000 +++ gman-0.9.3/debian/source/format 2012-01-18 14:36:32.000000000 +0000 @@ -0,0 +1 @@ +3.0 (quilt) diff -Nru gman-0.9.3/debian/source/options gman-0.9.3/debian/source/options --- gman-0.9.3/debian/source/options 1970-01-01 00:00:00.000000000 +0000 +++ gman-0.9.3/debian/source/options 2012-01-03 16:41:12.000000000 +0000 @@ -0,0 +1 @@ +extend-diff-ignore = "(^|/)(.*\.org|.*\.rej)$" diff -Nru gman-0.9.3/debian/watch gman-0.9.3/debian/watch --- gman-0.9.3/debian/watch 1970-01-01 00:00:00.000000000 +0000 +++ gman-0.9.3/debian/watch 2012-01-03 17:12:58.000000000 +0000 @@ -0,0 +1 @@ +# no upstream available now. diff -Nru gman-0.9.3/gman.1x gman-0.9.3/gman.1x --- gman-0.9.3/gman.1x 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/gman.1x 2002-05-21 13:21:16.000000000 +0000 @@ -5,53 +5,46 @@ .B gman .SH DESCRIPTION .B Gman -is a front-end for the manual page system. gman builds a database of all the -available man pages and displays them in a list. Clicking on an entry in the -list makes +is a front-end for the original +.I man +page system. The most basic job of gman is to build a database for all +the man pages and display them (or part of them) as a list. When +user decides to read a specific man page, .B gman -launch another window with the manual page displayed in it. -.PP +will launch a +.I xterm +window and call the traditional man system to display the man page in the +window. +.sp .B Gman -can launch more than one window at same time. The user can use -the index/key word search function to look for the man pages that they need. -.PP +can launch more than one window at same time. And user can use +the index/key word search function to look for the man pages that he needs. +.sp It is simple, but it is useful. .SH OPTIONS There are no command line options for gman, for now. - -.SH DISPLAY OPTIONS -Currently gman has 4 different modes to present the man pages, available as -the following items in the \fBView\fP menu: -.TP -.B xTerm -This will launch an X terminal emulator with the \fIman\fP output shown -inside. .sp -You can add the following line to your ~/.gman file in order to select -the preferred X terminal emulator: +Tips: Currently gman have 4 different modes to present the man pages +to you. In the first mode "Xterm", you can add the following line in +your ~/.gman file to select the xterm software which you would like to +use. .sp -.RS 16 xterm_command = rxvt -.RE -.TP -.B GhostView -gman will present man pages in a GhostView window for you to view and print -the man page. .sp -This requires GhostView (command "gv") to be available on your system. -.TP -.B LocalBrowse -gman will launch a Mozilla window to show you the man page. -.sp -This requires man2html and Mozilla (command "mozilla") to be available on your -system. -.TP -.B NetBrowse -In this mode, you can view the pages with Mozilla and navigate from -one man page to another by clicking the links in the man pages. -.sp -This requires man2html, Mozilla (command "mozilla") and a HTTP server -running on localhost. +Tips: If GhostView package (command "gv") is aviable on your system. +You may set "View"->"GhostView" and gman will present man pages with a +ghostview window for you to view and print the man page. +.sp +Tips: If you have netscape on your system, you may set +"View"->"LocalBrowse" and gman will launch a netscape window to show +you the man page. +.sp +Tips: If you have netscape and apache server running ( defult +cgi-bin directory is "/var/www/cgi-bin") , you may enjoy the full +NetBrowse mode by set "View"->"NetBrowse". In this mode, you can view +the pages with netscape browser and navigate from one man page to +another (by click the links in the man pages). This mode is very +useful. .SH FILES .TP @@ -78,13 +71,8 @@ .BR man (1), .BR man (7), .BR xterm (1). - .SH AUTHOR .B Gman -was written by a smart guy named Xinkai Wang . -.PP -Home page of gman is at: +was written by a smart gay named Xinkai Wang . Home page of gman is at: .br -.UR -http://homex.coolconnect.com/user/xkwang/gman/ -.UE +.I http://homex.coolconnect.com/user/xkwang/gman/ diff -Nru gman-0.9.3/gman.c gman-0.9.3/gman.c --- gman-0.9.3/gman.c 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/gman.c 2002-05-21 06:39:34.000000000 +0000 @@ -42,12 +42,13 @@ int main(int argc, char *argv[]) { GtkWidget *window; + pthread_t th_init_data; pthread_mutex_init(>k_lock,NULL); pthread_mutex_init(&context_lock,NULL); pthread_mutex_init(&loading_man_path_lock,NULL); init_context(); - debuging = (long)context->get_value("debuging"); + debuging = (int)context->get_value("debuging"); pthread_mutex_lock(>k_lock); gtk_init (&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -82,18 +83,18 @@ context = new AppContext(); // context->set_default_value("v_size",(void*)400); context->set_default_value("debuging","int",(void*)0); - context->set_default_value("man_paths","char*",(void*)"/usr/share/man:/usr/X11R6/man:/usr/man:/usr/local/man"); + context->set_default_value("man_paths","char*",(void*)"/usr/man:/usr/local/man:/usr/X11R6/man"); context->set_default_value("display_section_policy","int",(void*)0); context->set_default_value("display_section","int",(void*)3); context->set_default_value("searching_mode","int",(void*)0); context->set_default_value("show_status_bar","int",(void*)0); context->set_default_value("show_warning","int",(void*)0); context->set_default_value("show_mode","int",(void*)0); // 0 = xterm, 1 = ghostview - context->set_default_value("xterm_command","char*",(void*)"x-terminal-emulator"); + context->set_default_value("xterm_command","char*",(void*)"xterm"); // rxvt, Eterm also works context->set_default_value("gv_command","char*",(void*)"gv"); - context->set_default_value("browser_command","char*",(void*)"mozilla"); // kfm also works + context->set_default_value("browser_command","char*",(void*)"netscape"); // kfm also works context->set_default_value("cgi_host","char*",(void*)"localhost"); - context->set_default_value("cgi_location","char*",(void*)"/cgi-bin/gman.pl"); + context->set_default_value("cgi_location","char*",(void*)"/cgi-bin/gman/gman.pl"); context->set_default_value("print_command","char*",(void*)"lpr"); // not in use attach(buffer,getenv("HOME"),".gman"); diff -Nru gman-0.9.3/gman.pl gman-0.9.3/gman.pl --- gman-0.9.3/gman.pl 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/gman.pl 2002-05-21 06:39:35.000000000 +0000 @@ -1,30 +1,18 @@ -#!/usr/bin/perl -w -use strict; +#!/usr/bin/perl +use strict(all); -if (@ARGV != 2) { - print <<_EOF_; -Content-type: text/html +my $cgi_path = "/cgi-bin/gman/gman.pl"; +my $man2html = "man2html -M $cgi_path"; +my $path = `man -w @ARGV`; +my $tmp_file = "/tmp/gman.$ARGV[1].$ARGV[0]"; -gman.pl: invalid use - -

gman.pl cannot be used without arguments.

- -_EOF_ - die; -} -my $section = $ARGV[0]; # should also have some sanity check -my $name = $ARGV[1]; -my $man2html = "/usr/lib/cgi-bin/man/man2html"; -my $path = `man -w $section $name`; chomp $path; $path =~ s/\s*$//; - -unless (-s "$path") { - warn "not -s $path\n"; - $name = lc $name; - $path = `man -w $section $name`; chomp $path; $path =~ s/\s*$//; +if (!&file_exist($path)) { + my $name = lc($ARGV[1]); + $path = `man -w $ARGV[0] $name`; +# print "check point 0.9\n"; } -unless (-s "$path") { - warn "not -s $path\n"; +if (!&file_exist($path)) { print <404 Not Found

Not Found

-The requested man page $name($section) was not found on this server. +The requested man page $ARGV[1]($ARGV[0]) was not found on this server.

end_of_line die; } - -unless (-e "$man2html") { - warn "$man2html missing\n"; - print < - -man2html missing - -

man2html missing

- -

You have to install man2html in order to use this mode in gman. - - -end_of_line - die; +my $page; +if ($path =~ /gz$/) { + my $file = `gzip -cd $path`; + open (TEMPFILE,">$tmp_file"); + print TEMPFILE $file; + close (TEMPFILE); + $page = `$man2html $tmp_file`; + `rm $tmp_file`; +} else { + $page = `$man2html $path`; } -my $page = `$man2html $path`; - -# $page =~ s/^Content-type: text\/html\n\n// if (not run as cgi...); - -$page =~ s/(This document was created by\nman2html<\/a>)(,\nusing the manual pages.
)/$1 for
gman<\/a>$2/io; - +$page =~ s/This document was created by\s*man2html<\/A>,\s*using the manual pages.
/This document was created by +
man2html<\/A> for gman<\/A>, +using the manual pages.
/; print $page; +#print `cat /home/wxk/src/gtk/gman.html`; + +sub file_exist { + open (FILE,$_[0]); + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) = stat(FILE); + close(FILE); + +# print "check point 0.5, size = $size, $_[0]\n"; + if ($size == 0 or $size eq null) { + return 0; + } else { + return 1; + } +} diff -Nru gman-0.9.3/Makefile gman-0.9.3/Makefile --- gman-0.9.3/Makefile 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/Makefile 2002-05-21 06:39:34.000000000 +0000 @@ -1,39 +1,55 @@ # Gman Makefile # You can adjust the following variables. - CXX = g++ -CXXFLAGS = -DVERSION=\"0.9.3\" $(shell pkg-config --cflags gtk+-2.0) -O2 -Wall $(DEBUG) +CXXFLAGS = -DVERSION=\"0.9.3\" `gtk-config --cflags` -O2 -Wall CC = $(CXX) $(CXXFLAGS) +GNOMELIB = #`gnome-config --libs gnomeui` +GTKLIB = -L/usr/lib/ `gtk-config --libs` prefix = /usr -cgi_bin_prefix = ${prefix}/lib/cgi-bin +cgi_bin_prefix = /var/www/cgi-bin # There shouldn't be any need to edit anything below this point. all: gman -objectfiles = menu.o mandata.o util.o gman.o list.o context.o task.o \ - taskfunc.o window2.o +gman: menu.o mandata.o util.o gman.o list.o context.o task.o taskfunc.o window2.o + $(CXX) -lgtk -lgdk -lpthread $(GTKLIB) menu.o mandata.o util.o gman.o list.o context.o task.o taskfunc.o window2.o -o gman -GTK_LIBS = $(shell pkg-config --libs gtk+-2.0) +gman.o: gman.c menu.h + $(CC) -c gman.c -gman: $(objectfiles) - $(CC) -rdynamic $(objectfiles) -o gman -lpthread $(GTK_LIBS) +menu.o: menu.c mandata.h util.h + $(CC) -c menu.c -o menu.o -%.o: %.c %.h -gman.o: gman.c gman.h menu.h -menu.o: menu.c menu.h mandata.h util.h mandata.o: mandata.c mandata.h util.h mandatadef.h + $(CC) -c mandata.c -o mandata.o -clean: - rm -f $(objectfiles) gman +util.o: util.c util.h + $(CC) -c util.c -o util.o + +list.o: list.c list.h + $(CC) -c list.c + +context.o: context.c context.h + $(CC) -c context.c -distclean: clean - rm -f *.o *~ +task.o: task.c task.h + $(CC) -c task.c + +taskfunc.o: taskfunc.c taskfunc.h + $(CC) -c taskfunc.c + +window2.o: window2.c window2.h + $(CC) -c window2.c + +clean: + rm -f *.o *~ gman install: test -d $(prefix)/bin || mkdir -p $(prefix)/bin - test -d $(prefix)/share/man/man1 || mkdir -p $(prefix)/share/man/man1 - test -d $(cgi_bin_prefix) || mkdir -p $(cgi_bin_prefix) - install -m 755 gman $(prefix)/bin/ - install -m 755 gman.pl $(cgi_bin_prefix)/gman.pl - install -m 644 gman.1x $(prefix)/share/man/man1 + test -d $(prefix)/man/man1 || mkdir -p $(prefix)/man/man1 + test -d $(cgi_bin_prefix)/gman || mkdir -p $(cgi_bin_prefix)/gman + install -s -m 755 gman $(prefix)/bin + install -s -m 755 gman.pl $(prefix)/bin/gman.cgi + install -m 644 gman.1x $(prefix)/man/man1 + install -s -m 755 gman.pl $(ci_bin_prefix)/gman diff -Nru gman-0.9.3/mandata.c gman-0.9.3/mandata.c --- gman-0.9.3/mandata.c 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/mandata.c 2002-05-21 06:39:34.000000000 +0000 @@ -30,6 +30,7 @@ void attach (char *dest, const char *dirname, const char *name); static int section_translate_c_to_n(const char* c); +static int ManItemComp(ManItem ** a,ManItem ** b); static int is_zip_suffix(char* c); char buffer1[BUFFER_SIZE]; @@ -39,6 +40,7 @@ ManPath::ManPath(char* _path_name) { int i; + int len; active = 1; path_name = my_strdup(_path_name); for (i=0;id_name); //printf("LoadManPath: %s\n",name); val = stat (buffer1, &state); - if (val < 0) fprintf(stderr,"error getting state of %s: %s\n",buffer1,strerror(errno)); + if (val < 0) fprintf(stderr,"error number %d, in get state %s",errno,buffer1); else if (S_ISDIR(state.st_mode) && !strncmp(item->d_name,"man",3)) LoadManSubPath(item->d_name); else { @@ -149,7 +151,7 @@ attach(buffer1,buffer2,item->d_name); //printf("LoadManSubPath: %s\n",full_name); val = stat (buffer1, &state); - if (val < 0) fprintf(stderr,"error getting state of %s: %s\n",buffer1,strerror(errno)); + if (val < 0) fprintf(stderr,"error number %d, in get state %s\n",errno,buffer1); else if (S_ISDIR(state.st_mode)) continue; else { @@ -164,7 +166,6 @@ } } closedir(dirp); - return 0; } ManItem * ManPath::search_man_item(char * name, char * sect) @@ -235,15 +236,15 @@ void ManItem::active_man_page(void) { + int i; int len; char buffer[2*BUFFER_SIZE]; char loc_name[BUFFER_SIZE]; char buffer2[BUFFER_SIZE]; - switch ((long)context->get_value("show_mode")) { + switch ((int)context->get_value("show_mode")) { case 0: - sprintf(buffer,"%s -T '%s manual page' -n '%s - GMan' -e man ", + sprintf(buffer,"%s -T '%s manual page' -n GMan -e man ", (char*)context->get_value("xterm_command"), - get_display_name(buffer1), get_display_name(buffer1)); len = strlen(buffer); attach(buffer+len,man_path->GetPath(),file_name); @@ -294,7 +295,6 @@ strcat(buffer,loc_name); strcat(buffer," ; rm ~/.gman.tmp ; sleep 120; rm "); strcat(buffer,loc_name); - fprintf(stderr, "running: %s\n", buffer); g_warning(buffer); if(!fork()) { @@ -307,7 +307,7 @@ case 2: sprintf(loc_name," ~/.gman.%s.html ",get_display_name(buffer1)); //g_warning(loc_name); - strcpy(buffer,"/usr/lib/cgi-bin/gman.pl "); + strcpy(buffer,"gman.cgi "); strcat(buffer," "); strcat(buffer,get_section_name(buffer2)); strcat(buffer," "); @@ -320,7 +320,6 @@ strcat(buffer,loc_name); strcat(buffer," ; sleep 120; rm "); strcat(buffer,loc_name); - fprintf(stderr, "running: %s\n", buffer); //g_warning(buffer); if(!fork()) { @@ -340,7 +339,6 @@ strcat(buffer,"+"); strcat(buffer,get_display_name(loc_name)); strcat(buffer,"\""); - fprintf(stderr, "running: %s\n", buffer); //g_warning(buffer); if(!fork()) { @@ -351,7 +349,7 @@ break; default: if(context->get_value("show_warning")) - g_print("unexpected \'show_mode\' : %ld ",(long)context->get_value("show_mode")); + g_print("unexpected \'show_mode\' : %d ",(int)context->get_value("show_mode")); return; } //g_warning(buffer); diff -Nru gman-0.9.3/menu.c gman-0.9.3/menu.c --- gman-0.9.3/menu.c 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/menu.c 2002-05-21 13:13:25.000000000 +0000 @@ -33,6 +33,8 @@ #include "window2.h" #include "taskfunc.h" +static int print_hello(GtkWidget *w, gpointer data); +static int test_callback(GtkWidget *w, gpointer data); static int window_resize_callback(GtkWidget *w, GtkAllocation *size, gpointer data); static int section_policy_callback(GtkWidget *w, gpointer data); static int section_select_callback(GtkWidget *w, gpointer data); @@ -58,35 +60,36 @@ static GtkItemFactoryEntry menu_items[] = { {"/_File", NULL, NULL, 0, ""}, - {"/File/_Quit", "Q", (void (*)())app_quit, 0, NULL}, + {"/File/_Quit", "Q", (void (*)(...))app_quit, 0, NULL}, {"/_Sections", NULL, NULL, 0, ""}, {"/Sections/tearoff1", NULL, NULL, 0, "" }, - {"/Sections/_All", NULL, (void (*)())section_policy_callback, 0, ""}, - {"/Sections/all _But", NULL, (void (*)())section_policy_callback, 1, "/Sections/All"}, - {"/Sections/_Only", NULL, (void (*)())section_policy_callback, 2, "/Sections/All"}, + {"/Sections/_All", NULL, (void (*)(...))section_policy_callback, 0, ""}, + {"/Sections/all _But", NULL, (void (*)(...))section_policy_callback, 1, "/Sections/All"}, + {"/Sections/_Only", NULL, (void (*)(...))section_policy_callback, 2, "/Sections/All"}, {"/Sections/sep1", NULL, NULL, 0, ""}, - {"/Sections/_1: User Commands", NULL, (void (*)())section_select_callback, 1<<0, ""}, - {"/Sections/_2: System Calls", NULL, (void (*)())section_select_callback, 1<<1, ""}, - {"/Sections/_3: Subroutines", NULL, (void (*)())section_select_callback, 1<<2, ""}, - {"/Sections/_4: Devices", NULL, (void (*)())section_select_callback, 1<<3, ""}, - {"/Sections/_5: File Formats", NULL, (void (*)())section_select_callback, 1<<4, ""}, - {"/Sections/_6: Games", NULL, (void (*)())section_select_callback, 1<<5, ""}, - {"/Sections/_7: Miscellaneous", NULL, (void (*)())section_select_callback, 1<<6, ""}, - {"/Sections/_8: Sys.Administration",NULL, (void (*)())section_select_callback, 1<<7, ""}, - {"/Sections/_l: Local", NULL, (void (*)())section_select_callback, 1<<8, ""}, - {"/Sections/_n: New", NULL, (void (*)())section_select_callback, 1<<9, ""}, + {"/Sections/_1: User Commands", NULL, (void (*)(...))section_select_callback, 1<<0, ""}, + {"/Sections/_2: System Calls", NULL, (void (*)(...))section_select_callback, 1<<1, ""}, + {"/Sections/_3: Subroutines", NULL, (void (*)(...))section_select_callback, 1<<2, ""}, + {"/Sections/_4: Devices", NULL, (void (*)(...))section_select_callback, 1<<3, ""}, + {"/Sections/_5: File Formats", NULL, (void (*)(...))section_select_callback, 1<<4, ""}, + {"/Sections/_6: Games", NULL, (void (*)(...))section_select_callback, 1<<5, ""}, + {"/Sections/_7: Miscellaneous", NULL, (void (*)(...))section_select_callback, 1<<6, ""}, + {"/Sections/_8: Sys.Administration",NULL, (void (*)(...))section_select_callback, 1<<7, ""}, + {"/Sections/_l: Local", NULL, (void (*)(...))section_select_callback, 1<<8, ""}, + {"/Sections/_n: New", NULL, (void (*)(...))section_select_callback, 1<<9, ""}, {"/_View", NULL, NULL, 0, ""}, - {"/View/x_Term", "T", (void (*)())show_mode_callback, 0, ""}, - {"/View/_GhostView", "G", (void (*)())show_mode_callback, 1, "/View/xTerm"}, - {"/View/_LocalBrowse", "L", (void (*)())show_mode_callback, 2, "/View/xTerm"}, - {"/View/_NetBrowse", "N", (void (*)())show_mode_callback, 3, "/View/xTerm"}, + {"/View/x_Term", "T", (void (*)(...))show_mode_callback, 0, ""}, + {"/View/_GhostView", "G", (void (*)(...))show_mode_callback, 1, "/View/xTerm"}, + {"/View/_LocalBrowse", "L", (void (*)(...))show_mode_callback, 2, "/View/xTerm"}, + {"/View/_NetBrowse", "N", (void (*)(...))show_mode_callback, 3, "/View/xTerm"}, {"/_Options", NULL, NULL, 0, ""}, - {"/Options/Status bar", NULL, (void (*)())status_bar_callback, 0, ""}, + {"/Options/Status bar", NULL, (void (*)(...))status_bar_callback, 0, ""}, {"/Options/sep1", NULL, NULL, 0, ""}, - {"/Options/_Index search", "I", (void (*)())search_mode_callback, 0, ""}, - {"/Options/_Key word search", "K", (void (*)())search_mode_callback, 1, "/Options/Index search"}, + {"/Options/_Index search", "I", (void (*)(...))search_mode_callback, 0, ""}, + {"/Options/_Key word search", "K", (void (*)(...))search_mode_callback, 1, "/Options/Index search"}, {"/Options/sep2", NULL, NULL, 0, ""}, - {"/Options/Man _Paths...", NULL, (void (*)())edit_paths_callback, 0, NULL}, + {"/Options/Man _Paths...", NULL, (void (*)(...))edit_paths_callback, 0, NULL}, + // {"/Options/Test", NULL, (void (*)(...))test_callback, 0, NULL}, {"/_Help", NULL, NULL, 0, ""}, {"/_Help/About", NULL, GTK_SIGNAL_FUNC(window_help_about_callback),0,NULL} }; @@ -113,7 +116,7 @@ int man_items_count; int clist_selected_row; List * man_paths_to_be_load; -const char * keyword; +char * keyword; void updata_menu_buttons(int); @@ -141,8 +144,7 @@ gtk_item_factory_create_items(item_factory, nmenu_items, menu_items, NULL); /* Attach the new accelerator group to the window. */ -/* gtk_accel_group_attach (accel_group, GTK_OBJECT (window)); */ - gtk_window_add_accel_group (GTK_WINDOW (window), accel_group); + gtk_accel_group_attach (accel_group, GTK_OBJECT (window)); if (menubar) /* Finally, return the actual menu bar created by the item factory. */ @@ -174,32 +176,32 @@ /*flag = 0 means not to invoke call backs when changing the states of buttons.*/ void updata_menu_buttons(int flag) { - long i,j,k,k2; - k = (long)context->get_value("display_section_policy"); + int i,j,k,k2; + k = (int)context->get_value("display_section_policy"); if(k>0 && k<=2) if(!((GtkCheckMenuItem*)(section_select[k]))->active){ if(!flag) signal_menu_change++; gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(section_select[k]),1); } - k = (long)context->get_value("display_section"); + k = (int)context->get_value("display_section"); for (i = 0;i<10;i++) if(!(k&(1<active)) { if(!flag) signal_menu_change++; gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(section_buttons[i]),k&(1<get_value("searching_mode"); + k = (int)context->get_value("searching_mode"); if(k>0 && k<=1) if(!(((GtkCheckMenuItem*)(searching_mode_buttons[k]))->active)) { if(!flag) signal_menu_change++; gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(searching_mode_buttons[k]),1); } - k = (long)context->get_value("show_mode"); + k = (int)context->get_value("show_mode"); if(k>0 && k<=3) if(!(((GtkCheckMenuItem*)(show_mode_buttons[k]))->active)) { if(!flag) signal_menu_change++; gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show_mode_buttons[k]),1); } - k2 = (long)context->get_value("show_status_bar"); + k2 = (int)context->get_value("show_status_bar"); i = k2&(1<active); if((i&&!j) || (!i&&j)) { @@ -221,10 +223,10 @@ static void updata_widget_show(int flag) { - long k,k2; + int k,k2; - k = (long)context->get_value("searching_mode"); - k2 = (long)context->get_value("show_status_bar"); + k = (int)context->get_value("searching_mode"); + k2 = (int)context->get_value("show_status_bar"); if(k2&(1<get_value("h_size"), - (long)context->get_value("v_size")); + (int)context->get_value("h_size"), + (int)context->get_value("v_size")); gtk_widget_set_usize(GTK_WIDGET(window),200,150); main_vbox = gtk_vbox_new(FALSE, 1); @@ -382,8 +386,7 @@ /******************* tools functions ******************/ -/*int search_array_for_text(char ** array, int count, char * text) */ -int search_array_for_text(char ** array, int count, const char * text) +int search_array_for_text(char ** array, int count, char * text) { int i; for (i=0;i0 ;i++); @@ -420,8 +423,8 @@ int i; GtkWidget * clist = (GtkWidget *)data; i = search_array_for_text(man_items_buffer, - man_items_count, - gtk_entry_get_text(GTK_ENTRY(w))); + man_items_count, + gtk_entry_get_text(GTK_ENTRY(w))); if (i == -1) return; gtk_clist_moveto(GTK_CLIST(clist),i,0,0.1,0.0); GTK_CLIST(clist)->focus_row = i; @@ -443,32 +446,54 @@ gtk_clist_select_row(GTK_CLIST(clist),i,0); } +static int print_hello(GtkWidget *w, gpointer data) { + if(signal_menu_change>0) {signal_menu_change--;return 1;} + g_message("Hello, World! %x\n",data); + return 0; +} + +static int print_page(GtkWidget *w, gpointer data) { + if(signal_menu_change>0) {signal_menu_change--;return 1;} + g_message("Hello, World! %x\n",data); + return 0; +} + +static int test_callback(GtkWidget *w, gpointer data) { + int i,j; + if(signal_menu_change>0) {signal_menu_change--;return 1;} + j = man_paths->get_size(); + for(i = 0;iget_value(i))); + delete (man_paths); + init_man_data(); + return 0; +} + static int section_policy_callback(GtkWidget *w, gpointer data) { // static int signal; - long k,k2; - k2 = (long) data; + int k,k2; + k2 = (int) data; if(!((GtkCheckMenuItem*)(section_select[k2]))->active) return 1; // g_message("Hello, World! %x\n signal = %d",data,signal_menu_change); if(signal_menu_change>0) {signal_menu_change--;return 1;} //if(!signal) {signal++;return 1;} //signal--; - k = (long) context->get_value("display_section_policy"); + k = (int) context->get_value("display_section_policy"); if(k == k2) return 1; pthread_mutex_lock(&context_lock); context->set_value("display_section_policy","int",(void*)k2); pthread_mutex_unlock(&context_lock); task_set_active(task_extract_man_data); task_set_active(task_add_data_to_clist); - return 0; } static int section_select_callback(GtkWidget *w, gpointer data) { - long var; + int var; if(signal_menu_change>0) {signal_menu_change--;return 1;} pthread_mutex_lock(&context_lock); - var = (long)context->get_value("display_section"); - var ^= (long)data; + var = (int)context->get_value("display_section"); + var ^= (int)data; context->set_value("display_section","int",(void*)var); if (context->get_value("display_section_policy")) { task_set_active(task_extract_man_data); @@ -476,7 +501,6 @@ } pthread_mutex_unlock(&context_lock); // g_message("Hello, World! %x\n",data); - return 0; } static void app_quit(GtkWidget *w, gpointer data) { @@ -493,12 +517,12 @@ context->set_value("man_paths","char*",my_strdup(buffer)); attach(buffer,getenv("HOME"),".gman"); if((fd = fopen(buffer,"w"))) { - context->save(fd,"automatically made by Gman"); + context->save(fd,"automatically made by G-man"); fclose(fd); } - // context->save(stdout,"automatically made by Gman"); + // context->save(stdout,"automatically made by G-man"); - gtk_exit((long)data); + gtk_exit((int)data); } static int window_resize_callback(GtkWidget *w, GtkAllocation * size, gpointer data) @@ -520,6 +544,7 @@ { GtkWidget *button; + GdkFont *font; about_window = gtk_dialog_new (); gtk_window_set_position (GTK_WINDOW (about_window), GTK_WIN_POS_MOUSE); @@ -551,12 +576,6 @@ gtk_label_new ("Copyright (C) 1999 Xinkai Wang"), FALSE, FALSE, 5); - char *tmp = g_strdup_printf("Credits: %s", authors[0]); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about_window)->vbox), - gtk_label_new (tmp), - FALSE, FALSE, 5); - g_free(tmp); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about_window)->vbox), gtk_label_new ("Comments and suggestions are extremely welcomed!"), FALSE, FALSE, 5); @@ -575,10 +594,10 @@ static int status_bar_callback (GtkWidget *widget, gpointer data) { - long k,k2; + int k,k2; if(signal_menu_change>0) {signal_menu_change--;return 1;} - k2 = (long) context->get_value("show_status_bar"); - k = (long) context->get_value("searching_mode"); + k2 = (int) context->get_value("show_status_bar"); + k = (int) context->get_value("searching_mode"); if(((GtkCheckMenuItem*)(status_bar_button))->active) k2 = k2 | (1<active) return 1; if(signal_menu_change>0) {signal_menu_change--;return 1;} //if(!signal) {signal++;return 1;} //signal--; - k = (long) context->get_value("searching_mode"); + k = (int) context->get_value("searching_mode"); if(k == k2) return 1; pthread_mutex_lock(&context_lock); context->set_value("searching_mode","int",(void*)k2); @@ -608,13 +627,13 @@ static int show_mode_callback (GtkWidget *widget, gpointer data) { - long k,k2; - k2 = (long) data; + int k,k2; + k2 = (int) data; if(!((GtkCheckMenuItem*)(show_mode_buttons[k2]))->active) return 1; if(signal_menu_change>0) {signal_menu_change--;return 1;} //if(!signal) {signal++;return 1;} //signal--; - k = (long) context->get_value("show_mode"); + k = (int) context->get_value("show_mode"); if(k == k2) return 1; pthread_mutex_lock(&context_lock); context->set_value("show_mode","int",(void*)k2); @@ -632,7 +651,7 @@ static void entry4_changed_callback(GtkWidget *w,gpointer data) { - const char * tmp; + char * tmp; tmp = gtk_entry_get_text(GTK_ENTRY(entry4)); gtk_widget_set_sensitive(search_button,strlen(tmp) >= 3); @@ -640,10 +659,9 @@ static int button_clicked_callback(GtkWidget * w,gpointer data) { - long i = (long) data; + int i = (int) data; switch (i) { case 1: task_set_stop(task_key_word_search);break; case 2: task_set_active(task_key_word_search);break; } - return 0; } diff -Nru gman-0.9.3/README gman-0.9.3/README --- gman-0.9.3/README 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/README 2002-05-21 06:39:34.000000000 +0000 @@ -71,7 +71,7 @@ * autoconf support, especially if GNOME support is included. * use of gettext for easier translation to other languages. - * improvement for the parser which reads the ~/.gman file (context.c). + * improvment for the parser when reading the ~/.gman file (context.c). * internal method of displaying manual pages, not with xterm. Your comments and suggestions will be the most important for gman diff -Nru gman-0.9.3/task.c gman-0.9.3/task.c --- gman-0.9.3/task.c 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/task.c 2002-05-21 06:39:34.000000000 +0000 @@ -30,7 +30,7 @@ TaskGroup * task_group_new() { - //int retcode; + int retcode; TaskGroup * task_group = (TaskGroup*)g_malloc(sizeof(TaskGroup)); task_group->tasks = new List; task_group->state = 0; @@ -44,7 +44,7 @@ Task * task_new(TaskGroup * task_group, float priority, TaskRunFunc task_func, gpointer data) { - int i,j; + int i,j,k; Task * task; g_return_val_if_fail((priority>0.0 && priority <1.0)&&(task_group != NULL)&&(task_func != NULL),(Task*)NULL); @@ -106,18 +106,18 @@ { int i,j; int have_task; - int state; + int state,k; Task * task; do { have_task = 0; task = (Task *)NULL; - long flag = 0; + int flag; pthread_mutex_lock(&task_group->lock); j = task_group->tasks->get_size(); for(i = 0; itasks->get_item(i))->signals[0]->get_size()) { - flag = ((long)task->signals[0]->get_item(0) & ~1) | (task->state & 1); + flag = ((int)task->signals[0]->get_item(0) & ~1) | (task->state & 1); task->signals[0]->delete_item(0); have_task++; } @@ -126,7 +126,7 @@ have_task++; } else if (task->signals[1]->get_size()) { - flag = ((long)task->signals[1]->get_item(1) & ~1); + flag = ((int)task->signals[1]->get_item(1) & ~1); task->signals[1]->delete_item(0); have_task++; } diff -Nru gman-0.9.3/taskfunc.c gman-0.9.3/taskfunc.c --- gman-0.9.3/taskfunc.c 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/taskfunc.c 2002-05-21 06:39:34.000000000 +0000 @@ -18,6 +18,7 @@ /********************* init_man_data *************************/ int init_man_data() { + ManPath * path; char * path_name,*p1,*p2; int end = 0; man_paths = new Dictionary; @@ -41,10 +42,10 @@ int display_section_ID; pthread_mutex_lock(&context_lock); - switch ((long)context->get_value("display_section_policy")) { + switch ((int)context->get_value("display_section_policy")) { case 0: display_section_ID = ~0;break; - case 1: display_section_ID = ~(long)(context->get_value("display_section"));break; - case 2: display_section_ID = (long)context->get_value("display_section"); break; + case 1: display_section_ID = ~(int)(context->get_value("display_section"));break; + case 2: display_section_ID = (int)context->get_value("display_section"); break; default: fprintf(stderr,"warning: init_man_data: \"display_section_policy\" " "have invalid value %d",context->get_value("display_section_policy")); display_section_ID = ~0; @@ -72,10 +73,11 @@ { gchar *text[2]; static int i; - int j; + int j,k; ManItem ** buffer; static char ** pointer; char a[100],b[20]; + int display_section_ID; text[0] = a; text[1] = b; buffer = (ManItem**) man_items_buffer; @@ -158,9 +160,9 @@ static int parser_whatis(int fd) { static int init = 0; - int i,k,end; + int i,j,k,end; static char buffer[BUF_SIZE]; - char c; + char a,b,c; if(!init) { names = new List; @@ -283,6 +285,7 @@ static int key_word_search_taskfunc(int flag) { static int init = 0; + static char * parameter; static int process_ID; static int pipes[2]; static List * paths; @@ -332,10 +335,12 @@ } else { path = (char*) paths->get_item(0); paths->delete_item(0); - strcat(buffer,"whatis -w \"*"); + strcpy(buffer,"grep "); strcat(buffer,keyword); - strcat(buffer,"*\" "); - fprintf (stderr, "%s\n", file_name); + strcat(buffer," "); + attach(file_name,path,"whatis"); + strcat(buffer,file_name); + strcat(buffer," "); g_return_val_if_fail(!pipe(pipes),0); process_ID = fork(); @@ -372,8 +377,7 @@ man_item = (ManItem*)man_path->search_man_item(s,section); //g_print("point 1\n"); if(context->get_value("show_warning")) - if (!man_item) - g_warning("man item: %s (%s) could not be found in %s",names->get_item(i),section,path); + if (!man_item) g_warning("man item: %s (%s) could not found",names->get_item(i),section); text[0] = (char*)names->get_item(i); //g_print("point 2\n"); if(i == j-1) text[2] = comment; diff -Nru gman-0.9.3/util.c gman-0.9.3/util.c --- gman-0.9.3/util.c 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/util.c 2002-05-21 06:39:34.000000000 +0000 @@ -24,6 +24,7 @@ #include #include #include +#include #include "util.h" #include "gripedefs.h" diff -Nru gman-0.9.3/window2.c gman-0.9.3/window2.c --- gman-0.9.3/window2.c 2012-01-18 14:36:31.000000000 +0000 +++ gman-0.9.3/window2.c 2002-05-21 06:39:34.000000000 +0000 @@ -2,7 +2,6 @@ /******************** window2.c **************************/ #include -#include #include #include "menu.h" #include "list.h" @@ -223,7 +222,7 @@ GtkWidget * x, *apply_button,*add_new_button; gchar * c, *c2; int i; - long select = (long)data; + int select = (int)data; gchar * clist_item[3]; // printf("point2 data = %d\n",select); apply_button = (GtkWidget*)gtk_object_get_data(GTK_OBJECT(window2),"button2"); @@ -240,9 +239,9 @@ break; case 3: //Add New x = (GtkWidget*)gtk_object_get_data(GTK_OBJECT(window2),"entry2"); - c = (gchar *)gtk_entry_get_text(GTK_ENTRY(x)); + c = gtk_entry_get_text(GTK_ENTRY(x)); if(!strcmp(c,"")) { - g_print("gman: path name can not be empty\n"); + g_print("g-man: path name can not be empty\n"); break; } if (man_paths->have_item(c)) break; @@ -269,7 +268,7 @@ gtk_widget_set_sensitive(apply_button,1); break; default: - g_print("gman: sorry... this function not implemented yet\n"); + g_print("g-man: sorry... this function not implementd yet, please wait for the future version\n"); }; return 1; }