Update to pinfo 0.6.9; many bugfixes.

With feedback, help and fixes from both kili@ and espie@.

ok kili@, "go ahead" espie@ (MAINTAINER)
This commit is contained in:
mgrimm 2007-11-19 18:31:03 +00:00
parent 28f99ceb93
commit 75f3498214
13 changed files with 286 additions and 175 deletions

View File

@ -1,24 +1,36 @@
# $OpenBSD: Makefile,v 1.4 2007/09/15 20:59:41 merdely Exp $
# $OpenBSD: Makefile,v 1.5 2007/11/19 18:31:03 mgrimm Exp $
COMMENT=info viewer
MAINTAINER=Marc Espie <espie@openbsd.org>
DISTNAME=pinfo-0.6.7
CATEGORIES=textproc devel
COMMENT= info viewer with lynx-style navigation
# original distsite is currently unavailable
MASTER_SITES=ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/
DISTNAME= pinfo-0.6.9
CATEGORIES= textproc devel
# GPL
PERMIT_DISTFILES_FTP=Yes
PERMIT_DISTFILES_CDROM=Yes
PERMIT_PACKAGE_FTP=Yes
PERMIT_PACKAGE_CDROM=Yes
WANTLIB=c ncurses
HOMEPAGE= https://alioth.debian.org/frs/?group_id=30592
CONFIGURE_STYLE=autoconf
AUTOCONF_VERSION=2.13
#CONFIGURE_ARGS+=--disable-nls
MODULES=devel/gettext
CONFIGURE_ENV=CPPFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib"
MAINTAINER= Marc Espie <espie@openbsd.org>
MASTER_SITES= https://alioth.debian.org/frs/download.php/1502/ \
ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/
# GPLv2
PERMIT_DISTFILES_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_PACKAGE_CDROM= Yes
WANTLIB= c ncurses readline
USE_LIBTOOL= Yes
MODULES+= devel/gettext
AUTOCONF_VERSION= 2.59
CONFIGURE_STYLE= autoconf
MAKE_FLAGS+= INTLLIBS='-L${LOCALBASE}/lib -lintl -liconv'
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/pinfo
${INSTALL_DATA} ${WRKSRC}/src/pinforc \
${PREFIX}/share/examples/pinfo/
.include <bsd.port.mk>

View File

