v11i002: xrolo -- an XView rolodex, Patch3, Part01/01

Luis Soltero luis at rice.edu
Mon Jan 28 07:10:59 AEST 1991


Submitted-by: luis at rice.edu (Luis Soltero)
Posting-number: Volume 11, Issue 2
Archive-name: xrolo/patch3
Patch-To: xrolo: Volume 9, Issue 84-86
Patch-To: xrolo: Volume 10, Issue 71
Patch-To: xrolo: Volume 11, Issue 1

This file contains patches to xrolo version 2.0 patchlevel 4.  To apply
the patch unshar the following and then apply xrolo.patch3 unsing 
Larry Walls patch program.
	cd XROLO_SRC ; patch < xrolo.patch3; xmkmf; make

sources to xrolo and previous patches to xrolo can be obtained from
comp.sources.x/volume9/xrolo/part[0-3] volume10/patch1 and a patch2 
which has been posted to comp.sources.x but has not made it to the
archive.

A set of patch sources can be obtained from expo.lcs.mit.edu
contrib/xrolo.v2p4.tar.Z

Patch 4:
    Replaced list_button procedure with one that is much faster and
    does not have the irritating scroll.  This new function does lots
    of malloc'ing. If malloc's cause you problems you can get to the
    old list function be defining DONT_USE_MALLOC_LIST.

    Added a few more include statements to prevent compilation errors
    on some architectures.

    Added soundex (sounds like) searching.  Soundex algorithm was
    adapted from code by Jonathan Leffler (john at sphinx.co.uk). Thanks
    John! Replaces "xrolo.SloppyRegexMatch" resource by the more
    general "xrolo.SearchType".  Resource values of 0, 1 and 2 represent
    egrep(1), sloppy or soundex searches respectively.

    When executing a find, strings in cards matching regex are now
    centered in the textsw and the insertion point is set to the base
    address of the matching string.  This facilitates finding entries
    in cards with many lines of text.

    added missing "#include <ctype.h>" in send_mail.c.


--luis at rice.edu

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 1)."
# Contents:  soundex.c xrolo.patch3
# Wrapped by luis at oort on Tue Jan 15 17:47:57 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'soundex.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'soundex.c'\"
else
echo shar: Extracting \"'soundex.c'\" \(2154 characters\)
sed "s/^X//" >'soundex.c' <<'END_OF_FILE'
X/*
X**	SOUNDEX CODING
X**
X**	Rules:
X**	1.	Retain the first letter; ignore non-alphabetic characters.
X**	2.	Replace second and subsequent characters by a group code.
X**		Group	Letters
X**		1		BFPV
X**		2		CGJKSXZ
X**		3		DT
X**		4		L
X**		5		MN
X**		6		R
X**	3.	Do not repeat digits
X**	4.	Truncate or ser-pad to 4-character result.
X**
X**	Originally formatted with tabstops set at 4 spaces -- you were warned!
X**
X**	Code by: Jonathan Leffler (john at sphinx.co.uk)
X**	This code is shareware -- I wrote it; you can have it for free
X**	if you supply it to anyone else who wants it for free.
X**
X**	BUGS: Assumes ASCII
X*/
X
X#include <ctype.h>
Xstatic char	lookup[] = {
X	'0',	/* A */
X	'1',	/* B */
X	'2',	/* C */
X	'3',	/* D */
X	'0',	/* E */
X	'1',	/* F */
X	'2',	/* G */
X	'0',	/* H */
X	'0',	/* I */
X	'2',	/* J */
X	'2',	/* K */
X	'4',	/* L */
X	'5',	/* M */
X	'5',	/* N */
X	'0',	/* O */
X	'1',	/* P */
X	'0',	/* Q */
X	'6',	/* R */
X	'2',	/* S */
X	'3',	/* T */
X	'0',	/* U */
X	'1',	/* V */
X	'0',	/* W */
X	'2',	/* X */
X	'0',	/* Y */
X	'2',	/* Z */
X};
X
X/*
X**	Soundex for arbitrary number of characters of information
X*/
Xchar	*nsoundex(str, n)
Xchar	*str;	/* In: String to be converted */
Xint		 n;		/* In: Number of characters in result string */
X{
X	static	char	buff[10];
X	register char	*s;
X	register char	*t;
X	char	c;
X	char	l;
X
X	if (n <= 0)
X		n = 4;	/* Default */
X	if (n > sizeof(buff) - 1)
X		n = sizeof(buff) - 1;
X	t = &buff[0];
X
X	for (s = str; ((c = *s) != '\0') && t < &buff[n]; s++)
X	{
X		if (!isascii(c))
X			continue;
X		if (!isalpha(c))
X			continue;
X		c = toupper(c);
X		if (t == &buff[0])
X		{
X			l = *t++ = c;
X			continue;
X		}
X		c = lookup[c-'A'];
X		if (c != '0' && c != l)
X			l = *t++ = c;
X	}
X	while (t < &buff[n])
X		*t++ = '0';
X	*t = '\0';
X	return(&buff[0]);
X}
X
X/* Normal external interface */
Xchar	*soundex(str)
Xchar	*str;
X{
X	return(nsoundex(str, 4));
X}
X
X/*
X**	Alternative interface:
X**	void	soundex(given, gets)
X**	char	*given;
X**	char	*gets;
X**	{
X**		strcpy(gets, nsoundex(given, 4));
X**	}
X*/
X
X
X#ifdef TEST
X#include <stdio.h>
Xmain()
X{
X	char	buff[30];
X
X	while (fgets(buff, sizeof(buff), stdin) != (char *)0)
X		printf("Given: %s Soundex produces %s\n", buff, soundex(buff));
X}
X#endif
END_OF_FILE
if test 2154 -ne `wc -c <'soundex.c'`; then
    echo shar: \"'soundex.c'\" unpacked with wrong size!
fi
# end of 'soundex.c'
fi
if test -f 'xrolo.patch3' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xrolo.patch3'\"
else
echo shar: Extracting \"'xrolo.patch3'\" \(23785 characters\)
sed "s/^X//" >'xrolo.patch3' <<'END_OF_FILE'
X*** ../xrolo.v2.3/Imakefile	Tue Jan 15 17:37:41 1991
X--- Imakefile	Tue Jan 15 17:27:25 1991
X***************
X*** 4,12 ****
X  # --Luis Soltero (luis at rice.edu), 10/10/90
X  #
X  
X- MAILER = /usr/ucb/mail
X- VERSION = 2.0
X- 
X  #
X  # linking against openlook libraries on suns after patching ol_button.c. 
X  # see README for details.
X--- 4,9 ----
X***************
X*** 17,27 ****
X  # patching ol_button.c. see README for details.
X  # LOCAL_LIBRARIES = -lxview -lolgx
X  
X! 		CDEBUGFLAGS = -g
X!            SRCS = main.c panel.c cards.c popup.c send_mail.c
X!            OBJS = main.o panel.o cards.o popup.o send_mail.o
X         INCLUDES = -I$$OPENWINHOME/include
X!         DEFINES = -DSTANDALONE -DMAILER=\"$(MAILER)\" -DVERSION=\"$(VERSION)\"
X  
X  AllTarget(xrolo)
X  NormalProgramTarget(xrolo,$(OBJS),$(DEPLIBS), $(LOCAL_LIBRARIES), $(XLIB))
X--- 14,33 ----
X  # patching ol_button.c. see README for details.
X  # LOCAL_LIBRARIES = -lxview -lolgx
X  
X! 		CDEBUGFLAGS = -O
X!            SRCS = main.c panel.c cards.c popup.c send_mail.c soundex.c
X!            OBJS = main.o panel.o cards.o popup.o send_mail.o soundex.o
X         INCLUDES = -I$$OPENWINHOME/include
X! #
X! # User setable defines
X! # 
X! #	MAILER = Mailer to use when send mail to author menu entry is selected.
X! #   VERSION = Xrolo version number
X! #   NEED_STRSTR = Include only if your system does not have a strstr(3C).
X! 
X! 	MAILER  = /bin/mail
X! 	VERSION = 2.0
X!     DEFINES = -DSTANDALONE -DMAILER=\"$(MAILER)\" -DVERSION=\"$(VERSION)\"
X  
X  AllTarget(xrolo)
X  NormalProgramTarget(xrolo,$(OBJS),$(DEPLIBS), $(LOCAL_LIBRARIES), $(XLIB))
X*** ../xrolo.v2.3/Patchlevel	Mon Jan  7 11:04:11 1991
X--- Patchlevel	Tue Jan 15 17:27:18 1991
X***************
X*** 1,8 ****
X! Rolo, release 2.0, patch level 3
X  
X  Patch 3:
X      Added rudimentary field sort. Each line in the rolo card is
X!     considered to be a separate field.  A filed sort can be acomplished by
X      pointing and clicking on the desired field before invoking the sort. 
X  
X      Added Mail to Author menu entry to Help button.  This menu entry
X--- 1,30 ----
X! Rolo, release 2.0, patch level 4
X  
X+ Patch 4:
X+     Replaced list_button procedure with one that is much faster and 
X+     does not have the irritating scroll.  This new function does lots
X+     of malloc'ing. If malloc's cause you problems you can get to the
X+     old list function be defining DONT_USE_MALLOC_LIST.
X+ 
X+     Added a few more include statements to prevent compilation errors
X+     on some architectures.
X+ 
X+ 	Added soundex (sounds like) searching.  Soundex algorithm was
X+     adapted from code by Jonathan Leffler (john at sphinx.co.uk). Thanks
X+     John! Replaces "xrolo.SloppyRegexMatch" resource by the more
X+     general "xrolo.SearchType".  Resource values of 0, 1 and 2 represent
X+     egrep(1), sloppy or soundex searches respectively.
X+ 
X+     When executing a find, strings in cards matching regex are now
X+     centered in the textsw and the insertion point is set to the base
X+     address of the matching string.  This facilitates finding entries
X+     in cards with many lines of text.
X+ 
X+     added missing "#include <ctype.h>" in send_mail.c.
X+ 
X  Patch 3:
X      Added rudimentary field sort. Each line in the rolo card is
X!     considered to be a separate field.  A filed sort can be accomplished by
X      pointing and clicking on the desired field before invoking the sort. 
X  
X      Added Mail to Author menu entry to Help button.  This menu entry
X*** ../xrolo.v2.3/README	Mon Jan  7 11:04:12 1991
X--- README	Tue Jan 15 17:27:19 1991
X***************
X*** 8,13 ****
X--- 8,53 ----
X  --luis at rice.edu
X  
X  
X+ The following command line options are supported by all xview2.0
X+ applications. I have included them here because it tool me some time
X+ to discover them.
X+ 
X+ FLAG    (LONG FLAG)             ARGS            NOTES
X+ -Ww     (-width)                columns
X+ -Wh     (-height)               lines
X+ -Ws     (-size)                 x y
X+ -Wp     (-position)             x y
X+         (-geometry)     "[WxH][{+|-}X{+|-}Y]"   (X geometry)
X+ -WP     (-icon_position)        x y
X+ -Wl     (-label)                "string"
X+         (-title)                "string"        (Same as -label)
X+ -Wi     (-iconic)               (Application will come up closed)
X+ +Wi     (+iconic)               (Application will come up open)
X+ -Wt     (-font)                 fontname
X+ -fn                             fontname
X+ -Wx     (-scale)                small | medium | large | extra_large
X+ -Wf     (-foreground_color)     red green blue  0-255 (no color-full color)
X+ -fg     (-foreground)           colorname       (X Color specification)
X+ -Wb     (-background_color)     red green blue  0-255 (no color-full color)
X+ -bg     (-background)           colorname       (X Color specification)
X+ -WI     (-icon_image)           filename
X+ -WL     (-icon_label)           "string"
X+ -WT     (-icon_font)            filename
X+ -Wr     (-display)              "server_name:screen"
X+ -Wdr    (-disable_retained)
X+ -Wdxio  (-disable_xio_error_handler)
X+ -Wfsdb  (-fullscreendebug)
X+ -Wfsdbs (-fullscreendebugserver)
X+ -Wfsdbp (-fullscreendebugptr)
X+ -Wfsdbk (-fullscreendebugkbd)
X+ -WS     (-defeateventsecurity)
X+ -sync   (-synchronous)                          (Force a synchronous connection)
X+ +sync   (+synchronous)                          (Make an asynchronous connection)
X+ -Wd     (-default)              resource value  (Set the X resource to value)
X+ -xrm                            resource:value  (Set the X resource to value)
X+ -WH     (-help)
X+ 
X+ 
X  BUGS.
X  	There is a nasty bug in XView 2.0 which causes XView to core dump
X  when run xrolo is run in 2D mode (the default on B&W displays). If you
X*** ../xrolo.v2.3/help.h	Mon Jan  7 11:04:15 1991
X--- help.h	Tue Jan 15 17:27:22 1991
X***************
X*** 179,190 ****
X  by egrep(1), which are not the same as the\n\
X  shell meta-characters. By default xrolo will\n\
X  do a case insensitive (or \"sloppy\") regular\n\
X! regular expression search.  The deafult search\n\
X! mode may be changed by selecting \"Egrep Regex\n\
X! Match\" from the find menu or by setting the X\n\
X  resource \n\
X!     xrolo.SloppyRegexMatch\n\
X! to 1 or 0\n\
X  \n\
X  SLIDER\n\
X     The slider item on the control panel may\n\
X--- 179,195 ----
X  by egrep(1), which are not the same as the\n\
X  shell meta-characters. By default xrolo will\n\
X  do a case insensitive (or \"sloppy\") regular\n\
X! regular expression search.  If soundex search\n\
X! mode is selected, xrolo will try to match an\n\
X! entry which sounds like the expression\n\
X! (e.g. \"cuper\" will match \"cooper\").\n\
X! The default search mode may be changed by\n\
X! selecting \"Egrep Regex Match\" or \"Soundex\"\n\
X! from the find menu or by setting the X\n\
X  resource \n\
X!     \"xrolo.SearchType\"\n\
X! to 0, 1 or 3 for EGREP, SLOPPY or SOUNDEX\n\
X! searches respectively.\n\
X  \n\
X  SLIDER\n\
X     The slider item on the control panel may\n\
X***************
X*** 209,214 ****
X--- 214,222 ----
X           case sensitive sorts.\n\
X      xrolo.PrintCommand - text string used to\n\
X           set the default print command.\n\
X+     xrolo.SearchType - default search mode for\n\
X+          find. 0, 1 or 2 for EGREP, SLOPPY or\n\
X+          SOUNDEX search modes respectively.\n\
X  \n",
X  
X  "\
X*** ../xrolo.v2.3/panel.c	Mon Jan  7 11:04:16 1991
X--- panel.c	Tue Jan 15 17:27:23 1991
X***************
X*** 42,50 ****
X--- 42,52 ----
X  #include <xview/seln.h>
X  #include <xview/notice.h>
X  #include <xview/defaults.h>
X+ #include <xview/svrimage.h>
X  #include <sys/param.h>
X  #include <ctype.h>
X  #include <alloca.h>
X+ #include <string.h>
X  
X  #include "defs.h"
X  #include "help.h"
X***************
X*** 108,114 ****
X  
X    done_button (), done_n_save(), done_n_save_exit(), done_n_exit(),
X    find_button (), find_button_forward(), find_button_reverse(),
X!   turn_on_sloppy(), turn_off_sloppy(),
X  
X    print_button(), print_entry(), print_all(), set_print_command(),
X  
X--- 110,116 ----
X  
X    done_button (), done_n_save(), done_n_save_exit(), done_n_exit(),
X    find_button (), find_button_forward(), find_button_reverse(),
X!   turn_on_sloppy(), turn_on_egrep(), turn_on_soundex(),
X  
X    print_button(), print_entry(), print_all(), set_print_command(),
X  
X***************
X*** 181,186 ****
X--- 183,189 ----
X  {
X  	int	panel_columns;
X  	Menu tmpmenu;
X+ 	char *defaults_set_search_type_str();
X  
X  	frame = _frame;
X  	panel = xv_create (frame, PANEL,
X***************
X*** 361,366 ****
X--- 364,373 ----
X  
X  #define SLOPPY_EXPR_STR	  "Sloppy Regex Match"
X  #define EGREP_EXPR_STR	  "Egrep(1) Regex Match"
X+ #define SOUNDEX_EXPR_STR  "Soundex"
X+ #define EGREP   0
X+ #define SLOPPY  1
X+ #define SOUNDEX 2
X  
X  	tmpmenu = menu_create(
X  						  MENU_ITEM,
X***************
X*** 374,382 ****
X  						  MENU_STRING,
X  						  EGREP_EXPR_STR,
X  						  MENU_NOTIFY_PROC,
X! 						  turn_off_sloppy,
X  						  NULL,
X  
X  						  NULL);
X  
X  	find_menu = menu_create (
X--- 381,396 ----
X  						  MENU_STRING,
X  						  EGREP_EXPR_STR,
X  						  MENU_NOTIFY_PROC,
X! 						  turn_on_egrep,
X  						  NULL,
X  
X+ 						  MENU_ITEM,
X+ 						  MENU_STRING,
X+ 						  SOUNDEX_EXPR_STR,
X+ 						  MENU_NOTIFY_PROC,
X+ 						  turn_on_soundex,
X+ 						  NULL,
X+ 
X  						  NULL);
X  
X  	find_menu = menu_create (
X***************
X*** 387,406 ****
X  							 MENU_ACTION_ITEM,
X  							 "(S) Find Regular Expression, Reverse", 
X  							 find_button_reverse, 
X- 							 
X- 							 MENU_CLIENT_DATA, 
X- 							 defaults_get_integer("xrolo.sloppyregexmatch",
X- 												  "xrolo.SloppyRegexMatch",
X- 												  1), /* sloppy regex by */
X- 							                          /* default */
X  
X  							 MENU_ITEM,
X  							 MENU_STRING, 
X! 							 defaults_get_integer("xrolo.sloppyregexmatch",
X! 												  "xrolo.SloppyRegexMatch",
X! 												  1) 
X! 							 ? SLOPPY_EXPR_STR : EGREP_EXPR_STR,
X! 							 MENU_CLIENT_DATA, 1, 
X  							 MENU_PULLRIGHT, tmpmenu,
X  							 NULL,
X  						   
X--- 401,414 ----
X  							 MENU_ACTION_ITEM,
X  							 "(S) Find Regular Expression, Reverse", 
X  							 find_button_reverse, 
X  
X+ 							 MENU_CLIENT_DATA, 
X+ 							 defaults_set_search_type(), 
X+ 							 
X  							 MENU_ITEM,
X  							 MENU_STRING, 
X! 							 defaults_set_search_type_str(),
X! 							 MENU_CLIENT_DATA, -1,
X  							 MENU_PULLRIGHT, tmpmenu,
X  							 NULL,
X  						   
X***************
X*** 1329,1338 ****
X  static  int in_find_button;
X  static	char	*e, regbuf [MAX_SELN_LEN];
X  
X! init_find_button()
X  {
X  	static		int bozo = 0;
X- 	int sloppy;
X  
X  	save_card (current);
X  
X--- 1337,1346 ----
X  static  int in_find_button;
X  static	char	*e, regbuf [MAX_SELN_LEN];
X  
X! init_find_button(search_type)
X! int search_type;
X  {
X  	static		int bozo = 0;
X  
X  	save_card (current);
X  
X***************
X*** 1341,1350 ****
X  		char	*pe = (char *) xv_get(regex_item, PANEL_VALUE);
X  
X  		(void) strcpy (regbuf, e);
X! 		/* if panel item is empty, copy selection into it */
X! /*		if ((pe == NULL) || (strlen (pe) == 0)) { /* */
X! 			xv_set (regex_item, PANEL_VALUE, regbuf, 0);
X! /*		} /* */
X  	} else {
X  		/* else use panel value */
X  		(void) strcpy (regbuf, (char *) xv_get(regex_item, PANEL_VALUE));
X--- 1349,1355 ----
X  		char	*pe = (char *) xv_get(regex_item, PANEL_VALUE);
X  
X  		(void) strcpy (regbuf, e);
X! 		xv_set (regex_item, PANEL_VALUE, regbuf, 0);
X  	} else {
X  		/* else use panel value */
X  		(void) strcpy (regbuf, (char *) xv_get(regex_item, PANEL_VALUE));
X***************
X*** 1365,1372 ****
X  
X  	bozo = 0;
X  
X! 	sloppy = xv_get(find_menu, MENU_CLIENT_DATA);
X! 	if ( sloppy ) {
X  		to_sloppy(regbuf);
X  	}
X  	e = re_comp (regbuf);
X--- 1370,1380 ----
X  
X  	bozo = 0;
X  
X! 	if ( search_type == SOUNDEX ) {
X! 		strcpy(regbuf, soundex(regbuf));
X! 		return(1);
X! 	}
X! 	if ( search_type == SLOPPY ) {
X  		to_sloppy(regbuf);
X  	}
X  	e = re_comp (regbuf);
X***************
X*** 1377,1397 ****
X  	return(1);
X  }
X  
X  static void find_button_forward (item, event)
X  Panel_item	item;
X  Event		*event;
X  {
X  	struct card *p;
X  	if ( in_find_button ) {
X  		in_find_button = 0;
X  		return;
X  	}
X! 	if ( !init_find_button() )
X  	  return;
X  	p = (current == last) ? first : current->c_next;
X  	while (p != current) {
X! 		if (re_exec (p->c_text) == 1) {
X! 			show_card (p);
X  			return;
X  		}
X  		p = (p == last) ? first : p->c_next;
X--- 1385,1431 ----
X  	return(1);
X  }
X  
X+ char *match(str, search_type)
X+ char *str;
X+ int search_type;
X+ {
X+ 	char *cp, *strtok(), *regexstrstr();
X+ 	char *buff;
X+ 
X+ 	if ( search_type != SOUNDEX ) {
X+ 		return ( re_exec(str) ? regexstrstr(str) : NULL);
X+ 	}
X+ 
X+ 	
X+ 	/* soundex match */
X+ 	buff = (char *)alloca(strlen(str)+1);
X+ 	strcpy(buff, str);
X+ 	cp = strtok(buff," \t\n\r");
X+ 	while( cp != NULL ) {
X+ 		if ( strncmp(soundex(cp), regbuf, 4) == 0 )
X+ 		  return(&str[(int)(cp - buff)]);
X+ 		cp = strtok(NULL, " \t\n\r");
X+ 	}
X+ 	return(NULL);
X+ }
X+ 
X  static void find_button_forward (item, event)
X  Panel_item	item;
X  Event		*event;
X  {
X  	struct card *p;
X+ 	char *cp;
X+ 	int search_type = xv_get(find_menu, MENU_CLIENT_DATA);
X  	if ( in_find_button ) {
X  		in_find_button = 0;
X  		return;
X  	}
X! 	if ( !init_find_button(search_type) )
X  	  return;
X  	p = (current == last) ? first : current->c_next;
X  	while (p != current) {
X! 		if ( cp=match(p->c_text, search_type)) {
X! 			show_positioned_card (p, (int)(cp - p->c_text));
X  			return;
X  		}
X  		p = (p == last) ? first : p->c_next;
X***************
X*** 1405,1420 ****
X  Event		*event;
X  {
X  	struct card *p;
X  	if ( in_find_button ) {
X  		in_find_button = 0;
X  		return;
X  	}
X! 	if ( !init_find_button() )
X  	  return;
X  	p = (current == first) ? last : current->c_prev;
X  	while (p != current) {
X! 		if (re_exec (p->c_text) == 1) {
X! 			show_card (p);
X  			return;
X  		}
X  		p = (p == first) ? last : p->c_prev;
X--- 1439,1456 ----
X  Event		*event;
X  {
X  	struct card *p;
X+ 	char *cp;
X+ 	int search_type = xv_get(find_menu, MENU_CLIENT_DATA);
X  	if ( in_find_button ) {
X  		in_find_button = 0;
X  		return;
X  	}
X! 	if ( !init_find_button(search_type) )
X  	  return;
X  	p = (current == first) ? last : current->c_prev;
X  	while (p != current) {
X! 		if (cp=match(p->c_text, search_type)) {
X! 			show_positioned_card (p, (int)(cp - p->c_text));
X  			return;
X  		}
X  		p = (p == first) ? last : p->c_prev;
X***************
X*** 1437,1470 ****
X  	}
X  }
X  
X  static void turn_on_sloppy(item, event)
X  Panel_item	item;
X  Event		*event;
X  {
X  	Menu_item find_item = xv_find(find_menu, MENUITEM, 
X! 								  MENU_CLIENT_DATA, 1, NULL);
X  	if ( find_item == NULL ) {
X  		confirm("turn_on_sloppy: Bad news!");
X  		return;
X  	}
X  	xv_set(find_item, MENU_STRING, SLOPPY_EXPR_STR, NULL);
X! 	xv_set(find_menu, MENU_CLIENT_DATA, 1);
X  }
X  
X! static void turn_off_sloppy(item, event)
X  Panel_item	item;
X  Event		*event;
X  {
X  	Menu_item find_item = xv_find(find_menu, MENUITEM, 
X! 								  MENU_CLIENT_DATA, 1, NULL);
X  	if ( find_item == NULL ) {
X! 		confirm("turn_off_sloppy: Bad news!");
X  		return;
X  	}
X  	xv_set(find_item, MENU_STRING, EGREP_EXPR_STR, NULL);
X! 	xv_set(find_menu, MENU_CLIENT_DATA, 0);
X  }
X  
X  /*
X   *	Notification proc for the "List" button.  The text window is used
X   *	to display the first non-blank line of each card.
X--- 1473,1547 ----
X  	}
X  }
X  
X+ defaults_set_search_type()
X+ {
X+ 	int cc=defaults_get_integer("xrolo.searchtype", 
X+ 							   "xrolo.SearchType",
X+ 							   SLOPPY);
X+ 	switch(cc) {
X+ 	  case EGREP:
X+ 	  case SLOPPY:
X+ 	  case SOUNDEX:
X+ 		return(cc);
X+ 	}
X+ 	return(SLOPPY);
X+ }
X+ 
X+ char *defaults_set_search_type_str()
X+ {
X+ 	int cc = defaults_set_search_type();
X+ 	switch(cc) {
X+ 	  case EGREP:
X+ 		return(EGREP_EXPR_STR);
X+ 	  case SLOPPY:
X+ 		return(SLOPPY_EXPR_STR);
X+ 	  case SOUNDEX:
X+ 		return(SOUNDEX_EXPR_STR);
X+ 	}
X+ }
X+ 
X  static void turn_on_sloppy(item, event)
X  Panel_item	item;
X  Event		*event;
X  {
X  	Menu_item find_item = xv_find(find_menu, MENUITEM, 
X! 								  MENU_CLIENT_DATA, -1, NULL);
X  	if ( find_item == NULL ) {
X  		confirm("turn_on_sloppy: Bad news!");
X  		return;
X  	}
X  	xv_set(find_item, MENU_STRING, SLOPPY_EXPR_STR, NULL);
X! 	xv_set(find_menu, MENU_CLIENT_DATA, SLOPPY);
X  }
X  
X! static void turn_on_egrep(item, event)
X  Panel_item	item;
X  Event		*event;
X  {
X  	Menu_item find_item = xv_find(find_menu, MENUITEM, 
X! 								  MENU_CLIENT_DATA, -1, NULL);
X  	if ( find_item == NULL ) {
X! 		confirm("turn_on_egrep: Bad news!");
X  		return;
X  	}
X  	xv_set(find_item, MENU_STRING, EGREP_EXPR_STR, NULL);
X! 	xv_set(find_menu, MENU_CLIENT_DATA, EGREP);
X  }
X  
X+ static void turn_on_soundex(item, event)
X+ Panel_item	item;
X+ Event		*event;
X+ {
X+ 	Menu_item find_item = xv_find(find_menu, MENUITEM, 
X+ 								  MENU_CLIENT_DATA, -1, NULL);
X+ 	if ( find_item == NULL ) {
X+ 		confirm("turn_on_soundex: Bad news!");
X+ 		return;
X+ 	}
X+ 	xv_set(find_item, MENU_STRING, SOUNDEX_EXPR_STR, NULL);
X+ 	xv_set(find_menu, MENU_CLIENT_DATA, SOUNDEX);
X+ }
X+ 
X  /*
X   *	Notification proc for the "List" button.  The text window is used
X   *	to display the first non-blank line of each card.
X***************
X*** 1491,1496 ****
X--- 1568,1587 ----
X  	}
X  }
X  
X+ char *catbuf(buf, str)
X+ char *buf, *str;
X+ {
X+ 	char *malloc(), *realloc();
X+ 	if (buf == NULL) {
X+ 		buf = malloc(strlen(str)+1);
X+ 		*buf = '\0';
X+ 	} else {
X+ 		buf = realloc(buf, strlen(buf)+strlen(str)+2);
X+ 	}
X+ 	strcat(buf, str);
X+ 	return(buf);
X+ }
X+ 
X  /*ARGSUSED*/
X  static void list_button (item, event)
X  	Panel_item	item;
X***************
X*** 1500,1505 ****
X--- 1591,1601 ----
X  	void notify_proc();
X  	Menu_item list_item;
X  
X+ #ifndef DONT_USE_MALLOC_LIST
X+ 	char *index_buf = NULL;
X+ 	int len;
X+ #endif
X+ 
X  	if (in_list_button || def_notify_proc != NULL) {
X  		in_list_button = 0;
X  		return;
X***************
X*** 1515,1524 ****
X--- 1611,1642 ----
X  
X  	textsw_reset (rolocard, 0, 0);		/* clear the text window */
X  
X+ #ifndef DONT_USE_MALLOC_LIST
X  	for (p = first; p != NULL_CARD; p = p->c_next) {
X  		char	*nl;
X  		char	line_buf [MAX_INDEX_LINE + 2];
X  
X+ 		(void) sprintf (line_buf, "%d: ", p->c_num);	/* prepend # */
X+ 		(void) strncat (line_buf, first_char (p->c_text),
X+ 			MAX_INDEX_LINE);
X+ 		line_buf [MAX_INDEX_LINE] = 0;	/* make sure it's terminated */
X+ 
X+ 		(void) strcat (line_buf, "\n");	/* make sure of newline */
X+ 		nl = index (line_buf, '\n');
X+ 		*++nl = '\0';			/* chop at first line break */
X+ 		index_buf = catbuf (index_buf, line_buf);
X+ 	}
X+ 
X+ 	len = strlen (index_buf);
X+ 	window_set (rolocard, TEXTSW_MEMORY_MAXIMUM, len + 20000, 0);
X+ 
X+ 	(void) textsw_insert (rolocard, index_buf, len);
X+ 	free (index_buf);
X+ #else
X+ 	for (p = first; p != NULL_CARD; p = p->c_next) {
X+ 		char	*nl;
X+ 		char	line_buf [MAX_INDEX_LINE + 2];
X+ 
X  		(void) sprintf (line_buf, "%d: ", p->c_num);/* prepend number */
X  		textsw_insert (rolocard, line_buf, strlen (line_buf));
X  
X***************
X*** 1531,1536 ****
X--- 1649,1655 ----
X  		*++nl = '\0';			/* chop at first line break */
X  		textsw_insert (rolocard, line_buf, strlen (line_buf));
X  	}
X+ #endif
X  
X  	xv_set (rolocard, TEXTSW_INSERTION_POINT, 0, 0);	/* rewind */
X  	textsw_normalize_view (rolocard, 0);
X***************
X*** 1687,1701 ****
X  show_card (p)
X  	struct	card	*p;
X  {
X  	textsw_reset (rolocard, 0, 0);
X  	textsw_insert (rolocard, p->c_text, strlen (p->c_text));
X! 	xv_set (rolocard, TEXTSW_INSERTION_POINT, 0, 0);
X! 	textsw_normalize_view (rolocard, 0);
X  	update_num_display (p->c_num);
X  	current = p;
X  }
X  
X- 
X  /*
X   *	Change to the card with the given index number.  The number is
X   *	range checked, then searched for.  When found, the pointer to the
X--- 1806,1826 ----
X  show_card (p)
X  	struct	card	*p;
X  {
X+ 	show_positioned_card(p, 0);
X+ }
X+ 
X+ show_positioned_card (p, pos)
X+ struct	card	*p;
X+ char *pos;
X+ {
X  	textsw_reset (rolocard, 0, 0);
X  	textsw_insert (rolocard, p->c_text, strlen (p->c_text));
X! 	xv_set (rolocard, TEXTSW_INSERTION_POINT, pos, 0);
X! 	textsw_normalize_view (rolocard, pos);
X  	update_num_display (p->c_num);
X  	current = p;
X  }
X  
X  /*
X   *	Change to the card with the given index number.  The number is
X   *	range checked, then searched for.  When found, the pointer to the
X***************
X*** 2070,2074 ****
X--- 2195,2214 ----
X  	}
X  
X  	return (notify_next_destroy_func (frame, status));
X+ }
X+ 
X+ #ifndef NULL
X+ #include <stdio.h> 
X+ #endif
X+ 
X+ char *regexstrstr(s1)
X+ char *s1;
X+ {
X+ 	while ( *s1 != '\0' && re_exec(s1) ) {
X+ 		s1++;
X+ 	}
X+ 	if ( *s1 != '\0' )
X+ 	  return(--s1);
X+ 	return( NULL );
X  }
X  
X*** ../xrolo.v2.3/patchlevel.h	Mon Jan  7 11:04:20 1991
X--- patchlevel.h	Tue Jan 15 17:27:27 1991
X***************
X*** 1 ****
X! #define PATCHLEVEL 3
X--- 1 ----
X! #define PATCHLEVEL 4
X*** ../xrolo.v2.3/send_mail.c	Mon Jan  7 11:04:20 1991
X--- send_mail.c	Tue Jan 15 17:27:26 1991
X***************
X*** 26,31 ****
X--- 26,32 ----
X  /************************************************************************/
X  
X  #include	<stdio.h>
X+ #include	<ctype.h>
X  #include    "patchlevel.h"
X  #include	<sys/param.h>
X  #include	<sys/types.h>
X*** ../xrolo.v2.3/xrolo.man	Mon Jan  7 11:04:10 1991
X--- xrolo.man	Tue Jan 15 17:27:17 1991
X***************
X*** 114,120 ****
X  lines.  By default, sorting is done in a case
X  insensitive manner. The sort mode may be set
X  by selecting the case [In]Sensitive pullright
X! menu or by setting the xrolo.CaseInsensitiveSort
X  resource to 0 or 1. Xrolo implements a very 
X  rudimentary field sort. each line in the card
X   is considered to be a field. Pointing and
X--- 114,120 ----
X  lines.  By default, sorting is done in a case
X  insensitive manner. The sort mode may be set
X  by selecting the case [In]Sensitive pullright
X! menu or by setting the "xrolo.CaseInsensitiveSort"
X  resource to 0 or 1. Xrolo implements a very 
X  rudimentary field sort. each line in the card
X   is considered to be a field. Pointing and
X***************
X*** 171,178 ****
X  or set the print command. The default print
X  command is "lpr".  A user can customize
X  the default printer command by creating an
X! X resource entry called
X!      xrolo.PrintCommand.
X  .TP
X  FIND BUTTON
X  This button searches for a regular expression
X--- 171,177 ----
X  or set the print command. The default print
X  command is "lpr".  A user can customize
X  the default printer command by creating an
X! X resource entry called "xrolo.PrintCommand".
X  .TP
X  FIND BUTTON
X  This button searches for a regular expression
X***************
X*** 194,207 ****
X  .br
X  Note: "Regular expressions" are the kind used
X  by egrep(1), which are not the same as the
X! shell meta-characters. By default xrolo will
X  do a case insensitive (or "sloppy") regular
X! regular expression search.  The deafult search
X! mode may be changed by selecting "Egrep Regex
X! Match" from the find menu or by setting the X
X! resource
X!     xrolo.SloppyRegexMatch
X! to 1 or 0.
X  .TP
X  SLIDER
X  The slider item on the control panel may
X--- 193,212 ----
X  .br
X  Note: "Regular expressions" are the kind used
X  by egrep(1), which are not the same as the
X! shell meta-characters. 
X! .br
X! By default xrolo will
X  do a case insensitive (or "sloppy") regular
X! regular expression search.  If soundex search
X! mode is selected, xrolo will try to match an
X! entry which sounds like the expression
X! (e.g. "cuper" will match "cooper").
X! The default search mode may be changed by
X! selecting "Egrep Regex Match" or "Soundex"
X! from the find menu or by setting the X
X! resource "xrolo.SearchType"
X! to 0, 1 or 3 for EGREP, SLOPPY or SOUNDEX
X! searches respectively.
X  .TP
X  SLIDER
X  The slider item on the control panel may
X***************
X*** 220,225 ****
X--- 225,233 ----
X  0 turns on case sensitive sorts.
X  
X  xrolo.PrintCommand - text string used to set the default print command.
X+ 
X+ xrolo.SearchType - default search mode for find. 0, 1 or 2 for EGREP,
X+ SLOPPY or SOUNDEX search modes respectively.
X  .SH FILES
X  .TP
X  $HOME/.rolo
END_OF_FILE
if test 23785 -ne `wc -c <'xrolo.patch3'`; then
    echo shar: \"'xrolo.patch3'\" unpacked with wrong size!
fi
# end of 'xrolo.patch3'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have the archive.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0

--
dan
----------------------------------------------------
O'Reilly && Associates   argv at sun.com / argv at ora.com
Opinions expressed reflect those of the author only.



More information about the Comp.sources.x mailing list