@ -1,5 +1,5 @@
MD5 (pinfo-0.6.7.tar.gz) = 0KyCOqj+Uo7VQATQIssIlg==
RMD160 (pinfo-0.6.7.tar.gz) = tMkG4fcJh2d6HLNlT60KNIByhPo=
SHA1 (pinfo-0.6.7.tar.gz) = EnH3T3YQ+ivMATbYO3BzQEXOjUQ=
SHA256 (pinfo-0.6.7.tar.gz) = 5tmBf5CwcdHDH29evqRJUDr2aUlkM7El/PY1U4Ahwro=
SIZE (pinfo-0.6.7.tar.gz) = 318720
MD5 (pinfo-0.6.9.tar.gz) = wymNNlN2AXU1WLPpJAsAtw==
RMD160 (pinfo-0.6.9.tar.gz) = wnFemZCuRlEqZM2dMNX+MNu53N0=
SHA1 (pinfo-0.6.9.tar.gz) = c1uC9T9Bjeu89/VLhGPSKdrC2JU=
SHA256 (pinfo-0.6.9.tar.gz) = wl8I4RWl55b0CDiijQ6YFsdV9Muee8x39tTJ3a8KFlE=
SIZE (pinfo-0.6.9.tar.gz) = 554213

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-config_h_in,v 1.1.1.1 2003/07/08 16:23:47 espie Exp $
--- config.h.in.orig Wed Jul 2 12:06:59 2003
+++ config.h.in Wed Jul 2 12:07:23 2003
@@ -163,6 +163,9 @@
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
+/* Define if you have the mkstemp function. */
+#undef HAVE_MKSTEMP
+
/* Define if you have the strtoul function. */
#undef HAVE_STRTOUL

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-configure_in,v 1.1.1.1 2003/07/08 16:23:47 espie Exp $
--- configure.in.orig Wed Jul 2 12:06:29 2003
+++ configure.in Wed Jul 2 12:06:48 2003
@@ -61,6 +61,7 @@ dnl AC_CHECK_FUNCS(strdup strstr)
dnl Checks for missing functions.
AC_CHECK_FUNCS(getopt_long snprintf)
AC_CHECK_FUNCS(curs_set use_default_colors bkgdset)
+AC_CHECK_FUNCS(mkstemp)
dnl AC_CHECK_LIB(ncurses, curs_set, AC_DEFINE(HAS_CURS_SET))
dnl AC_CHECK_LIB(ncurses, use_default_colors, AC_DEFINE(HAS_USE_DEFAULT_COLORS))
AM_CONDITIONAL(HAVE_SNPRINTF,test "x$ac_cv_func_snprintf" = "xyes")

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-macros_curses_m4,v 1.1 2007/11/19 18:31:03 mgrimm Exp $
The world isn't debian.
--- macros/curses.m4.orig Thu Mar 9 20:44:38 2006
+++ macros/curses.m4 Sun Jul 22 21:44:40 2007
@@ -254,11 +254,11 @@ dnl check if the curses header we found, works
dnl
AC_DEFUN([AC_CHECK_CURSES_COMPILE], [
- dnl save CFLAGS and LDFLAGS and set new ones
+ dnl save CFLAGS and LIBS and set new ones
CFLAGS_OLD=$CFLAGS
CFLAGS="$CFLAGS $curses_includes"
- LDFLAGS_OLD=$LDFLAGS
- LDFLAGS="$LDFLAGS $curses_libs"
+ LIBS_OLD=$LIBS
+ LIBS="$LIBS $curses_libs"
dnl do the compile test
AC_MSG_CHECKING([if curses is usable])
@@ -288,7 +288,7 @@ AC_DEFUN([AC_CHECK_CURSES_COMPILE], [
dnl restore variables
CFLAGS=$CFLAGS_OLD
- LDFLAGS=$LDFLAGS_OLD
+ LIBS=$LIBS_OLD
])

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-src_Makefile_in,v 1.1 2007/11/19 18:31:03 mgrimm Exp $
--- src/Makefile.in.orig Thu Mar 16 17:27:31 2006
+++ src/Makefile.in Sun Jul 8 15:30:35 2007
@@ -783,14 +783,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am
@HAVE_SIGBLOCK_FALSE@sigblock.o: $(pinfo_SIGBLOCK)
install-data-local:
- if [ ! -f $(DESTDIR)$(sysconfdir)/pinforc ] ; then \
- if [ ! -d $(DESTDIR)$(sysconfdir) ]; then \
- $(INSTALL) -d $(DESTDIR)$(sysconfdir); \
- fi; \
- $(INSTALL) -m 644 $(srcdir)/pinforc $(DESTDIR)$(sysconfdir) ; \
- else \
- echo "WARNING! Old pinforc detected. I'm not installing the new file"; \
- fi
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,30 +1,37 @@
$OpenBSD: patch-src_filehandling_functions_c,v 1.1.1.1 2003/07/08 16:23:47 espie Exp $
--- src/filehandling_functions.c.orig Wed Jul 2 12:08:36 2003
+++ src/filehandling_functions.c Wed Jul 2 12:09:05 2003
@@ -503,7 +503,7 @@ opendirfile (int number)
unlink (tmpfilename1); /* erase old tmpfile */
free (tmpfilename1);
}
- tmpfilename1 = tempnam ("/tmp", NULL);
+ tmpfilename1 = mytempfile ();
tmpfilename = tmpfilename1; /* later we will refere only to tmp1 */
}
for (i = 0; i < infopathcount; i++) /* go through all paths */
@@ -671,7 +671,7 @@ openinfo (char *filename, int number) /*
unlink (tmpfilename1); /* erase old tmpfile */
free (tmpfilename1);
}
- tmpfilename1 = tempnam ("/tmp", NULL);
+ tmpfilename1 = mytempfile ();
tmpfilename = tmpfilename1; /* later we will refere only to tmp1 */
}
else
@@ -682,7 +682,7 @@ openinfo (char *filename, int number) /*
unlink (tmpfilename2); /* erase old tmpfile */
free (tmpfilename2);
}
- tmpfilename2 = tempnam ("/tmp", NULL);
+ tmpfilename2 = mytempfile ();
tmpfilename = tmpfilename2; /* later we will refere only to tmp2 */
$OpenBSD: patch-src_filehandling_functions_c,v 1.2 2007/11/19 18:31:03 mgrimm Exp $
--- src/filehandling_functions.c.orig Sun Jul 8 17:06:45 2007
+++ src/filehandling_functions.c Sun Jul 8 17:09:39 2007
@@ -139,6 +139,7 @@ dirpage_lookup(char **type, char ***message, long *lin
char name[256];
char file[256];
int i;
+ char *nameend, *filestart, *fileend, *dot;
id = opendirfile(0);
if (!id)
@@ -146,8 +147,6 @@ dirpage_lookup(char **type, char ***message, long *lin
read_item(id, type, message, lines);
- char *nameend, *filestart, *fileend, *dot;
-
/* search for node-links in every line */
for (i = 1; i < Lines; i++)
{
@@ -160,6 +159,7 @@ dirpage_lookup(char **type, char ***message, long *lin
&& (strncasecmp(filename, Message[i] + 2, filenamelen) == 0)
)
{
+ char *tmp;
/* skip this hit if it is not a perfect match and
* we have already found a previous partial match */
@@ -170,7 +170,7 @@ dirpage_lookup(char **type, char ***message, long *lin
}
/* find the name of the node link */
- char *tmp = name;
+ tmp = name;
strncpy(file, filestart + 1, fileend - filestart - 1);
file[fileend - filestart - 1] = 0;
strncpy(name, fileend + 1, dot - fileend - 1);

View File

@ -1,39 +1,21 @@
$OpenBSD: patch-src_manual_c,v 1.1.1.1 2003/07/08 16:23:47 espie Exp $
--- src/manual.c.orig Wed Jul 2 12:07:43 2003
+++ src/manual.c Wed Jul 2 12:08:15 2003
@@ -215,7 +215,7 @@ handlemanual (char *name) /*
unlink (tmpfilename1);
xfree (tmpfilename1);
}
- tmpfilename1 = tempnam ("/tmp", NULL);
+ tmpfilename1 = mytempfile ();
#ifdef getmaxyx
init_curses ();
@@ -315,7 +315,7 @@ handlemanual (char *name) /*
}
else
source = fopen (location, "r"); /* from cmd output */
- name = tempnam ("/tmp", NULL);
+ name = mytempfile ();
raw_tempfilename = name;
id = fopen (name, "w");
@@ -393,7 +393,7 @@ handlemanual (char *name) /*
if (use_apropos)
$OpenBSD: patch-src_manual_c,v 1.2 2007/11/19 18:31:03 mgrimm Exp $
--- src/manual.c.orig Sun Jul 8 17:10:13 2007
+++ src/manual.c Sun Jul 8 17:10:56 2007
@@ -797,7 +797,7 @@ man_initializelinks(char *tmp, int carry)
if ((!strchr(p_t1, '(')) &&(!is_in_manlinks(manlinks, p_t1)))
{
printf (_ ("Calling apropos \n"));
- apropos_tempfilename = tempnam ("/tmp", NULL);
+ apropos_tempfilename = mytempfile ();
snprintf (cmd, 255, "apropos %s > %s", name, apropos_tempfilename);
if (system (cmd) != 0)
{
@@ -437,7 +437,7 @@ handlemanual (char *name) /*
unlink (tmpfilename2);
xfree (tmpfilename2);
}
- tmpfilename2 = tempnam ("/tmp", NULL);
+ tmpfilename2 = mytempfile ();
if (return_value != -2) /* key_back is not pressed;
and return_value is an
offset to manuallinks */
char tempchar;
- int breakpos;
+ int breakpos, cols_before_link;
i = mylink - tmp - 1;
if (i < 0)
i++;
@@ -830,7 +830,7 @@ man_initializelinks(char *tmp, int carry)
*/
/* calculate the number of columns in front of the link */
- int cols_before_link = width_of_string(tmp, i-1);
+ cols_before_link = width_of_string(tmp, i-1);
/* a small check */
if (!((use_apropos) &&(manualhistorylength == 0)))

View File

@ -1,52 +1,79 @@
$OpenBSD: patch-src_utils_c,v 1.1.1.1 2003/07/08 16:23:47 espie Exp $
--- src/utils.c.orig Wed Jul 2 12:00:46 2003
+++ src/utils.c Wed Jul 2 12:08:29 2003
@@ -474,3 +474,48 @@ handlewinch ()
getmaxyx (stdscr, maxy, maxx);
ungetch (keys.refresh_1);
$OpenBSD: patch-src_utils_c,v 1.2 2007/11/19 18:31:03 mgrimm Exp $
--- src/utils.c.orig Sun Jul 8 17:12:56 2007
+++ src/utils.c Sun Jul 8 17:19:18 2007
@@ -553,6 +553,10 @@ handlewinch()
int
check_node_name( const char * const node_name, const char * const node_header)
{
+ size_t header_len;
+ char *header, *str_start, *c;
+ int res;
+
/* if either one of node_name or node_header is NULL or a zero
* sized string, we have nothing to check, so return success */
if ( (node_name==NULL) || (node_header==NULL)
@@ -561,15 +565,15 @@ check_node_name( const char * const node_name, const c
return 1;
}
- size_t header_len = strlen(node_header);
+ header_len = strlen(node_header);
/* copy node_header to a local string which can be mutilated */
/* don't use strdup here, as xmalloc handles all errors */
- char *header = xmalloc( header_len + 1 );
+ header = xmalloc( header_len + 1 );
strcpy(header, node_header);
/* search for "Node: foobar," in node_header */
- char *str_start = strstr(header, "Node: ");
+ str_start = strstr(header, "Node: ");
if (str_start==NULL) /* no match */
{
return 0;
@@ -577,14 +581,14 @@ check_node_name( const char * const node_name, const c
/* advance str_start to the start of the node name */
str_start += strlen("Node: ");
/* and search for the next comma, tab, or newline */
- char *c = str_start;
+ c = str_start;
while ( (*c!=',') && (*c!='\t') && (*c!='\n') && (*c!='\0') ) c++;
*c = '\0';
/* so, now str_start point to a \0-terminated string containing the
* node name from the header.
* Let's compare it with the node_name we're looking for */
- int res = strcmp(str_start, node_name);
+ res = strcmp(str_start, node_name);
/* we're done, so free alloc'ed vars */
xfree(header);
@@ -637,20 +641,24 @@ wcswidth(const wchar_t *wstr, size_t max_len)
int
width_of_string( const char * const mbs, const int len)
{
+ int width;
+ char *str;
+#ifdef USE_WCHAR
+ wchar_t *wstr;
+#endif /* USE_WCHAR */
+
+char *
+mytempfile()
+{
+ char *result;
+ int fd;
+
+#ifdef HAVE_MKSTEMP
+ result = strdup ("/tmp/pinfo.XXXXXXXXXX");
+ if (!result)
+ return NULL;
+ fd = mkstemp (result);
+ if (fd == -1)
+ {
+ free (result);
+ return NULL;
+ }
+ else
+ {
+ close (fd);
+ return result;
+ }
+#else
+ int i;
+
+ for (i = 0; i < 50; i++)
+ {
+ result = tempnam ("/tmp", NULL);
+ if (!result)
+ break;
+ fd = open (result, O_WRONLY | O_CREAT | O_EXCL, 0666);
+ if (fd == -1)
+ free (result);
+ else
+ break;
+ }
+ if (fd != -1)
+ {
+ close (fd);
+ return result;
+ }
+ else
+ return NULL;
+#endif
+}
if (len<0) return -1;
if (len==0) return 0;
- int width;
-
/* copy the string to a local buffer, because we only want to
* compare the first len bytes */
- char *str = xmalloc(len+1);
+ str = xmalloc(len+1);
memcpy(str, mbs, len);
#ifdef USE_WCHAR
/* allocate a widestring */
- wchar_t *wstr = xmalloc( (len+1)*sizeof(wchar_t) );
+ wstr = xmalloc( (len+1)*sizeof(wchar_t) );
mbstowcs(wstr, str, len);
width = wcswidth(wstr, len);

View File

@ -1,9 +0,0 @@
$OpenBSD: patch-src_utils_h,v 1.1.1.1 2003/07/08 16:23:47 espie Exp $
--- src/utils.h.orig Wed Jul 2 12:05:36 2003
+++ src/utils.h Wed Jul 2 12:05:48 2003
@@ -51,4 +51,5 @@ void waitforgetch (); /* Block until so
extern int curses_open; /* is curses screen open? */
+extern char *mytempfile ();
#endif

View File

@ -0,0 +1,57 @@
$OpenBSD: patch-src_video_c,v 1.1 2007/11/19 18:31:03 mgrimm Exp $
--- src/video.c.orig Wed Mar 15 22:54:56 2006
+++ src/video.c Sun Jul 8 17:27:51 2007
@@ -88,9 +88,10 @@ showscreen(char **message, char *type, long lines, lon
attrset(normal);
for (i = pos;(i < lines) &&(i < pos + maxy - 2); i++)
{
- if (!message[i]) continue;
+ int tmp;
- int tmp = strlen(message[i]) - 1;
+ if (!message[i]) continue;
+ tmp = strlen(message[i]) - 1;
message[i][tmp] = 0;
if (tmp>column)
mvaddstr(i + 1 - pos, 0, message[i]+column);
@@ -263,12 +264,13 @@ info_add_highlights(int pos, int cursor, long lines, i
{
regmatch_t pmatch[1];
long maxpos = pos +(maxy - 2);
+ int maxregexp;
if (maxpos > lines)
{
maxpos = lines;
}
- int maxregexp = aftersearch ? h_regexp_num + 1 : h_regexp_num;
+ maxregexp = aftersearch ? h_regexp_num + 1 : h_regexp_num;
/*
* if it is after search, then we have user defined regexps+
* a searched regexp to highlight
@@ -285,6 +287,9 @@ info_add_highlights(int pos, int cursor, long lines, i
/* check if this regexp is present on this line */
while (!regexec(&h_regexp[j], str, 1, pmatch, 0))
{
+ int x, y;
+ char tmp;
+
/* yes, found something, so highlight it */
int n = pmatch[0].rm_eo - pmatch[0].rm_so;
@@ -292,12 +297,12 @@ info_add_highlights(int pos, int cursor, long lines, i
str += pmatch[0].rm_so;
/* calculate position on screen */
- int x = calculate_len(message[i], str);
- int y = i - pos + 1;
+ x = calculate_len(message[i], str);
+ y = i - pos + 1;
/* save the char after the end of the match,
* and replace it by \0 */
- char tmp = str[n];
+ tmp = str[n];
str[n] = 0;
/* write out the highlighted match to screen */

View File

@ -1,2 +1,2 @@
pinfo is an alternate GNU texinfo viewer,
that recognizes command sequences in the style of lynx.
pinfo is an alternate GNU texinfo viewer that recognizes command
sequences in the style of lynx.

View File

@ -1,10 +1,20 @@
@comment $OpenBSD: PLIST,v 1.2 2004/09/15 18:44:07 espie Exp $
@comment $OpenBSD: PLIST,v 1.3 2007/11/19 18:31:03 mgrimm Exp $
bin/pinfo
@info info/pinfo.info
@man man/man1/pinfo.1
share/examples/pinfo/
share/examples/pinfo/pinforc
@sample ${SYSCONFDIR}/pinforc
share/locale/cs/LC_MESSAGES/pinfo.mo
share/locale/de/LC_MESSAGES/pinfo.mo
share/locale/eu/
share/locale/eu/LC_MESSAGES/
share/locale/eu/LC_MESSAGES/pinfo.mo
share/locale/ja/LC_MESSAGES/pinfo.mo
share/locale/nl/LC_MESSAGES/pinfo.mo
share/locale/pl/LC_MESSAGES/pinfo.mo
share/locale/pt_BR/LC_MESSAGES/pinfo.mo
share/locale/ro/LC_MESSAGES/pinfo.mo
share/locale/ru/LC_MESSAGES/pinfo.mo
share/locale/sv/LC_MESSAGES/pinfo.mo
share/locale/vi/LC_MESSAGES/pinfo.mo