diff options
| author | Jordan K. Hubbard <jkh@FreeBSD.org> | 1996-05-29 22:38:37 +0000 | 
|---|---|---|
| committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 1996-05-29 22:38:37 +0000 | 
| commit | 5c6b0b391751cf944e107a5ddab480f5b3d82f51 (patch) | |
| tree | ee836fb7d1770d9cc76d401b0cbc83b61858ffc0 | |
| parent | d2d02801b93cc9bf0c9fadd6d3a319d2ebe85b4e (diff) | |
Notes
372 files changed, 4789 insertions, 24897 deletions
diff --git a/bin/Makefile b/bin/Makefile index b324bba44ab9..1310471e6101 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -1,7 +1,7 @@  #	From: @(#)Makefile	8.1 (Berkeley) 5/31/93 -#	$Id$ +#	$Id: Makefile,v 1.2 1994/09/18 21:25:26 wollman Exp $ -SUBDIR=	cat chmod cp csh date dd df domainname echo ed expr hostname \ +SUBDIR= cat chmod cp csh date dd df domainname echo ed expr hostname \  	kill ln ls mkdir mv pax ps pwd rcp rm rmail rmdir sh sleep \  	stty sync test diff --git a/bin/Makefile.inc b/bin/Makefile.inc index 4760782bef05..5e19e782632a 100644 --- a/bin/Makefile.inc +++ b/bin/Makefile.inc @@ -2,3 +2,13 @@  BINDIR?=	/bin  NOSHARED?=	YES + +.if exists (${.CURDIR}/../../secure) + +.if exists(${.CURDIR}/../../secure/lib/libcipher/obj) +CIPHEROBJDIR=    ${.CURDIR}/../../secure/lib/libcipher/obj +.else +CIPHEROBJDIR=    ${.CURDIR}/../../secure/lib/libcipher +.endif + +.endif diff --git a/bin/chmod/chmod.1 b/bin/chmod/chmod.1 index 5c06913f0cf6..60974ef53363 100644 --- a/bin/chmod/chmod.1 +++ b/bin/chmod/chmod.1 @@ -33,7 +33,7 @@  .\" SUCH DAMAGE.  .\"  .\"	@(#)chmod.1	8.4 (Berkeley) 3/31/94 -.\"	$Id$ +.\"	$Id: chmod.1,v 1.2 1994/09/24 02:53:37 davidg Exp $  .\"  .Dd March 31, 1994  .Dt CHMOD 1 @@ -274,6 +274,7 @@ There's no  .Ar perm  option for the naughty bits.  .Sh SEE ALSO +.Xr chflags 1 ,  .Xr install 1 ,  .Xr chmod 2 ,  .Xr stat 2 , diff --git a/bin/cp/cp.1 b/bin/cp/cp.1 index 9d4a77d5dcf9..4841e41c666b 100644 --- a/bin/cp/cp.1 +++ b/bin/cp/cp.1 @@ -33,7 +33,7 @@  .\" SUCH DAMAGE.  .\"  .\"	@(#)cp.1	8.3 (Berkeley) 4/18/94 -.\"	$Id$ +.\"	$Id: cp.1,v 1.2 1994/09/24 02:53:40 davidg Exp $  .\"  .Dd April 18, 1994  .Dt CP 1 @@ -47,14 +47,16 @@  .Fl R  .Op Fl H | Fl L | Fl P  .Oc -.Op Fl fip +.Op Fl f | i +.Op Fl p  .Ar source_file target_file  .Nm cp  .Oo  .Fl R  .Op Fl H | Fl L | Fl P  .Oc -.Op Fl fip +.Op Fl f | i +.Op Fl p  .Ar source_file ... target_directory  .Sh DESCRIPTION  In the first synopsis form, the @@ -105,18 +107,25 @@ For each existing destination pathname, remove it and  create a new file, without prompting for confirmation  regardless of its permissions.  (The -.Fl i -option is ignored if the  .Fl f -option is specified.) +option overrides any previous +.Fl i +options.)  .It Fl i  Causes  .Nm cp  to write a prompt to the standard error output before copying a file  that would overwrite an existing file.  If the response from the standard input begins with the character -.Sq Li y , +.Sq Li y  +or +.Sq Li Y ,  the file copy is attempted. +(The +.Fl i +option overrides any previous +.Fl f +options.)  .It Fl p  Causes  .Nm cp diff --git a/bin/cp/cp.c b/bin/cp/cp.c index ef88b8cb4d31..8b69f83b415b 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -33,7 +33,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: cp.c,v 1.5 1995/04/02 00:49:16 bde Exp $ + *	$Id: cp.c,v 1.6 1995/05/30 00:06:21 rgrimes Exp $   */  #ifndef lint @@ -86,7 +86,7 @@ static char sccsid[] = "@(#)cp.c	8.2 (Berkeley) 4/1/94";  PATH_T to = { to.p_path, "" };  uid_t myuid; -int Rflag, iflag, pflag, rflag; +int Rflag, iflag, pflag, rflag, fflag;  int myumask;  enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE }; @@ -104,7 +104,7 @@ main(argc, argv)  	int Hflag, Lflag, Pflag, ch, fts_options, r;  	char *target; -	Hflag = Lflag = Pflag = Rflag = 0; +	Hflag = Lflag = Pflag = 0;  	while ((ch = getopt(argc, argv, "HLPRfipr")) != EOF)  		switch (ch) {  		case 'H': @@ -123,10 +123,12 @@ main(argc, argv)  			Rflag = 1;  			break;  		case 'f': +			fflag = 1;  			iflag = 0;  			break;  		case 'i': -			iflag = isatty(fileno(stdin)); +			iflag = 1; +			fflag = 0;  			break;  		case 'p':  			pflag = 1; @@ -134,7 +136,6 @@ main(argc, argv)  		case 'r':  			rflag = 1;  			break; -		case '?':  		default:  			usage();  			break; diff --git a/bin/cp/extern.h b/bin/cp/extern.h index 6f84535b34ca..6ca9910c3eb5 100644 --- a/bin/cp/extern.h +++ b/bin/cp/extern.h @@ -31,7 +31,7 @@   * SUCH DAMAGE.   *   *	@(#)extern.h	8.2 (Berkeley) 4/1/94 - *	$Id$ + *	$Id: extern.h,v 1.2 1994/09/24 02:53:41 davidg Exp $   */  typedef struct { @@ -42,7 +42,7 @@ typedef struct {  extern PATH_T to;  extern uid_t myuid; -extern int iflag, pflag, myumask; +extern int iflag, pflag, fflag, myumask;  #include <sys/cdefs.h> diff --git a/bin/cp/utils.c b/bin/cp/utils.c index 0aa480d7b163..3d73c790a7c5 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: utils.c,v 1.5 1995/10/03 12:55:01 bde Exp $ + *	$Id: utils.c,v 1.3.4.2 1995/10/05 07:24:24 davidg Exp $   */  #ifndef lint @@ -86,12 +86,21 @@ copy_file(entp, dne)  			checkch = ch = getchar();  			while (ch != '\n' && ch != EOF)  				ch = getchar(); -			if (checkch != 'y') { +			if (checkch != 'y' && checkch != 'Y') {  				(void)close(from_fd);  				return (0);  			}  		} -		to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0); +		 +		if (fflag) { +		    /* remove existing destination file name,  +		     * create a new file  */ +		    (void)unlink(to.p_path); +		    to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT, +				 fs->st_mode & ~(S_ISUID | S_ISGID)); +		} else  +		    /* overwrite existing destination file name */ +		    to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);  	} else  		to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,  		    fs->st_mode & ~(S_ISUID | S_ISGID)); @@ -281,7 +290,7 @@ void  usage()  {  	(void)fprintf(stderr, "%s\n%s\n", -"usage: cp [-R [-H | -L | -P] [-fip] src target", -"       cp [-R [-H | -L | -P] [-fip] src1 ... srcN directory"); +"usage: cp [-R [-H | -L | -P]] [-f | -i] [-p] src target", +"       cp [-R [-H | -L | -P]] [-f | -i] [-p] src1 ... srcN directory");  	exit(1);  } diff --git a/bin/csh/const.c b/bin/csh/const.c index 4dac78293cdd..0d6068b2d73f 100644 --- a/bin/csh/const.c +++ b/bin/csh/const.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: const.c,v 1.2 1994/09/24 02:53:48 davidg Exp $ + *	$Id: const.c,v 1.3 1995/05/30 00:06:29 rgrimes Exp $   */  #ifndef lint @@ -47,7 +47,9 @@ Char STR0[]             = { '0', '\0' };  Char STR1[]             = { '1', '\0' };  Char STRHOME[]		= { 'H', 'O', 'M', 'E', '\0' };  Char STRLANG[]  	= { 'L', 'A', 'N', 'G', '\0' }; -Char STRLC_CTYPE[]	= { 'L', 'C', '_', 'C', 'T', 'Y', 'P', 'E' ,'\0' }; +Char STRLC_ALL[]        = { 'L', 'C', '_', 'A', 'L', 'L', '\0' }; +Char STRLC_CTYPE[]      = { 'L', 'C', '_', 'C', 'T', 'Y', 'P', 'E', '\0' }; +Char STRLC_COLLATE[]    = { 'L', 'C', '_', 'C', 'O', 'L', 'L', 'A', 'T', 'E', '\0' };  Char STRLOGNAME[]	= { 'L', 'O', 'G', 'N', 'A', 'M', 'E', '\0' };  Char STRLbrace[]	= { '{', '\0' };  Char STRLparen[]	= { '(', '\0' }; diff --git a/bin/csh/csh.1 b/bin/csh/csh.1 index 52e7dc279138..7400412ad7ad 100644 --- a/bin/csh/csh.1 +++ b/bin/csh/csh.1 @@ -30,7 +30,7 @@  .\" SUCH DAMAGE.  .\"  .\"     @(#)csh.1	8.2 (Berkeley) 1/21/94 -.\"	$Id: csh.1,v 1.2 1994/09/24 02:53:49 davidg Exp $ +.\"	$Id: csh.1,v 1.3 1995/05/06 13:52:29 ache Exp $  .\"  .Dd January 21, 1994  .Dt CSH 1 @@ -1405,7 +1405,7 @@ of the names suffice.  .Pp  .It Ic login  Terminate a login shell, replacing it with an instance of -.Pa /bin/login. +.Pa /usr/bin/login.  This is one way to log off, included for compatibility with  .Xr sh  1  .  .Pp diff --git a/bin/csh/csh.c b/bin/csh/csh.c index 826c4276ce3f..727cf4641349 100644 --- a/bin/csh/csh.c +++ b/bin/csh/csh.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: csh.c,v 1.3 1995/05/30 00:06:30 rgrimes Exp $ + *	$Id: csh.c,v 1.3.4.1 1995/08/25 02:55:47 davidg Exp $   */  #ifndef lint @@ -186,7 +186,9 @@ main(argc, argv)  	AsciiOnly = k > 0377;      }  #else -    AsciiOnly = getenv("LANG") == NULL && getenv("LC_CTYPE") == NULL; +    AsciiOnly = getenv("LANG") == NULL && +		getenv("LC_ALL") == NULL && +		getenv("LC_CTYPE") == NULL;  #endif				/* NLS */      /* diff --git a/bin/csh/func.c b/bin/csh/func.c index e409197e90fe..445d42edab01 100644 --- a/bin/csh/func.c +++ b/bin/csh/func.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: func.c,v 1.2 1994/09/24 02:54:04 davidg Exp $ + *	$Id: func.c,v 1.3 1995/05/30 00:06:34 rgrimes Exp $   */  #ifndef lint @@ -967,7 +967,8 @@ dosetenv(v, t)  	importpath(lp);  	dohash(NULL, NULL);      } -    else if (eq(vp, STRLANG) || eq(vp, STRLC_CTYPE)) { +    else if (eq(vp, STRLANG) || eq(vp, STRLC_CTYPE) || +	     eq(vp, STRLC_ALL) || eq(vp, STRLC_COLLATE)) {  #ifdef NLS  	int     k; @@ -1015,7 +1016,8 @@ dounsetenv(v, t)  		if (!Gmatch(name, *v))  		    continue;  		maxi = 1; -		if (eq(name, STRLANG) || eq(name, STRLC_CTYPE)) { +		if (eq(name, STRLANG) || eq(name, STRLC_CTYPE) || +		    eq(name, STRLC_ALL) || eq(name, STRLC_COLLATE)) {  #ifdef NLS  		    int     k; @@ -1025,6 +1027,7 @@ dounsetenv(v, t)  		    AsciiOnly = k > 0377;  #else  		    AsciiOnly = getenv("LANG") == NULL && +			getenv("LC_ALL") == NULL &&  			getenv("LC_CTYPE") == NULL;  #endif				/* NLS */  		} diff --git a/bin/date/date.c b/bin/date/date.c index 94e3b33227e6..811cb9f88a34 100644 --- a/bin/date/date.c +++ b/bin/date/date.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: date.c,v 1.4 1995/04/03 20:08:33 joerg Exp $ + *	$Id: date.c,v 1.4.4.1 1995/08/28 10:31:25 davidg Exp $   */  #ifndef lint @@ -54,6 +54,7 @@ static char sccsid[] = "@(#)date.c	8.1 (Berkeley) 5/31/93";  #include <string.h>  #include <syslog.h>  #include <unistd.h> +#include <locale.h>  #include "extern.h" @@ -79,6 +80,7 @@ main(argc, argv)  	char *endptr;  	int set_timezone; +	(void) setlocale(LC_TIME, "");  	tz.tz_dsttime = tz.tz_minuteswest = 0;  	rflag = 0;  	set_timezone = 0; @@ -208,7 +210,7 @@ setthetime(p)  	/* convert broken-down time to GMT clock time */  	if ((tval = mktime(lt)) == -1) -		badformat(); +		errx(1, "nonexistent time");  	/* set the time */  	if (nflag || netsettime(tval)) { diff --git a/bin/dd/dd.c b/bin/dd/dd.c index d3428701a43f..55c4e76a06c8 100644 --- a/bin/dd/dd.c +++ b/bin/dd/dd.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: dd.c,v 1.3 1995/01/17 22:55:59 ache Exp $ + *	$Id: dd.c,v 1.4 1995/01/17 23:04:29 ache Exp $   */  #ifndef lint @@ -61,6 +61,7 @@ static char sccsid[] = "@(#)dd.c	8.5 (Berkeley) 4/2/94";  #include <stdlib.h>  #include <string.h>  #include <unistd.h> +#include <locale.h>  #include "dd.h"  #include "extern.h" @@ -84,6 +85,7 @@ main(argc, argv)  	int argc;  	char *argv[];  { +	(void) setlocale(LC_CTYPE, "");  	jcl(argv);  	setup(); diff --git a/bin/df/df.c b/bin/df/df.c index 80cbba4abe16..701a9adac46c 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -35,7 +35,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: df.c,v 1.6 1995/03/19 13:28:15 joerg Exp $ + *	$Id: df.c,v 1.7 1995/05/30 00:06:42 rgrimes Exp $   */  #ifndef lint @@ -386,10 +386,7 @@ ufs_df(file, maxwidth)  	sfsp->f_blocks = sblock.fs_dsize;  	sfsp->f_bfree = sblock.fs_cstotal.cs_nbfree * sblock.fs_frag +  		sblock.fs_cstotal.cs_nffree; -	sfsp->f_bavail = (sblock.fs_dsize * (100 - sblock.fs_minfree) / 100) - -		(sblock.fs_dsize - sfsp->f_bfree); -	if (sfsp->f_bavail < 0) -		sfsp->f_bavail = 0; +	sfsp->f_bavail = freespace(&sblock, sblock.fs_minfree);  	sfsp->f_files =  sblock.fs_ncg * sblock.fs_ipg;  	sfsp->f_ffree = sblock.fs_cstotal.cs_nifree;  	sfsp->f_fsid.val[0] = 0; diff --git a/bin/echo/echo.1 b/bin/echo/echo.1 index b74272c8a9f2..d045b3dcc67c 100644 --- a/bin/echo/echo.1 +++ b/bin/echo/echo.1 @@ -33,7 +33,7 @@  .\" SUCH DAMAGE.  .\"  .\"	@(#)echo.1	8.1 (Berkeley) 7/22/93 -.\"	$Id$ +.\"	$Id: echo.1,v 1.2 1994/09/24 02:55:17 davidg Exp $  .\"  .Dd July 22, 1993  .Dt ECHO 1 @@ -55,7 +55,9 @@ output.  The following option is available:  .Bl -tag -width flag  .It Fl n -Do not print the trailing newline character. +Do not print the trailing newline character.  This may also be +achieved by appending `\ec' to the end of the string, as is done +by iBCS2 compatible systems.  .El  .Pp  The diff --git a/bin/echo/echo.c b/bin/echo/echo.c index ba9f9ed7cc2b..e604765e48a3 100644 --- a/bin/echo/echo.c +++ b/bin/echo/echo.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id$ + *	$Id: echo.c,v 1.2 1994/09/24 02:55:18 davidg Exp $   */  #ifndef lint @@ -62,8 +62,14 @@ main(argc, argv)  	else  		nflag = 0; -	while (*argv) { -		(void)printf("%s", *argv); +	while (argv[0]) { +		int len = strlen(argv[0]); + +		if (len >= 2 && !argv[1] && argv[0][len - 2] == '\\' && argv[0][len - 1] == 'c') { +			argv[0][len - 2] = '\0'; +			nflag = 1; +		} +		(void)printf("%s", argv[0]);  		if (*++argv)  			putchar(' ');  	} diff --git a/bin/ed/Makefile b/bin/ed/Makefile index 68cfc3a9aae9..fa13ceb61946 100644 --- a/bin/ed/Makefile +++ b/bin/ed/Makefile @@ -1,8 +1,15 @@ -#	$Id: Makefile,v 1.9 1994/10/29 10:13:34 phk Exp $ +#	$Id: Makefile,v 1.10 1994/12/18 15:15:10 jkh Exp $  PROG=	ed -SRCS=	 buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c +SRCS=	buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c  LINKS=  ${BINDIR}/ed ${BINDIR}/red  MLINKS= ed.1 red.1 +.if exists(../../secure) && !defined(NOCRYPT) && !defined(NOSECURE) +DISTRIBUTION=des +CFLAGS+=-DDES +LDADD+= -L${CIPHEROBJDIR} -lcipher +DPADD+= ${CIPHEROBJDIR}/libcipher.a +.endif +  .include <bsd.prog.mk> diff --git a/bin/ed/io.c b/bin/ed/io.c index 1072d06b7a00..99e832acbb7b 100644 --- a/bin/ed/io.c +++ b/bin/ed/io.c @@ -24,7 +24,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: io.c,v 1.3 1994/09/24 02:55:27 davidg Exp $ + *	$Id: io.c,v 1.4 1995/03/19 13:28:32 joerg Exp $   */  #ifndef lint @@ -58,7 +58,7 @@ read_file(fn, n)  		sprintf(errmsg, "cannot close input file");  		return ERR;  	} -	fprintf(stderr, !scripted ? "%lu\n" : "", size); +	fprintf(stdout, !scripted ? "%lu\n" : "", size);  	return current_addr - n;  } @@ -173,7 +173,7 @@ write_file(fn, mode, n, m)  		sprintf(errmsg, "cannot close output file");  		return ERR;  	} -	fprintf(stderr, !scripted ? "%lu\n" : "", size); +	fprintf(stdout, !scripted ? "%lu\n" : "", size);  	return n ? m - n + 1 : 0;  } diff --git a/bin/expr/Makefile b/bin/expr/Makefile index c98e59fbcb3b..63c0055d945d 100644 --- a/bin/expr/Makefile +++ b/bin/expr/Makefile @@ -1,5 +1,5 @@  #	/b/source/CVS/src/bin/expr/Makefile,v 1.5 1993/06/14 19:56:06 jtc Exp -#	$Id: Makefile,v 1.6 1994/09/24 02:55:36 davidg Exp $ +#	$Id: Makefile,v 1.7 1995/05/30 00:06:49 rgrimes Exp $  PROG=		expr  SRCS=		expr.c @@ -7,7 +7,7 @@ CLEANFILES+=	expr.c y.tab.h  expr.c:  	${YACC} -d ${.IMPSRC} -	mv y.tab.c expr.c +	mv -f y.tab.c expr.c  .include <bsd.prog.mk> diff --git a/bin/hostname/hostname.1 b/bin/hostname/hostname.1 index 8235045fb25f..68548f748813 100644 --- a/bin/hostname/hostname.1 +++ b/bin/hostname/hostname.1 @@ -30,7 +30,7 @@  .\" SUCH DAMAGE.  .\"  .\"	@(#)hostname.1	8.1 (Berkeley) 5/31/93 -.\"	$Id$ +.\"	$Id: hostname.1,v 1.2 1994/09/24 02:55:40 davidg Exp $  .\"  .Dd May 31, 1993  .Dt HOSTNAME 1 @@ -58,7 +58,7 @@ Trims off any domain information from the printed  name.  .El  .Sh SEE ALSO -.Xr gethostname 2 +.Xr gethostname 3  .Sh HISTORY  The  .Nm hostname diff --git a/bin/ln/ln.c b/bin/ln/ln.c index 73fffa711856..b9c4f3f1eed5 100644 --- a/bin/ln/ln.c +++ b/bin/ln/ln.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: ln.c,v 1.4 1994/09/24 02:55:48 davidg Exp $ + *	$Id: ln.c,v 1.5 1994/12/06 18:50:44 bde Exp $   */  #ifndef lint @@ -53,7 +53,6 @@ static char sccsid[] = "@(#)ln.c	8.2 (Berkeley) 3/31/94";  #include <string.h>  #include <unistd.h> -int	dirflag;			/* Undocumented directory flag. */  int	fflag;				/* Unlink existing files. */  int	sflag;				/* Symbolic, not hard, link. */  					/* System link call. */ @@ -72,11 +71,8 @@ main(argc, argv)  	int ch, exitval;  	char *sourcedir; -	while ((ch = getopt(argc, argv, "Ffs")) != EOF) +	while ((ch = getopt(argc, argv, "fs")) != EOF)  		switch (ch) { -		case 'F': -			dirflag = 1;	/* XXX: deliberately undocumented. */ -			break;  		case 'f':  			fflag = 1;  			break; @@ -127,9 +123,10 @@ linkit(target, source, isdir)  			warn("%s", target);  			return (1);  		} -		/* Only symbolic links to directories, unless -F option used. */ -		if (!dirflag && (sb.st_mode & S_IFMT) == S_IFDIR) { -			warnx("%s: is a directory", target); +		/* Only symbolic links to directories. */ +		if (S_ISDIR(sb.st_mode)) { +			errno = EISDIR; +			warn("%s", target);  			return (1);  		}  	} diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 17f7137c1d3a..a02b1fbf8a38 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -33,7 +33,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: ls.c,v 1.5 1995/03/19 13:28:44 joerg Exp $ + *	$Id: ls.c,v 1.6 1995/03/23 19:05:00 phk Exp $   */  #ifndef lint @@ -58,6 +58,7 @@ static char sccsid[] = "@(#)ls.c	8.5 (Berkeley) 4/2/94";  #include <stdlib.h>  #include <string.h>  #include <unistd.h> +#include <locale.h>  #include "ls.h"  #include "extern.h" @@ -104,6 +105,8 @@ main(argc, argv)  	int ch, fts_options, notused;  	char *p; +	(void) setlocale(LC_ALL, ""); +  	/* Terminal defaults to -Cq, non-terminal defaults to -1. */  	if (isatty(STDOUT_FILENO)) {  		if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == -1 || diff --git a/bin/ls/print.c b/bin/ls/print.c index 058d0b3a7a8a..d6a2bc7d2354 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -33,7 +33,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: print.c,v 1.4 1995/05/30 00:06:50 rgrimes Exp $ + *	$Id: print.c,v 1.4.4.1 1995/08/28 10:30:27 davidg Exp $   */  #ifndef lint @@ -53,7 +53,6 @@ static char sccsid[] = "@(#)print.c	8.4 (Berkeley) 4/17/94";  #include <string.h>  #include <time.h>  #include <unistd.h> -#include <utmp.h>  #include "ls.h"  #include "extern.h" @@ -108,8 +107,12 @@ printlong(dp)  		if (f_flags)  			(void)printf("%-*s ", dp->s_flags, np->flags);  		if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode)) -			(void)printf("%3d, %3d ", -			    major(sp->st_rdev), minor(sp->st_rdev)); +			if (minor(sp->st_rdev) > 255) +				(void)printf("%3d, 0x%08x ", +				    major(sp->st_rdev), minor(sp->st_rdev)); +			else +				(void)printf("%3d, %3d ", +				    major(sp->st_rdev), minor(sp->st_rdev));  		else if (dp->bcfile)  			(void)printf("%*s%*qd ",  			    8 - dp->s_size, "", dp->s_size, sp->st_size); diff --git a/bin/ls/util.c b/bin/ls/util.c index e436c922ff61..d16ab6aa7a14 100644 --- a/bin/ls/util.c +++ b/bin/ls/util.c @@ -33,7 +33,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: util.c,v 1.3 1994/09/24 02:55:58 davidg Exp $ + *	$Id: util.c,v 1.4 1994/10/09 15:25:23 ache Exp $   */  #ifndef lint @@ -57,7 +57,7 @@ prcopy(src, dest, len)  	char *src, *dest;  	int len;  { -	int ch; +	unsigned char ch;  	while (len--) {  		ch = *src++; diff --git a/bin/mv/mv.1 b/bin/mv/mv.1 index 01c0f2b7415d..9ad2ea34d050 100644 --- a/bin/mv/mv.1 +++ b/bin/mv/mv.1 @@ -33,7 +33,7 @@  .\" SUCH DAMAGE.  .\"  .\"	@(#)mv.1	8.1 (Berkeley) 5/31/93 -.\"	$Id: mv.1,v 1.2 1994/09/24 02:56:06 davidg Exp $ +.\"	$Id: mv.1,v 1.2.6.1 1995/08/29 11:14:21 davidg Exp $  .\"  .Dd May 31, 1993  .Dt MV 1 @@ -77,17 +77,25 @@ The following options are available:  Do not prompt for confirmation before overwriting the destination  path.  (The -.Fl i -option is ignored if the  .Fl f -option is specified.) +option overrides any previous +.Fl i +options.)  .It Fl i  Causes  .Nm mv  to write a prompt to standard error before moving a file that would  overwrite an existing file. -If the response from the standard input begins with the character ``y'', +If the response from the standard input begins with the character +.Sq Li y  +or +.Sq Li Y ,  the move is attempted. +(The +.Fl i +option overrides any previous +.Fl f +options.)  .El  .Pp  It is an error for either the @@ -121,6 +129,7 @@ The  utility exits 0 on success, and >0 if an error occurs.  .Sh SEE ALSO  .Xr cp 1 , +.Xr rm 1 ,  .Xr symlink 7  .Sh STANDARDS  The diff --git a/bin/mv/mv.c b/bin/mv/mv.c index 28da455ecd6f..1486052ddaa5 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -33,7 +33,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: mv.c,v 1.3 1995/10/07 10:42:48 bde Exp $ + *	$Id: mv.c,v 1.2.6.1 1995/10/09 05:12:21 davidg Exp $   */  #ifndef lint @@ -79,21 +79,20 @@ main(argc, argv)  	int ch;  	char path[MAXPATHLEN + 1]; -	while ((ch = getopt(argc, argv, "-if")) != EOF) +	while ((ch = getopt(argc, argv, "fi")) != EOF)  		switch (ch) {  		case 'i':  			iflg = 1; +			fflg = 0;  			break;  		case 'f':  			fflg = 1; +			iflg = 0;  			break; -		case '-':		/* Undocumented; for compatibility. */ -			goto endarg; -		case '?':  		default:  			usage();  		} -endarg:	argc -= optind; +	argc -= optind;  	argv += optind;  	if (argc < 2) @@ -152,6 +151,13 @@ do_move(from, to)  	 * make sure the user wants to clobber it.  	 */  	if (!fflg && !access(to, F_OK)) { + +		/* prompt only if source exist */ +	        if (lstat(from, &sb) == -1) { +			warn("%s", from); +			return (1); +		} +		      		ask = 0;  		if (iflg) {  			(void)fprintf(stderr, "overwrite %s? ", to); @@ -167,7 +173,7 @@ do_move(from, to)  		if (ask) {  			if ((ch = getchar()) != EOF && ch != '\n')  				while (getchar() != '\n'); -			if (ch != 'y') +			if (ch != 'y' && ch != 'Y')  				return (0);  		}  	} @@ -302,7 +308,8 @@ copy(from, to)  void  usage()  { -	(void)fprintf(stderr, -"usage: mv [-if] src target;\n   or: mv [-if] src1 ... srcN directory\n"); +	(void)fprintf(stderr, "%s\n%s\n", +		      "usage: mv [-f | -i] src target", +		      "       mv [-f | -i] src1 ... srcN directory");  	exit(1);  } diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index e3481bda9e2e..827a02d2224d 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: ar_io.c,v 1.2 1994/09/24 02:56:11 davidg Exp $ + *	$Id: ar_io.c,v 1.3 1995/05/30 00:06:52 rgrimes Exp $   */  #ifndef lint @@ -52,7 +52,6 @@ static char sccsid[] = "@(#)ar_io.c	8.2 (Berkeley) 4/18/94";  #include <fcntl.h>  #include <unistd.h>  #include <stdio.h> -#include <ctype.h>  #include <errno.h>  #include <stdlib.h>  #include "pax.h" diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c index c725fe854a27..7777afb79f41 100644 --- a/bin/pax/ar_subs.c +++ b/bin/pax/ar_subs.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: ar_subs.c,v 1.2 1994/09/24 02:56:12 davidg Exp $ + *	$Id: ar_subs.c,v 1.3 1995/05/30 00:06:52 rgrimes Exp $   */  #ifndef lint @@ -48,7 +48,6 @@ static char sccsid[] = "@(#)ar_subs.c	8.2 (Berkeley) 4/18/94";  #include <signal.h>  #include <string.h>  #include <stdio.h> -#include <ctype.h>  #include <fcntl.h>  #include <errno.h>  #include <unistd.h> diff --git a/bin/pax/buf_subs.c b/bin/pax/buf_subs.c index b8b6a8c966c6..fa6f925ac3b1 100644 --- a/bin/pax/buf_subs.c +++ b/bin/pax/buf_subs.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: buf_subs.c,v 1.2 1994/09/24 02:56:13 davidg Exp $ + *	$Id: buf_subs.c,v 1.3 1995/05/30 00:06:53 rgrimes Exp $   */  #ifndef lint @@ -46,7 +46,6 @@ static char sccsid[] = "@(#)buf_subs.c	8.2 (Berkeley) 4/18/94";  #include <sys/stat.h>  #include <sys/param.h>  #include <stdio.h> -#include <ctype.h>  #include <errno.h>  #include <unistd.h>  #include <stdlib.h> diff --git a/bin/pax/cache.c b/bin/pax/cache.c index 8d88abe15b29..6ffe469ac7c4 100644 --- a/bin/pax/cache.c +++ b/bin/pax/cache.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id$ + *	$Id: cache.c,v 1.2 1994/09/24 02:56:14 davidg Exp $   */  #ifndef lint @@ -47,7 +47,6 @@ static char sccsid[] = "@(#)cache.c	8.1 (Berkeley) 5/31/93";  #include <sys/param.h>  #include <string.h>  #include <stdio.h> -#include <ctype.h>  #include <pwd.h>  #include <grp.h>  #include <unistd.h> diff --git a/bin/pax/cpio.c b/bin/pax/cpio.c index 0307c54ff95c..e3fd4f1a420d 100644 --- a/bin/pax/cpio.c +++ b/bin/pax/cpio.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: cpio.c,v 1.2 1994/09/24 02:56:16 davidg Exp $ + *	$Id: cpio.c,v 1.3 1995/05/30 00:06:54 rgrimes Exp $   */  #ifndef lint @@ -46,7 +46,6 @@ static char sccsid[] = "@(#)cpio.c	8.1 (Berkeley) 5/31/93";  #include <sys/stat.h>  #include <sys/param.h>  #include <string.h> -#include <ctype.h>  #include <stdio.h>  #include <unistd.h>  #include <stdlib.h> diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c index f220639870d6..107a1003329e 100644 --- a/bin/pax/file_subs.c +++ b/bin/pax/file_subs.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: file_subs.c,v 1.2 1994/09/24 02:56:19 davidg Exp $ + *	$Id: file_subs.c,v 1.3 1995/05/30 00:06:56 rgrimes Exp $   */  #ifndef lint @@ -49,7 +49,6 @@ static char sccsid[] = "@(#)file_subs.c	8.1 (Berkeley) 5/31/93";  #include <fcntl.h>  #include <string.h>  #include <stdio.h> -#include <ctype.h>  #include <errno.h>  #include <sys/uio.h>  #include <stdlib.h> diff --git a/bin/pax/ftree.c b/bin/pax/ftree.c index 6f2b14b256bd..375e62071693 100644 --- a/bin/pax/ftree.c +++ b/bin/pax/ftree.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: ftree.c,v 1.2 1994/09/24 02:56:20 davidg Exp $ + *	$Id: ftree.c,v 1.3 1995/05/30 00:06:57 rgrimes Exp $   */  #ifndef lint @@ -48,7 +48,6 @@ static char sccsid[] = "@(#)ftree.c	8.2 (Berkeley) 4/18/94";  #include <unistd.h>  #include <string.h>  #include <stdio.h> -#include <ctype.h>  #include <errno.h>  #include <stdlib.h>  #include <fts.h> diff --git a/bin/pax/gen_subs.c b/bin/pax/gen_subs.c index fba1699f0955..dc0d5a07280c 100644 --- a/bin/pax/gen_subs.c +++ b/bin/pax/gen_subs.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: gen_subs.c,v 1.5 1995/08/07 19:17:36 wollman Exp $ + *	$Id: gen_subs.c,v 1.4.4.1 1995/08/28 10:41:14 davidg Exp $   */  #ifndef lint @@ -46,7 +46,6 @@ static char sccsid[] = "@(#)gen_subs.c	8.1 (Berkeley) 5/31/93";  #include <sys/stat.h>  #include <sys/param.h>  #include <stdio.h> -#include <ctype.h>  #include <utmp.h>  #include <unistd.h>  #include <stdlib.h> diff --git a/bin/pax/options.c b/bin/pax/options.c index e8e5cc6d0f7b..53a9ad6b06a2 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: options.c,v 1.2 1994/09/24 02:56:22 davidg Exp $ + *	$Id: options.c,v 1.3 1995/03/19 13:28:53 joerg Exp $   */  #ifndef lint @@ -47,7 +47,6 @@ static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";  #include <sys/mtio.h>  #include <sys/param.h>  #include <stdio.h> -#include <ctype.h>  #include <string.h>  #include <unistd.h>  #include <stdlib.h> diff --git a/bin/pax/pat_rep.c b/bin/pax/pat_rep.c index aadd17cd5d61..451a9dfc0a2f 100644 --- a/bin/pax/pat_rep.c +++ b/bin/pax/pat_rep.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: pat_rep.c,v 1.3 1995/03/19 13:28:56 joerg Exp $ + *	$Id: pat_rep.c,v 1.4 1995/05/30 00:06:59 rgrimes Exp $   */  #ifndef lint @@ -46,7 +46,6 @@ static char sccsid[] = "@(#)pat_rep.c	8.2 (Berkeley) 4/18/94";  #include <sys/stat.h>  #include <sys/param.h>  #include <stdio.h> -#include <ctype.h>  #include <string.h>  #include <unistd.h>  #include <stdlib.h> diff --git a/bin/pax/pax.c b/bin/pax/pax.c index 2bdf6bd81166..5d5e31f21e68 100644 --- a/bin/pax/pax.c +++ b/bin/pax/pax.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: pax.c,v 1.2 1994/09/24 02:56:27 davidg Exp $ + *	$Id: pax.c,v 1.3 1995/05/30 00:07:00 rgrimes Exp $   */  #ifndef lint @@ -57,6 +57,7 @@ static char sccsid[] = "@(#)pax.c	8.2 (Berkeley) 4/18/94";  #include <unistd.h>  #include <stdlib.h>  #include <errno.h> +#include <locale.h>  #include "pax.h"  #include "extern.h"  static int gen_init __P((void)); @@ -227,6 +228,7 @@ main(argc, argv)  	char **argv;  #endif  { +	(void) setlocale(LC_TIME, "");  	/*  	 * parse options, determine operational mode, general init  	 */ diff --git a/bin/pax/sel_subs.c b/bin/pax/sel_subs.c index c90dc786ee7b..e759bdb58dbc 100644 --- a/bin/pax/sel_subs.c +++ b/bin/pax/sel_subs.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id$ + *	$Id: sel_subs.c,v 1.2 1994/09/24 02:56:29 davidg Exp $   */  #ifndef lint @@ -48,7 +48,6 @@ static char sccsid[] = "@(#)sel_subs.c	8.1 (Berkeley) 5/31/93";  #include <pwd.h>  #include <grp.h>  #include <stdio.h> -#include <ctype.h>  #include <string.h>  #include <strings.h>  #include <unistd.h> diff --git a/bin/pax/tables.c b/bin/pax/tables.c index c3ccc1c6a9e3..b0694176c06d 100644 --- a/bin/pax/tables.c +++ b/bin/pax/tables.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: tables.c,v 1.2 1994/09/24 02:56:34 davidg Exp $ + *	$Id: tables.c,v 1.3 1995/05/30 00:07:01 rgrimes Exp $   */  #ifndef lint @@ -47,7 +47,6 @@ static char sccsid[] = "@(#)tables.c	8.1 (Berkeley) 5/31/93";  #include <sys/param.h>  #include <sys/fcntl.h>  #include <stdio.h> -#include <ctype.h>  #include <string.h>  #include <unistd.h>  #include <errno.h> diff --git a/bin/pax/tar.c b/bin/pax/tar.c index fc5ca2fa7f42..a88f6585c090 100644 --- a/bin/pax/tar.c +++ b/bin/pax/tar.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: tar.c,v 1.2 1994/09/24 02:56:37 davidg Exp $ + *	$Id: tar.c,v 1.3 1995/05/30 00:07:03 rgrimes Exp $   */  #ifndef lint @@ -47,7 +47,6 @@ static char sccsid[] = "@(#)tar.c	8.2 (Berkeley) 4/18/94";  #include <sys/param.h>  #include <string.h>  #include <stdio.h> -#include <ctype.h>  #include <unistd.h>  #include <stdlib.h>  #include "pax.h" diff --git a/bin/pax/tty_subs.c b/bin/pax/tty_subs.c index 4a6cb5839719..0c47facdca90 100644 --- a/bin/pax/tty_subs.c +++ b/bin/pax/tty_subs.c @@ -34,7 +34,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id$ + *	$Id: tty_subs.c,v 1.2 1994/09/24 02:56:38 davidg Exp $   */  #ifndef lint @@ -47,7 +47,6 @@ static char sccsid[] = "@(#)tty_subs.c	8.2 (Berkeley) 4/18/94";  #include <sys/param.h>  #include <fcntl.h>  #include <stdio.h> -#include <ctype.h>  #include <errno.h>  #include <unistd.h>  #include <stdlib.h> diff --git a/bin/ps/Makefile b/bin/ps/Makefile index e8885f24d177..d7d3094bb65f 100644 --- a/bin/ps/Makefile +++ b/bin/ps/Makefile @@ -1,10 +1,10 @@  #	@(#)Makefile	8.1 (Berkeley) 6/2/93 -#	$Id: Makefile,v 1.4 1995/04/15 03:23:36 davidg Exp $ +#	$Id: Makefile,v 1.5 1995/04/15 03:31:19 davidg Exp $  PROG=	ps  SRCS=	fmt.c keyword.c nlist.c print.c ps.c  CFLAGS+=-I/sys -DPADD=	${LIBMATH} ${LIBKVM} +DPADD=	${LIBM} ${LIBKVM}  LDADD=	-lm -lkvm  BINGRP=	kmem  BINMODE=2555 diff --git a/bin/ps/fmt.c b/bin/ps/fmt.c index ce8efe902fab..8231c73850be 100644 --- a/bin/ps/fmt.c +++ b/bin/ps/fmt.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: fmt.c,v 1.4 1994/11/10 23:25:12 ats Exp $ + *	$Id: fmt.c,v 1.5 1995/03/09 20:40:17 davidg Exp $   */  #ifndef lint @@ -41,7 +41,6 @@ static char sccsid[] = "@(#)fmt.c	8.4 (Berkeley) 4/15/94";  #include <sys/syslimits.h>  #include <sys/time.h>  #include <sys/resource.h> -#include <ctype.h>  #include <stdio.h>  #include <stdlib.h>  #include <string.h> diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index d2423181b81d..4fb2bd28969f 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: keyword.c,v 1.7 1995/09/26 17:48:58 peter Exp $ + *	$Id: keyword.c,v 1.5.6.1 1995/10/05 07:46:36 davidg Exp $   */  #ifndef lint @@ -57,6 +57,7 @@ static char sccsid[] = "@(#)keyword.c	8.5 (Berkeley) 4/2/94";  #ifdef NEWVM  #include <sys/ucred.h> +#include <sys/user.h>  #include <sys/sysctl.h>  #endif diff --git a/bin/ps/print.c b/bin/ps/print.c index 01f815abfcf3..b1d76ee28c77 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: print.c,v 1.10 1995/09/26 17:48:59 peter Exp $ + *	$Id: print.c,v 1.7.4.2 1995/10/05 07:46:37 davidg Exp $   */  #ifndef lint @@ -49,6 +49,7 @@ static char sccsid[] = "@(#)print.c	8.6 (Berkeley) 4/16/94";  #ifdef NEWVM  #include <sys/ucred.h> +#include <sys/user.h>  #include <sys/sysctl.h>  #include <vm/vm.h>  #else @@ -418,7 +419,7 @@ wchan(k, ve)  		(void)printf("%-*s", v->width, "-");  } -#define pgtok(a)        (((a)*NBPG)/1024) +#define pgtok(a)        (((a)*getpagesize())/1024)  void  vsize(k, ve) @@ -574,7 +575,7 @@ getpmem(k)  	/* XXX want pmap ptpages, segtab, etc. (per architecture) */  	szptudot = UPAGES;  	/* XXX don't have info about shared */ -	fracmem = ((float)e->e_vm.vm_rssize + szptudot)/CLSIZE/mempages; +	fracmem = ((float)e->e_vm.vm_rssize + szptudot)/getpagesize()/mempages;  #endif  	return (100.0 * fracmem);  } @@ -611,7 +612,7 @@ maxrss(k, ve)  	v = ve->var;  #ifndef NEWVM	/* not yet */ -	if (KI_PROC(k)->p_maxrss != (RLIM_INFINITY/NBPG)) +	if (KI_PROC(k)->p_maxrss != (RLIM_INFINITY/PAGE_SIZE))  		(void)printf("%*d", v->width, pgtok(KI_PROC(k)->p_maxrss));  	else  #endif diff --git a/bin/ps/ps.1 b/bin/ps/ps.1 index dfc5d23c080d..e77ab9975730 100644 --- a/bin/ps/ps.1 +++ b/bin/ps/ps.1 @@ -30,7 +30,7 @@  .\" SUCH DAMAGE.  .\"  .\"     @(#)ps.1	8.3 (Berkeley) 4/18/94 -.\"	$Id: ps.1,v 1.4.6.1 1995/12/30 13:53:17 joerg Exp $ +.\"	$Id: ps.1,v 1.4.6.2 1996/02/22 19:51:39 peter Exp $  .\"  .Dd April 18, 1994  .Dt PS 1 @@ -186,46 +186,29 @@ fields to exceed 100%.  .It %mem  The percentage of real memory used by this process.  .It flags -The flags (in hexadecimal) associated with the process as in +The flags associated with the process as in  the include file  .Aq Pa sys/proc.h : -.Bl -column SNOCLDSTOP SNOCLDSTOP -.It Dv "SLOAD" Ta No "0x0000001	in core" -.It Dv "SSYS" Ta No "0x0000002	swapper or pager process" -.It Dv "SLOCK" Ta No "0x0000004	process being swapped out" -.It Dv "SSWAP" Ta No "0x0000008	save area flag" -.It Dv "STRC" Ta No "0x0000010	process is being traced" -.It Dv "SWTED" Ta No "0x0000020	another tracing flag" -.It Dv "SSINTR" Ta No "0x0000040	sleep is interruptible" -.It Dv "SKEEP" Ta No "0x0000100	another flag to prevent swap out" -.It Dv "SOMASK" Ta No "0x0000200	restore old mask after taking signal" -.It Dv "SWEXIT" Ta No "0x0000400	working on exiting" -.It Dv "SPHYSIO" Ta No "0x0000800	doing physical" -.Tn I/O -.It Dv "SVFORK" Ta No "0x0001000	process resulted from" -.Xr vfork 2 -.It Dv "SVFDONE" Ta No "0x0002000	another" -.Xr vfork -flag -.It Dv "SNOVM" Ta No "0x0004000	no vm, parent in a" -.Xr vfork -.It Dv "SPAGV" Ta No "0x0008000	init data space on demand, from vnode" -.It Dv "SSEQL" Ta No "0x0010000	user warned of sequential vm behavior" -.It Dv "SUANOM" Ta No "0x0020000	user warned of random vm behavior" -.It Dv "STIMO" Ta No "0x0040000	timing out during sleep" -.It Dv "SNOCLDSTOP" Ta No "0x0080000	no" -.Dv SIGCHLD -when children stop -.It Dv "SCTTY" Ta No "0x0100000	has a controlling terminal" -.It Dv "SOWEUPC" Ta No "0x0200000	owe process an addupc() call at next ast" -.\" the routine addupc is not documented in the man pages -.It Dv "SSEL" Ta No "0x0400000	selecting; wakeup/waiting danger" -.It Dv "SEXEC" Ta No "0x0800000	process called" -.Xr exec 2 -.It Dv "SHPUX" Ta No "0x1000000	\\*(tNHP-UX\\*(sP process -.Pq Dv HPUXCOMPAT -.It Dv "SULOCK" Ta No "0x2000000	locked in core after swap error" -.It Dv "SPTECHG" Ta No "0x4000000	pte's for process have changed" +.Bl -column P_NOCLDSTOP P_NOCLDSTOP +.It Dv "P_ADVLOCK" Ta No "0x00001	Process may hold a POSIX advisory lock" +.It Dv "P_CONTROLT" Ta No "0x00002	Has a controlling terminal" +.It Dv "P_INMEM" Ta No "0x00004		Loaded into memory" +.It Dv "P_NOCLDSTOP" Ta No "0x00008	No SIGCHLD when children stop" +.It Dv "P_PPWAIT" Ta No "0x00010	Parent is waiting for child to exec/exit" +.It Dv "P_PROFIL" Ta No "0x00020	Has started profiling" +.It Dv "P_SELECT" Ta No "0x00040	Selecting; wakeup/waiting danger" +.It Dv "P_SINTR" Ta No "0x00080		Sleep is interruptible" +.It Dv "P_SUGID" Ta No "0x00100		Had set id privileges since last exec" +.It Dv "P_SYSTEM" Ta No "0x00200	System proc: no sigs, stats or swapping" +.It Dv "P_TIMEOUT" Ta No "0x00400	Timing out during sleep" +.It Dv "P_TRACED" Ta No "0x00800	Debugged process being traced" +.It Dv "P_WAITED" Ta No "0x01000	Debugging process has waited for child" +.It Dv "P_WEXIT" Ta No "0x02000		Working on exiting" +.It Dv "P_EXEC" Ta No "0x04000		Process called exec" +.It Dv "P_NOSWAP" Ta No "0x08000	Another flag to prevent swap out" +.It Dv "P_PHYSIO" Ta No "0x10000	Doing physical I/O" +.It Dv "P_OWEUPC" Ta No "0x20000	Owe process an addupc() call at next ast" +.It Dv "P_SWAPPING" Ta No "0x40000	Process is being swapped"  .El  .It lim  The soft limit on memory used, specified via a call to diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 21d67cca8e9a..1684810314f7 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: ps.c,v 1.7 1995/05/30 00:07:05 rgrimes Exp $ + *	$Id: ps.c,v 1.7.4.1 1996/02/22 19:51:40 peter Exp $   */  #ifndef lint @@ -57,13 +57,15 @@ static char sccsid[] = "@(#)ps.c	8.4 (Berkeley) 4/2/94";  #include <errno.h>  #include <fcntl.h>  #include <kvm.h> +#include <limits.h>  #include <nlist.h>  #include <paths.h>  #include <stdio.h>  #include <stdlib.h>  #include <string.h> -#include <pwd.h>  #include <unistd.h> +#include <locale.h> +#include <pwd.h>  #include "ps.h" @@ -116,7 +118,9 @@ main(argc, argv)  	uid_t uid;  	int all, ch, flag, i, fmt, lineno, nentries;  	int prtheader, wflag, what, xflg; -	char *nlistf, *memf, *swapf, errbuf[256]; +	char *nlistf, *memf, *swapf, errbuf[_POSIX2_LINE_MAX]; + +	(void) setlocale(LC_ALL, "");  	if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) == -1 &&  	     ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) == -1 && diff --git a/bin/rcp/rcp.c b/bin/rcp/rcp.c index 564786828af7..34c38a852bde 100644 --- a/bin/rcp/rcp.c +++ b/bin/rcp/rcp.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: rcp.c,v 1.3 1995/03/19 13:29:14 joerg Exp $ + *	$Id: rcp.c,v 1.4 1995/05/30 00:07:06 rgrimes Exp $   */  #ifndef lint @@ -69,9 +69,11 @@ static char sccsid[] = "@(#)rcp.c	8.2 (Berkeley) 4/2/94";  #include "extern.h"  #ifdef KERBEROS -#include <kerberosIV/des.h> +#include <des.h>  #include <kerberosIV/krb.h> +#include "../../usr.bin/rlogin/krb.h" +  char	dst_realm_buf[REALM_SZ];  char	*dest_realm = NULL;  int	use_kerberos = 1; @@ -590,22 +592,21 @@ sink(argc, argv)  		if (ch == '\n')  			*--cp = 0; -#define getnum(t) (t) = 0; while (isdigit(*cp)) (t) = (t) * 10 + (*cp++ - '0');  		cp = buf;  		if (*cp == 'T') {  			setimes++;  			cp++; -			getnum(mtime.tv_sec); -			if (*cp++ != ' ') +			mtime.tv_sec = strtol(cp, &cp, 10); +			if (!cp || *cp++ != ' ')  				SCREWUP("mtime.sec not delimited"); -			getnum(mtime.tv_usec); -			if (*cp++ != ' ') +			mtime.tv_usec = strtol(cp, &cp, 10); +			if (!cp || *cp++ != ' ')  				SCREWUP("mtime.usec not delimited"); -			getnum(atime.tv_sec); -			if (*cp++ != ' ') +			atime.tv_sec = strtol(cp, &cp, 10); +			if (!cp || *cp++ != ' ')  				SCREWUP("atime.sec not delimited"); -			getnum(atime.tv_usec); -			if (*cp++ != '\0') +			atime.tv_usec = strtol(cp, &cp, 10); +			if (!cp || *cp++ != '\0')  				SCREWUP("atime.usec not delimited");  			(void)write(rem, "", 1);  			continue; diff --git a/bin/rm/rm.1 b/bin/rm/rm.1 index 2e523b9a8639..693c1cf35705 100644 --- a/bin/rm/rm.1 +++ b/bin/rm/rm.1 @@ -33,7 +33,7 @@  .\" SUCH DAMAGE.  .\"  .\"	@(#)rm.1	8.2 (Berkeley) 4/18/94 -.\"	$Id$ +.\"	$Id: rm.1,v 1.2 1994/09/24 02:57:00 davidg Exp $  .\"  .Dd April 18, 1994  .Dt RM 1 @@ -118,10 +118,26 @@ removed.  If an error occurs,  .Nm rm  exits with a value >0. +.Sh NOTE +.Nm rm +use  +.Xr getopt 3 +parsing routine. Getopt accept a +.Sq Li -- +argument, which stop reading options, anything after this +is not an option. +So  +.Nm rm +handle files whose names begins with a +.Sq Li - . +Example: + +``$ rm -- -filename''.  .Sh SEE ALSO  .Xr rmdir 1 ,  .Xr unlink 2 ,  .Xr fts 3 , +.Xr getopt 3 ,  .Xr symlink 7  .Sh BUGS  The diff --git a/bin/rm/rm.c b/bin/rm/rm.c index 1a743786030d..8df172f61cf0 100644 --- a/bin/rm/rm.c +++ b/bin/rm/rm.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: rm.c,v 1.5 1994/09/24 02:57:02 davidg Exp $ + *	$Id: rm.c,v 1.6 1995/04/13 13:35:09 ache Exp $   */  #ifndef lint @@ -81,7 +81,7 @@ main(argc, argv)  {  	int ch, rflag; -	Pflag = rflag = 0; +	rflag = 0;  	while ((ch = getopt(argc, argv, "dfiPRr")) != EOF)  		switch(ch) {  		case 'd': @@ -102,7 +102,6 @@ main(argc, argv)  		case 'r':			/* Compatibility. */  			rflag = 1;  			break; -		case '?':  		default:  			usage();  		} @@ -378,7 +377,7 @@ check(path, name, sp)  	first = ch = getchar();  	while (ch != '\n' && ch != EOF)  		ch = getchar(); -	return (first == 'y'); +	return (first == 'y' || first == 'Y');  }  #define ISDOT(a)	((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2]))) @@ -410,6 +409,6 @@ void  usage()  { -	(void)fprintf(stderr, "usage: rm [-dfiRr] file ...\n"); +	(void)fprintf(stderr, "usage: rm [-f | -i] [-dPRr] file ...\n");  	exit(1);  } diff --git a/bin/rmail/rmail.c b/bin/rmail/rmail.c index aeec46cca134..b45ec457682e 100644 --- a/bin/rmail/rmail.c +++ b/bin/rmail/rmail.c @@ -30,7 +30,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: rmail.c,v 1.4 1995/03/19 13:29:18 joerg Exp $ + *	$Id: rmail.c,v 1.5 1995/05/30 00:07:08 rgrimes Exp $   */  #ifndef lint @@ -211,6 +211,8 @@ main(argc, argv)  		/* Save off from user's address; the last one wins. */  		for (p = addrp; *p && !isspace(*p); ++p);  		*p = '\0'; +		if (*addrp == '\0') +			addrp = "<>";  		if (from_user != NULL)  			free(from_user);  		if ((from_user = strdup(addrp)) == NULL) diff --git a/bin/sh/Makefile b/bin/sh/Makefile index cd0932b90d1b..d703e92b082b 100644 --- a/bin/sh/Makefile +++ b/bin/sh/Makefile @@ -1,5 +1,5 @@  #	@(#)Makefile	8.1 (Berkeley) 6/8/93 -#	$Id: Makefile,v 1.8 1995/08/27 20:26:40 joerg Exp $ +#	$Id: Makefile,v 1.7.6.1 1995/12/11 23:04:38 joerg Exp $  PROG=	sh  SRCS=	alias.c builtins.c cd.c echo.c error.c eval.c exec.c expand.c \ @@ -23,6 +23,9 @@ CLEANFILES+=\  token.def: mktokens  	sh ${.CURDIR}/mktokens +${.CURDIR}/builtins: +	# just override the default rule +  builtins.h builtins.c: ${.CURDIR}/mkbuiltins ${.CURDIR}/builtins  	cd ${.CURDIR}; sh mkbuiltins diff --git a/bin/sh/bltin/bltin.h b/bin/sh/bltin/bltin.h index f10ded216019..0300d14ba626 100644 --- a/bin/sh/bltin/bltin.h +++ b/bin/sh/bltin/bltin.h @@ -34,7 +34,7 @@   * SUCH DAMAGE.   *   *	@(#)bltin.h	8.1 (Berkeley) 5/31/93 - *	$Id: bltin.h,v 1.3 1995/12/10 15:37:44 joerg Exp $ + *	$Id: bltin.h,v 1.2.6.1 1995/12/11 23:05:26 joerg Exp $   */  /* @@ -60,10 +60,10 @@  #define fputs outstr  #define fflush flushout  #define INITARGS(argv) -#define warnx(a, b, c) {                                               \ -       char buf[64];                                                   \ -       (void)snprintf(buf, sizeof(buf), a, b, c);                       \ -       error(buf);                                                     \ +#define warnx(a, b, c) {						\ +	char buf[64];							\ +	(void)snprintf(buf, sizeof(buf), a, b, c);			\ +	error(buf);							\  }  #else  #undef NULL diff --git a/bin/sh/parser.c b/bin/sh/parser.c index d12932685dd4..d96667350e3d 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -33,7 +33,7 @@   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * SUCH DAMAGE.   * - *	$Id: parser.c,v 1.6.4.1 1995/08/25 03:21:06 davidg Exp $ + *	$Id: parser.c,v 1.6.4.2 1995/08/30 05:53:05 davidg Exp $   */  #ifndef lint @@ -150,29 +150,12 @@ list(nlflag) {  	for (;;) {  		switch (readtoken()) {  		case TBACKGND: -			if (n1->type == NCMD || n1->type == NPIPE) { -				n1->ncmd.backgnd = 1; -			} else if (n1->type == NREDIR) { -				n1->type = NBACKGND; -			} else { -				n3 = (union node *)stalloc(sizeof (struct nredir)); -				n3->type = NBACKGND; -				n3->nredir.n = n1; -				n3->nredir.redirect = NULL; -				n1 = n3; -			} -			goto tsemi;  		case TNL: -			tokpushback++; +			parseheredoc(); +			if (nlflag) +				return n1;  			/* fall through */ -tsemi:	    case TSEMI: -			if (readtoken() == TNL) { -				parseheredoc(); -				if (nlflag) -					return n1; -			} else { -				tokpushback++; -			} +		case TSEMI:  			checkkwd = 2;  			if (tokendlist[peektoken()])  				return n1; @@ -212,6 +195,19 @@ andor() {  		} else if (t == TOR) {  			t = NOR;  		} else { +			if (t == TBACKGND) { +				if (n1->type == NCMD || n1->type == NPIPE) { +					n1->ncmd.backgnd = 1; +				} else if (n1->type == NREDIR) { +					n1->type = NBACKGND; +				} else { +					n3 = (union node *)stalloc(sizeof (struct nredir)); +					n3->type = NBACKGND; +					n3->nredir.n = n1; +					n3->nredir.redirect = NULL; +					n1 = n3; +				} +			}  			tokpushback++;  			return n1;  		} diff --git a/bin/stty/stty.1 b/bin/stty/stty.1 index addbe1b4d0fe..e582a16ae103 100644 --- a/bin/stty/stty.1 +++ b/bin/stty/stty.1 @@ -33,7 +33,7 @@  .\" SUCH DAMAGE.  .\"  .\"     @(#)stty.1	8.4 (Berkeley) 4/18/94 -.\"	$Id$ +.\"	$Id: stty.1,v 1.2 1994/09/24 02:59:01 davidg Exp $  .\"  .Dd April 18, 1994  .Dt STTY 1 @@ -160,10 +160,10 @@ Signal (do not signal)  on  break.  .It Cm ignpar Pq Fl ignpar -Ignore (do not ignore) parity +Ignore (do not ignore) characters with parity  errors.  .It Cm parmrk Pq Fl parmrk -Mark (do not mark) parity errors. +Mark (do not mark) characters with parity errors.  .It Cm inpck Pq Fl inpck  Enable (disable) input parity  checking. @@ -235,7 +235,7 @@ output modes).  Map (do not map)  .Dv NL  to -.DV CR-NL +.Dv CR-NL  on output.  .It Cm oxtabs Pq Fl oxtabs  Expand (do not expand) tabs to spaces on output. diff --git a/bin/sync/sync.8 b/bin/sync/sync.8 index 1dafffd6723b..513b7016810c 100644 --- a/bin/sync/sync.8 +++ b/bin/sync/sync.8 @@ -30,7 +30,7 @@  .\" SUCH DAMAGE.  .\"  .\"	@(#)sync.8	8.1 (Berkeley) 5/31/93 -.\"	$Id$ +.\"	$Id: sync.8,v 1.2 1994/09/24 02:59:08 davidg Exp $  .\"  .Dd May 31, 1993  .Dt SYNC 8 @@ -64,9 +64,9 @@ function call.  .Sh SEE ALSO  .Xr sync 2 ,  .Xr fsync 2 , +.Xr update 4 ,  .Xr halt 8 , -.Xr reboot 8 , -.Xr update 8 +.Xr reboot 8  .Sh HISTORY  A  .Nm sync diff --git a/etc/Makefile b/etc/Makefile index cbd9136dc9a1..397d0578fb5e 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,15 +1,15 @@  #	from: @(#)Makefile	5.11 (Berkeley) 5/21/91 -#	$Id: Makefile,v 1.117.4.5 1996/03/27 22:42:05 torstenb Exp $ +#	$Id: Makefile,v 1.117.4.6 1996/05/09 05:58:59 jkh Exp $ -# disktab may be wrong -- hcx9 is a tahoe, but gets its own.  # -rw-r--r--  BINOWN= root  BINGRP= wheel -BIN1=   aliases csh.cshrc csh.login csh.logout dm.conf \ +BIN1=   aliases amd.map csh.cshrc csh.login csh.logout dm.conf \  	ftpusers gettytab group hosts host.conf hosts.equiv hosts.lpd \ -	inetd.conf login.access motd modems netstart \ -	networks pccard.conf.sample phones printcap profile protocols \ -	rc rc.local rc.pccard rc.serial etc.${MACHINE}/rc.${MACHINE} \ +	inetd.conf login.access motd modems netstart networks \ +	newsyslog.conf phones printcap profile protocols \ +	rc rc.firewall rc.local rc.serial \ +	etc.${MACHINE}/rc.${MACHINE} \  	remote security services sysconfig shells \  	syslog.conf ttys etc.${MACHINE}/disktab rpc make.conf \  	${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config \ @@ -21,116 +21,17 @@ BIN2=	motd  # -rwxr-xr-x root.wheel, for the new cron root.wheel  BIN3=	daily weekly monthly pccard_ether -CLEANFILES+=	*.c *.o *.lo -CLEANFILES+=	filesystem filesystem.cache filesystem.mk -CLEANFILES+=	kcopy kcopy.cache kcopy.mk - -MAKEDEVS=	(cd ${MOUNT}/dev; \ -		    sh ${DESTDIR}/dev/MAKEDEV std; \ -		    rm -rf fd; \ -		    sh ${DESTDIR}/dev/MAKEDEV fd0 fd1; \ -		    rm -rf fd0?* rfd0?* fd1?* rfd1?*; \ -		    sh ${DESTDIR}/dev/MAKEDEV wd0 wd1 sd0 sd1 cd0 mcd0 mcd1; \ -		    rm -rf *wd[01][ijklm] rmcd*) - -NEWFS=		newfs -b 4096 -c 80 -f 512 -m 0 -o space -u 0 -t 0 -ZIPNSPLIT=	gzip --no-name -9 -c | split -b 240640 - -  MTREE=	BSD.local.dist BSD.root.dist BSD.usr.dist BSD.var.dist  NAMEDB=	PROTO.localhost.rev named.boot named.root make-localhost  PPPCNF= ppp.conf.filter.sample ppp.conf.iij ppp.conf.sample \  	ppp.linkup.sample ppp.secret.sample -PCS=	pcs750.bin -WCS1=	wcs fppwcs poc poc1 poc2 fppoc -WCS2=	fpevent fppwcs fppwcs_dual hdcwcs load_diags start_fpp wcs wcs_dual  # Special top level files for FreeBSD  COPYRIGHT=	COPYRIGHT  FREEBSD=  FREEBSD+=	${COPYRIGHT} -# -# Floppy drive name, mount point, type and parameters for building Floppies -FLOPPY?=	fd0 -MOUNT?=		/mnt -FLOPPY_TYPE?=	fd1440 -FLOPPY_BS?=	18b -FLOPPY_TRACKS?=	160 -# -MDEC=		usr/mdec/bootfd usr/mdec/fdboot -MDEC+=		usr/mdec/bootsd usr/mdec/sdboot -MDEC+=		usr/mdec/bootwd usr/mdec/wdboot -# -KC_DIRS=	bin dev mnt sbin etc -KC_FILES=	${COPYRIGHT} -KC_LINKS=	bin/[ bin/cp bin/echo bin/sh bin/test -KC_LINKS+=	sbin/fsck sbin/halt sbin/init -KC_LINKS+=	sbin/mount sbin/mount_cd9660 -KC_LINKS+=	sbin/umount -# -CD_DIRS=	etc usr -# -FILESYSTEM_DIRS=	bin dev etc mnt proc sbin usr usr/bin usr/mdec usr/sbin -FILESYSTEM_TREES=	dev -FILESYSTEM_FILES=	${COPYRIGHT} -FILESYSTEM_FILES+=	dev/MAKEDEV -FILESYSTEM_FILES+=	etc/group -FILESYSTEM_FILES+=	etc/master.passwd etc/passwd etc/pwd.db -FILESYSTEM_FILES+=	${MDEC} -FILESYSTEM_LINKS=	bin/[ bin/expr bin/ls bin/mkdir bin/rm -FILESYSTEM_LINKS+=	bin/sh bin/sync bin/test -FILESYSTEM_LINKS+=	sbin/disklabel sbin/fdisk sbin/halt sbin/init -FILESYSTEM_LINKS+=	sbin/mount -FILESYSTEM_LINKS+=	sbin/newfs -FILESYSTEM_LINKS+=	sbin/umount -FILESYSTEM_LINKS+=	usr/bin/cpio -FILESYSTEM_LINKS+=	usr/bin/gunzip usr/bin/gzcat usr/bin/gzip usr/bin/zcat -FILESYSTEM_LINKS+=	usr/sbin/bad144 -FILESYSTEM_CPIO=	.profile -FILESYSTEM_CPIO+=	root/.profile -FILESYSTEM_CPIO+=	bin/[ -FILESYSTEM_CPIO+=	bin/chmod bin/cat bin/cp bin/df bin/expr bin/ls -FILESYSTEM_CPIO+=	bin/ln bin/mkdir bin/mv bin/rm bin/sync -FILESYSTEM_CPIO+=	bin/test -FILESYSTEM_CPIO+=	etc/spwd.db -FILESYSTEM_CPIO+=	sbin/disklabel sbin/fdisk sbin/halt sbin/init -FILESYSTEM_CPIO+=	sbin/mount -FILESYSTEM_CPIO+=	sbin/newfs -FILESYSTEM_CPIO+=	sbin/umount -FILESYSTEM_CPIO_DIRS=	root - -CPIO_FILES=	${COPYRIGHT} -CPIO_CPIO=	bin/dd bin/ps bin/pwd bin/stty -CPIO_CPIO+=	etc/protocols etc/remote etc/services -CPIO_CPIO+=	etc/termcap -CPIO_CPIO+=	sbin/dmesg -CPIO_CPIO+=	sbin/ifconfig sbin/fsck sbin/mknod sbin/mount_cd9660 -CPIO_CPIO+=	sbin/mount_procfs -CPIO_CPIO+=	sbin/reboot sbin/route sbin/slattach -CPIO_CPIO+=	usr/bin/awk usr/bin/chgrp usr/bin/cpio usr/bin/ex usr/bin/ftp -CPIO_CPIO+=	usr/bin/gunzip usr/bin/gzcat usr/bin/gzip -CPIO_CPIO+=	usr/bin/more usr/bin/tar usr/bin/tip -CPIO_CPIO+=	usr/bin/vi usr/bin/view usr/bin/zcat -CPIO_CPIO+=	usr/lib/libc.so.* -CPIO_CPIO+=	usr/lib/libcurses.so.* -CPIO_CPIO+=	usr/lib/libgcc.so.* -CPIO_CPIO+=	usr/lib/libm.so.* -CPIO_CPIO+=	usr/lib/libtermcap.so.* -CPIO_CPIO+=	usr/lib/libutil.so.* -CPIO_CPIO+=	usr/libexec/ld.so -CPIO_CPIO+=	usr/sbin/bad144 usr/sbin/chown -CPIO_CPIO+=	usr/share/misc/termcap -CPIO_CPIO_DIRS=		tmp usr/lib usr/libexec usr/share usr/share/misc -CPIO_CPIO_DIRS+=	var var/tmp var/run var/spool var/spool/lock - -SCRYPT_LIB=	lib/libcrypt -DESCRYPT_LIB=	secure/lib/libcrypt -CRYPT_SRCS=	bin/ed bin/rcp -CRYPT_SRCS+=	sbin/init -.if !defined(NOCRYPT) -CRYPT_SRCS+=	secure -.endif -CRYPT_DIRS=	bin sbin usr usr/bin usr/lib +# Compatibility stuff, remove those links  LATIN1LINKS = \  	da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES fi_FI \  	fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT nl_BE nl_NL no_NO \ @@ -138,24 +39,6 @@ LATIN1LINKS = \  all depend etc install lint: -scrypt: -	rm -f ${LIBCRYPT}; -	(cd ${.CURDIR}/../${SCRYPT_LIB}; \ -		${MAKE} cleandir obj depend all install) -	for i in ${CRYPT_SRCS}; do \ -		cd ${.CURDIR}/../$$i; \ -		${MAKE} cleandir obj depend all; \ -	done - -descrypt: -	rm -f ${LIBCRYPT}; -	(cd ${.CURDIR}/../${DESCRYPT_LIB}; \ -		${MAKE} cleandir obj depend all install) -	for i in ${CRYPT_SRCS}; do \ -		cd ${.CURDIR}/../$$i; \ -		${MAKE} cleandir obj depend all; \ -	done -  distribute:  	cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/bin @@ -174,6 +57,12 @@ distribution:  	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev )  	(cd ${DESTDIR}/dev; sh MAKEDEV all) ;  	(cd ${.CURDIR}/root; \ +		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 dot.fvwmrc \ +		    ${DESTDIR}/root/.fvwmrc; \ +		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 dot.Xdefaults \ +		    ${DESTDIR}/root/.Xdefaults; \ +		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 dot.xsession \ +		    ${DESTDIR}/root/.xsession; \  		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 dot.cshrc \  		    ${DESTDIR}/root/.cshrc; \  		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 dot.klogin \ @@ -203,6 +92,8 @@ distribution:  	    ${DESTDIR}/var/log/lastlog  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \  	    ${DESTDIR}/var/log/messages +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ +	    ${DESTDIR}/var/log/slip.log  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \  	    ${DESTDIR}/var/log/wtmp  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ @@ -215,7 +106,7 @@ distribution:  	    ${MAKE} install; \  	 cd ../cf/cf; \  	    ${MAKE} obj; \ -	    ${MAKE} freefall.cf; \ +	    ${MAKE} freebsd.cf; \  	    ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 obj/freebsd.cf \  		${DESTDIR}/etc/sendmail.cf)  	(cd ${.CURDIR}/..; \ @@ -223,223 +114,19 @@ distribution:  		${DESTDIR}/)  	(cd ${.CURDIR}/../share/man; ${MAKE} makedb; ) -crunch: -	crunchgen ${.CURDIR}/../usr.sbin/crunch/examples/kcopy.conf -	${MAKE} -f kcopy.mk objs exe -	crunchgen ${.CURDIR}/../usr.sbin/crunch/examples/filesystem.conf -	${MAKE} -f filesystem.mk objs exe - -extract: -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \ -	    ${.CURDIR}/etc.i386/EXTRACT_bin.sh \ -	    ${RELEASEDIR}/tarballs/bin/EXTRACT.sh -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \ -	    ${.CURDIR}/etc.i386/EXTRACT_src.sh \ -	    ${RELEASEDIR}/tarballs/bin/EXTRACT.sh -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \ -	    ${.CURDIR}/etc.i386/EXTRACT_secr.sh \ -	    ${RELEASEDIR}/tarballs/bin/EXTRACT.sh - -hcx9-distribution: -	(cd ${.CURDIR}/etc.tahoe; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} \ -	    -m 444 ${WCS2} ${DESTDIR}/) - -kcopy-kernels: ${.CURDIR}/../sys/i386/conf/GENERIC -	(cd ${.CURDIR}/../sys/compile; rm -rf GENERIC) -	(cd ${.CURDIR}/../sys/i386/conf; config GENERIC) -	(cd ${.CURDIR}/../sys/compile/GENERIC; ${MAKE} depend; ${MAKE} all; \ -	    ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 kernel \ -	        ${DESTDIR}/kernel.GENERIC) - -kcopy-floppy: -	echo y | fdformat ${FLOPPY} -	disklabel -w -r -B -b ${DESTDIR}/usr/mdec/fdboot \ -		-s ${DESTDIR}/usr/mdec/bootfd ${FLOPPY} ${FLOPPY_TYPE} -	${NEWFS} -i 8192 r${FLOPPY} ${FLOPPY_TYPE} -	mount /dev/${FLOPPY} ${MOUNT} -	chown ${BINOWN}.${BINGRP} ${MOUNT}/. -	chmod 755 ${MOUNT}/. -	(cd ${DESTDIR}/; \ -	    ls -d ${KC_DIRS} | cpio -pdamuv ${MOUNT}) -	${MAKEDEVS} -	(cd ${DESTDIR}/; \ -	    ls ${KC_FILES} | cpio -pdamuv ${MOUNT}) -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \ -	    ${.CURDIR}/etc.i386/kc.profile ${MOUNT}/etc/rc -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \ -	    kcopy ${MOUNT}/bin/kcopy -	(cd ${MOUNT}/; \ -	    for i in ${KC_LINKS}; do \ -		ln bin/kcopy $$i; \ -	    done) - -kcopy.flp: -	(cd ${.CURDIR}; ${MAKE} kcopy-floppy) -	(cd ${.CURDIR}/../sys/compile/GENERIC; \ -	    ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 kernel ${MOUNT}/) -	df -ik ${MOUNT} -	# XXX umount is returning 1 for some reason :-( -	-umount /dev/${FLOPPY} -	fsck /dev/r${FLOPPY} -	dd if=/dev/r${FLOPPY} of=${RELEASEDIR}/floppies/kcopy.flp \ -		bs=${FLOPPY_BS} count=${FLOPPY_TRACKS} -	gzip --no-name -9 -c ${RELEASEDIR}/floppies/kcopy.flp \ -		>${RELEASEDIR}/floppies/kcopy.flp.gz & - -cdins-floppy: -	(cd ${.CURDIR}; ${MAKE} kcopy-floppy) -	(cd ${DESTDIR}/; \ -	    ls -d ${CD_DIRS} | cpio -pdamuv ${MOUNT}) -	(cd ${MOUNT}/usr; \ -	    ln -s /cdrom/filesys/usr/libexec libexec; \ -	    ln -s /cdrom/filesys/usr/lib lib) -	mkdir ${MOUNT}/cdrom -	chown ${BINOWN}.${BINGRP} ${MOUNT}/cdrom -	chmod 755 ${MOUNT}/cdrom -	#${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \ -	#    ${.CURDIR}/etc.i386/cdinst1.profile ${MOUNT}/.profile -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \ -	    ${.CURDIR}/etc.i386/cdinst1.install ${MOUNT}/install -	ln ${MOUNT}/install ${MOUNT}/etc/rc - -cdins.flp: -	(cd ${.CURDIR}; ${MAKE} kcopy-floppy) -	(cd ${.CURDIR}/../sys/compile/GENERIC; \ -	    ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 kernel ${MOUNT}/) -	df -ik ${MOUNT} -	# XXX umount is returning 1 for some reason :-( -	-umount /dev/${FLOPPY} -	fsck /dev/r${FLOPPY} -	dd if=/dev/r${FLOPPY} of=${RELEASEDIR}/floppies/cdins.flp \ -		bs=${FLOPPY_BS} count=${FLOPPY_TRACKS} -	gzip --no-name -9 -c ${RELEASEDIR}/floppies/cdins.flp \ -		>${RELEASEDIR}/floppies/cdins.flp.gz & - -filesyst.flp: -	echo y | fdformat ${FLOPPY} -	disklabel -w -r -B -b ${DESTDIR}/usr/mdec/fdboot \ -		-s ${DESTDIR}/usr/mdec/bootfd ${FLOPPY} ${FLOPPY_TYPE} -	${NEWFS} -i 10240 r${FLOPPY}  ${FLOPPY_TYPE} -	mount /dev/${FLOPPY}  ${MOUNT} -	chown ${BINOWN}.${BINGRP} ${MOUNT}/. -	chmod 755 ${MOUNT}/. -	(cd ${DESTDIR}/; \ -	    ls -d ${FILESYSTEM_DIRS} | cpio -pdamuv ${MOUNT}) -	${MAKEDEVS} -	(cd ${DESTDIR}/; \ -	    ls ${FILESYSTEM_FILES} | cpio -pdamuv ${MOUNT}; \ -	    (find ${FILESYSTEM_CPIO}; ls -d ${FILESYSTEM_CPIO_DIRS}) | \ -		cpio -H newc --block-size=16 -oav | \ -		gzip -9 >${MOUNT}/inst1.cpio.gz) -	#${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \ -	#    ${.CURDIR}/etc.i386/inst1.profile ${MOUNT}/.profile -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \ -	    ${.CURDIR}/etc.i386/inst1.install ${MOUNT}/install -	ln ${MOUNT}/install ${MOUNT}/etc/rc -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \ -	    filesystem ${MOUNT}/bin/filesystem -	(cd ${MOUNT}/; \ -	    for i in ${FILESYSTEM_LINKS}; do \ -		ln bin/filesystem $$i; \ -	    done) -	(cd ${MOUNT}/; \ -	    ls ${FILESYSTEM_FILES} >/tmp/filelist; \ -	    ls ${FILESYSTEM_LINKS} >>/tmp/filelist; \ -	    ls -d ${FILESYSTEM_DIRS} >>/tmp/filelist; \ -	    find ${FILESYSTEM_TREES} >>/tmp/filelist; \ -	    sort -u -r /tmp/filelist >filelist; \ -	    rm /tmp/filelist) -	df -ik ${MOUNT} -	# XXX umount is returning 1 for some reason :-( -	-umount /dev/${FLOPPY} -	fsck /dev/r${FLOPPY} -	dd if=/dev/r${FLOPPY} of=${RELEASEDIR}/floppies/filesyst.flp \ -		bs=${FLOPPY_BS} count=${FLOPPY_TRACKS} -	gzip --no-name -9 -c ${RELEASEDIR}/floppies/filesyst.flp \ -		>${RELEASEDIR}/floppies/filesyst.flp.gz & - -cpio.flp: -	echo y | fdformat ${FLOPPY} -	disklabel -w -r -B -b ${DESTDIR}/usr/mdec/fdboot \ -		-s ${DESTDIR}/usr/mdec/bootfd ${FLOPPY} ${FLOPPY_TYPE} -	${NEWFS} -i 65536 r${FLOPPY}  ${FLOPPY_TYPE} -	mount /dev/${FLOPPY} ${MOUNT} -	chown ${BINOWN}.${BINGRP} ${MOUNT}/. -	chmod 755 ${MOUNT}/. -	(cd ${DESTDIR}/; \ -		ls ${CPIO_FILES} | cpio -pdamuv ${MOUNT}) -	# -	# XXX This ugliness is because the default termcap file is simply too -	# big and we don't need such a hugh one for the initial installation, -	# yet we want the symlink in /etc to point to the right place so we -	# need to install the smaller one in the same location. -	# -	mv ${DESTDIR}/usr/share/misc/termcap ${DESTDIR}/usr/share/misc/otermcap -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \ -	    ${.CURDIR}/termcap.small ${DESTDIR}/usr/share/misc/termcap -	(cd ${DESTDIR}/; \ -	    (find ${CPIO_CPIO}; ls -d ${CPIO_CPIO_DIRS}) | \ -		cpio -H newc --block-size=16 -oav | \ -		gzip -9 >${MOUNT}/inst2.cpio.gz) -	# XXX cpio is done, put everything back in shape for the bindist. -	mv ${DESTDIR}/usr/share/misc/otermcap ${DESTDIR}/usr/share/misc/termcap -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \ -	    ${.CURDIR}/etc.i386/cpio.rc ${MOUNT}/rc -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \ -	    ${.CURDIR}/etc.i386/cpio.install ${MOUNT}/install -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \ -	    ${.CURDIR}/etc.i386/cpio.magic ${MOUNT}/magic -	df -ik ${MOUNT} -	# XXX umount is returning 1 for some reason :-( -	-umount /dev/${FLOPPY} -	fsck /dev/r${FLOPPY} -	dd if=/dev/r${FLOPPY} of=${RELEASEDIR}/floppies/cpio.flp \ -		bs=${FLOPPY_BS} count=${FLOPPY_TRACKS} -	gzip --no-name -9 -c ${RELEASEDIR}/floppies/cpio.flp \ -		>${RELEASEDIR}/floppies/cpio.flp.gz & - -bin-tarball: -	(cd ${DESTDIR}; \ -		mkdir -p ${RELEASEDIR}/tarballs/bin; \ -		tar cf - . | \ -		${ZIPNSPLIT} ${RELEASEDIR}/tarballs/bin/bin.) - -des-tarball: -	rm -rf ${RELEASEDIR}/tmpdes -	mkdir ${RELEASEDIR}/tmpdes -	for i in ${CRYPT_DIRS}; do \ -		cd ${RELEASEDIR}/tmpdes; \ -		mkdir $$i; \ -		chown ${BINOWN}.${GRPOWN} $$i; \ -		chmod 755 $$i; \ -	done -	# This is ugly, it force installs a /usr/lib/libcrypt.a so -	# that the other makes will be built with des. -	# -	(set -x ; cd ${.CURDIR}/../${DESCRYPT_LIB}; \ -		NOCRYPT=; \ -		unset NOCRYPT; \ -		DESTDIR=; export DESTDIR; \ -		${MAKE} cleandir obj depend all install; \ -		NOMAN=noman; export NOMAN; \ -		DESTDIR=${RELEASEDIR}/tmpdes; export DESTDIR; \ -		${MAKE} cleandir obj depend all install) -	for i in ${CRYPT_SRCS}; do \ -		NOCRYPT=; \ -		unset NOCRYPT; \ -		DESTDIR=${RELEASEDIR}/tmpdes; export DESTDIR; \ -		NOMAN=noman; export NOMAN; \ -		cd ${.CURDIR}/../$$i; \ -		${MAKE} cleandir obj depend all install; \ -	done -	(cd ${RELEASEDIR}/tmpdes; \ -		tar cf - . | \ -			${ZIPNSPLIT} ${RELEASEDIR}/tarballs/des/des_tgz.) -	rm -rf ${RELEASEDIR}/tmpdes -  distrib-dirs:  	mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/  	mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var +# Compatibility stuff, remove obsoleted links, if exists +	if [ -d	${DESTDIR}/usr/share/locale ] ;	\ +	then \ +		cd ${DESTDIR}/usr/share/locale;	\ +		for l in ${LATIN1LINKS}	; do \ +			if [ -h $$l.ISO_8859-1 ]; then \ +				rm $$l.ISO_8859-1; \ +			fi ; \ +		done; \ +	fi  	mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr  	mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \  		-p ${DESTDIR}/usr/include @@ -448,19 +135,34 @@ distrib-dirs:  .endif  	cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys  	cd ${DESTDIR}/usr/share/locale; \ -	for l in ${LATIN1LINKS} ; do \ -		rm -rf $$l.ISO_8859-1; \ -		ln -s lt_LN.ISO_8859-1 $$l.ISO_8859-1; \ +	set - `cat ${.CURDIR}/locale.alias`; \ +	while [ $$# -gt 0 ] ; \ +	do \ +		rm -rf "$$1"; \ +		ln -s "$$2" "$$1"; \ +		shift; shift; \  	done - -floppies:	kcopy.flp filesyst.flp cpio.flp cdins.flp - -release:	release-dirs distribution crunch extract kcopy-kernels \ -		floppies bin-tarball des-tarball clean - -release-dirs: -	chflags -R noschg ${RELEASEDIR}/ -	rm -rf ${RELEASEDIR}/* -	mtree -d -U -f ${.CURDIR}/mtree/BSD.release.dist -p ${RELEASEDIR} +	cd ${DESTDIR}/usr/share/nls; \ +	set - `cat ${.CURDIR}/locale.alias`; \ +	while [ $$# -gt 0 ] ; \ +	do \ +		rm -rf "$$1"; \ +		ln -s "$$2" "$$1"; \ +		shift; shift; \ +	done; \ +	rm -rf POSIX; \ +	ln -s C POSIX +.if defined(MAKE_LOCAL) +	cd ${DESTDIR}/usr/local/share/nls; \ +	set - `cat ${.CURDIR}/locale.alias`; \ +	while [ $$# -gt 0 ] ; \ +	do \ +		rm -rf "$$1"; \ +		ln -s "$$2" "$$1"; \ +		shift; shift; \ +	done; \ +	rm -rf POSIX; \ +	ln -s C POSIX +.endif  .include <bsd.prog.mk> diff --git a/etc/aliases b/etc/aliases index 0b5ed72c7e30..6f7172b52dff 100644 --- a/etc/aliases +++ b/etc/aliases @@ -28,3 +28,6 @@ uucp:	root  # manager:  # dumper:  # operator: + +# msgs: "| /usr/bin/msgs -s" + diff --git a/etc/crontab b/etc/crontab index 9ef7abd8114f..bb7a6378a81e 100644 --- a/etc/crontab +++ b/etc/crontab @@ -1,6 +1,6 @@  # /etc/crontab - root's crontab for FreeBSD  # -# $Id: crontab,v 1.9 1994/11/02 09:50:11 ache Exp $ +# $Id: crontab,v 1.10 1995/05/27 01:55:21 ache Exp $  # From: Id: crontab,v 1.6 1993/05/31 02:03:57 cgd Exp  #  SHELL=/bin/sh @@ -12,7 +12,7 @@ HOME=/var/log  */5     *       *       *       *       root	/usr/libexec/atrun  #  # rotate log files every hour, if necessary -#0	*	*	*	*	root	/usr/bin/newsyslog +0	*	*	*	*	root	/usr/sbin/newsyslog  #  # do daily/weekly/monthly maintenance  0       2       *       *       *       root    /etc/daily 2>&1 | sendmail root diff --git a/etc/csh.login b/etc/csh.login index 178e35143f2b..e0954fb1af86 100644 --- a/etc/csh.login +++ b/etc/csh.login @@ -2,12 +2,10 @@  # Uncomment this to give you the default 4.2 behavior, where disk   # information is shown in K-Blocks  # setenv BLOCKSIZE	K -# Uncomment next line if you want to setup your 8-bit locale at program -# startup automatically -# See also rc and profile -# setenv ENABLE_STARTUP_LOCALE -# Uncomment this line to activate russian locale +# Uncomment this line to activate Russian locale  # setenv LANG ru_SU.KOI8-R -# Uncomment this line to activate italian locale +# Uncomment this line to activate Italian locale  # setenv LANG it_IT.ISO_8859-1  # For full locales list check /usr/share/locale/* +# Read system messages +# msgs -f diff --git a/etc/daily b/etc/daily index 01be2a03fea8..423063e5c29c 100644 --- a/etc/daily +++ b/etc/daily @@ -30,37 +30,54 @@ cd /tmp  #	   -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \  #		-a -atime +3 -exec rm -f -- {} \;  # + +# remove system	messages older than 21 days  msgs -c +  if [ -f /etc/news.expire ]; then  	/etc/news.expire  fi -if [ -d /var/account ] ; then +if [ -f /var/account/acct ] ; then  	echo "" -	echo "Purging accounting records:" +	echo "Gathering accounting statistics:"  	cd /var/account  	if [ -f acct.2 ] ; then mv -f acct.2 acct.3 ; fi  	if [ -f acct.1 ] ; then mv -f acct.1 acct.2 ; fi  	if [ -f acct.0 ] ; then mv -f acct.0 acct.1 ; fi -	if [ -f acct ] ; then -		cp -pf acct acct.0 -		sa -s > /dev/null -	fi +	cp -pf acct acct.0 +	sa -s > /dev/null  fi  echo ""  echo "Backup passwd and group files:" +if [ ! -f $bak/master.passwd.bak ] ; then +	echo "no $bak/master.passwd.bak" +	cp -p /etc/master.passwd $bak/master.passwd.bak +fi  if cmp -s $bak/master.passwd.bak /etc/master.passwd; then :; else  	echo "$host passwd diffs:"  	diff $bak/master.passwd.bak /etc/master.passwd  	mv $bak/master.passwd.bak $bak/master.passwd.bak2  	cp -p /etc/master.passwd $bak/master.passwd.bak  fi +if [ ! -f $bak/group.bak ] ; then +	echo "no $bak/group.bak" +	cp -p /etc/group $bak/group.bak +fi  if cmp -s $bak/group.bak /etc/group; then :; else +	echo "$host group diffs:" +	diff $bak/group.bak /etc/group  	mv $bak/group.bak $bak/group.bak2  	cp -p /etc/group $bak/group.bak  fi +if [ ! -f $bak/aliases.bak ] ; then +	echo "no $bak/aliases.bak" +	cp -p /etc/aliases $bak/aliases.bak +fi  if cmp -s $bak/aliases.bak /etc/aliases; then :; else +	echo "$host aliases diffs:" +	diff $bak/aliases.bak /etc/aliases  	mv $bak/aliases.bak $bak/aliases.bak2  	cp -p /etc/aliases $bak/aliases.bak  fi @@ -75,23 +92,6 @@ echo ""  echo "Running calendar:"  calendar -a -echo "" -echo "Rotating mail log:" -cd /var/log -rm -f maillog.7 -if [ -f maillog.6 ]; then mv -f maillog.6  maillog.7; fi -if [ -f maillog.5 ]; then mv -f maillog.5  maillog.6; fi -if [ -f maillog.4 ]; then mv -f maillog.4  maillog.5; fi -if [ -f maillog.3 ]; then mv -f maillog.3  maillog.4; fi -if [ -f maillog.2 ]; then mv -f maillog.2  maillog.3; fi -if [ -f maillog.1 ]; then mv -f maillog.1  maillog.2; fi -if [ -f maillog.0 ]; then mv -f maillog.0  maillog.1; fi -mv -f maillog maillog.0 -cp /dev/null maillog -chmod 644    maillog -kill -1 `cat /var/run/syslog.pid` -cd / -  if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then  	echo ""  	echo "Cleaning up UUCP:" @@ -123,7 +123,9 @@ echo ""  echo "network:"  netstat -i  echo "" -ruptime +if [ -d /var/rwho ] ; then +	ruptime +fi  echo ""  if [ -f /etc/Distfile ]; then diff --git a/etc/etc.i386/MAKEDEV b/etc/etc.i386/MAKEDEV index c2fb329d2951..fdba56c0d89d 100644 --- a/etc/etc.i386/MAKEDEV +++ b/etc/etc.i386/MAKEDEV @@ -36,14 +36,14 @@  #		via the floppy disk controller)  #  # Disks: -#	wd*	"winchester" disk drives (ST506,IDE,ESDI,RLL,...) +#	wd*	"Winchester" disk drives (ST506,IDE,ESDI,RLL,...)  #	fd*	"floppy" disk drives (3 1/2", 5 1/4") -#	sd*	"scsi disks" -#	cd*	"scsi cdrom disks" -#	mcd*	"mitsumi cdrom disks" -#	scd*	"sony cdrom disks" -#	matcd*	"Matsushita (panasonic) cdrom disks" -#	wcd*	"IDE cdrom disks" +#	sd*	"SCSI disks" +#	cd*	"SCSI CD-ROM disks" +#	mcd*	"Mitsumi CD-ROM disks" +#	scd*	"Sony CD-ROM disks" +#	matcd*	"Matsushita (Panasonic) CD-ROM disks" +#	wcd*	"IDE CD-ROM disks"  #	vn*	"vnode disks"  #	od*	"optical disks"  # @@ -77,27 +77,29 @@  #	worm*	WORM driver  #	pt*	Processor Type (HP scanner, as one example)  # +# PC-CARD (previously called PCMCIA) support +#	card*	PC-CARD slots +#  # Special purpose devices: +#	apm	Advanced Power Management BIOS  #	bpf*	packet filter  #	speaker	pc speaker  #	tw*	xten power controller -#	snd*	various sound cards (generic entries) -#	gusmax	A GUS MAX sound card (does various snd* entries) -#	pas16	A ProAudio Spectrum 16 card (does various snd* entries) -#	sb	A sound blaster card (any type) +#	snd*	various sound cards  #	pcaudio PCM audio driver  #	socksys iBCS2 socket system driver  #	vat	VAT compatibility audio driver (requires snd*)  #	gsc	Genius GS-4500 hand scanner  #	joy	pc joystick  #	tun	Tunneling IP device -#	spigot	Video Spigot video aquisition card -#	meteor*	Matrox Meteor video aquisition card (pci) -#	qcam*	Connectix QuickCam parallel port camera +#	spigot	Video Spigot video acquisition card +#	meteor*	Matrox Meteor video acquisition card (pci) +#	qcam*	Connectix QuickCam(tm) parallel port camera  #	isdn*	ISDN devices  #	labpc*	National Instrument's Lab-PC and LAB-PC+ +#	perfmon	CPU performance-monitoring counters  # -#	$Id: MAKEDEV,v 1.95.4.10 1996/05/03 06:02:41 asami Exp $ +#	$Id: MAKEDEV,v 1.95.4.11 1996/05/04 07:18:45 pst Exp $  #  PATH=/sbin:/bin/:/usr/bin:/usr/sbin: @@ -158,6 +160,10 @@ dkrawslice=1  # Control bit for SCSI  scsictl=536870912 +# Standard umasks +disk_umask=037			# allow group operator to read disks +tape_umask=017			# allow group operator to read/write tapes +  for i  do  case $i in @@ -165,26 +171,28 @@ case $i in  all)  	sh MAKEDEV std						# standard  	sh MAKEDEV wd0 wd1 wd2 wd3 fd0 fd1 sd0 sd1 sd2 sd3	# bdev, disk -	sh MAKEDEV cd0 mcd0 scd0 matcd0	wcd0			# bdev, cdrom +	sh MAKEDEV cd0 mcd0 scd0 matcd0 wcd0			# bdev, cdrom  	sh MAKEDEV ft0 wt0 st0					# bdev, tape  	sh MAKEDEV ttyd0 ttyd1 ttyd2 ttyd3			# cdev, serial  	sh MAKEDEV cuaa0 cuaa1 cuaa2 cuaa3			# cdev, serial  	sh MAKEDEV lpt0 lpt1 lpt2				# cdev, printer  	sh MAKEDEV pty0 ch0 tw0 bpf0				# cdev -	sh MAKEDEV speaker pcaudio psm0 mse0			# cdev +	sh MAKEDEV perfmon speaker pcaudio psm0 mse0		# cdev  	sh MAKEDEV vty4						# cdev  	sh MAKEDEV tun0						# cdev  	;;  std) -	rm -f console drum mem kmem null zero io tty klog stdin stdout stderr -	rm -f lkm +	rm -f console drum mem kmem null random urandom zero io tty klog +	rm -f stdin stdout stderr lkm  	mknod console	c 0 0;	chmod 600 console;	chown root.wheel console  	mknod drum	c 4 0;	chmod 640 drum;		chown root.kmem drum  	mknod kmem	c 2 1;	chmod 640 kmem;		chown root.kmem kmem  	mknod mem	c 2 0;	chmod 640 mem;		chown root.kmem mem  	mknod null	c 2 2;	chmod 666 null;		chown root.wheel null +	mknod random	c 2 3;	chmod 644 random;	chown root.wheel random +	mknod urandom	c 2 4;	chmod 644 urandom;	chown root.wheel urandom  	mknod zero	c 2 12;	chmod 666 zero;		chown root.wheel zero -	mknod io	c 2 14;	chmod 640 io;		chown root.kmem io +	mknod io	c 2 14;	chmod 600 io;		chown root.wheel io  	mknod tty	c 1 0;	chmod 666 tty;		chown root.wheel tty  	mknod klog	c 7 0;	chmod 600 klog;		chown root.wheel klog  	mknod stdin	c 22 0; chmod 666 stdin;	chown root.wheel stdin @@ -211,7 +219,7 @@ mach-4)  # Create device files for new Archive/Wangtek QIC-02 tape driver (vak)  wt*) -	umask 7 +	umask $tape_umask  	u=`expr $i : '..\(.*\)'`  	if [ x$u = x ]; then u=0; fi  	rm -f r[Ww]t$u nr[Ww]t$u r[Ww]t$u[a-f] nr[Ww]t$u[a-f] @@ -234,13 +242,13 @@ wt*)  	;;  # Individual slices. -sd*s*|vn*s*|wd*s*|od*s*) -	umask 37 +od*s*|sd*s*|vn*s*|wd*s*) +	umask $disk_umask  	case $i in +	od*s*) name=od; blk=20; chr=70;;  	sd*s*) name=sd; blk=4;  chr=13;;  	wd*s*) name=wd; blk=0;  chr=3;;  	vn*s*) name=vn; blk=15; chr=43;; -	od*s*) name=od; blk=20; chr=70;;  	esac  	unit=`expr $i : '..\([0-9]*\)s'`  	slice=`expr $i : '..[0-9]*s\([0-9]*\)'` @@ -293,7 +301,7 @@ sd*s*|vn*s*|wd*s*|od*s*)  	;;  fd*) -	umask 2 +	umask $disk_umask  	unit=`expr $i : '..\(.*\)'`  	name=fd; blk=2; chr=9  	rm -f $name$unit* r$name$unit* @@ -368,7 +376,6 @@ fd*)  		# ln r${name}${unit}.360 r${name}${unit}48ds9  		chgrp operator ${name}${unit}* r${name}${unit}* -		chmod 640 ${name}${unit}* r${name}${unit}*  		;;  	*)  		echo bad unit for disk in: $i @@ -377,9 +384,8 @@ fd*)  	umask 77  	;; -  ft*) -	umask 2 +	umask $tape_umask  	unit=`expr $i : '..\(.*\)'`  	name=ft; blk=2; chr=9  	rm -f $name$unit* r$name$unit* @@ -390,7 +396,6 @@ ft*)  		ln ${name}${unit} ${name}${unit}a  		ln r${name}${unit} r${name}${unit}a  		chgrp operator ${name}${unit}* r${name}${unit}* -		chmod 640 ${name}${unit}* r${name}${unit}*  		;;  	*)  		echo bad unit for tape in: $i @@ -399,13 +404,13 @@ ft*)  	umask 77  	;; -sd*|vn*|wd*|od*) -	umask 37 +od*|sd*|vn*|wd*) +	umask $disk_umask  	case $i in +	od*) name=od; blk=20; chr=70;;  	sd*) name=sd; blk=4;  chr=13;; -	wd*) name=wd; blk=0;  chr=3;;  	vn*) name=vn; blk=15; chr=43;; -	od*) name=od; blk=20; chr=70;; +	wd*) name=wd; blk=0;  chr=3;;  	esac  	unit=`expr $i : '..\(.*\)'`  	case $unit in @@ -415,7 +420,7 @@ sd*|vn*|wd*|od*)  			sh MAKEDEV $name$unit$slicepartname  		done  		case $name in -		sd|od) +		od|sd)  			rm -f r${name}${unit}.ctl  			mknod r${name}${unit}.ctl c $chr `expr $unit '*' 8 + $scsictl `  			chmod 600 r${name}${unit}.ctl @@ -473,7 +478,6 @@ worm*)  	mknod r${name}${unit} c $chr ${unit}  	rm -f r${name}${unit}.ctl  	mknod r${name}${unit}.ctl c $chr `expr $unit + $scsictl ` -	chmod 600 r${name}${unit}.ctl  	;;  # SCSI processor type driver @@ -489,7 +493,6 @@ pt[0-9]*)  	mknod ${name}${unit} c $chr $unit  	rm -f ${name}${unit}.ctl  	mknod ${name}${unit}.ctl c $chr `expr $unit + $scsictl ` -	chmod 600 ${name}${unit}.ctl  	;;  pty*) @@ -529,7 +532,7 @@ pty*)  	;;  st*) -	umask 2 +	umask $tape_umask  	unit=`expr $i : '..\(.*\)'`  	chr=14 @@ -553,10 +556,7 @@ st*)  					nrst${unit}.${mode} \  					erst${unit}.${mode} \  					st${unit}ctl.${mode} -			chmod 640	rst${unit}.${mode}\ -					nrst${unit}.${mode} \ -					erst${unit}.${mode} -			chmod 660	st${unit}ctl.${mode} +			chmod 600	st${unit}ctl.${mode}  		done  		rm -f rst${unit}.ctl  		mknod rst${unit}.ctl c $chr `expr $unit '*' 16 + $scsictl ` @@ -574,7 +574,7 @@ st*)  	;;  ch*) -	umask 2 +	umask 37  	unit=`expr $i : '..\(.*\)'`  	case $i in  	ch*) name=ch;  chr=17;; @@ -584,7 +584,6 @@ ch*)  	0|1|2|3|4|5|6)  		mknod ${name}${unit}	c $chr `expr $unit '*' 16 + 0`  		chgrp operator ${name}${unit} -		chmod 640 ${name}${unit}  		rm -f r${name}${unit}.ctl  		mknod r${name}${unit}.ctl c $chr `expr $unit '*' 16 + $scsictl `  		chmod 600 r${name}${unit}.ctl @@ -597,7 +596,7 @@ ch*)  	;;  cd*|mcd*|scd*) -	umask 2 +	umask $disk_umask  	case $i in  	cd*) unit=`expr $i : '..\(.*\)'`; name=cd; blk=6; chr=15;;  	mcd*) unit=`expr $i : '...\(.*\)'`; name=mcd; blk=7; chr=29;; @@ -611,7 +610,6 @@ cd*|mcd*|scd*)  		mknod r${name}${unit}a	c $chr `expr $unit '*' 8 + 0`  		mknod r${name}${unit}c	c $chr `expr $unit '*' 8 + 2`  		chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h] -		chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]  		case $name in  		cd)  			rm -f r${name}${unit}.ctl @@ -892,7 +890,8 @@ mouse*)  	if [ ! -c $name ]; then  		$0 $name			# make the appropriate device  	fi -	ln -fs $name mouse +	rm -f mouse +	ln -s $name mouse  	;;  pcaudio) @@ -914,7 +913,7 @@ socksys)  snd*)  #  # changes from Linux voxware -# minor		linux			freebsd +# minor		Linux			FreeBSD  # 8		sequencer2 (aka music0)	music0  # 17		patmgr0			sequencer1  # 33		patmgr1			sequencer2 @@ -928,13 +927,13 @@ snd*)  	umask $snd_security_hole  	if [ $unit = "0" ] ; then -		ln -fs mixer$unit mixer -		ln -fs sequencer$unit sequencer -		ln -fs dsp$unit dsp -		ln -fs audio$unit audio -		ln -fs dspW$unit dspW -		ln -fs music$unit music -		ln -fs pss$unit pss +		rm -f mixer     ; ln -s mixer$unit mixer +		rm -f sequencer ; ln -s sequencer$unit sequencer +		rm -f dsp       ; ln -s dsp$unit dsp +		rm -f audio     ; ln -s audio$unit audio +		rm -f dspW      ; ln -s dspW$unit dspW +		rm -f music	; ln -s music$unit music +		rm -f pss       ; ln -s pss$unit pss  	fi  	rm -f mixer$unit	# Mixer	[ Control ] @@ -970,18 +969,6 @@ snd*)  	umask 77  	;; -# More specialized cases of snd driver. -gusmax) -	sh /dev/MAKEDEV snd0 snd1 snd2 -	ln -fs /dev/dsp2 /dev/dsp -	;; -pas16) -	sh /dev/MAKEDEV snd0 snd1 -	;; -sb) -	sh /dev/MAKEDEV snd0 -	;; -  vat)  	rm -f vatio  	mknod vatio c 25 128 @@ -1036,7 +1023,6 @@ cronyx)  	;;  joy) -	umask 2  	rm -f joy0 joy1  	mknod joy0 c 51 0  	mknod joy1 c 51 1 @@ -1061,6 +1047,7 @@ meteor?)  	unit=`expr $i : 'meteor\(.*\)'`  	rm -f meteor$unit  	mknod meteor$unit c 67 $unit +	chown root.wheel meteor$unit  	chmod 444 meteor$unit  	;; @@ -1177,6 +1164,10 @@ labpc*)  	umask 77  	;; +perfmon) +	mknod perfmon	c 2 32;	chmod 640 perfmon;	chown root.kmem perfmon +	;; +  local)  	umask 0			# XXX should be elsewhere  	sh MAKEDEV.local diff --git a/etc/etc.i386/disktab b/etc/etc.i386/disktab index b915c552d583..cf6105a1b346 100644 --- a/etc/etc.i386/disktab +++ b/etc/etc.i386/disktab @@ -183,3 +183,9 @@ sony650|Sony 650 MB MOD|\  	:ty=removable:dt=SCSI:se#512:nt#1:ns#31:nc#18600:ts#1:rm#4800:\  	:pc#576600:oc#0:\  	:pa#576600:oa#0:ta=4.2BSD:ba#8192:fa#1024: + +mta3230|mo230|IBM MTA-3230 230 Meg 3.5inch Magneto-Optical:\ +	:ty=removeable:dt=SCSI:rm#3600:\ +	:se#512:nt#64:ns#32:nc#216:sc#2048:su#444384:\ +	:pa#444384:oa#0:ba#4096:fa#0:ta=4.2BSD:\ +	:pc#444384:oc#0: diff --git a/etc/etc.i386/rc.i386 b/etc/etc.i386/rc.i386 index 05300419a482..0b98a9a71360 100644 --- a/etc/etc.i386/rc.i386 +++ b/etc/etc.i386/rc.i386 @@ -1,6 +1,6 @@  #!/bin/sh -  # -#	$Id: rc.i386,v 1.9.4.1 1995/07/27 14:07:03 rgrimes Exp $ +#	$Id: rc.i386,v 1.9.4.2 1996/01/29 14:47:03 gpalmer Exp $  #	Do i386 specific processing  # @@ -9,19 +9,21 @@ echo -n 'enabling FreeBSD/i386 options:'  # Start the SCO binary emulation if requested.  if [ "X${ibcs2}" = X"YES" ]; then  	echo -n ' ';		ibcs2 -	# XXX BOUGS - ibcs2 script shouldn't make any output on success +	# XXX BOGUS - ibcs2 script shouldn't make any output on success  fi  # Start the Linux binary emulation if requested.  if [ "X${linux}" = X"YES" ]; then -	echo -n ' ';            linux -	# XXX BOGUS - linux script shouldn't make any output on success +	echo -n ' ';		linux +	# XXX BOGUS - Linux script shouldn't make any output on success  fi  if [ "X${xtend}" != X"NO" -a -x /usr/libexec/xtend ]; then   	echo -n ' xtend';	/usr/libexec/xtend  fi +echo '.' +  ##########################################################################  ####### Syscons section						  ########  ########################################################################## @@ -30,20 +32,7 @@ fi  kbddev=/dev/ttyv0  viddev=/dev/ttyv0 -# don't change these, they're modified below -kbdadjust=NO -vidadjust=NO - -[ "X${keymap}" != X"NO" -o "X${keyrate}" != X"NO" \ -	-o "X${keychange}" != X"NO" ] && kbdadjust=YES -[ "X${scrnmap}" != X"NO" -o "X${font8x16}" != X"NO" -o \ -	"X${font8x14}" != X"NO" -o "X${font8x8}" != X"NO" -o \ -	"X${blanktime}" != X"NO" -o "X${cursor}" != X"NO" ] && vidadjust=YES - -[ "X${kbdadjust}" != X"NO" -o "X${vidadjust}" != X"NO" -o \ -	"X${saver}" != X"NO" ] && { echo; echo "configuring syscons:"; } - -[ "X${kbdadjust}" != X"NO" ] && echo -n ' [kbdcontrol:' +echo -n "configuring syscons:"  # keymap  if [ "X${keymap}" != X"NO" ]; then @@ -66,11 +55,6 @@ if [ "X${keychange}" != X"NO" ]; then  	done  fi -[ "X${kbdadjust}" != X"NO" ] && echo ']' - - -[ "X${vidadjust}" != X"NO" ] && echo -n ' [vidcontrol:' -  # cursor type  if [ "X${cursor}" != X"NO" ]; then  	echo -n ' cursor';	vidcontrol <${viddev} -c ${cursor} @@ -101,13 +85,20 @@ if [ "X${blanktime}" != X"NO" ]; then  	echo -n ' blank_time';	vidcontrol <${viddev} -t ${blanktime}  fi -[ "X${vidadjust}" != X"NO" ] && echo ']' -  # screen saver  if [ "X${saver}" != X"NO" ] ; then -	echo -n ' screensaver: ' -	modstat | grep _saver || modload -u -o /tmp/saver_mod -e \ -				 saver_init -q /lkm/${saver}_saver_mod.o +	echo -n ' screensaver' +	modstat | grep _saver || \ +		modload -u -o /tmp/saver_mod -q /lkm/${saver}_saver_mod.o  fi  echo '.' + +# interrupts for /dev/random device +if [ "X${rand_irqs}" != X"NO" ] ; then +	echo -n 'entropy source: ' +	rndcontrol ${rand_irqs} +fi + +echo '.' # probably bogus + diff --git a/etc/hosts b/etc/hosts index eb61507e5335..9ce3df033a6e 100644 --- a/etc/hosts +++ b/etc/hosts @@ -1,4 +1,4 @@ -# $Id: hosts,v 1.5 1995/04/09 09:54:39 rgrimes Exp $ +# $Id: hosts,v 1.5.4.1 1995/11/19 17:53:28 jkh Exp $  #  # Host Database  # This file should contain the addresses and aliases @@ -8,14 +8,12 @@  #  #  127.0.0.1		localhost localhost.my.domain -# for the no-configured-network case. -127.0.0.1		myname.my.domain  #  # Imaginary network.  #10.0.0.2		myname.my.domain myname  #10.0.0.3		myfriend.my.domain myfriend  # -# According to RFC 1597, you can use the following IP networks for +# According to RFC 1918, you can use the following IP networks for  # private nets which will never be connected to the Internet:  #  #	10.0.0.0	-   10.255.255.255 diff --git a/etc/inetd.conf b/etc/inetd.conf index 7460512f09d3..58486f0acc19 100644 --- a/etc/inetd.conf +++ b/etc/inetd.conf @@ -42,6 +42,8 @@ rkinit	stream	tcp	nowait	root	/usr/libexec/rkinitd	rkinitd  #rusersd/1-2	dgram	rpc/udp	wait	root	/usr/libexec/rpc.rusersd	rpc.rusersd  #walld/1	dgram	rpc/udp	wait	root	/usr/libexec/rpc.rwalld	rpc.rwalld  #pcnfsd/1-2	dgram	rpc/udp	wait	root	/usr/libexec/rpc.pcnfsd	rpc.pcnfsd	 +#rquotad/1	dgram	rpc/udp	wait	root	/usr/libexec/rpc.rquotad rpc.rquotad +#sprayd/1	dgram	rpc/udp	wait	root	/usr/libexec/rpc.sprayd	rpc.sprayd  #  # example entry for the pop3 server  #pop3	stream	tcp	nowait	root	/usr/local/libexec/popper	popper diff --git a/etc/make.conf b/etc/make.conf index b284f8abdaa1..63ac814e588d 100644 --- a/etc/make.conf +++ b/etc/make.conf @@ -1,4 +1,4 @@ -# $Id: make.conf,v 1.23 1995/09/30 17:20:27 ache Exp $ +# $Id: make.conf,v 1.17.4.3 1995/10/26 02:39:24 jfieber Exp $  #  # This file, if present, will be read by make (see /usr/share/mk/sys.mk).  # It allows you to override macro definitions to make without changing @@ -11,7 +11,7 @@  #  # One, and probably the most common, use could be:  # -#CFLAGS= -O2 -m486 -pipe -fno-strength-reduce +#CFLAGS= -O2 -m486 -pipe  #  # Another useful entry is  # @@ -39,26 +39,45 @@  #NOMANCOMPRESS=	true  #  # +# If you do not want additional documentation (some of which are +# a few hundred KB's) for ports to be installed: +# +#NOPORTDOCS=	true +# +#  # Default format for system documentation, depends on your printer.  # Set this to "ascii" for simple printers or screen  #  #PRINTER=	ps  #  # -# How many times to check if a key has been pressed before giving up and -# booting the default kernel. 0 actually means check once, but saves the -# loop overhead. This value is approximately in milliseconds. +# How long to wait for a console keypress before booting the default kernel. +# This value is approximately in milliseconds. Keypresses are accepted by the +# BIOS before booting from disk, making it possible to give custom boot +# parameters even when this is set to 0.  #  #BOOTWAIT=0  #BOOTWAIT=30000  #  #  # By default, this points to /usr/X11R6 for XFree86 releases 3.0 or earlier. -# If you have a XFree86 from before 3.0 you want to uncomment this. +# If you have a XFree86 from before 3.0 that has the X distribution in +# /usr/X386, you want to uncomment this.  #  #X11BASE=	/usr/X386  #  # +# If you have Motif on your system, uncomment this. +# +#HAVE_MOTIF=	yes +# +# If the default location of the Motif library (specified below) is NOT +# appropriate for you, uncomment this and change it to the correct value. +# If your motif is in ${X11BASE}/lib, you don't need to touch this line. +# +#MOTIFLIB=	-L${X11BASE}/lib -lXm +# +#  # Build `cc' using a dynamic internals library, rather than the default  # (static) one.  This makes the compilers run slower (10-15%), but saves   # quite some diskspace. diff --git a/etc/monthly b/etc/monthly index 477d0ce91768..b96bb38a780c 100644 --- a/etc/monthly +++ b/etc/monthly @@ -7,22 +7,6 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin  host=`hostname -s`  echo "Subject: $host monthly run output" -# echo "" -# echo "Doing login accounting:" -# ac -p | sort -nr +1 - -echo "" -echo -n "Rotating log files:" -cd /var/log -for i in kerberos.log lpd-errs wtmp; do -	echo -n " $i" -	if [ -f $i.5 ]; then mv -f $i.5 $i.6; fi -	if [ -f $i.4 ]; then mv -f $i.4 $i.5; fi -	if [ -f $i.3 ]; then mv -f $i.3 $i.4; fi -	if [ -f $i.2 ]; then mv -f $i.2 $i.3; fi -	if [ -f $i.1 ]; then mv -f $i.1 $i.2; fi -	if [ -f $i.0 ]; then mv -f $i.0 $i.1; fi -	if [ -f $i ]; then mv -f $i $i.0; fi -	>$i -done  echo "" +echo "Doing login accounting:" +ac -p | sort -nr +1 @@ -2,3 +2,9 @@ FreeBSD ?.?.?  (UNKNOWN)  Welcome to FreeBSD! +If the info distribution has been loaded on this machine, the FreeBSD +Handbook will be in file:/usr/share/doc/handbook and the FAQ in +file:/usr/share/doc/FAQ  + +Type /stand/sysinstall to re-enter the installation and configuration utility. + diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist index 227f89f4147c..c0a20e28e5d5 100644 --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -1,4 +1,4 @@ -#	$Id: BSD.include.dist,v 1.1 1995/03/18 07:02:10 rgrimes Exp $ +#	$Id: BSD.include.dist,v 1.2 1995/05/17 09:31:03 rgrimes Exp $  #  /set type=dir uname=bin gname=bin mode=0755 @@ -13,14 +13,8 @@      ..      net      .. -    netccitt -    ..      netinet      .. -    netiso -    .. -    netns -    ..      nfs      ..      objc diff --git a/etc/mtree/BSD.local.dist b/etc/mtree/BSD.local.dist index 789c5b8ba205..98f61d736ec5 100644 --- a/etc/mtree/BSD.local.dist +++ b/etc/mtree/BSD.local.dist @@ -1,4 +1,4 @@ -#     $Id: BSD.local.dist,v 1.11 1995/05/17 09:31:07 rgrimes Exp $ +#     $Id: BSD.local.dist,v 1.11.4.1 1995/10/05 09:31:35 davidg Exp $  #  /set type=dir uname=bin gname=bin mode=0755 @@ -32,6 +32,8 @@          ..          cat8            uname=man          .. +        cat9            uname=man +        ..          catl            uname=man          ..          man1 @@ -50,14 +52,16 @@          ..          man8          .. -        manl +        man9          .. -        skel +        manl          ..      ..      sbin      ..      share +        doc +        ..          nls  	    C  	    .. @@ -112,5 +116,7 @@  	    sv_SE.ISO_8859-1              ..          .. +        skel +        ..      ..  .. diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index ffbde141e510..6cbdbd88ea63 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -1,4 +1,4 @@ -#	$Id: BSD.usr.dist,v 1.40.4.6 1996/05/07 15:34:50 nate Exp $ +#	$Id: BSD.usr.dist,v 1.40.4.7 1996/05/07 20:15:49 jkh Exp $  #  /set type=dir uname=bin gname=bin mode=0755 @@ -43,6 +43,8 @@  		..  		hr_HR.ISO_8859-2  		.. +		ru_SU.KOI8-R +		..          ..          dict          .. @@ -179,8 +181,6 @@              ..              sup              .. -            syscons -            ..          ..  /set type=dir uname=games gname=bin mode=0755          games           uname=bin diff --git a/etc/mtree/BSD.var.dist b/etc/mtree/BSD.var.dist index 1e4409228b84..95065ccdc045 100644 --- a/etc/mtree/BSD.var.dist +++ b/etc/mtree/BSD.var.dist @@ -1,4 +1,4 @@ -#	$Id: BSD.var.dist,v 1.22 1995/04/12 03:02:01 ache Exp $ +#	$Id: BSD.var.dist,v 1.23 1995/05/17 09:31:17 rgrimes Exp $  #  /set type=dir uname=bin gname=bin mode=0755 @@ -34,7 +34,7 @@      ..      mail            uname=bin      .. -    msgs            uname=bin +    msgs            uname=daemon      ..      preserve        uname=bin      .. diff --git a/etc/netstart b/etc/netstart index c837bce1edc4..d0ad128e4c22 100755 --- a/etc/netstart +++ b/etc/netstart @@ -1,6 +1,6 @@  #!/bin/sh -  # -#	$Id: netstart,v 1.32.4.2 1995/08/23 07:18:05 jkh Exp $ +#	$Id: netstart,v 1.32.4.3 1995/08/25 07:21:46 davidg Exp $  #	From: @(#)netstart	5.9 (Berkeley) 3/30/91  # Note that almost all the user-configurable behavior is no longer in @@ -23,9 +23,14 @@ if [ -n "$defaultdomainname" -a "x$defaultdomainname" != "xNO" ] ; then  	domainname $defaultdomainname  fi +# If IP filtering +if [ -n "$firewall" -a "x$firewall" != "xNO" -a -f /etc/rc.firewall ] ; then +	sh /etc/rc.firewall +fi +  #  # XXX This is known to cause an error if /usr is nfs mounted since it -# will not be avaliable until after the network is up :-(.  Once the +# will not be available until after the network is up :-(.  Once the  # relocation of sysctl to /sbin is done that problem will go away.  #  if [ -n "$tcp_extensions" -a "x$tcp_extensions" = "xNO" ] ; then @@ -49,28 +54,20 @@ if [ -n "$defaultrouter" -a "x$defaultrouter" != "xNO" ] ; then  fi  # Set up any static routes.  This should be done before router discovery. -for i in ${static_routes}; do -	eval route_args=\$route_${i} -	route add ${route_args} -done +if [ "x${static_routes}" != "x" ]; then +	for i in ${static_routes}; do +		eval route_args=\$route_${i} +		route add ${route_args} +	done +fi  if [ "x$gateway" != "xNO" ]; then  	echo 'configuring host as a gateway.' -	sysctl -w net.inet.ip.forwarding=1 +	sysctl -w net.inet.ip.forwarding=1 >/dev/null 2>&1  fi -if [ "x$gated" != "xNO" -o "x$routedflags" != "xNO" ] ; then -	echo -n starting routing daemons: - -	# $gated and $routedflags are imported from /etc/sysconfig. -	# If $gated == YES, gated is used; otherwise routed. -	# If $routedflags == NO, routed isn't run. - -	if [ "X${gated}" = X"YES" -a -r /etc/gated.conf ]; then -		echo -n	' gated';	/usr/local/sbin/gated $gatedflags -	elif [ "X${routedflags}" != X"NO" ]; then -		echo -n ' routed';	routed $routedflags -	fi - +if [ "x$router" != "xNO" ] ; then +	echo -n starting routing daemon: +	echo -n " ${router}";	${router} ${routerflags}  	echo '.'  fi diff --git a/etc/ppp/ppp.conf.iij b/etc/ppp/ppp.conf.iij index 940898cb9ede..6c15bc9b20c3 100644 --- a/etc/ppp/ppp.conf.iij +++ b/etc/ppp/ppp.conf.iij @@ -2,7 +2,7 @@  #  #  Examples to connect to IIJ Dialup PPP service  # -#	1) On IIJ servive, both user side and server side address can +#	1) On IIJ service, both user side and server side address can  #	   not be predicted by a customer. In this circumstance, you need  #	   some trick to use on-demand dialup. See iij-demand for example.  # @@ -10,7 +10,7 @@  #	   In all cases, you can use same username and password assigned  #	   from IIJ.  # -#  $Id:$ +#  $Id: ppp.conf.iij,v 1.1.1.1 1995/01/31 06:24:33 amurai Exp $  #  #############################################################################  # @@ -27,7 +27,7 @@ iij:   set timeout 0   dial  # -#  If you prefer to use PAP authentification, use this one. +#  If you prefer to use PAP authentication, use this one.  #  #	% ppp iij-pap  # @@ -41,7 +41,7 @@ iij-pap:   set openmode active   dial  # -#  Use "% ppp iij-chap" for CHAP authentification +#  Use "% ppp iij-chap" for CHAP authentication  #  iij-chap:   set phone 0332425701 diff --git a/etc/ppp/ppp.conf.sample b/etc/ppp/ppp.conf.sample index 20180228a7b8..0da1cf9db987 100644 --- a/etc/ppp/ppp.conf.sample +++ b/etc/ppp/ppp.conf.sample @@ -4,14 +4,14 @@  #  #	  Written by Toshiharu OHNO  # -# $Id: ppp.conf.sample,v 1.2 1995/02/26 12:16:36 amurai Exp $ +# $Id: ppp.conf.sample,v 1.3 1995/04/22 17:14:21 amurai Exp $  #  #################################################################  #  # Default setup. Executed always when PPP is invoked.  #  default: - set device /dev/cua01 + set device /dev/cuaa1   set speed 38400   disable lqr   deny lqr @@ -36,9 +36,15 @@ simplesite:   set login "TIMEOUT 5 login:-\\r-login: ppp word: ppp"   set timeout 120  # -# If peer reqires to use CHAP, don't forget to supply authname and authkey. +# Multi-phone example  # -# If you'd like to use CHAP to authentificate peer, comment out the line +multiphone: + set phone 12345678:12345679:12345670:12345671 + set login "TIMEOUT 5 login:-\\r-login: ppp word: ppp" +# +# If peer requires to use CHAP, don't forget to supply authname and authkey. +# +# If you'd like to use CHAP to authentication peer, comment out the line  # ``enable chap'' below. You also need to prepare /etc/ppp.secret.  #  # If remote system sends its system name within CHAP packet and it is @@ -54,7 +60,7 @@ chapsite:   set authname MySystemName   set authkey  OurSecretKey  # -# To speak PAP is just smilar to CHAP +# To speak PAP is just similar to CHAP  #  papsite:   set phone 12345678 @@ -76,8 +82,8 @@ ondemand:   set phone 1234567   set login "TIMEOUT 5 login:-\\r-login: ppp word: ppp"   set timeout 120 - set ifaddr 192.244.185.226 192.244.176.44 - add 0 255.255.255.0 192.244.176.44 + set ifaddr 192.244.185.226 192.244.176.44 255.255.255.0 + add 0 0 192.244.176.44  #  # Another on demand example  #  If peer assign some IP address for us, and we can't predict it @@ -87,8 +93,8 @@ pmdemend:   set phone 1234567   set login "TIMEOUT 5 login:-\\r-login: ppp word: ppp"   set timeout 120 - set ifaddr 0 192.244.176.44 - add 0 255.255.255.0 192.244.176.44 + set ifaddr 0 192.244.176.44 255.255.255.0 + add 0 0 192.244.176.44  #  # Example to validate incoming user with CHAP  #  Invod as ``ppp -direct users'' from login script. User's system name @@ -106,8 +112,8 @@ users:  # Example of Callback Request  #  #  Here, we assume that peer will hangup the line and initiates a callback -#  after successful authentification. We simply use chat script capabiluty -#  and wait for a "NO CARRIRER" response from our modem. +#  after successful authentication. We simply use chat script capability +#  and wait for a "NO CARRIER" response from our modem.  #  #  % ppp callback  # diff --git a/etc/ppp/ppp.linkup.sample b/etc/ppp/ppp.linkup.sample index afe58a79ed17..2328317d6fc1 100644 --- a/etc/ppp/ppp.linkup.sample +++ b/etc/ppp/ppp.linkup.sample @@ -4,17 +4,17 @@  #  #  #  This file is checked when PPP establishes network level connection. -#  PPP command seaches label in this file in following way and order. +#  PPP command searches label in this file in following way and order.  # -#  1) At first, IP address assigned into our side is serched and execute +#  1) At first, IP address assigned into our side is searched and execute  #     associated command.  #  #  2) If it didn't found, then label name specified at startup time is  #     searched.  # -#  3) If given label name is not found, then label MYADDR is serched. +#  3) If given label name is not found, then label MYADDR is searched.  # -# $Id:$ +# $Id: ppp.linkup.sample,v 1.1.1.1 1995/01/31 06:24:33 amurai Exp $  #  #########################################################################  # @@ -22,16 +22,16 @@  # to 192.244.176.0 network.  #  #192.244.176.32: -# add 192.244.176.0 255.255.255.0 HISADDR +# add 192.244.176.0 0 HISADDR  # -# If we are invked with an argument ``iij-demand'', then +# If we are invoked with an argument ``iij-demand'', then  # delete existing route entry and add peer as default gateway.  #  iij-demand:   delete ALL   add 0 0 HISADDR  # -# Otherwide, simply add peer as default gateway. +# Otherwise, simply add peer as default gateway.  #  MYADDR:   add 0 0 HISADDR diff --git a/etc/profile b/etc/profile index 69b96d1069df..e868673d976e 100644 --- a/etc/profile +++ b/etc/profile @@ -2,12 +2,10 @@  # Uncomment this to give you the default 4.2 behavior, where disk   # information is shown in K-Blocks  # BLOCKSIZE=K; export BLOCKSIZE -# Uncomment next line if you want to setup your 8-bit locale at program -# startup automatically -# See also rc and csh.login -# ENABLE_STARTUP_LOCALE=; export ENABLE_STARTUP_LOCALE -# Uncomment next line to activate russian locale +# Uncomment next line to activate Russian locale  # LANG=ru_SU.KOI8-R; export LANG -# Uncomment next line to activate italian locale +# Uncomment next line to activate Italian locale  # LANG=it_IT.ISO_8859-1; export LANG  # For full locales list check /usr/share/locale/* +# Read system messages +# msgs -f @@ -1,5 +1,5 @@  #!/bin/sh -#	$Id: rc,v 1.66.4.9 1996/03/22 17:26:47 nate Exp $ +#	$Id: rc,v 1.66.4.10 1996/05/03 06:02:34 asami Exp $  #	From: @(#)rc	5.27 (Berkeley) 6/5/91  # System startup script run by init on autoboot @@ -84,10 +84,6 @@ if [ $? != 0 ]; then  	exit 1  fi -# If the machine runs wall CMOS clock (compatible with MSDOS), -# activate following line by creating empty file /etc/wall_cmos_clock -# If this file not exist, following line does nothing (assumed -# the machine runs UTC CMOS clock). See adjkerntz(8) for details.  adjkerntz -i  # If there is a global system configuration file, suck it in. @@ -120,7 +116,7 @@ rm -f /etc/nologin  rm -f /var/spool/lock/*  rm -rf /var/spool/uucp/.Temp/*  rm -f /dev/log -(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) +(cd /var/run && { cp /dev/null utmp; chmod 644 utmp; })  echo clearing /tmp @@ -201,7 +197,7 @@ if [ "X${nis_serverflags}" != X"NO" ]; then  	echo -n ' ypserv'; ypserv ${nis_serverflags}  	if [ "X${yppasswddflags}" != X"NO" ]; then -		echo -n ' yppasswdd'; yppasswdd ${yppasswddflags} +		echo -n ' yppasswdd'; rpc.yppasswdd ${yppasswddflags}  	fi  fi @@ -221,7 +217,7 @@ fi  if [ "X${nfs_server}" = X"YES" -a -r /etc/exports ]; then  	echo -n ' mountd' -	if [ "X${pcnfsd}" = X"YES" ]; then +	if [ "X${weak_mountd_authentication}" = X"YES" ]; then  		mountd -n  	else  		mountd @@ -234,26 +230,18 @@ if [ "X${nfs_client}" = X"YES" ]; then  fi  if [ "X${amdflags}" != X"NO" ]; then -	echo -n ' amd';			amd ${amdflags} -fi - -# These should go elsewhere but netstart is too early and I don't -# want to touch rc.local, so... -if [ "X${pcnfsd}" = X"YES" -a -x /usr/local/libexec/rpc.pcnfsd ]; then -	echo -n ' rpc.pcnfsd'; /usr/local/libexec/rpc.pcnfsd & -fi - -if [ "X${apache_httpd}" = X"YES" -a -x /usr/local/sbin/httpd ]; then -	echo -n ' apache httpd'; /usr/local/sbin/httpd & +	echo -n ' amd' +	amd ${amdflags} > /var/run/amd.pid  fi  # Kerberos runs ONLY on the Kerberos server machine  if [ "X${kerberos_server}" = X"YES" ]; then  	echo -n ' kerberos';	kerberos >> /var/log/kerberos.log &  	echo -n ' kadmind'; \ -		(sleep 20; /usr/sbin/kadmind -n >/dev/null 2>&1 &) & +		(sleep 20; kadmind -n >/dev/null 2>&1 &) &  fi +# IP multicast routing daemon  if [ "X${mrouted}" != X"NO" -a -x /usr/sbin/mrouted ]; then  	echo -n ' mrouted'; mrouted ${mrouted}  fi @@ -282,13 +270,18 @@ if [ "$virecovery" != '/var/tmp/vi.recover/recover.*' ]; then  fi  if [ "X${accounting}" = X"YES" -a -d /var/account ]; then -	echo 'turning on accounting';	accton /var/account/acct +	echo 'turning on accounting' +	if [ ! -e /var/account/acct ]; then +		touch /var/account/acct +	fi +	accton /var/account/acct  fi  # Now start up miscellaneous daemons that don't belong anywhere else  #  echo -n standard daemons:  echo -n ' cron';		cron +  if [ "X${lpd}" != X"NO" -a -x /usr/sbin/lpd ]; then  	echo -n ' printer';		lpd  fi @@ -296,7 +289,7 @@ fi  # $sendmail_flags is imported from /etc/sysconfig;  # if $sendmail_flags is something other than NO, sendmail is run.  if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then -	echo -n ' sendmail';		sendmail ${sendmail_flags}  +	echo -n ' sendmail';            /usr/sbin/sendmail ${sendmail_flags}  fi  echo '.' @@ -308,7 +301,6 @@ if [ -x /sbin/ldconfig ]; then  	if [ -d /usr/X11R6/lib ]; then _LDC="${_LDC} /usr/X11R6/lib" ; fi  	if [ -d /usr/X386/lib ]; then _LDC="${_LDC} /usr/X386/lib" ; fi  	if [ -d /usr/local/lib ]; then _LDC="${_LDC} /usr/local/lib" ; fi -	if [ -d /usr/gnu/lib ]; then _LDC="${_LDC} /usr/gnu/lib" ; fi  	echo 'setting ldconfig path:' ${_LDC}  	ldconfig ${_LDC}  fi @@ -319,6 +311,15 @@ if [ -f /etc/rc.${arch} ]; then  	. /etc/rc.${arch}  fi +# for each valid dir in $local_startup, search for init scripts matching *.sh +if [ "X${local_startup}" != X"NO" ]; then +	for dir in ${local_startup}; do +		[ -d ${dir} ] && for script in ${dir}/*.sh; do +			[ -x ${script} ] && ${script} start +		done +	done +fi +  # Do traditional (but rather obsolete) rc.local file if it exists.  [ -f /etc/rc.local ] && sh /etc/rc.local diff --git a/etc/rc.serial b/etc/rc.serial index f9671e2e9cbe..580e505846f8 100644 --- a/etc/rc.serial +++ b/etc/rc.serial @@ -1,4 +1,7 @@ -# Change some defauls for serial devices. +#!/bin/sh +# $Id$ + +# Change some defaults for serial devices.  # Standard defaults are:  #	dtrwait 300 drainwait 0  #	initial cflag from <sys/ttydefaults.h> = cread cs8 hupcl @@ -11,57 +14,73 @@  default() {  	# Reset everything changed by the other functions to initial defaults. + +	ci=$1; shift	# call in device identifier +	co=$1; shift	# call out device identifier +  	for i in $*  	do -		comcontrol /dev/ttyd$i dtrwait 300 drainwait 0 -		stty </dev/ttyid$i -clocal  crtscts  hupcl 9600 reprint ^R -		stty </dev/ttyld$i -clocal -crtscts -hupcl 0 -		stty </dev/cuaia$i -clocal  crtscts  hupcl 9600 reprint ^R -		stty </dev/cuala$i -clocal -crtscts -hupcl 0 +		comcontrol /dev/tty$ci$i dtrwait 300 drainwait 0 +		stty </dev/ttyi$ci$i -clocal  crtscts  hupcl 9600 reprint ^R +		stty </dev/ttyl$ci$i -clocal -crtscts -hupcl 0 +		stty </dev/cuai$co$i -clocal  crtscts  hupcl 9600 reprint ^R +		stty </dev/cual$co$i -clocal -crtscts -hupcl 0  	done  }  maybe() {  	# Special settings. + +	ci=$1; shift +	co=$1; shift +  	for i in $*  	do  		# Don't use ^R; it breaks bash's ^R when typed ahead. -		stty </dev/ttyid$i reprint undef -		stty </dev/cuaia$i reprint undef +		stty </dev/ttyi$ci$i reprint undef +		stty </dev/cuai$co$i reprint undef  		# Lock clocal off on dialin device for security. -		stty </dev/ttyld$i clocal +		stty </dev/ttyl$ci$i clocal  		# Lock the speeds to use old binaries that don't support them.  		# Any legal speed works to lock the initial speed. -		stty </dev/ttyld$i 300 -		stty </dev/cuala$i 300 +		stty </dev/ttyl$ci$i 300 +		stty </dev/cual$co$i 300  	done  }  modem() {  	# Modem that supports CTS and perhaps RTS handshaking. + +	ci=$1; shift +	co=$1; shift +  	for i in $*  	do  		# may depend on modem -		comcontrol /dev/ttyd$i dtrwait 100 drainwait 180 +		comcontrol /dev/tty$ci$i dtrwait 100 drainwait 180  		# Lock crtscts on.  		# Speed reasonable for V42bis. -		stty </dev/ttyid$i crtscts 57600 -		stty </dev/ttyld$i crtscts -		stty </dev/cuaia$i crtscts 57600 -		stty </dev/cuala$i crtscts +		stty </dev/ttyi$ci$i crtscts 57600 +		stty </dev/ttyl$ci$i crtscts +		stty </dev/cuai$co$i crtscts 57600 +		stty </dev/cual$co$i crtscts  	done  }  mouse() {  	# Mouse on either callin or callout port. + +	ci=$1; shift +	co=$1; shift +  	for i in $*  	do  		# Lock clocal on, hupcl off.  		# Standard speed for Microsoft mouse. -		stty </dev/ttyid$i clocal -hupcl 1200 -		stty </dev/ttyld$i clocal  hupcl -		stty </dev/cuaia$i clocal -hupcl 1200 -		stty </dev/cuala$i clocal  hupcl +		stty </dev/ttyi$ci$i clocal -hupcl 1200 +		stty </dev/ttyl$ci$i clocal  hupcl +		stty </dev/cuai$co$i clocal -hupcl 1200 +		stty </dev/cual$co$i clocal  hupcl  	done  } @@ -72,21 +91,37 @@ terminal() {  	# Also works for bidirectional communications to another pc  	# provided at most one side runs getty.  	# Same as modem() except we want a faster speed and no dtrwait. -	modem $* + +	ci=$1; shift +	co=$1; shift + +	modem $ci $co $*  	for i in $*  	do -		comcontrol /dev/ttyd$i dtrwait 0 -		stty </dev/ttyid$i 115200 -		stty </dev/cuaia$i 115200 +		comcontrol /dev/tty$ci$i dtrwait 0 +		stty </dev/ttyi$ci$i 115200 +		stty </dev/cuai$co$i 115200  	done  }  # Don't use anything from this file unless you have some buggy programs  # that require it. -# +  # Edit the functions and the examples to suit your system. -# -# maybe		0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v -# mouse		    2 -# modem		  1 -# terminal	0 +# $1 is the call in device identifier, $2 is the call out device identifier +# and the remainder of the line lists the device numbers. + +# Initialize assorted 8250-16550 (sio) ports. +# maybe    d a  0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v +# mouse    d a      2 +# modem    d a    1 +# terminal d a  0 + +# Initialize all ports on a Cyclades-8yo. +# modem    c c  0 1 2 3 4 5 6 7 + +# Initialize all ports on a Cyclades-16ye. +# modem    c c  0 1 2 3 4 5 6 7 8 9 a b c d e f  + +# Initialize all ports on a Digiboard 8. +# modem    D D  0 1 2 3 4 5 6 7 diff --git a/etc/security b/etc/security index 19d1bcb525a9..7cf84ab35b7c 100644 --- a/etc/security +++ b/etc/security @@ -1,9 +1,10 @@  #!/bin/sh -  #  #	@(#)security	5.3 (Berkeley) 5/28/91 -#	$Id: security,v 1.7 1995/01/14 13:23:50 ats Exp $ +#	$Id: security,v 1.8 1995/05/27 01:37:44 ache Exp $  #  PATH=/sbin:/bin:/usr/bin +LC_ALL=C; export LC_ALL  host=`hostname -s`  echo "Subject: $host security check output" @@ -24,11 +25,17 @@ set $MP  while test $# -ge 1; do  	mount=$1  	shift -	find $mount -xdev \( -perm -u+s -or -perm -g+s \) | sort +	find -X $mount -xdev -type f \ +		\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \ +		\( -perm -u+s -or -perm -g+s \) | sort  done | xargs -n 20 ls -lgTd > $TMP +if [ ! -f $LOG/setuid.today ] ; then +	echo "no $LOG/setuid.today" +	cp $TMP $LOG/setuid.today +fi  if cmp $LOG/setuid.today $TMP >/dev/null; then :; else -	echo "$host setuid/device diffs:" +	echo "$host setuid diffs:"  	diff -b $LOG/setuid.today $TMP  	mv $LOG/setuid.today $LOG/setuid.yesterday  	mv $TMP $LOG/setuid.today diff --git a/etc/services b/etc/services index bc2b8f1e2f40..20877b1e0292 100644 --- a/etc/services +++ b/etc/services @@ -9,7 +9,7 @@  # Kerberos services are for Kerberos v4, and are unofficial.  Sites running  # v5 should uncomment v5 entries and comment v4 entries.  # -#	$Id: services,v 1.11.4.3 1996/03/16 13:50:14 markm Exp $ +#	$Id: services,v 1.11.4.4 1996/04/07 01:17:26 joerg Exp $  #	From: @(#)services	5.8 (Berkeley) 5/9/91  #  # WELL KNOWN PORT NUMBERS @@ -900,6 +900,7 @@ nfsd-keepalive	1110/udp   #Client status info  supfiledbg	1127/tcp		# for SUP  nfa		1155/tcp   #Network File Access		         nfa		1155/udp   #Network File Access		        +phone		1167/udp   #conference calling  lupa		1212/tcp  lupa		1212/udp  nerv		1222/tcp   #SNI R&D network		      diff --git a/etc/sysconfig b/etc/sysconfig index 2b826ddcae26..808bcd754557 100644 --- a/etc/sysconfig +++ b/etc/sysconfig @@ -4,7 +4,14 @@  # This is sysconfig - a file full of useful variables that you can set   # to change the default startup behavior of your system.  # -#	$Id: sysconfig,v 1.14.4.7 1996/03/06 08:54:01 rgrimes Exp $ +#	$Id: sysconfig,v 1.14.4.8 1996/03/22 17:26:48 nate Exp $ + +######################### Start Of Local Configuration Section ########### + +# Location of local startup directories. +local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d" + +######################### End Of Local Configuration Section #############  ######################### Start Of Syscons Section ####################### @@ -39,7 +46,7 @@ blanktime=NO  # Set to screen saver desired: blank, green, snake, star (or NO for none)  saver=NO -# General russian setup for example: +# General Russian setup for example:  # (koi8-r keyboard with cp866 screen font mapped to koi8-r)  #  # keymap=ru.koi8-r @@ -70,31 +77,47 @@ defaultdomainname=NO  #  tcp_extensions=YES +# If you're running PCNFSD or anything else which requires mountd to allow +# non-root requests for NFS mounts, set this to YES. +weak_mountd_authentication=NO +  #  # Set to the list of network devices on this host.  You must have an  # ifconfig_${network_interface} line for each interface listed here.  # for example:  #  #	network_interfaces="ed0 sl0 lo0" +#  #	ifconfig_ed0="inet 10.0.0.1 netmask 0xffffff00"  #	ifconfig_sl0="inet 10.0.1.0 netmask 0xffffff00" +#	ifconfig_lo0="inet localhost"  #  network_interfaces="lo0" +  ifconfig_lo0="inet localhost"  #  # Set to the list of route add lines for this host.  You must have a -# route_${static_routes} line for each static route listed here. +# route_${static_routes} line for each static route listed here (unless +# static_routes is set to "" - do NOT use ``NO'' to denote a lack of static +# routes!).  # -static_routes="multicast loopback" -route_multicast="224.0.0.0 -netmask 0xf0000000 -interface ${hostname}" -route_loopback="${hostname} localhost" +#static_routes="foo multicast" +#route_foo="woofo woofo-gw" +#route_multicast="224.0.0.0 -netmask 0xf0000000 -interface 10.0.0.1" +static_routes=""  # Set to the host you'd like set as your default router, or NO for none. +# This is the same as adding a ``default'' entry to static_routes.  defaultrouter=NO +# This is the routing daemon you want to use.  Possible options are +# currently NO (for none), `routed' and `gated'.  Also see `routerflags' +# for startup flags. +router=routed +  # These are the flags you'd like to start the routing daemon with -routedflags=-q +routerflags=-q  # mrouted flags, or NO if you don't want to start mrouted. Needs kernel  # options enabled before it will work. @@ -109,7 +132,7 @@ xntpdflags="NO"  # this is inoperative unless xntpd is enabled; NO to disable  tickadjflags="-Aq" -# Set to the site you'd like to syncronize your clock from (gatekeeper.dec.com, +# Set to the site you'd like to synchronize your clock from (gatekeeper.dec.com,  # for example) or NO for no such site.  ntpdate="NO" @@ -123,8 +146,11 @@ lpd=YES  # time in minutes.  If set to NO, don't start sendmail at all.  sendmail_flags="-bd -q30m" -# Set to appropriate flags if you want to use AMD +# Set to appropriate flags if you want to use AMD.  The commented-out entry +# provides a reasonable default, using the sample amd.map config file from the +# /usr/src/etc directory.  amdflags="NO" +#amdflags="-a /net -c 1800 -k i386 -d my.domain -l syslog /host /etc/amd.map"  # Set to YES if this machine will be an NFS client  nfs_client=NO @@ -135,14 +161,14 @@ nfs_server=NO  # Set to appropriate flags if you want to start NIS for a client  nis_clientflags="NO" -# Set to host to ypset to if you need to do that +# Name of host to ypset to, if no YP server on this wire  nis_ypsetflags="NO"  # Set to appropriate flags if you want to start NIS for a server  nis_serverflags="NO" -# Set to appropriate flags for yppasswdd, if you wish to run it. -# Typical flags might be "-m /var/yp/master.passwd -s -f" +# Set to appropriate flags for rpc.yppasswdd, if you wish to run it. +# Typical flags might be "-t /var/yp/master.passwd -s -f"  yppasswddflags="NO"  # Set to appropriate flags for named, if you have a full-time @@ -177,15 +203,13 @@ kerberos_server=NO  # If you want this host to be a gateway, set to YES.  gateway=NO -# Set to YES if you want to run gated -gated=NO +# If you want this host to be a firewall or otherwise filter IP, set to YES. +firewall=NO -# Set to YES if you wish to check quotas.  NOTE:  For now this probably -# doesn't work and should be left disabled. +# Set to YES if you wish to check quotas.  check_quotas=NO -# Set to YES to turn on accounting.  NOTE: For now this probably -# doesn't work and should be left disabled. +# Set to YES to turn on accounting.  accounting=NO  ######################### End Of Netconfig Section ####################### diff --git a/etc/syslog.conf b/etc/syslog.conf index 73d56b70a784..c907ec7107e9 100644 --- a/etc/syslog.conf +++ b/etc/syslog.conf @@ -7,3 +7,5 @@ cron.*						/var/cron/log  *.notice;auth.debug				root  *.alert						root  *.emerg						* +!startslip +*.*						/var/log/slip.log diff --git a/etc/termcap.small b/etc/termcap.small index 400d1962f236..7a31985aaa83 100644 --- a/etc/termcap.small +++ b/etc/termcap.small @@ -55,7 +55,7 @@ cons50|ansil|ansi80x50:\  	:li#50:tc=cons25:  cons50-m|ansil-mono|ansi80x50-mono:\  	:li#50:tc=cons25-m: -# Syscons console with koi8-r russian code table. +# Syscons console with koi8-r Russian code table.  cons25r|pc3r|ibmpc3r|cons25-koi8-r:\  	:ac=q\200x\201m\204v\211j\205t\206n\212u\207l\202w\210k\203y\230z\231f\234~\225a\220h\221`^D.^Y-^XI^U0\215:\  	:tc=cons25w: diff --git a/etc/weekly b/etc/weekly index 125a98668f3e..8d75322d3b49 100644 --- a/etc/weekly +++ b/etc/weekly @@ -1,7 +1,7 @@  #!/bin/sh -  #  #	@(#)weekly	5.14 (Berkeley) 6/23/91 -# +#	$Id$  PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec  export PATH @@ -36,33 +36,11 @@ echo "Subject: $host weekly run output"  #	rm -rf $TDIR  #fi -if [ -f /usr/lib/uucp/clean.weekly ]; then +if [ -f /usr/libexec/uucp/clean.weekly ]; then  	echo ""  	echo "Cleaning up UUCP:" -	echo /usr/lib/uucp/clean.weekly | su daemon +	echo /usr/libexec/uucp/clean.weekly | su daemon  fi -echo "" - -echo "Rotating messages:" -cd /var/log -if [ -f messages.2 ]; then mv -f messages.2 messages.3; fi -if [ -f messages.1 ]; then mv -f messages.1 messages.2; fi -if [ -f messages.0 ]; then mv -f messages.0 messages.1; fi -mv -f messages messages.0 -cp /dev/null messages -chmod 644 messages -kill -1 `cat /var/run/syslog.pid` -cd / - -echo "Rotating cron log:" -cd /var/cron -if [ -f log.2 ]; then mv -f log.2 log.3; fi -if [ -f log.1 ]; then mv -f log.1 log.2; fi -if [ -f log.0 ]; then mv -f log.0 log.1; fi -mv -f log log.0 -cp /dev/null log -chmod 600 log -cd /  echo ""  echo "Rebuilding locate database:" @@ -76,8 +54,14 @@ echo ""  echo "Rebuilding whatis database:"  MANPATH=${MANPATH:-/usr/share/man:/usr/X11R6/man:/usr/local/man} -makewhatis "${MANPATH}" +makewhatis.local "${MANPATH}"  #echo ""  #echo "Reformatting manual pages:" -#echo catman "${MANPATH}" | su man +#echo catman.local "${MANPATH}" | su -fm man + +echo "" +echo "Cleaning up kernel database files:" +kernel=`sysctl -n kern.bootfile` +kernel=kvm_`basename ${kernel}`.db +find /var/db -name "kvm_*.db" -a ! -name ${kernel} -a -atime +7 -exec rm -f -- {} \; diff --git a/games/Makefile b/games/Makefile index 15f5c81f4ad9..f342283519fc 100644 --- a/games/Makefile +++ b/games/Makefile @@ -1,4 +1,5 @@  #	@(#)Makefile	8.2 (Berkeley) 3/31/94 +#	$Id$  # XXX missing: chess ching monop [copyright]  SUBDIR= adventure arithmetic atc backgammon battlestar bcd boggle bs caesar \ diff --git a/games/adventure/done.c b/games/adventure/done.c index fd286fd2d3e1..dcd8e335f202 100644 --- a/games/adventure/done.c +++ b/games/adventure/done.c @@ -42,6 +42,7 @@ static char sccsid[] = "@(#)done.c	8.1 (Berkeley) 5/31/93";  /*      Re-coding of advent in C: termination routines                  */ +#include <stdio.h>  #include "hdr.h"  score()                                         /* sort of like 20000   */ diff --git a/games/adventure/init.c b/games/adventure/init.c index 137f3c8b8a17..8236c52e04b3 100644 --- a/games/adventure/init.c +++ b/games/adventure/init.c @@ -43,7 +43,9 @@ static char sccsid[] = "@(#)init.c	8.1 (Berkeley) 6/2/93";  /*      Re-coding of advent in C: data initialization                   */  #include <sys/types.h> +#include <signal.h>  #include <stdio.h> +#include <stdlib.h>  #include "hdr.h"  int blklin = TRUE; diff --git a/games/adventure/io.c b/games/adventure/io.c index c6ae4fe5e87d..0f7bd3fb263b 100644 --- a/games/adventure/io.c +++ b/games/adventure/io.c @@ -44,6 +44,7 @@ static char sccsid[] = "@(#)io.c	8.1 (Berkeley) 5/31/93";  #include "hdr.h"  #include <stdio.h> +#include <stdlib.h>  getin(wrd1,wrd2)                        /* get command from user        */ diff --git a/games/adventure/main.c b/games/adventure/main.c index 6de4c37d0948..89629dfd12c3 100644 --- a/games/adventure/main.c +++ b/games/adventure/main.c @@ -49,6 +49,7 @@ static char sccsid[] = "@(#)main.c	8.1 (Berkeley) 6/2/93";  /*      Re-coding of advent in C: main program                          */  #include <sys/file.h> +#include <signal.h>  #include <stdio.h>  #include "hdr.h" diff --git a/games/adventure/save.c b/games/adventure/save.c index 8dea684be8aa..6501fbd5d80c 100644 --- a/games/adventure/save.c +++ b/games/adventure/save.c @@ -41,6 +41,7 @@ static char sccsid[] = "@(#)save.c	8.1 (Berkeley) 5/31/93";  #endif /* not lint */  #include <stdio.h> +#include <stdlib.h>  #include "hdr.h"  struct savestruct diff --git a/games/adventure/subr.c b/games/adventure/subr.c index 3e2ef7b2dfdd..d723512c8740 100644 --- a/games/adventure/subr.c +++ b/games/adventure/subr.c @@ -42,6 +42,7 @@ static char sccsid[] = "@(#)subr.c	8.1 (Berkeley) 5/31/93";  /*      Re-coding of advent in C: subroutines from main                 */ +#include <stdio.h>  # include "hdr.h"  /*              Statement functions     */ diff --git a/games/adventure/vocab.c b/games/adventure/vocab.c index d060433640c7..f5cfb3a4b47b 100644 --- a/games/adventure/vocab.c +++ b/games/adventure/vocab.c @@ -42,6 +42,7 @@ static char sccsid[] = "@(#)vocab.c	8.1 (Berkeley) 5/31/93";  /*      Re-coding of advent in C: data structure routines               */ +#include <stdio.h>  # include "hdr.h"  dstroy(object) diff --git a/games/adventure/wizard.c b/games/adventure/wizard.c index 4eaf055590f3..0a18e265e494 100644 --- a/games/adventure/wizard.c +++ b/games/adventure/wizard.c @@ -42,6 +42,8 @@ static char sccsid[] = "@(#)wizard.c	8.1 (Berkeley) 6/2/93";  /*      Re-coding of advent in C: privileged operations                 */ +#include <sys/types.h> +#include <stdio.h>  # include "hdr.h"  datime(d,t) diff --git a/games/atc/Makefile b/games/atc/Makefile index e6433c4f73c8..80305a183347 100644 --- a/games/atc/Makefile +++ b/games/atc/Makefile @@ -12,7 +12,7 @@ CLEANFILES=grammar.c y.tab.h lex.c  HIDEGAME=hidegame  beforeinstall: -	(cd ${.CURDIR}/games; install -c -o ${BINOWN} -g ${BINGRP} -m 400 \ +	(cd ${.CURDIR}/games; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 400 \  	    ${GAMES} ${DESTDIR}/usr/share/games/atc)  .include <bsd.prog.mk> diff --git a/games/backgammon/common_source/backgammon.c b/games/backgammon/common_source/backgammon.c index 1385fa7960ff..6e00a5a2cc3a 100644 --- a/games/backgammon/common_source/backgammon.c +++ b/games/backgammon/common_source/backgammon.c @@ -94,14 +94,14 @@ main()  	srand(time(0));  	go[5] = NIL;  	fprintf(stdout, "Instructions? "); -	gets(s); +	fgets(s, 100, stdin);  	if(*s == 'y')  		instructions();  	putchar('\n');  	fprintf(stdout, "Opponent's level: b - beginner,\n");  	fprintf(stdout, "i - intermediate, e - expert? ");  	level='e'; -	gets(s); +	fgets(s, 100, stdin);  	if(*s == 'b')  		level = 'b';  	else if(*s == 'i') @@ -109,12 +109,12 @@ main()  	putchar('\n');  	fprintf(stdout, "You will play brown.\n\n");  	fprintf(stdout, "Would you like to roll your own dice? "); -	gets(s); +	fgets(s, 100, stdin);  	putchar('\n');  	if(*s == 'y')  		nobroll = 1;  	fprintf(stdout, "Would you like to go first? "); -	gets(s); +	fgets(s, 100, stdin);  	putchar('\n');  	if(*s == 'y')  		goto nowhmove; @@ -141,7 +141,7 @@ nowhmove:  retry:  	fprintf(stdout, "\nYour roll is %d  %d\n", die1, die2);  	fprintf(stdout, "Move? "); -	gets(s); +	fgets(s, 100, stdin);  	switch(*s) {  		case '\0':			/* empty line */  			fprintf(stdout, "Brown's move skipped.\n"); @@ -362,7 +362,7 @@ roll(who)  	if(who == BROWN && nobroll) {  		fprintf(stdout, "Roll? "); -		gets(s); +		fgets(s, 10, stdin);  		n = sscanf(s, "%d%d", &die1, &die2);  		if(n != 2 || die1 < 1 || die1 > 6 || die2 < 1 || die2 > 6)  			fprintf(stdout, "Illegal - I'll do it!\n"); diff --git a/games/bcd/bcd.6 b/games/bcd/bcd.6 index 62b47191a79c..42d12f93f4f0 100644 --- a/games/bcd/bcd.6 +++ b/games/bcd/bcd.6 @@ -45,14 +45,18 @@  .Nm ppt  .Op Ar string ...  .Nm morse -.Op Fl s Ar string ... +.Op Fl p +.Op Fl w Ar speed +.Op Fl f Ar frequency +.Op Fl s +.Op Ar string ...  .Sh DESCRIPTION  The commands  .Nm bcd ,  .Nm ppt  and  .Nm morse -reads the given input and reformats it in the form of punched cards, +read the given input and reformat it in the form of punched cards,  paper tape or morse code respectively.  Acceptable input are command line arguments or the standard input.  .Pp @@ -62,6 +66,70 @@ Available option:  The  .Fl s  option for morse produces dots and dashes rather than words. +.It Fl p +Send morse the real way. This only works if your system has sound +support and if the program understands your audio hardware. +.It Fl w Ar speed +Set the sending speed in words per minute. If not specified the default +speed of 20 WPM is used. +.It Fl f Ar frequency +Set the sidetone frequency to something other than the default 600 Hz.  .El +.Pp +The +.Fl w +and +.Fl f +flags only work in conjunction with the +.Fl p +flag. +.Pp +Not all prosigns have corresponding characters. Use +.Ql # +for +.Em AS , +.Ql @ +for  +.Em SK , +.Ql * +for +.Em VE +and +.Ql % +for +.Em BK . +The more common prosigns are +.Ql = +for +.Em BT , +.Ql ( +for +.Em KN +and +.Ql + +for +.Em AR .  .Sh FILES -.SH HISTORY +.Bl -tag -width /dev/speaker -compact +.It Pa /dev/speaker +speaker device file +.El +.Sh ENVIRONMENT +.Bl -tag -width LC_CTYPE +.It Ev LC_CTYPE +.It Ev LANG +If one of these variables is set to a locale ending in +.Ql KOI8-R , +characters with the high-order bit set are being interpreted as +Cyrillic characters.  In all other cases, they are being interpreted +as belonging to the +.Ql ISO_8859-1 +character set. +.Sh HISTORY +Sound support added by Lyndon Nerenberg (VE7TCP/VE6BBM) <lyndon@orthanc.com>. +.Sh BUGS +Does only understand a few European characters (namely German and +French), but neither Asian ones, or the continental landline code. +.Pp +Sends a bit slower than it should due to system overhead. Some people +would call this a feature. diff --git a/games/caesar/Makefile b/games/caesar/Makefile index 13ff87d08dd9..b9e4bca7cf2e 100644 --- a/games/caesar/Makefile +++ b/games/caesar/Makefile @@ -6,8 +6,10 @@ DPADD=	${LIBM}  LDADD=	-lm  MLINKS=	caesar.6 rot13.6 +CFLAGS+= -Wall +  beforeinstall: -	install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \  	    ${.CURDIR}/rot13.sh ${DESTDIR}/usr/games/rot13  .include <bsd.prog.mk> diff --git a/games/caesar/caesar.6 b/games/caesar/caesar.6 index cadcc0fdc3dd..8c600c0d572e 100644 --- a/games/caesar/caesar.6 +++ b/games/caesar/caesar.6 @@ -36,20 +36,20 @@  .Os  .Sh NAME  .Nm caesar -.Nd decrypt caesar cyphers +.Nd decrypt caesar ciphers  .Sh SYNOPSIS  .Nm caesar  .Op Ar rotation  .Sh DESCRIPTION  The  .Nm caesar -utility attempts to decrypt caesar cyphers using English letter frequency +utility attempts to decrypt caesar ciphers using English letter frequency  statistics.  .Nm Caesar  reads from the standard input and writes to the standard output.  .Pp  The optional numerical argument -Ar rotation +.Ar rotation  may be used to specify a specific rotation value.  .Pp  The frequency (from most common to least) of English letters is as follows: diff --git a/games/caesar/caesar.c b/games/caesar/caesar.c index b0027860fded..749da50d7fb7 100644 --- a/games/caesar/caesar.c +++ b/games/caesar/caesar.c @@ -40,24 +40,28 @@   */  #ifndef lint -static char copyright[] = +static const char copyright[] =  "@(#) Copyright (c) 1989, 1993\n\  	The Regents of the University of California.  All rights reserved.\n";  #endif /* not lint */  #ifndef lint -static char sccsid[] = "@(#)caesar.c	8.1 (Berkeley) 5/31/93"; +static const char sccsid[] = "@(#)caesar.c    8.1 (Berkeley) 5/31/93";  #endif /* not lint */ +#include <errno.h>  #include <math.h>  #include <stdio.h> +#include <stdlib.h> +#include <string.h>  #include <ctype.h>  #include <unistd.h>  #define	LINELENGTH	2048  #define	ROTATE(ch, perm) \ +     isascii(ch) ? ( \  	isupper(ch) ? ('A' + (ch - 'A' + perm) % 26) : \ -	    islower(ch) ? ('a' + (ch - 'a' + perm) % 26) : ch +	    islower(ch) ? ('a' + (ch - 'a' + perm) % 26) : ch) : ch  /*   * letter frequencies (taken from some unix(tm) documentation) @@ -69,15 +73,15 @@ double stdf[26] = {  	2.62, 0.81, 1.88, 0.23,  2.07, 0.06,  }; -main(argc, argv) +void printit(); + +void main(argc, argv)  	int argc;  	char **argv;  { -	extern int errno; -	register int ch, dot, i, nread, winnerdot; +	register int ch, dot, i, nread, winnerdot = 0;  	register char *inbuf;  	int obs[26], try, winner; -	char *malloc(), *strerror();  	if (argc > 1)  		printit(argv[1]); @@ -99,11 +103,13 @@ main(argc, argv)  		exit(1);  	}  	for (i = nread; i--;) { -		ch = inbuf[i]; -		if (islower(ch)) -			++obs[ch - 'a']; -		else if (isupper(ch)) -			++obs[ch - 'A']; +		ch = (unsigned char) inbuf[i]; +		if (isascii(ch)) { +			if (islower(ch)) +				++obs[ch - 'a']; +			else if (isupper(ch)) +				++obs[ch - 'A']; +		}  	}  	/* @@ -126,7 +132,7 @@ main(argc, argv)  	for (;;) {  		for (i = 0; i < nread; ++i) { -			ch = inbuf[i]; +			ch = (unsigned char) inbuf[i];  			putchar(ROTATE(ch, winner));  		}  		if (nread < LINELENGTH) @@ -139,7 +145,7 @@ main(argc, argv)  	exit(0);  } -printit(arg) +void printit(arg)  	char *arg;  {  	register int ch, rot; diff --git a/games/caesar/rot13.sh b/games/caesar/rot13.sh index 93fb93557116..b71300f959d2 100644 --- a/games/caesar/rot13.sh +++ b/games/caesar/rot13.sh @@ -34,4 +34,4 @@  #	@(#)rot13.sh	8.1 (Berkeley) 5/31/93  # -caesar 13 $* +/usr/games/caesar 13 $* diff --git a/games/canfield/canfield/Makefile b/games/canfield/canfield/Makefile index ea503021a110..7b60e2924ef9 100644 --- a/games/canfield/canfield/Makefile +++ b/games/canfield/canfield/Makefile @@ -5,6 +5,7 @@ MAN6=	canfield.6  DPADD=	${LIBCURSES} ${LIBTERMCAP} ${LIBCOMPAT}  LDADD=	-lcurses -ltermcap -lcompat  HIDEGAME=hidegame +MLINKS=	canfield.6 cfscores.6  .include "../../Makefile.inc" diff --git a/games/cribbage/Makefile b/games/cribbage/Makefile index bb5ab6a13439..5d93bf61b3c0 100644 --- a/games/cribbage/Makefile +++ b/games/cribbage/Makefile @@ -8,7 +8,7 @@ MAN6=	cribbage.6  HIDEGAME=hidegame  beforeinstall: -	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/cribbage.n \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/cribbage.n \  	    ${DESTDIR}/usr/share/games/cribbage.instr  .include <bsd.prog.mk> diff --git a/games/fish/Makefile b/games/fish/Makefile index a57454f4e2cd..fa2e4195b784 100644 --- a/games/fish/Makefile +++ b/games/fish/Makefile @@ -5,7 +5,7 @@ MAN6=	fish.6  HIDEGAME=hidegame  beforeinstall: -	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/fish.instr \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/fish.instr \  	    ${DESTDIR}/usr/share/games/fish.instr  .include <bsd.prog.mk> diff --git a/games/fortune/Makefile b/games/fortune/Makefile index 70778cf00022..d360284b29d3 100644 --- a/games/fortune/Makefile +++ b/games/fortune/Makefile @@ -1,15 +1,11 @@  #	@(#)Makefile	8.1 (Berkeley) 5/31/93 -SUBDIR=	fortune - -.ifmake (clean) || (cleandir) || (obj) -SUBDIR+=datfiles -.endif +SUBDIR= fortune  .if !make(install) && !make(distribute)  SUBDIR+=strfile -.else -SUBDIR+=datfiles  .endif +SUBDIR+= datfiles +  .include <bsd.subdir.mk> diff --git a/games/fortune/datfiles/Makefile b/games/fortune/datfiles/Makefile index 14b3f9a77e86..72786eeb2d02 100644 --- a/games/fortune/datfiles/Makefile +++ b/games/fortune/datfiles/Makefile @@ -15,22 +15,37 @@ TYPE=	real  # THE FOURTH LINE  #TYPE=	fake +.if exists(${.CURDIR}/../../caesar/obj/caesar) +CAESAR=${.CURDIR}/../../caesar/obj/caesar +.elif exists(${.CURDIR}/../../caesar/caesar) +CAESAR=${.CURDIR}/../../caesar/caesar +.else +CAESAR=/usr/games/caesar +.endif + +.if exists(${.CURDIR}/../strfile/obj/strfile) +STRFILE=${.CURDIR}/../strfile/obj/strfile +.else +STRFILE=${.CURDIR}/../strfile/strfile +.endif +  CLEANFILES+=${BLDS} -install: ${SRCS} ${BLDS} -	(cd ${.CURDIR} && install -c -o ${BINOWN} -g ${BINGRP} -m 444 \ +all: ${SRCS} ${BLDS} + +install: +	(cd ${.CURDIR} && ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \  	    ${SRCS} ${DESTDIR}/usr/share/games/fortune) -	install -o ${BINOWN} -g ${BINGRP} -m 444 ${BLDS} \ +	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 444 ${BLDS} \  	    ${DESTDIR}/usr/share/games/fortune  fortunes.dat fortunes2.dat fortunes2-o.dat limerick.dat startrek.dat zippy.dat: -	${.CURDIR}/../strfile/obj/strfile -rs \ -	    ${.CURDIR}/${.TARGET:R} ${.TARGET} +	${STRFILE} -rs ${.CURDIR}/${.TARGET:R} ${.TARGET}  fortunes-o.dat: fortunes-o -	${.CURDIR}/../strfile/obj/strfile -rsx fortunes-o ${.TARGET} +	${STRFILE} -rsx fortunes-o ${.TARGET}  fortunes-o: fortunes-o.${TYPE} -	PATH=../../caesar:$$PATH ; caesar 13 < ${.ALLSRC} > ${.TARGET} +	${CAESAR} 13 < ${.ALLSRC} > ${.TARGET}  .include <bsd.prog.mk> diff --git a/games/fortune/datfiles/fortunes b/games/fortune/datfiles/fortunes index 2f69757157d0..6fdb71d4f5b4 100644 --- a/games/fortune/datfiles/fortunes +++ b/games/fortune/datfiles/fortunes @@ -5320,10 +5320,10 @@ of this thing with at least a cabin cruiser.  motto is:  'It is very difficult to disprove certain kinds of pain.'"  		-- Dave Barry, "Pain and Suffering"  % -Hier liegt ein Mann ganz obnegleich; -Im Leibe dick, an Suden reich. +Hier liegt ein Mann ganz ohnegleich; +Im Leibe dick, an Suenden reich.  Wir haben ihn in das Grab gesteckt,	Here lies a man with sundry flaws -Weil es uns dunkt er sei verreckt.	And numerous Sins upon his head; +Weil es uns duenkt er sei verreckt.	And numerous Sins upon his head;  					We buried him today because  					As far as we can tell, he's dead.  		-- PDQ Bach's epitaph, as requested by his cousin Betty diff --git a/games/fortune/datfiles/fortunes.sp.ok b/games/fortune/datfiles/fortunes.sp.ok index e9fbace02ea2..4e39cf029a65 100644 --- a/games/fortune/datfiles/fortunes.sp.ok +++ b/games/fortune/datfiles/fortunes.sp.ok @@ -1075,7 +1075,7 @@ Stoppard  Stormtroopers  Stretchy  Stult's -Suden +Suenden  Sulu  Sumeria  Summatra @@ -1445,7 +1445,7 @@ drivel  drop't  dummkopfen  dumpster -dunkt +duenkt  e.g  ecamier  ee @@ -1715,8 +1715,8 @@ nylleucylisoleucylarginylglutaminyllysylhistidylprolythreonylisoleucylprolyli  nylprolylprolylleucylglutaminylglycylphenylalanylglycylisoleucylserylalanylpro  obits  obius -obnegleich  obscurantist +ohnegleich  okay  ol;lkld;f;g;dd;po  oln diff --git a/games/fortune/datfiles/fortunes2 b/games/fortune/datfiles/fortunes2 index d4d297170dc0..bd52f56911c0 100644 --- a/games/fortune/datfiles/fortunes2 +++ b/games/fortune/datfiles/fortunes2 @@ -20433,10 +20433,10 @@ Hideously disfigured by an ancient Indian curse?  Call (511) 338-0959 for an immediate appointment.  % -Hier liegt ein Mann ganz obnegleich; -Im Leibe dick, an Suden reich. +Hier liegt ein Mann ganz ohnegleich; +Im Leibe dick, an Suenden reich.  Wir haben ihn in das Grab gesteckt,	Here lies a man with sundry flaws -Weil es uns dunkt er sei verreckt.	And numerous Sins upon his head; +Weil es uns duenkt er sei verreckt.	And numerous Sins upon his head;  					We buried him today because  					As far as we can tell, he's dead. diff --git a/games/fortune/fortune/fortune.6 b/games/fortune/fortune/fortune.6 index ad7d997585ef..725817ced1f6 100644 --- a/games/fortune/fortune/fortune.6 +++ b/games/fortune/fortune/fortune.6 @@ -169,4 +169,4 @@ fortune 50% funny 50% not  .El  .Sh SEE ALSO  .Xr regex 3 , -.Xr regcmp 3 , +.Xr regcomp 3 , diff --git a/games/larn/Makefile b/games/larn/Makefile index 78d3e102087a..4aab5e708bff 100644 --- a/games/larn/Makefile +++ b/games/larn/Makefile @@ -62,8 +62,8 @@ LDADD=	-ltermcap -lcompat  HIDEGAME=hidegame  beforeinstall: -	(cd ${.CURDIR}/datfiles; install -c -o ${BINOWN} -g ${BINGRP} -m 444 \ -	    larnmaze larnopts larn.help \ +	(cd ${.CURDIR}/datfiles; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} \ +	    -m 444 larnmaze larnopts larn.help \  	    ${DESTDIR}/usr/share/games/larn)  .include <bsd.prog.mk> diff --git a/games/larn/larn.6 b/games/larn/larn.6 index 6b4728150395..e64ee6f4402c 100644 --- a/games/larn/larn.6 +++ b/games/larn/larn.6 @@ -150,8 +150,8 @@ of the spell you are casting.  .Sh AUTHOR  Noah Morgan  .Sh FILES -.Bl -tag -width "/var/games/larn.scores" -compact -.It Pa /var/games/larn.scores +.Bl -tag -width "/var/games/larn/lscore12.0" -compact +.It Pa /var/games/larn/lscore12.0  Score file.  .It Pa ~/.larnopts  Options file. diff --git a/games/mille/mille.6 b/games/mille/mille.6 index bcd1af68c4b4..29ae50b640cc 100644 --- a/games/mille/mille.6 +++ b/games/mille/mille.6 @@ -105,7 +105,7 @@ Ken Arnold  .br  (The game itself is a product of Parker Brothers, Inc.)  .SH "SEE ALSO" -curses(3X), +curses(3),  .I "Screen Updating and Cursor Movement Optimization:"  .IR "A Library Package" ,  Ken Arnold diff --git a/games/mille/varpush.c b/games/mille/varpush.c index c31d833ba9e4..a81e340444a9 100644 --- a/games/mille/varpush.c +++ b/games/mille/varpush.c @@ -75,7 +75,7 @@ reg int	(*func)(); {  			char	buf[80];  over:  			printf("Debug file:"); -			gets(buf); +			fgets(buf, 80, stdin);  			if ((outf = fopen(buf, "w")) == NULL) {  				perror(buf);  				goto over; diff --git a/games/morse/Makefile b/games/morse/Makefile index 1d23a0a76812..444118974071 100644 --- a/games/morse/Makefile +++ b/games/morse/Makefile @@ -3,6 +3,6 @@  PROG=	morse  NOMAN=	noman  HIDEGAME=hidegame +CFLAGS += -DSPEAKER=\"/dev/speaker\"  .include <bsd.prog.mk> - diff --git a/games/morse/morse.c b/games/morse/morse.c index ca8a7a340e3b..a78e29fe313b 100644 --- a/games/morse/morse.c +++ b/games/morse/morse.c @@ -31,6 +31,11 @@   * SUCH DAMAGE.   */ +/* + * Taught to send *real* morse by Lyndon Nerenberg (VE7TCP/VE6BBM) + * <lyndon@orthanc.com> + */ +  #ifndef lint  static char copyright[] =  "@(#) Copyright (c) 1988, 1993\n\ @@ -43,103 +48,319 @@ static char sccsid[] = "@(#)morse.c	8.1 (Berkeley) 5/31/93";  #include <stdio.h>  #include <ctype.h> +#include <locale.h> +#include <stdlib.h> + +#ifdef SPEAKER +#include <machine/speaker.h> +#include <fcntl.h> +#endif + +struct morsetab { +	char            inchar; +	char           *morse; +}; + +static struct morsetab mtab[] = { + +	/* letters */ + +	'a', ".-", +	'b', "-...", +	'c', "-.-.", +	'd', "-..", +	'e', ".", +	'f', "..-.", +	'g', "--.", +	'h', "....", +	'i', "..", +	'j', ".---", +	'k', "-.-", +	'l', ".-..", +	'm', "--", +	'n', "-.", +	'o', "---", +	'p', ".--.", +	'q', "--.-", +	'r', ".-.", +	's', "...", +	't', "-", +	'u', "..-", +	'v', "...-", +	'w', ".--", +	'x', "-..-", +	'y', "-.--", +	'z', "--..", + +	/* digits */ + +	'0', "-----", +	'1', ".----", +	'2', "..---", +	'3', "...--", +	'4', "....-", +	'5', ".....", +	'6', "-....", +	'7', "--...", +	'8', "---..", +	'9', "----.", + +	/* punctuation */ -static char -	*digit[] = { -	"-----", -	".----", -	"..---", -	"...--", -	"....-", -	".....", -	"-....", -	"--...", -	"---..", -	"----.", -}, -	*alph[] = { -	".-", -	"-...", -	"-.-.", -	"-..", -	".", -	"..-.", -	"--.", -	"....", -	"..", -	".---", -	"-.-", -	".-..", -	"--", -	"-.", -	"---", -	".--.", -	"--.-", -	".-.", -	"...", -	"-", -	"..-", -	"...-", -	".--", -	"-..-", -	"-.--", -	"--..", +	',', "--..--", +	'.', ".-.-.-", +	'?', "..--..", +	'/', "-..-.", +	'-', "-....-", +	'=', "-...-",		/* BT */ +	':', "---...", +	';', "-.-.-.", +	'(', "-.--.",		/* KN */ +	')', "-.--.-", +	'$', "...-..-", +	'+', ".-.-.",		/* AR */ + +	/* prosigns without already assigned values */ + +	'#', ".-...",		/* AS */ +	'@', "...-.-",		/* SK */ +	'*', "...-.",		/* VE */ +	'%', "-...-.-",		/* BK */ + +	'\0', "" +}; + + +static struct morsetab iso8859tab[] = { +	'á', ".--.-", +	'à', ".--.-", +	'â', ".--.-", +	'ä', ".-.-", +	'ç', "-.-..", +	'é', "..-..", +	'è', "..-..", +	'ê', "-..-.", +	'ö', "---.", +	'ü', "..--", + +	'\0', "" +}; + +static struct morsetab koi8rtab[] = { +	/* +	 * the cyrillic alphabet; you'll need a KOI8R font in order +	 * to see the actual characters +	 */ +	'Á', ".-",		/* a */ +	'Â', "-...",		/* be */ +	'×', ".--",		/* ve */ +	'Ç', "--.",		/* ge */ +	'Ä', "-..",		/* de */ +	'Å', ".",		/* ye */ +	'Ö', "...-",		/* she */ +	'Ú', "--..",		/* ze */ +	'É', "..",		/* i */ +	'Ê', ".---",		/* i kratkoye */ +	'Ë', "-.-",		/* ka */ +	'Ì', ".-..",		/* el */ +	'Í', "--",		/* em */ +	'Î', "-.",		/* en */ +	'Ï', "---",		/* o */ +	'Ð', ".--.",		/* pe */ +	'Ò', ".-.",		/* er */ +	'Ó', "...",		/* es */ +	'Ô', "-",		/* te */ +	'Õ', "..-",		/* u */ +	'Æ', "..-.",		/* ef */ +	'È', "....",		/* kha */ +	'Ã', "-.-.",		/* ce */ +	'Þ', "---.",		/* che */ +	'Û', "----",		/* sha */ +	'Ý', "--.-",		/* shcha */ +	'Ù', "-.--",		/* yi */ +	'Ø', "-..-",		/* myakhkij znak */ +	'Ü', "..-..",		/* ae */ +	'À', "..--",		/* yu */ +	'Ñ', ".-.-",		/* ya */ + +	'\0', ""  }; -static int sflag; +void            show(const char *), play(const char *), morse(char); + +static int      pflag, sflag; +static int      wpm = 20;	/* words per minute */ +#define FREQUENCY 600 +static int      freq = FREQUENCY; + +#ifdef SPEAKER +#define DASH_LEN 3 +#define CHAR_SPACE 3 +#define WORD_SPACE (7 - CHAR_SPACE - 1) +static float    dot_clock; +int             spkr; +tone_t          sound; +#endif -main(argc, argv) -	int argc; -	char **argv; +static struct morsetab *hightab = iso8859tab; + +int +main(int argc, char **argv)  { -	extern char *optarg; -	extern int optind; -	register int ch; -	register char *p; +	extern char    *optarg; +	extern int      optind; +	register int    ch; +	register char  *p; -	while ((ch = getopt(argc, argv, "s")) != EOF) -		switch((char)ch) { +	while ((ch = getopt(argc, argv, "spw:f:")) != EOF) +		switch ((char) ch) { +		case 'f': +			freq = atoi(optarg); +			break; +		case 'p': +			pflag = 1; +			break;  		case 's':  			sflag = 1;  			break; +		case 'w': +			wpm = atoi(optarg); +			break;  		case '?':  		default: -			fprintf(stderr, "usage: morse [string ...]"); +			fputs("usage: morse [-s] [-p] [-w speed] [-f frequency] [string ...]\n", stderr); +			exit(1); +		} +	if (pflag && sflag) { +		fputs("morse: only one of -p and -s allowed\n", stderr); +		exit(1); +	} +	if (pflag && ((wpm < 1) || (wpm > 60))) { +		fputs("morse: insane speed\n", stderr); +		exit(1); +	} +	if (pflag && (freq == 0)) +		freq = FREQUENCY; + +	(void)setuid(getuid()); +#ifdef SPEAKER +	if (pflag) { +		if ((spkr = open(SPEAKER, O_WRONLY, 0)) == -1) { +			perror(SPEAKER);  			exit(1);  		} +		dot_clock = wpm / 2.4;		/* dots/sec */ +		dot_clock = 1 / dot_clock;	/* duration of a dot */ +		dot_clock = dot_clock / 2;	/* dot_clock runs at twice */ +						/* the dot rate */ +		dot_clock = dot_clock * 100;	/* scale for ioctl */ +	} +#endif  	argc -= optind;  	argv += optind; -	if (*argv) +	if((p = getenv("LC_CTYPE")) || (p = getenv("LANG"))) { +		if(strlen(p) >= strlen("KOI8-R") && +		   strcasecmp(&p[strlen(p) - strlen("KOI8-R")], "KOI8-R") == 0) +			hightab = koi8rtab; +		setlocale(LC_CTYPE, p); +	} else { +		setlocale(LC_CTYPE, ""); +	} + +	if (*argv) {  		do { -			for (p = *argv; *p; ++p) -				morse((int)*p); +			for (p = *argv; *p; ++p) { +				morse((int) *p); +			} +			morse((int) ' ');  		} while (*++argv); -	else while ((ch = getchar()) != EOF) -		morse(ch); +	} else { +		while ((ch = getchar()) != EOF) +			morse(ch); +	} +	exit(0);  } -morse(c) -	register int c; +void +morse(char c)  { +	struct morsetab *m; +  	if (isalpha(c)) -		show(alph[c - (isupper(c) ? 'A' : 'a')]); -	else if (isdigit(c)) -		show(digit[c - '0']); -	else if (c == ',') -		show("--..--"); -	else if (c == '.') -		show(".-.-.-"); -	else if (isspace(c)) -		show(" ...\n"); +		c = tolower(c); +	if ((c == '\r') || (c == '\n')) +		c = ' '; +	if (c == ' ') { +		if (pflag) { +			play(" "); +			return; +		} else { +			show(""); +			return; +		} +	} +	for (m = ((unsigned char)c < 0x80? mtab: hightab); +	     m->inchar != '\0'; +	     m++) { +		if (m->inchar == c) { +			if (pflag) { +				play(m->morse); +			} else +				show(m->morse); +		} +	}  } -show(s) -	register char *s; +void +show(const char *s)  {  	if (sflag)  		printf(" %s", s); -	else for (; *s; ++s) -		printf(" %s", *s == '.' ? "dit" : "daw"); -	printf(",\n"); +	else +		for (; *s; ++s) +			printf(" %s", *s == '.' ? "dit" : "dah"); +	printf("\n"); +} + +void +play(const char *s) +{ +#ifdef SPEAKER +	const char *c; + +	for (c = s; *c != '\0'; c++) { +		switch ((int) *c) { +		case '.': +			sound.frequency = freq; +			sound.duration = dot_clock; +			break; +		case '-': +			sound.frequency = freq; +			sound.duration = dot_clock * DASH_LEN; +			break; +		case ' ': +			sound.frequency = 0; +			sound.duration = dot_clock * WORD_SPACE; +			break; +		default: +			sound.duration = 0; +		} +		if (sound.duration) { +			if (ioctl(spkr, SPKRTONE, &sound) == -1) { +				perror("ioctl play"); +				exit(1); +			} +		} +		sound.frequency = 0; +		sound.duration = dot_clock; +		if (ioctl(spkr, SPKRTONE, &sound) == -1) { +			perror("ioctl rest"); +			exit(1); +		} +	} +	sound.frequency = 0; +	sound.duration = dot_clock * CHAR_SPACE; +	ioctl(spkr, SPKRTONE, &sound); +#endif  } diff --git a/games/phantasia/Makefile b/games/phantasia/Makefile index 7c6191679157..8e6ecccc10fb 100644 --- a/games/phantasia/Makefile +++ b/games/phantasia/Makefile @@ -16,16 +16,16 @@ setup: phantglobs.o setup.o monsters.asc ${LIBM}  beforeinstall:  	./setup -m ${.CURDIR}/monsters.asc -	install -c -m 660 -o games -g bin gold ${DESTDIR}/var/games/phantasia -	install -c -m 660 -o games -g bin lastdead ${DESTDIR}/var/games/phantasia -	install -c -m 660 -o games -g bin mess ${DESTDIR}/var/games/phantasia -	install -c -m 660 -o games -g bin monsters ${DESTDIR}/var/games/phantasia -	install -c -m 660 -o games -g bin motd ${DESTDIR}/var/games/phantasia -	install -c -m 660 -o games -g bin characs ${DESTDIR}/var/games/phantasia -	install -c -m 660 -o games -g bin scoreboard ${DESTDIR}/var/games/phantasia -	install -c -m 660 -o games -g bin void ${DESTDIR}/var/games/phantasia - -# Make Phantasia map.  Change the map commands reflect your installation. +	${INSTALL} -c -m 660 -o games -g bin gold ${DESTDIR}/var/games/phantasia +	${INSTALL} -c -m 660 -o games -g bin lastdead ${DESTDIR}/var/games/phantasia +	${INSTALL} -c -m 660 -o games -g bin mess ${DESTDIR}/var/games/phantasia +	${INSTALL} -c -m 660 -o games -g bin monsters ${DESTDIR}/var/games/phantasia +	${INSTALL} -c -m 660 -o games -g bin motd ${DESTDIR}/var/games/phantasia +	${INSTALL} -c -m 660 -o games -g bin characs ${DESTDIR}/var/games/phantasia +	${INSTALL} -c -m 660 -o games -g bin scoreboard ${DESTDIR}/var/games/phantasia +	${INSTALL} -c -m 660 -o games -g bin void ${DESTDIR}/var/games/phantasia + +# Make Phantasia map.  Change the map commands reflect your ${INSTALL}ation.  # PLOTDEVICE is used for plotting the map.  Change as appropriate.  map: map.c diff --git a/games/quiz/Makefile b/games/quiz/Makefile index 804464424ff6..fabca7f548bf 100644 --- a/games/quiz/Makefile +++ b/games/quiz/Makefile @@ -10,7 +10,7 @@ CATS=	africa america areas arith asia babies bard chinese collectives \  HIDEGAME=hidegame  beforeinstall: -	(cd ${.CURDIR}/datfiles; install -c -o ${BINOWN} -g ${BINGRP} -m 444 \ -	    ${CATS} ${DESTDIR}/usr/share/games/quiz.db) +	(cd ${.CURDIR}/datfiles; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} \ +	    -m 444 ${CATS} ${DESTDIR}/usr/share/games/quiz.db)  .include <bsd.prog.mk> diff --git a/games/quiz/quiz.c b/games/quiz/quiz.c index aa5f52783e6f..25ee3ed5f544 100644 --- a/games/quiz/quiz.c +++ b/games/quiz/quiz.c @@ -316,11 +316,14 @@ appdstr(s, tp, len)  	if ((m = malloc(strlen(s) + len + 1)) == NULL)  		err("%s", strerror(errno));  	for (mp = m, sp = s; *mp++ = *sp++;); +	mp--;  	if (*(mp - 1) == '\\')  		--mp; -	while ((ch = *mp++ = *tp++) && ch != '\n'); -	*mp = '\0'; +	memcpy(mp, tp, len); +	mp[len] = '\0'; +	if (mp[len - 1] == '\n') +		mp[len - 1] = '\0';  	free(s);  	return (m); diff --git a/games/robots/Makefile b/games/robots/Makefile index 7e9af468a2f1..bded13469ba8 100644 --- a/games/robots/Makefile +++ b/games/robots/Makefile @@ -10,7 +10,7 @@ LDADD=	-lcurses -ltermcap -lcompat  HIDEGAME=hidegame  beforeinstall: -	install -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \  	    ${DESTDIR}/var/games/robots_roll  .include <bsd.prog.mk> diff --git a/games/sail/pl_main.c b/games/sail/pl_main.c index 7b1f457662c7..02faa79390b5 100644 --- a/games/sail/pl_main.c +++ b/games/sail/pl_main.c @@ -198,11 +198,12 @@ reprint:  	else {  		(void) printf("Your name, Captain? ");  		(void) fflush(stdout); -		(void) gets(captain); +		(void) fgets(captain, sizeof captain, stdin);  		if (!*captain)  			(void) strcpy(captain, "no name"); +		else +			captain[strlen(captain) - 1] = '\0';  	} -	captain[sizeof captain - 1] = '\0';  	Write(W_CAPTAIN, ms, 1, (int)captain, 0, 0, 0);  	for (n = 0; n < 2; n++) {  		char buf[10]; diff --git a/games/snake/snake/Makefile b/games/snake/snake/Makefile index 7d79adf31f05..8b96cfc8bc3c 100644 --- a/games/snake/snake/Makefile +++ b/games/snake/snake/Makefile @@ -6,6 +6,7 @@ MAN6=	snake.6  DPADD=	${LIBM} ${LIBTERMCAP} ${LIBCOMPAT}  LDADD=	-lm -ltermcap -lcompat  HIDEGAME=hidegame +MLINKS=	snake.6 snscore.6  .include "../../Makefile.inc"  .include <bsd.prog.mk> diff --git a/games/snake/snake/snake.6 b/games/snake/snake/snake.6 index 14d86bfdb9fa..774153c56daa 100644 --- a/games/snake/snake/snake.6 +++ b/games/snake/snake/snake.6 @@ -99,9 +99,9 @@ To see who wastes time playing snake, run  .I snscore .  .SH FILES  .nf -.ta \w'/usr/games/lib/snakerawscores 'u -/usr/games/lib/snakerawscores	database of personal bests -/usr/games/lib/snake.log	log of games played +.ta \w'/var/games/snakerawscores 'u +/var/games/snakerawscores	database of personal bests +/var/games/snake.log	log of games played  .DT  .fi  .SH BUGS diff --git a/games/wargames/Makefile b/games/wargames/Makefile index 6246697a3fbd..56713f2d4852 100644 --- a/games/wargames/Makefile +++ b/games/wargames/Makefile @@ -4,7 +4,7 @@ NOOBJ=	noobj  all wargames clean cleandir depend lint tags:  install: -	install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} wargames.sh \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} wargames.sh \  	    ${DESTDIR}/usr/games/wargames  .include <bsd.prog.mk> diff --git a/games/wump/Makefile b/games/wump/Makefile index de09ffb7c18d..a4ccedc53a29 100644 --- a/games/wump/Makefile +++ b/games/wump/Makefile @@ -5,7 +5,7 @@ MAN6=	wump.6  HIDEGAME=hidegame  beforeinstall: -	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/wump.info \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/wump.info \  	    ${DESTDIR}/usr/share/games  .include <bsd.prog.mk> diff --git a/gnu/Makefile b/gnu/Makefile index 6bc3f4d4c04e..88925400f1cd 100644 --- a/gnu/Makefile +++ b/gnu/Makefile @@ -1,5 +1,6 @@  #	@(#)Makefile	5.33.1.1 (Berkeley) 5/6/91 +#	$Id$ -SUBDIR= games include lib libexec usr.bin usr.sbin +SUBDIR= include lib libexec usr.bin usr.sbin  .include <bsd.subdir.mk> diff --git a/gnu/games/Makefile b/gnu/games/Makefile deleted file mode 100644 index 4a7577e53ef8..000000000000 --- a/gnu/games/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -#	$Id$ - -SUBDIR=	chess - -.include <bsd.subdir.mk> diff --git a/gnu/games/Makefile.inc b/gnu/games/Makefile.inc deleted file mode 100644 index 4437a8428bef..000000000000 --- a/gnu/games/Makefile.inc +++ /dev/null @@ -1,9 +0,0 @@ -#	$Id$ - -BINOWN?=	games -.if defined(HIDEGAME) -BINDIR?=	/usr/games/hide -BINMODE?=	4700 -.else -BINDIR?=	/usr/games -.endif diff --git a/gnu/games/chess/DOCUMENTATION/ARTICLE b/gnu/games/chess/DOCUMENTATION/ARTICLE deleted file mode 100644 index b2ab331d21d5..000000000000 --- a/gnu/games/chess/DOCUMENTATION/ARTICLE +++ /dev/null @@ -1,66 +0,0 @@ -[This article was reproduced from a GNU Bulletin.] - -                          GNU Chess -                      by Stuart Cracraft -		copyright 1987 Stuart Cracraft - - -   GNU Chess is a communal chess program. Contributors donate their -time and effort in order to make it a stronger, better, sleeker program. -Contributions take many forms: interfaces to high-resolution displays, -opening book treatises, speedups of the underlying algorithms, additions -of extra heuristics. These contributions are then distributed to the -large user-base so that all may enjoy the fruits of our labor. The -original and continuing purpose of this project is to permanently end  -the rampant hoarding of computer chess software that has been the  -case for the past 20 years. - -   Many people have contributed to GNU Chess. Their contributions have -improved the program from being a patzer (weak program) to being a -grandpatzer (decently strong program). In its growth since initial -release, GNU Chess has gone from approximately class D to expert -strength. It beats the Fidelity Excel commercial unit rather handily. - -   GNU Chess's structure is a hybrid of the Shannon Type-A and -Type-B methods. It conducts a full-width search to a fixed-depth -and then continues with a quiescence search for many more ply. -This quiescence search helps the program find positions which -can be safely evaluated and which are not too turbulent. If -a terminal position is too turbulent, the evaluation will be -highly inaccurate. Additional searching by investigating series -of captures, checks, and other potentially imbalance-producing -moves is quite helpful. - -  GNU Chess will sacrifice pieces in order to reach known winning -endings. Also, it uses a trade-down bonus to encourage the stronger -side to trade off certain types of pieces thus reaching a more -simplified and therefore ostensibly "clearer" position. - -  GNU Chess has certain types of knowledge regarding easier endgames. -This allows it to play these endings somewhat better than might be -expected. - -  GNU Chess has time heuristics that it uses to improve its handling  -of time-controls and hasten its making of "obvious" moves. -  -  GNU Chess is interfaced to the SUN Windows and X Windows -display protocols and can display its pieces in elaborate format, -similar to chess diagrams. - -  GNU Chess has an opening book which consists of many variations -from MCO (Modern Chess Openings). - -  For comparison purposes, GNU Chess running on a VAX 8650 is -stronger than the famous Chess 4.5 running on a CDC 6400. - -  We wish to acknowledge the contributions of the following -individuals: (in alphabetical order) Jim Aspnes, Wayne Christopher, -Steve Dougherty, David Goldberg, Richard Greenblatt, David Kittinger, -Richard Stallman, John Stanback, and Ken Thompson. - -  Contact information: The author may be reached by a variety of -methods. Via U.S. mail: Stuart Cracraft, 5 Via Amistosa, Suite G, -Rancho Santa Margarita, Ca. 92688 USA.  -    By Internet: 'cracraft at wheaties.ai.mit.edu' -The author may also be contacted via the Free Software Foundation, Inc. -675 Massachusetts Ave.,Cambridge MA 02139. diff --git a/gnu/games/chess/DOCUMENTATION/ARTICLE.2 b/gnu/games/chess/DOCUMENTATION/ARTICLE.2 deleted file mode 100644 index 031ae18f9e4b..000000000000 --- a/gnu/games/chess/DOCUMENTATION/ARTICLE.2 +++ /dev/null @@ -1,123 +0,0 @@ - - -                 GNU Chess: Experiences Learned -                      with Communal Sharing -                       by Stuart Cracraft -              (and contributors to the GNU Project) - - -Limited sharing has characterized the  computer  chess  community -for the past two decades. Occasional research articles give hints -and suggestions for useful features, but rarely reveal  the  real -details  of  the  critically  important  advances.  We  will here -describe an effort underway (titled "GNU Chess") to create a more -open and friendly environment of sharing. - -GNU Chess is part of Project GNU, a large-scale effort  in  which -the philosophical goals are far-reaching. We will not go into any -great depth about these goals as they relate to the  larger  pro- -ject, because these are described elsewhere [1]. However, we will -mention the basic issues and the changes we hope to encourage. - -The start of the GNU Chess project was a natural  result  of  the -experiences  gleaned in writing a chess program. While the author -was at a progressive academic location [2], he was able  to  con- -ceive the idea of a communal chess program only after much heart- -ache.  During the period of writing the initial  version  (which -has  since  undergone  many improvements and whole revisions), it -became clear that the best features and most  useful  hints,  the -very best of the heuristics, were hidden and difficult to find in -the literature. - -Sprinkled across many books, research papers, magazine  articles, -accumulated in the community, during the past 25 years, there was -literally a void of true,  empirical  programs.  Locating  usable -programs was difficult. Many programs were the result of academic -work in "ivory towers", and hence were inaccessible to the common -man. Other programs were sequestered in research think-tanks. Na- -turally, developers  of  commercial  programs  carefully  guarded -their  source  in order to protect their investment. On the other -hand, a few chess program source listings had actually been  pub- -lished, but these were not really very strong, often written in a -non-general language, and frequently more pedantic  than  practi- -cal. - -The idea of a  reasonably  strong  communal  program  solidified. -When  we  refer  to  a communal program, we do not regard this as -public-domain software. Rather, we refer to a  program  which  is -under  the shared authority of a number of individuals, the prin- -cipal contributors.  These individuals have experienced and real- -ized  the  positive  results of a sharing community and the rapid -improvements that come through contributing in such a  community. -Further, these individuals devote time and energy to coordinating -the contributions of other individuals.  While  they  exercise  a -certain editorial right, this is usually not exercised arbitrari- -ly; instead, a discussion is often undertaken. - -Eventually, a working C program that played chess was  available. -The  coordinating  institution  for Project GNU [3], accepted our -suggestion of inclusion of a chess program in the  GNU  distribu- -tion.  Initial  distribution of GNU Chess commenced in October of -1986. Interest in the project increased rapidly. - -Contributions came in from many places and people. Interfaces  to -X-windows  and SUN-windows were donated, thus allowing very fancy -chess fonts on bit-mapped screens. Also, contributions  involving -large  portions  of  opening books such as MCO and collections of -master games  were  added  to  the  distribution.   Additionally, -tree-search modifications and heuristics were provided, and occa- -sionally even entire rewrites. - -The program advanced in strength by several USCF class  intervals -during  a  period  of  less than one year. During this time, many -unusual features and enhancements were added to the program, usu- -ally under the coordination of two or more people, with one work- -ing in a distant-advisory capacity to the other. Frequently, gra- -duate  students  would give up significant time from their thesis -work to devote energy to contributing. Their  corporate  counter- -parts would often give up project time to make their donation. - -Contributors would often enter the project in a very forceful way -and  then  having made their contribution, learn the viability of -communal sharing once others had stepped in  and  contributed  to -them, thus providing considerable reinforcement. Frequently, con- -tributors would then go into "hibernation" for a long  period  of -time,  but  most  of  them remained open to contributing and were -helpful when asked to reprogram their particular contribution  in -a more recent version. - -GNU Chess has made great strides in relatively little  time.   It -has  run  on  many  different hardware architectures and has been -compiled by a number of C compilers [4]. A sampling of  the  com- -puters  on  which  the  program  has  run is: National 32032, Vax -11/750, 8550, 8600, 8650, Motorola  68020,  CCI  5/32,  CCI  6/32 -(tahoe), Cray XMP. - -It is our belief that GNU Chess will stimulate graduate  research -in computer chess theory and practice.  When students are able to -easily obtain a state-of-the-art program in  order  to  test  out -their  ideas, they will no longer need to reinvent the wheel. The -students will be able to investigate their  research  areas  much -more thoroughly, because they will spend more time on the specif- -ic research areas they are concerned about.  Basically, GNU Chess -"frees up" time in order to get on to more fundamental issues. - -We also feel that as other researchers  gain  trust  in  the  GNU -Chess  project, they will be more likely to release their results -directly and rapidly, through journal articles,  or  directly  to -the  GNU  project,  and  in fact become contributors and join the -present list [5]. At the very  least,  a  communal,  ever-growing -program will encourage the few "closeted" researchers to be some- -what more open in their approach to disseminating advances. - -In whatever form it takes, the  progress  toward  elaboration  of -machine  chess  is  ongoing,  and  we hope that GNU chess will be -helpful to the community. Copies of GNU Chess source and  "book", -as  well  as  additional experimental code are available from the -Free Software Foundation [3] or the author [6]. - - -[1] The GNU Manifesto, Richard Stallman, Free Software Foundation, Inc. - -[2] University of Southern California, Information Sciences Institute. - diff --git a/gnu/games/chess/DOCUMENTATION/CHANGES b/gnu/games/chess/DOCUMENTATION/CHANGES deleted file mode 100644 index 9866075ab8a8..000000000000 --- a/gnu/games/chess/DOCUMENTATION/CHANGES +++ /dev/null @@ -1,362 +0,0 @@ -	  GNU CHESS HISTORY -    (#include "../version.h") - -August 1, 1989 -- Jay Scott -He proofread the opening book and made -corrections. - -June 21, 1989 -- Hes @log-se.sv -He contributed new move generation routines (move.c move.h) to speedup -move generation and the overall program, by about 15-30% - -June 9, 1989 -- Tim Radzy (unet!nplab4!radz@ames.arc.nasa.gov) -He fixed a bug in xchess/board.c. In a post-game new-game situation, -castling wouldn't be permitted under circumstances. Tim made -it possible to castle again. - -May 12, 1989 -- Joe Garbarini (garbarini%kegger@circus.llnl.gov) -Recommended changes to documentation vis a vis chesstool usage. - -May 5, 1989 -- Jouko Holopainen (jhol@tolsun.oulu.fi) -Wrote code to support underpromotion. -Changed interface to accept ECO/Informator style moves. - -April 30, 1989 -- Various GNU contributors -setlinebuf() modification for xchess/chesstool. -check for zero division in time printout. - -January 17, 1989 -- Anders Thulin -Provided extensive addition to the opening book for his -favorite opening the Vienna Game. This was drawn from ECO. - -November 23, 1988 -- Stuart Cracraft -Installed new version of Xchess that is better debugged, works on -the next version of X. Thanks to Wayne Christopher and Arturo Perez. - -August 28, 1988 -- Stuart Cracraft -Removed a sacrifice line from the Giuoco Piano entry in the opening -book; the program didn't seem to like the positions it got from this line. -   -December 30, 1987 -- John Stanback -Wrote a short blurb on the heuristics contained in GNU Chess. It resides -in the subdirectory DOCUMENTATION as the file HEURISTICS. - -December 17, 1987 -- John Stanback -Modified criteria for positional evaluation in quiescence search -to include positions in which the estimated score lies within -the alpha-beta window; fixed a bug in the king proximity to pawns heuristic; -fixed a bug involving passed pawn heuristics; - -December 16, 1987 -- Stuart Cracraft -Added automatic 'list' upon exit (both in display, non-display, and -chesstool mode); command-line setting of tournament time controls -bug fixed. - -December 14, 1987 -- John Stanback -GNU defeated the commercial product 'Fidelity Excellence' 5.5-4.5 in -a 10-game match. It was running at about 500 nodes per second (typical -of its speed on a VAX 8650) and this would indicate its strength -would be about USCF 1875-1900. - -December 4, 1987 -- John Stanback -Man page added. Command line arguments now specify regular clock -settings if so desired (useful for SUN players). Thinking -on opponent's time is now disabled by default. Estimated  -rating is 1850 at 500 nodes per second. - -October 20, 1987 -- Stuart Cracraft -Fixed GNU/SUN interaction. Chesstool and its features now -seem to fully work. - -October 5, 1987 -- Ken Thompson -GNU beat Belle (actually drew due to a bug, but -Ken kept GNU playing through to the win) while -running on a Cray XMP-48. In this 3-1 time handicap game -Belle outsearched Cray GNU by 10-1 (even with the handicap). - -September 26, 1987 -- John Stanback at HP -Hash table functioning. Thinking on opponent's -time functioning. - -August 20, 1987   -- Mike Meyer at Berkeley -Mike ran GNU Chess on a Cray 1 supercomputer. -The system was very heavily loaded, so the -program was not as speedy as with the Cray below. - -August 16, 1987   -- David Goldberg at SUN -He added "chesstool" support so that this -version of GNU Chess can run under the -display manager "chesstool". - -August 15, 1987   -- John Stanback at HP -Hash tables, more heuristics, a modified -search which is more efficient. He also -discovered a bug in the piece-exchanger. This -would cause the program to exchange pieces suboptimally. -With this fix, the program should play much -more strongly. - -August 13, 1987   -- Ken Thompson at Bell Labs -Ken ran GNU Chess on a Cray XMP supercomputer - (among other processors). The program got - about 3000-4000 chess positions per second - which is comprable to today's fastest bit-slice  - commercial machines. Also, he had GNU Chess - play two games against Belle. - -July 19, 1987 -- Jay Scott & John Stanback - Many positional heuristics have been added. - -July 18, 1987 -- Stuart Cracraft - Improvements have been made to the opening - book. It is mostly an MCO book, containing - major variations from many of the major openings - and particularly in-depth on Sicilian. - -May 11, 1987  -- John Stanback at HP - He donated his chess program, a fairly mature - and strong program. - -May 1, 1987   -- Stuart Cracraft - He added several bug fixes various people - had reported. He also changed makemove() so that - the calling syntax is makemove(movelist,index,board) - rather than makemove(move,board). Having the latter - tickled a bug in at least one manufacturer's C-compiler, - so rather than write fancy code, we simplified it. - -April 25, 1987-- Jim Aspnes at MIT -He added all sorts of useful capabilities, -including positional evaluation in the tree -search using a table-driven algorithm, -modifying transposition table code in order -to work properly, though it doesn't improve -speed too much, checkmates/stalemates detected -in the search, en passant captures allowed, -detect repeated positions, iterative deepening, -quicker quiescence search, tournament time controls, -sqattacked sped up by a factor of 4, compile-time -debugging options. - -January 2, 1987   -- Stuart Cracraft - He added a few more Tal games to the collection. - -January 2, 1987   -- Jim Aspnes at MIT - He contributed MCO variations for the Catalan, - Queen's Indian, and Reti openings. - -December 29, 1986 -- Jim Aspnes at MIT - He contributed all MCO variations of the Najdorf - to the opening book. He also contributed a LISP - macro (written in GNU Emacs Lisp) to convert - xchess game formats to GNU Chess opening book - format.  - -December 14, 1986 -- Ken Thompson at Bell Labs - He contributed almost 200 games by Tal to - our collection of Tal-games, bringing the - total number of Tal positions in the book - to 10,692. Total book positions now 13,207. - These reside in bookin, bookin.bdg, bookin.tal. - Note that presently, only bookin and bookin.tal - can be used. The new Tal positions came in a - slightly different format, which we have chosen - to adopt as our standard format. All book - games in bookin and bookin.bdg will gradually - change into the new standard format. - -December 11, 1986 -- Stuart Cracraft - Added "averages" for node-count per move, - cpu per move, rate per move to list_history - and write_history. - New version of Xchess installed. - Started typing in Tal games into "bookin.tal". - Added "total book positions" printout to "book" - and "enter" statistics printout. - -December 10, 1986 -- Stuart Cracraft - Implemented aspiration search in normal - alpha-beta search. Speedups of 3% to 40% - have been noticed in most positions. - Occasionally a slower search will result, - but it is thought these are worth the - usual speedups. - -December 9, 1986  -- Stuart Cracraft - Fixed minor bug in write_history() - Added another Tal game, 2nd game of 1st world - championship match with Botvinnik, a Benoni. - -December 9, 1986  -- Stuart Cracraft - Enhanced parallelism. All parallel processors - now communicate via a shared data file and - are kept running (in idle loops watching the - shared data file). This saves us a few seconds - on each move since the 'rsh' need not be invoked - more than once (at the beginning). Since the - shared data file is now implemented, we will - next work towards a "parallel anarchy" in which - any processor can use any other processor in - order to reduce its search. The current scheme - with the program being only as fast as its slowest - processor, is quite inefficient. - -December 1, 1986 --  Jim Aspnes at MIT - Added a couple of Master games from  - Modern Chess Openings 12 (a Fischer game, - and a Matanovic game). - -November 30, 1986 -- Stuart Cracraft - Added parallelism. Can now handle multiple - processors (sharing same disk). Later we will - add the capability to use processors not sharing - the same disk. Modified README and MAN-PAGE. - -November 26, 1986 -- Stuart Cracraft - Fixed a few bugs in book-mailing mechanism. - Fixed a bug regarding situations where only - one move is available. - Fixed a bug in read_history() that caused - Black queenside castles to be mishandled. - -November 25, 1986 -- Stuart Cracraft - Added two pawn heuristics. Reward pawns moving into - a phalanx of pawns. A phalanx is two or more - horizontally-connected pawns. Likewise, penalize - pawns leaving a phalanx of pawns. The penalty for - leaving is a little more than the reward for - entering. - -November 24, 1986 -- Stuart Cracraft - A user reported an unbelievable bug. Investigation - of this bug led to the discovery that GNU Chess was -  not picking the move judged best by the tree search - in all cases. This resulted in the bug showing -  itself which further showed that the program was - selecting an inferior move. This may result in an - improvement to the program's play. - -November 24, 1986 -- Stuart Cracraft - Added two heuristics. Penalize king moves if - the king hasn't castled yet. Also, penalize pawn - moves which produce doubled pawns. Should - probably have something for isolated pawns - too. - -November 23, 1986 -- Wayne Christopher at Berkeley - New version of X chess display front-end. - Fixed bugs include multiple pieces, runs - on SUNS & Bobcats, loads saved games. - -November 23, 1986 -- Stuart Cracraft - Cleaned up some minor bugs regarding history. - Added "Illegal command" error message at Wayne's - request. - -November 22, 1986 -- David Goldberg at SUN Microsystems - He complained that GNU Chess was memory-hungry. - A few minor modifications to hash.c reduced - uninitialized data space 87% and text space - 12%. This should make it easier for GNU Chess - to run on small computers. - -November 22, 1986 -- Stuart Cracraft - "read" command was working, but needed - additional tweaking so that history - array would be printed by list_history(). - -November 19, 1986 -- Stuart Cracraft - Added "read" command which reads a history - file (game listing) and restores the board - to as if the person was still playing that. - particular game. Generally cleaned up  - history mechanism, made it more orthogonal. - Revised README. Added doc to MAN-PAGE. - -November 16, 1986 -- Stuart Cracraft - More opening book bugs found and fixed. - Added capability to accept abbreviated-algebraic notation - for entering "book" games from files. - Added approximately 2500 new positions to - opening book from games involving the - opening called Blackmar-Diemer Gambit, - a hoary line developed by Diemer in - Germany years ago. - -November 15, 1986 -- Wayne Christopher at Berkeley - He modified the move generator, resulting in - a 28% speedup. - -November 14, 1986 -- Stuart Cracraft - He documented a lot of the GNU Chess modules - with brief comments for each function. More - extensive internal documentation may go in - later. - -November 14, 1986 -- Wayne Christopher at Berkeley - He created the Xchess interface for - GNU Chess to have windowing with X windows. - -November 14, 1986 -- Stuart Cracraft - He added a "randomization" feature to - the opening book. This will cause the - program to select randomly from alternate - variations whenever -DBEST is removed - from Makefile's CFLAGS. If this is not - removed, the opening play selects the - first move found in the book as it appears - "in order" in the human-readable book. - -November 14, 1986 -- David Goldberg at SUN Microsystems - He responded to a query about dbm(3) which - eventually resulted in the fixing of a subtle - bug in the book code which was causing the - program to sometimes hash to the incorrect - address and thereby produce a book move which - didn't even exist in the book. Thanks David! - -November 14, 1986 -- Stuart Cracraft - He added the "oboard" routine in util.c. This - is the reverse of the already extant "iboard" - (same module). These two routines translate - between GNU Chess internal format and - Forsythe notation. - -November 10, 1986 -- Stuart Cracraft - He added the "enter" command. This causes - the current game to be entered in the book. - Then, GNU Chess tries to mail this new entry - to the book maintainers (for inclusion in - the master copy of the book). - -November 9, 1986 -- Stuart Cracraft -He added code for an opening book. MAN-PAGE -and README were modified accordingly. - -November 8, 1986 -- Stuart Cracraft -Checks and mates are now noticed at ply-1. -This is a more complete fix to the Oct 31 fix. - -October 31, 1986 -- Stuart Cracraft -First attempt at fix to bug which causes -program to check human's king when program -itself is in check. - -October 31, 1986 -- Mly at MIT -Reported a bug which caused program to crash -when an illegal human move was played. Fixed. -Also, program was unable to play as White. Fixed. - -October 22, 1986 -- Stuart Cracraft -Pps now rewards moves which liberate bishops. - -October 19, 1986 -- Stuart Cracraft -Added bitmapper routines to distribution. -Added version notice. - -October 19, 1986 -- David Goldberg at SUN Microsystems -Interfaced GNU Chess with SUN's chesstool. - -October 18, 1986 -- Initial release date.  - - diff --git a/gnu/games/chess/DOCUMENTATION/COPYING b/gnu/games/chess/DOCUMENTATION/COPYING deleted file mode 100644 index 17847b71307f..000000000000 --- a/gnu/games/chess/DOCUMENTATION/COPYING +++ /dev/null @@ -1,123 +0,0 @@ -		 GNU CHESS GENERAL PUBLIC LICENSE - - Copyright (C) 1986,1987 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license, but changing it is not allowed. - -  The license agreements of most software companies keep you at the -mercy of those companies.  By contrast, our general public license is -intended to give everyone the right to share GNU Chess.  To make -sure that you get the rights we want you to have, we need to make -restrictions that forbid anyone to deny you these rights or to ask you -to surrender the rights.  Hence this license agreement. - -  Specifically, we want to make sure that you have the right to give -away copies of GNU Chess, that you receive source code or else can get it -if you want it, that you can change GNU Chess or use pieces of it in new -free programs, and that you know you can do these things. - -  To make sure that everyone has such rights, we have to forbid you to -deprive anyone else of these rights.  For example, if you distribute -copies of GNU Chess, you must give the recipients all the rights that you -have.  You must make sure that they, too, receive or can get the -source code.  And you must tell them their rights. - -  Also, for our own protection, we must make certain that everyone -finds out that there is no warranty for GNU Chess.  If GNU Chess is -modified by someone else and passed on, we want its recipients to know -that what they have is not what we distributed, so that any problems -introduced by others will not reflect on our reputation. - -  Therefore the Free Software Foundation, Inc. makes the following -terms which say what you must do to be allowed to distribute or change -GNU Chess. - -			COPYING POLICIES - -  1. You may copy and distribute verbatim copies of GNU Chess source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each file a valid copyright notice -"Copyright (C) 1986,1987 Free Software Foundation, Inc.", containing the -year of last change for the file in question; keep intact the notices -on all files that refer to this License Agreement and to the absence -of any warranty; and give any other recipients of the GNU Chess -program a copy of this License Agreement along with the program. - -  2. You may modify your copy or copies of GNU Chess source code or -any portion of it, and copy and distribute such modifications under -the terms of Paragraph 1 above, provided that you also do the following: - -    a) cause the modified files to carry prominent notices stating -    who last changed such files and the date of any change; and - -    b) cause the whole of any work that you distribute or publish, -    that in whole or in part contains or is a derivative of GNU Chess -    or any part thereof, to be freely distributed -    and licensed to all third parties on terms identical to those -    contained in this License Agreement (except that you may choose -    to grant more extensive warranty protection to third parties, -    at your option). - -    c) if the modified program serves as a text editor, cause it -    when started running in the simplest and usual way, to print -    an announcement including a valid copyright notice ("Copyright -    (C)", the year of authorship, and all copyright owners' names), -    saying that there is no warranty (or else, saying that you provide -    a warranty) and that users may redistribute the program under -    these conditions, and telling the user how to view a copy of -    this License Agreement. - -  3. You may copy and distribute GNU Chess or any portion of it in -compiled, executable or object code form under the terms of Paragraphs -1 and 2 above provided that you do the following: - -    a) cause each such copy of GNU Chess to be accompanied by the -    corresponding machine-readable source code; or - -    b) cause each such copy of GNU Chess to be accompanied by a -    written offer, with no time limit, to give any third party -    free (except for a nominal shipping charge) machine readable -    copy of the corresponding source code; or - -    c) in the case of a recipient of GNU Chess in compiled, executable -    or object code form (without the corresponding source code) you -    shall cause copies you distribute to be accompanied by a copy -    of the written offer of source code which you received along -    with the copy of GNU Chess. - -  4. You may not copy, sublicense, distribute or transfer GNU Chess -except as expressly provided under this License Agreement.  Any attempt -otherwise to copy, sublicense, distribute or transfer GNU Chess is void and -your rights to use GNU Chess under this License agreement shall be -automatically terminated.  However, parties who have received computer -software programs from you with this License Agreement will not have -their licenses terminated so long as such parties remain in full compliance. - -Your comments and suggestions about our licensing policies and our -software are welcome!  Please contact the Free Software Foundation, Inc., -1000 Mass Ave, Cambridge, MA 02138, or call (617) 876-3296. - -			   NO WARRANTY - -  BECAUSE GNU CHESS IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY -NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT -WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, -AND/OR OTHER PARTIES PROVIDE GNU CHESS "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -PROGRAM IS WITH YOU.  SHOULD THE GNU CHESS PROGRAM PROVE DEFECTIVE, -YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL FREE SOFTWARE -FOUNDATION, INC., AND/OR ANY OTHER PARTY WHO MAY MODIFY AND -REDISTRIBUTE GNU CHESS AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR -INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA -BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A -FAILURE OF THE PROGRAM TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY -FREE SOFTWARE FOUNDATION, INC.) THE PROGRAM, EVEN IF YOU HAVE BEEN -ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY -OTHER PARTY. -====================================================================== diff --git a/gnu/games/chess/DOCUMENTATION/GENERAL b/gnu/games/chess/DOCUMENTATION/GENERAL deleted file mode 100644 index aafb7ed335e3..000000000000 --- a/gnu/games/chess/DOCUMENTATION/GENERAL +++ /dev/null @@ -1,34 +0,0 @@ -			      GNU Chess - -Copyright (C) 1987 Stuart Cracraft -  (Copying permission notice at the end.) - -GNU Chess is your program (as long as you follow the copyright and -licensing rules listed in the file COPYING). Your contributioinspire current and future software -developers.  - -This document -------------- -This document is not meant to be a an introduction to computer chess. -The following books are excellent introductions and treatises. -They are listed in order of difficulty: - -   Computer Chess (2nd edition), by David Welsh and Boris Bazcynski -   The Joy of Computer Chess, by David Levy -   Chess Skill in Man and Machine (2nd edition), by Peter Frey - - -Current Distribution --------------------- -The most recent distribution of GNU Chess contains the following -main-level files and directories: - -    Filename         Purpose -   ------------------------------------------------------ -   README           Pointer to main README below. -   gnuchess.c       Most recent version of GNU Chess -   nondsp.c	    Non-display interface, and chesstool/xchess interface -   uxdsp.c	    Unix (curses) display interface	 -   ansidsp.c	    ANSI display interface -   gnuchess.book    Most recent version of opening book - diff --git a/gnu/games/chess/DOCUMENTATION/HEURISTICS b/gnu/games/chess/DOCUMENTATION/HEURISTICS deleted file mode 100644 index 254b34472abe..000000000000 --- a/gnu/games/chess/DOCUMENTATION/HEURISTICS +++ /dev/null @@ -1,122 +0,0 @@ -This file contains a description of GNU's heuristics. -   Copyright (C) 1986, 1987 Free Software Foundation, Inc. - -This file is part of CHESS. - -CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -CHESS, but only under the conditions described in the -CHESS General Public License.   A copy of this license is -supposed to have been given to you along with CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -- requested by main author -Heuristic descriptions for CHESS. - -Revision: 12-16-87 - -Copyright (c) 1987 by John Stanback - -  Here is a brief description of the heuristics used in the positional  -  evaluator of the GNU Chess program. Many heuristics are functions of the  -  stage of the game which is based on the total non-pawn material remaining  -  for both sides.  -     - -PAWNS -    The material value of a pawn is 100 points. Isolated pawns get a  -    penalty depending on which file they occupy:  -       (12,14,16,20,20,16,14,12) for files (a..h). -    Doubled pawns (which are not also isolated) get a penalty of 12  -    points. Backward pawns (defined simply as not being defended by a  -    pawn with the square in front also not defended by a a pawn) are  -    penalized 6 points. A 4 point penalty is also invoked for each attack  -    by the opponent to a backward pawn and for a backward pawn on a  -    half-open file. Pawn Advancement in the centre is given a bonus of  -    about 4 points per rank in the opening increasing to about 8 points  -    per rank in the ending. Advancement on the edges is given a lower  -    bonus. Pawns on the e and d files and on the 2nd rank are given a 10  -    point penalty. An additional penalty of 15 points is invoked if these  -    pawns are also blocked. Pawns within 2 squares of the king are given  -    a 10 point bonus. Passed pawns are given a bonus for increasing rank  -    which is a function of stage of the game and of whether the opponent  -    blocks or attacks one or more squares in front of the pawn or if the  -    opponents king is in the square of the pawn. This bonus ranges from  -    about 15 points for a pawn on the second rank up to about 300 points  -    for a passed pawn on the 7th rank which can't be stopped from  -    queening.  -               - -KNIGHTS -    The material value of a knight is 330 points. The main heuristic for  -    knights is a bonus for proximity to the centre. This varies from 0  -    points in the corners to 30 points in the centre. Knights are also  -    given a bonus for being within 2 squares of each enemy piece. This  -    bonus is a function of the stage of the game, equalling 4 points in  -    the end game. A penalty of 1 point per square is given for distance  -    from either king. A bonus of up to 8 points (depends on stage) is  -    given for knights which can't be driven away by enemy pawns.  - - -BISHOPS -    The material value of a bishop is 330 points. Bishops are given a  -    bonus as material falls off the board equalling 10 points in the end  -    game. Bishops get a bonus for mobility and Xray mobility thru pieces  -    but not pawns. This bonus ranges from -4 points for a totally blocked  -    bishop up to 18 points for a bishop attacking 12 or more squares.  -    Xray attacks on an enemy R,Q,K or any undefended piece are given an 8  -    point bonus. Bishops are given a bonus of 14 points if they lie on  -    the edge of the board up to 22 points if the lie in the centre. A  -    bishop is given a bonus of up to 5 points for each attack to a square  -    adjacent to the enemy king.  - - -ROOKS -    The material value of a rook is 520 points. Rook mobility is handled  -    similiarly to bishops with a bonus of 0 points if blocked up to 20  -    points if attacking 12 squares or more. A bonus of 8 points for Xray  -    attacks is handled as it is for bishops. Rooks are given a bonus of  -    10 points for occupying a file with no friendly pawns and a bonus of  -    4 points if no enemy pawns lie on that file. After the opening Rooks  -    are penalized slightly depending on "taxicab" distance to the enemy  -    king.  -   - -QUEENS -    The material value of a queen is 980 points. The only heuristic for a  -    queen is that after the opening it is penalized slightly for  -    "taxicab" distance to the enemy king.  - - -KINGS -    Kings are given a penalty for proximity to the centre in the opening  -    and a bonus for proximity to the centre in the endgame. The penalty  -    is about 24 points for being in the centre in the opening with a  -    bonus of about 36 points for being in the centre in the endgame.  -    Kings are penalized for lying on an open or half-open file or if the  -    adjacent file closest to the corner is open or half-open. This  -    penalty is up to 23 points in the opening and goes to zero in the end  -    game. The King is penalized up to 8 points if there are no pawns  -    immediately adjacent. A penalty is invoked depending on the number of  -    "safe" checks available by the opponent. This penalty ranges from 6  -    points for one such check to 50 points for 4 or more. Depending on  -    game stage, Kings are given up to 10 points for castling and a  -    penalty of up to 40 points for moving before castling.  -   - -SPECIAL -    If more than one piece is "hung" (attacked and not defended or  -    attacked by an enemy piece of lower value) an extra penalty of 10  -    points is invoked for that side and the search may be extended one  -    ply. Pinned or trapped pieces are treated similarly. A special mating  -    routine is used if one side has only a king and the other has mating  -    material.  - diff --git a/gnu/games/chess/DOCUMENTATION/MAN-PAGE b/gnu/games/chess/DOCUMENTATION/MAN-PAGE deleted file mode 100644 index bbf0aa4abf98..000000000000 --- a/gnu/games/chess/DOCUMENTATION/MAN-PAGE +++ /dev/null @@ -1,161 +0,0 @@ -.TH Chess GNU -.SH NAME -Chess \- GNU Chess -.SH SYNOPSIS -.B Chess -[ -.B arg1 arg2 -] -.SH DESCRIPTION -.I Chess -plays a game of chess against the user or it plays against itself. -.PP -.I Chess -has a simple alpha-numeric board display or it can be compiled for -use with the CHESSTOOL program on a SUN workstation. -The program gets its opening moves from the file gnuchess.book which -should be located in the same directory as gnuchess. -To invoke the prgram, type 'gnuchess' or type 'chesstool gnuchess' -on a SUN workstation where 'CHESSTOOL' is installed. -The 'gnuchess' command can be followed by up to 2 command line arguments. -If one argument is given it determines the programs search time in -seconds.  If two arguments are given, they will be used to set tournament -time controls with the first argument being the number of moves and the second -being the total clock time in minutes.  Thus, entering 'chess 60 5' will set -the clocks for 5 minutes (300 seconds) for the first 60 moves. -If no argument is given the program will prompt the user for level of -play. -For use with CHESSTOOL, see the documentation on that program. -.PP -Once -.I Chess -is invoked, the program will display the board and prompt the user -for a move. To enter a move, use the notation 'e2e4' where the first -letter-number pair indicates the origination square -and the second letter-number pair indicates the destination square. -An alternative is to use the notation 'nf3' where -the first letter indicates the piece type (p,n,b,r,q,k). -To castle, type the origin and destination squares -of the king just as you would do for a regular move, or type -"o-o" for kingside castling and "o-o-o" for queenside. -.SH COMMANDS -.PP -In addition to legal moves, the following commands are available as responses. -.PP -.I beep --- causes the program to beep after each move. -.PP -.I bd --- updates the current board position on the display. -.PP -.I book --- turns off use of the opening library. -.PP -.I both --- causes the computer to play both sides of a chess game. -.PP -.I black --- causes the computer to take the black pieces with the move -and begin searching. -.PP -.I level --- allows the user to set time controls such as -60 moves in 5 minutes etc.  In tournament mode, the program will -vary the time it takes for each -move depending on the situation.  If easy mode is disabled (using -the 'easy' command), the program -will often respond with its move immediately, saving time on -its clock for use later on. -.PP -.I depth --- allows the user to change the -search depth of the program.  The maximum depth is 29 ply. -Normally the depth is set to 29 and the computer terminates -its search based on elapsed time rather than depth. -Using the depth command allows setting depth to say -4 ply and setting response time to a large number such as -9999 seconds. The program will then search until all moves -have been examined to a depth of 4 ply (with extensions up -to 11 additional ply for sequences of checks and captures).  -.PP -.I easy --- toggles easy mode (thinking on opponents time) -on and off. The default is easy mode ON.  If easy mode is disabled, -the user must enter a 'break' or '^C' to get the programs -attention before entering each move. -.PP -.I edit --- allows the user to set up a board position. -In this mode, the '#' command will clear the board, the 'c' -command will toggle piece color, and the '.' command will exit -setup mode.  Pieces are entered by typing a letter (p,n,b,r,q,k) for -the piece followed by the coordinate.  For example "pb3" would -place a pawn on square b3. -.PP -.I force --- allows the user to enter moves for both -sides. To get the program to play after a sequence of moves -has been entered use the 'white' or 'black' commands. -.PP -.I get --- retrieves a game from disk.  The program will -prompt the user for a file name. -.PP -.I help --- displays a short description of the commands. -.PP -.I hint --- causes the program to supply the user with -its predicted move. -.PP -.I list --- writes the game moves and some statistics -on search depth, nodes, and time to the file 'chess.lst'. -.PP -.I new --- starts a new game. -.PP -.I post --- causes the program to display the principle -variation and the score during the search.  A score of -100 is equivalent to a 1 pawn advantage for the computer. -.PP -.I random --- causes the program to randomize its move -selection slightly. -.PP -.I reverse --- causes the board display to be reversed.  That -is, the white pieces will now appear at the top of the board. -.PP -.I quit --- exits the game. -.PP -.I save --- saves a game to disk.  The program will prompt -the user for a file name. -.PP -.I switch --- causes the program to switch places with -the opponent and begin searching. -.PP -.I undo --- undoes the last move whether it was the computer's -or the human's. You may also type "remove". This is equivalent -to two "undo's" (e.g. retract one move for each side). -.PP -.I white --- causes the computer to take the white pieces -with the move and begin searching. -.SH BUGS -.PP -Pawn promotion to pieces other than a queen is not allowed. -En-Passant does not work properly with CHESSTOOOL. -The transposition table may not work properly in some -positions so the default is to turn this off.  -.fi -.SH SEE ALSO -.nf -chesstool(6) -.fi - diff --git a/gnu/games/chess/Makefile b/gnu/games/chess/Makefile deleted file mode 100644 index a40e597ff340..000000000000 --- a/gnu/games/chess/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -#	@(#)Makefile	5.4 (Berkeley) 5/11/90 - -PROG=	chess -SRCS=	gnuchess.c uxdsp.c move.c -CFLAGS+=-DNEWMOVE=12 -MAN6=	chess.6 -DPADD=	${LIBCURSES} ${LIBTERMCAP} -LDADD=	-lcurses -ltermcap -HIDEGAME=hidegame - -beforeinstall: -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \ -	    ${.CURDIR}/gnuchess.book ${DESTDIR}/usr/share/games - -.include <bsd.prog.mk> diff --git a/gnu/games/chess/Xchess/COPYING b/gnu/games/chess/Xchess/COPYING deleted file mode 100644 index 5905c3292de1..000000000000 --- a/gnu/games/chess/Xchess/COPYING +++ /dev/null @@ -1,124 +0,0 @@ - -		 GNU X-CHESS GENERAL PUBLIC LICENSE - - Copyright (C) 1986 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license, but changing it is not allowed. - -  The license agreements of most software companies keep you at the -mercy of those companies.  By contrast, our general public license is -intended to give everyone the right to share GNU X-Chess.  To make -sure that you get the rights we want you to have, we need to make -restrictions that forbid anyone to deny you these rights or to ask you -to surrender the rights.  Hence this license agreement. - -  Specifically, we want to make sure that you have the right to give -away copies of GNU X-Chess, that you receive source code or else can get it -if you want it, that you can change GNU X-Chess or use pieces of it in new -free programs, and that you know you can do these things. - -  To make sure that everyone has such rights, we have to forbid you to -deprive anyone else of these rights.  For example, if you distribute -copies of GNU X-Chess, you must give the recipients all the rights that you -have.  You must make sure that they, too, receive or can get the -source code.  And you must tell them their rights. - -  Also, for our own protection, we must make certain that everyone -finds out that there is no warranty for GNU X-Chess.  If GNU X-Chess is -modified by someone else and passed on, we want its recipients to know -that what they have is not what we distributed, so that any problems -introduced by others will not reflect on our reputation. - -  Therefore the Free Software Foundation, Inc. makes the following -terms which say what you must do to be allowed to distribute or change -GNU X-Chess. - -			COPYING POLICIES - -  1. You may copy and distribute verbatim copies of GNU X-Chess source -code as you receive it, in any medium, provided that you conspicuously -and appropriately publish on each file a valid copyright notice -"Copyright (C) 1986 Free Software Foundation, Inc.", containing the -year of last change for the file in question; keep intact the notices -on all files that refer to this License Agreement and to the absence -of any warranty; and give any other recipients of the GNU X-Chess -program a copy of this License Agreement along with the program. - -  2. You may modify your copy or copies of GNU X-Chess source code or -any portion of it, and copy and distribute such modifications under -the terms of Paragraph 1 above, provided that you also do the following: - -    a) cause the modified files to carry prominent notices stating -    who last changed such files and the date of any change; and - -    b) cause the whole of any work that you distribute or publish, -    that in whole or in part contains or is a derivative of GNU X-Chess -    or any part thereof, to be freely distributed -    and licensed to all third parties on terms identical to those -    contained in this License Agreement (except that you may choose -    to grant more extensive warranty protection to third parties, -    at your option). - -    c) if the modified program serves as a text editor, cause it -    when started running in the simplest and usual way, to print -    an announcement including a valid copyright notice ("Copyright -    (C)", the year of authorship, and all copyright owners' names), -    saying that there is no warranty (or else, saying that you provide -    a warranty) and that users may redistribute the program under -    these conditions, and telling the user how to view a copy of -    this License Agreement. - -  3. You may copy and distribute GNU X-Chess or any portion of it in -compiled, executable or object code form under the terms of Paragraphs -1 and 2 above provided that you do the following: - -    a) cause each such copy of GNU X-Chess to be accompanied by the -    corresponding machine-readable source code; or - -    b) cause each such copy of GNU X-Chess to be accompanied by a -    written offer, with no time limit, to give any third party -    free (except for a nominal shipping charge) machine readable -    copy of the corresponding source code; or - -    c) in the case of a recipient of GNU X-Chess in compiled, executable -    or object code form (without the corresponding source code) you -    shall cause copies you distribute to be accompanied by a copy -    of the written offer of source code which you received along -    with the copy of GNU X-Chess. - -  4. You may not copy, sublicense, distribute or transfer GNU X-Chess -except as expressly provided under this License Agreement.  Any attempt -otherwise to copy, sublicense, distribute or transfer GNU X-Chess is void and -your rights to use GNU X-Chess under this License agreement shall be -automatically terminated.  However, parties who have received computer -software programs from you with this License Agreement will not have -their licenses terminated so long as such parties remain in full compliance. - -Your comments and suggestions about our licensing policies and our -software are welcome!  Please contact the Free Software Foundation, Inc., -1000 Mass Ave, Cambridge, MA 02138, or call (617) 876-3296. - -			   NO WARRANTY - -  BECAUSE GNU X-CHESS IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY -NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT -WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, -AND/OR OTHER PARTIES PROVIDE GNU X-CHESS "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -PROGRAM IS WITH YOU.  SHOULD THE GNU X-CHESS PROGRAM PROVE DEFECTIVE, -YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL FREE SOFTWARE -FOUNDATION, INC., AND/OR ANY OTHER PARTY WHO MAY MODIFY AND -REDISTRIBUTE GNU X-CHESS AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR -INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA -BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A -FAILURE OF THE PROGRAM TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY -FREE SOFTWARE FOUNDATION, INC.) THE PROGRAM, EVEN IF YOU HAVE BEEN -ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY -OTHER PARTY. -====================================================================== diff --git a/gnu/games/chess/Xchess/Makefile b/gnu/games/chess/Xchess/Makefile deleted file mode 100644 index c4d0d78adcd9..000000000000 --- a/gnu/games/chess/Xchess/Makefile +++ /dev/null @@ -1,136 +0,0 @@ -# RCS Info: $Revision: 1.3 $ on $Date: 1995/05/30 04:41:16 $ -#           $Source: /home/ncvs/src/gnu/games/chess/Xchess/Makefile,v $ -# Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group -# -# Makefile for xchess. - -#CC = cc -O -m68010 -L/pub.MC68010/lib -L/usr.MC68010/lib -CC = cc -O - -CFILES	=\ -	board.c\ -	button.c\ -	clock.c\ -	control.c\ -	jail.c\ -	message.c\ -	parse.c\ -	popup.c\ -	program.c\ -	record.c\ -	std.c\ -	valid.c\ -	window.c\ -	XCircle.c - -COBJS	=\ -	board.o\ -	button.o\ -	clock.o\ -	control.o\ -	jail.o\ -	message.o\ -	parse.o\ -	popup.o\ -	program.o\ -	record.o\ -	std.o\ -	valid.o\ -	window.o\ -	XCircle.o - -HFILES	=\ -	std.h\ -	xchess.h - -SOURCE = $(CFILES) - -ALLFILES = $(SOURCE) $(HFILES) - -INCLUDE = -I. -I${X11BASE}/include - -DEFINES = -DDEF_PROGRAM=\"/usr/games/chess\" - -CFLAGS = $(DEFINES) $(INCLUDE) -LINTFLAGS = -u -z -lc -DLINT $(DEFINES) $(INCLUDE) -LINTLIB = ../lib/llib-lX.ln -#LDFLAGS = -L/usr2/X/lib -z -lX -lm -LDFLAGS = -L${X11BASE}/lib -loldX -lX11 -z -lm -GPLDFLAGS = -z -loldX -lX11 -lXMenu_p -lX -lm_p -g -pg - -.c.o: $*.c -	$(CC) $(CFLAGS) -c $*.c -.s.o: $*.s -	$(CC) $(CFLAGS) -c $*.s - -all: xchess scrollText.o -	@echo "All done." - -everything: all tags depend lint wc -	@echo "All done." - -xchess:	xchess.o $(COBJS) scrollText.o -	$(CC) -o xchess xchess.o $(COBJS) scrollText.o \ -	$(LDFLAGS) - -scrollText.o: scrollText.h scrollText.c - -gpxchess: xchess.o $(COBJS) -	$(CC) -o gpxchess xchess.o $(COBJS) scrollText/libScroll.a \ -	$(GPLDFLAGS) - -lint:	$(SOURCE) -	lint $(LINTFLAGS) $(SOURCE) $(LINTLIB) | \ -	grep -v "multiply declared" - -qgrind: $(ALLFILES) -	qgrind -lc $(ALLFILES) - -vgrind:	$(ALLFILES) -	vgrind -lc $(ALLFILES) - -opt: all - -reopt: all - -install: all - -source:	$(SOURCE) - -tags: $(ALLFILES) -	ctags -w -t *.c *.h > /dev/null 2>&1 - -wc: $(ALLFILES) -	@wc $(ALLFILES) - -print: $(ALLFILES) -	@pr $(ALLFILES) - -clean: -	rm -f *.o *.a *.out xchess tags foo tmp - -tar: -	tar -cf xchess.tar Makefile *.h *.c *.bitmap *.icon *.cur *.1\ -	scrollText/Makefile scrollText/*.h scrollText/*.c scrollText/*.1\ -	scrollText/*.3 - -$(ALLFILES): -	co $@ - -depend: $(SOURCE) -	cc -M $(CFLAGS) $(CFILES) > makedep -	echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep -	echo '$$r makedep' >>eddep -	echo 'w' >>eddep -	ed - Makefile < eddep -	rm eddep makedep -	echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile -	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile -	echo '# see make depend above' >> Makefile - -#----------------------------------------------------------------- -# DO NOT DELETE THIS LINE -- make depend uses it -# DEPENDENCIES MUST END AT END OF FILE - -xchess.o $(COBJS): $(HFILES) - diff --git a/gnu/games/chess/Xchess/ScrollText b/gnu/games/chess/Xchess/ScrollText deleted file mode 100644 index 782a54f48548..000000000000 --- a/gnu/games/chess/Xchess/ScrollText +++ /dev/null @@ -1,34 +0,0 @@ -Subject: File: scrollText.h - -/* - * Scrollable Text Window Header File - * - * David Harrison - * University of California,  Berkeley - * 1986 - * - * This file contains definitions for a scrollable text window - * with scroll bar support. - */ - -int TxtGrab(); -   /* Take hold of a previously created window */ - -#define TXT_NO_COLOR	-1 - -int TxtAddFont(); -   /* Loads a new font for use later */ -int TxtWinP(); -   /* Returns non-zero value if the window is text window */ -int TxtClear(); -   /* Clears text window and resets text buffer */ - -int TxtWriteStr(); -   /* Writes a string to window with immediate update */ -int TxtJamStr(); -   /* Write a string without causing update to screen */ - -int TxtRepaint(); -   /* Repaints entire scrollable text window */ -int TxtFilter(); -   /* Handles events related to text window */ diff --git a/gnu/games/chess/Xchess/XCircle.c b/gnu/games/chess/Xchess/XCircle.c deleted file mode 100644 index fc7de0d717b1..000000000000 --- a/gnu/games/chess/Xchess/XCircle.c +++ /dev/null @@ -1,162 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.3 $ on $Date: 1995/07/08 21:39:58 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/XCircle.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - */ - -#include <stdio.h> -#include <X11/Xlib.h> -#include <X11/X10.h> -#include <math.h> - -#define PI 3.1415926535897932384 - -#define MAXVERTS 1000 - -void -XCircle(win, x, y, rad, start, end, width, height, pixel, func, planes) -	Window win; -	int x, y, rad; -	double start, end; -	int pixel; -	int width, height; -	int func, planes; -{ -	Vertex verts[MAXVERTS]; -	double xp, yp, ang; -	int lx, ly, xpt, ypt, i; -	double gradincr = 2 / (double) rad; -	int bk = 0; - -	while (end >= PI * 2) -		end -= PI * 2; -	while (start >= PI * 2) -		start -= PI * 2; -	while (end < 0) -		end += PI * 2; -	while (start < 0) -		start += PI * 2; -	if (end == start) { -		if (end < gradincr) -			end = end + PI * 2 - gradincr / 2; -		else -			end -= gradincr / 2; -	} -	for (ang = start, i = 0; i < MAXVERTS; ) { - -		xp = x + rad * cos(ang); -		yp = y + rad * sin(ang); - -		xpt = xp; -		ypt = yp; - -		if (!i || (lx != xpt) || (ly != ypt)) { -			verts[i].x = xpt; -			verts[i].y = ypt; -			verts[i].flags = 0; -			i++; -		} -		lx = xpt; -		ly = ypt; -		if (bk) -			break; -		if (((ang < end) && (ang + gradincr > end)) || ((end < start) -				&& (ang + gradincr > 2 * PI) -				&& (ang + gradincr - 2 * PI > end))) { -			ang = end; -			bk = 1; -		} else if (ang == end) { -			break; -		} else { -			ang += gradincr; -		} -		if (ang >= PI * 2) -			ang -= PI * 2; -	} - -	/* Now draw the thing.. */ -	XDraw(win, verts, i, width, height, pixel, func, planes); - -	return; -} - -#ifdef notdef	/* VertexCurved is screwed up */ - -void -XCircle(win, x, y, rad, start, end, width, height, pixel, func, planes) -	Window win; -	int x, y, rad; -	double start, end; -	int pixel; -	int width, height; -	int func, planes; -{ -	Vertex verts[7]; -	int i, j, sv, ev; -	int dp = 0; - -	for (i = j = 0 ; i < 4; i++) { -		verts[j].x = x + rad * cos((double) (PI * i / 2)); -		verts[j].y = y + rad * sin((double) (PI * i / 2)); -		verts[j].flags = VertexCurved; -		if ((start >= PI * i / 2) && (start < PI * (i + 1) / 2) && -				(start != end)) { -			j++; -			verts[j].x = x + rad * cos(start); -			verts[j].y = y + rad * sin(start); -			verts[j].flags = VertexCurved; -			sv = j; -		} else if ((end >= PI * i / 2) && (end < PI * (i + 1) / 2) -				&& (start != end)) { -			j++; -			verts[j].x = x + rad * cos(end); -			verts[j].y = y + rad * sin(end); -			verts[j].flags = VertexCurved; -			ev = j; -		} -		j++; -	} -	verts[0].flags |= VertexStartClosed; -	verts[j].x = verts[0].x; -	verts[j].y = verts[0].y; -	verts[j].flags = (verts[0].flags & ~VertexStartClosed) | -			VertexEndClosed; -	for (i = 0; i < 15; i++) { -		if (dp) -			verts[i % 7].flags |= VertexDontDraw; -		if (i % 7 == ev) -			dp = 1; -		else if (i % 7 == sv) -			dp = 0; -	} -	XDraw(win, verts, j + 1, width, height, pixel, func, planes); - -	return; -} - -#endif notdef - diff --git a/gnu/games/chess/Xchess/bishop.bitmap b/gnu/games/chess/Xchess/bishop.bitmap deleted file mode 100644 index dc068ddf1cfa..000000000000 --- a/gnu/games/chess/Xchess/bishop.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define bishop_width 80 -#define bishop_height 80 -static char bishop_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x8f, -   0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x8f, 0x0f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x8f, 0x0f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x80, 0x0f, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x9f, -   0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x10, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x10, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xf8, 0xff, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xfc, 0xff, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, -   0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x23, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x67, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x80, 0xff, 0xf8, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -   0x1f, 0xc0, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0xc0, -   0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0xc0, 0x5f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xf8, 0x7f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xe0, 0xff, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xe0, 0xff, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, -   0xff, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xf8, -   0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xf8, 0x7f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xf8, 0xff, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xf8, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, -   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, -   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, -   0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, -   0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x3f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x80, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -   0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, -   0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xfe, 0xfd, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0xf8, -   0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x70, 0x02, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x70, 0x02, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xfa, 0xf8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xfe, 0xfd, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, -   0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xc0, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, -   0xfc, 0xfd, 0xc1, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xfd, -   0xff, 0xff, 0x07, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, -   0x3f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0x00, -   0x00, 0xc0, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x80, -   0x0f, 0xf0, 0x0f, 0xc0, 0x7f, 0x00, 0x1f, 0x00, 0x00, 0xc0, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/bishop_mask.bitmap b/gnu/games/chess/Xchess/bishop_mask.bitmap deleted file mode 100644 index ca17bb3dae0d..000000000000 --- a/gnu/games/chess/Xchess/bishop_mask.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define bishop_mask_width 80 -#define bishop_mask_height 80 -static char bishop_mask_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x80, 0x8f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0xdf, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, -   0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x1f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x1f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x80, 0x8f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, -   0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x3f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xfe, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, -   0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xc0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, -   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, -   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xf0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, -   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, -   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x01, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xfc, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, -   0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, -   0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x01, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xf8, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, -   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, -   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xe0, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, -   0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, -   0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x1f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x80, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -   0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, -   0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x80, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -   0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, -   0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x1f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xe0, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, -   0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xfc, 0x3f, 0xfc, 0xff, 0xe3, 0xff, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x01, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0x01, -   0x00, 0xf8, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0x01, 0x00, 0xe0, -   0xff, 0xff, 0x7f, 0xf8, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, 0x1f, 0xf8, -   0x1f, 0xe0, 0xff, 0x80, 0xff, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xf8, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/bishop_outline.bitmap b/gnu/games/chess/Xchess/bishop_outline.bitmap deleted file mode 100644 index 9772328c2984..000000000000 --- a/gnu/games/chess/Xchess/bishop_outline.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define bishop_outline_width 80 -#define bishop_outline_height 80 -static char bishop_outline_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x8d, -   0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x88, 0x08, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x8d, 0x0d, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x80, 0x0f, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x98, -   0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x70, 0x10, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x40, 0x10, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x18, 0xc0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x08, 0x80, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x0c, 0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, -   0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x22, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x66, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x01, 0x05, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x80, 0x01, 0x05, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -   0xe0, 0x3d, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x20, -   0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xe0, 0x3d, 0x50, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x05, 0x70, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x20, 0x00, 0x05, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x20, 0x00, 0x05, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, -   0x00, 0x05, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x05, -   0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x05, 0x40, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x08, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, -   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, -   0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0xc0, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x10, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, -   0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, -   0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x30, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x80, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, -   0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, -   0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, -   0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x8d, 0x03, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x8d, 0x03, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x02, 0x02, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, -   0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0c, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xc0, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x80, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x08, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x18, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x18, 0xc7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, -   0x0c, 0x85, 0xc1, 0xff, 0x01, 0x00, 0x00, 0x00, 0x0e, 0xf0, 0x87, 0x0d, -   0x7f, 0x00, 0x07, 0x00, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x08, 0x00, 0x00, -   0x3c, 0x00, 0x00, 0x70, 0x00, 0x00, 0xe0, 0x18, 0x00, 0x00, 0xe0, 0x00, -   0x00, 0xc0, 0xf8, 0x1f, 0x38, 0x70, 0xc0, 0xff, 0x31, 0x00, 0x00, 0x80, -   0x0f, 0xf0, 0x0f, 0xc0, 0x7f, 0x00, 0x1f, 0x00, 0x00, 0xc0, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/bishop_small.bitmap b/gnu/games/chess/Xchess/bishop_small.bitmap deleted file mode 100644 index 5525ecd03c2d..000000000000 --- a/gnu/games/chess/Xchess/bishop_small.bitmap +++ /dev/null @@ -1,15 +0,0 @@ - -#define bishop_small_width 32 -#define bishop_small_height 32 -static char bishop_small_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x1c, 0x00, 0x00, 0x70, 0x1c, 0x00, -   0x00, 0x70, 0x1c, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x60, 0x16, 0x00, -   0x00, 0x60, 0x22, 0x00, 0x00, 0xf0, 0x23, 0x00, 0x00, 0xf0, 0x21, 0x00, -   0x00, 0xf8, 0x21, 0x00, 0x00, 0xf8, 0x23, 0x00, 0x00, 0xf8, 0x23, 0x00, -   0x00, 0xf8, 0x27, 0x00, 0x00, 0x38, 0x27, 0x00, 0x00, 0x3c, 0x2f, 0x00, -   0x00, 0x0c, 0x2c, 0x00, 0x00, 0x0e, 0x3c, 0x00, 0x00, 0x3e, 0x3f, 0x00, -   0x00, 0x3e, 0x3f, 0x00, 0x00, 0x3e, 0x3f, 0x00, 0x00, 0x3e, 0x3f, 0x00, -   0x00, 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0x00, -   0x00, 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0x00, -   0x00, 0xfe, 0x7f, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0xe0, 0xff, 0xff, 0x07, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/bishop_small_outline.bitmap b/gnu/games/chess/Xchess/bishop_small_outline.bitmap deleted file mode 100644 index 8d29a812e29e..000000000000 --- a/gnu/games/chess/Xchess/bishop_small_outline.bitmap +++ /dev/null @@ -1,15 +0,0 @@ - -#define bishop_small_outline_width 32 -#define bishop_small_outline_height 32 -static char bishop_small_outline_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x1c, 0x00, 0x00, 0x50, 0x14, 0x00, -   0x00, 0x70, 0x1c, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x60, 0x16, 0x00, -   0x00, 0x60, 0x22, 0x00, 0x00, 0xf0, 0x23, 0x00, 0x00, 0x10, 0x21, 0x00, -   0x00, 0x18, 0x21, 0x00, 0x00, 0x08, 0x23, 0x00, 0x00, 0x08, 0x22, 0x00, -   0x00, 0x08, 0x26, 0x00, 0x00, 0x08, 0x24, 0x00, 0x00, 0xcc, 0x2c, 0x00, -   0x00, 0xc4, 0x28, 0x00, 0x00, 0xf6, 0x3b, 0x00, 0x00, 0xf2, 0x23, 0x00, -   0x00, 0xc2, 0x20, 0x00, 0x00, 0xc2, 0x20, 0x00, 0x00, 0xc2, 0x20, 0x00, -   0x00, 0xc2, 0x60, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x02, 0x40, 0x00, -   0x00, 0x02, 0x40, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x02, 0x40, 0x00, -   0x00, 0x02, 0x40, 0x00, 0x00, 0x02, 0x40, 0x00, 0xe0, 0xff, 0xff, 0x07, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/board.c b/gnu/games/chess/Xchess/board.c deleted file mode 100644 index fab97d8394cd..000000000000 --- a/gnu/games/chess/Xchess/board.c +++ /dev/null @@ -1,179 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:08 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/board.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - * Stuff to deal with the board. - */ - -#include "xchess.h" - -board *chessboard; - -void -board_setup() -{ -	chessboard = alloc(board); -	board_init(chessboard); -	return; -} - -void -board_init(b) -	board *b; -{ -	int i, j; - -	for (i = 0; i < 2; i++) -		for (j = 0; j < SIZE; j++) -			b->square[i][j].color = BLACK; -	for (i = 2; i < 6; i++) -		for (j = 0; j < SIZE; j++) -			b->square[i][j].color = NONE; -	for (i = 6; i < 8; i++) -		for (j = 0; j < SIZE; j++) -			b->square[i][j].color = WHITE; -	for (i = 0; i < SIZE; i++) -		b->square[1][i].type = b->square[6][i].type = -				PAWN; -	b->square[0][0].type = b->square[7][0].type = ROOK; -	b->square[0][1].type = b->square[7][1].type = KNIGHT; -	b->square[0][2].type = b->square[7][2].type = BISHOP; -	b->square[0][3].type = b->square[7][3].type = QUEEN; -	b->square[0][4].type = b->square[7][4].type = KING; -	b->square[0][5].type = b->square[7][5].type = BISHOP; -	b->square[0][6].type = b->square[7][6].type = KNIGHT; -	b->square[0][7].type = b->square[7][7].type = ROOK; -	b->black_cant_castle_k = false; -	b->black_cant_castle_q = false; -	b->white_cant_castle_k = false; -	b->white_cant_castle_q = false; - -	return; -} - -void -board_drawall() -{ -	int i, j; - -	for (i = 0; i < SIZE; i++) -		for (j = 0; j < SIZE; j++) -			if (chessboard->square[i][j].color != NONE) { -				win_drawpiece(&chessboard->square[i][j], i, -						j, WHITE); -				if (!oneboard) -					win_drawpiece(&chessboard->square[i][j], -							i, j, BLACK); -			} -	return; -} - -void -board_move(b, m) -	board *b; -	move *m; -{ -	switch (m->type) { - -	    case MOVE: -	    case CAPTURE: -		b->square[m->fromy][m->fromx].color = NONE; -		b->square[m->toy][m->tox].color = m->piece.color; -		b->square[m->toy][m->tox].type = m->piece.type; -		if ((m->piece.type == PAWN) && (((m->piece.color == BLACK) && -				(m->toy == 7)) || ((m->piece.color == WHITE) && -				(m->toy == 0)))) -			b->square[m->toy][m->tox].type = QUEEN; -		if (m->enpassant) -			b->square[m->toy + ((m->piece.color == WHITE) ? 1 : -					-1)][m->tox].color = NONE; -		break; - -	    case KCASTLE: -		if (m->piece.color == WHITE) { -			b->square[7][5].color = m->piece.color; -			b->square[7][5].type = ROOK; -			b->square[7][6].color = m->piece.color; -			b->square[7][6].type = KING; -			b->square[7][4].color = NONE; -			b->square[7][7].color = NONE; -		} else { -			b->square[0][5].color = m->piece.color; -			b->square[0][5].type = ROOK; -			b->square[0][6].color = m->piece.color; -			b->square[0][6].type = KING; -			b->square[0][4].color = NONE; -			b->square[0][7].color = NONE; -		} -		break; - -	    case QCASTLE: -		if (m->piece.color == WHITE) { -			b->square[7][3].color = m->piece.color; -			b->square[7][3].type = ROOK; -			b->square[7][2].color = m->piece.color; -			b->square[7][2].type = KING; -			b->square[7][4].color = NONE; -			b->square[7][0].color = NONE; -		} else { -			b->square[0][3].color = m->piece.color; -			b->square[0][3].type = ROOK; -			b->square[0][2].color = m->piece.color; -			b->square[0][2].type = KING; -			b->square[0][4].color = NONE; -			b->square[0][0].color = NONE; -		} -		break; - -	    default: -		fprintf(stderr, "Bad move type %d\n", m->type); -	} - -	if (m->piece.type == KING) { -		if (m->piece.color == WHITE) -			b->white_cant_castle_q = -					b->white_cant_castle_k= true; -		else -			b->black_cant_castle_q = -					b->black_cant_castle_k= true; -	} else if (m->piece.type == ROOK) { -		if (m->piece.color == WHITE) { -			if (m->fromx == 0) -				b->white_cant_castle_q = true; -			else if (m->fromx == 7) -				b->white_cant_castle_k = true; -		} else { -			if (m->fromx == 0) -				b->black_cant_castle_q = true; -			else if (m->fromx == 7) -				b->black_cant_castle_k = true; -		} -	} - -	return; -} - diff --git a/gnu/games/chess/Xchess/button.c b/gnu/games/chess/Xchess/button.c deleted file mode 100644 index d91005df4362..000000000000 --- a/gnu/games/chess/Xchess/button.c +++ /dev/null @@ -1,337 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:15 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/button.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - * Do stuff with the buttons. - * The configuration we're using is:	Draw	Back	Pause - *					Resign	Fwd	Flip - *					Reset	Save	Easy (Switch) - */ - -#include "xchess.h" - -typedef enum choice { NOCHOICE, DRAW, RESIGN, REPLAY, SWITCH, FORE, SAVE, -		STOP, FLIP, RESTART, EASY } choice; - -static struct but { -	char *label; -	int x, y; -	int width, height; -	choice which; -} buts[] = { -	{ "Draw", 0, 20, 108, 29, DRAW } , -	{ "Back", 109, 20, 108, 29, REPLAY } , -	{ "Pause", 219, 20, 108, 29, STOP } , -	{ "Resign", 0, 50, 108, 29, RESIGN } , -	{ "Fwd", 109, 50, 108, 29, FORE } , -	{ "Flip", 219, 50, 108, 29, FLIP } , -	{ "Reset", 0, 80, 108, 29, RESTART } , -	{ "Save", 109, 80, 108, 29, SAVE } , -#define EASY_OFFSET 8 -	{ "Switch", 219, 80, 108, 29, SWITCH } -/*	{ "NoEasy", 219, 80, 108, 29, EASY }*/ -} ; -static int easy = 1; - -void -button_draw(win) -	windata *win; -{ -	int i, x, numbuts = sizeof (buts) / sizeof (struct but); - -	XSetState(win->display, DefaultGC(win->display, 0), -		  win->border.pixel, WhitePixel(win->display, 0), -		  GXcopy, AllPlanes); -	XSetLineAttributes(win->display, DefaultGC(win->display, 0), -			   BORDER_WIDTH, LineSolid, CapButt, -			   JoinMiter); - -	XDrawLine(win->display, win->buttonwin, -		  DefaultGC(win->display, 0), -		  0, 29, BUTTON_WIDTH, 29); -	XDrawLine(win->display, win->buttonwin, -		  DefaultGC(win->display, 0), -		  0, 60, BUTTON_WIDTH, 60); -	XDrawLine(win->display, win->buttonwin, -		  DefaultGC(win->display, 0), -		  108, 0, 108, BUTTON_HEIGHT); -	XDrawLine(win->display, win->buttonwin, -		  DefaultGC(win->display, 0), -		  219, 0, 219, BUTTON_HEIGHT); - -	XSetFont(win->display, DefaultGC(win->display, 0), win->large->fid); -	XSetForeground(win->display, DefaultGC(win->display, 0), -		       win->textcolor.pixel); -	XSetBackground(win->display, DefaultGC(win->display, 0), -		       win->textback.pixel); - -	for (i = 0; i < numbuts; i++) { -		x = (buts[i].width - -		     XTextWidth(win->large, buts[i].label, -				strlen(buts[i].label))) / 2; - -		XDrawImageString(win->display, win->buttonwin, -				 DefaultGC(win->display, 0), -				 buts[i].x + x, buts[i].y, buts[i].label, -				 strlen(buts[i].label)); -	} -	return; -} - -void -button_service(win, event) -	windata *win; -	XEvent *event; -{ -	XKeyEvent *ev = &event->xkey; -	choice c; -	int i, numbuts = sizeof (buts) / sizeof (struct but); -	char *s; - -	ev->y += 15; -	for (i = 0; i < numbuts; i++) -		if ((ev->x >= buts[i].x) && (ev->x <= buts[i].x + -				buts[i].width) && (ev->y >= buts[i].y) && -				(ev->y <= buts[i].y + buts[i].height)) { -			c = buts[i].which; -			break; -		} -	if ((i == numbuts) || (c == NOCHOICE)) { -		message_add(win, "Bad choice.\n", true); -		return; -	} - -	if (loading_flag && (c != STOP)) { -		message_add(win, "You can only use PAUSE now\n", true); -		return; -	} - -	switch (c) { -	    case DRAW: -		if (!oneboard) { -			message_add(win, "Just a sec...\n", false); -			if (!pop_question(((win == win1) ? win2 : win1), -"The other player wants\nto call the game a draw.\nDo you agree?\n")) { -				message_add(win, -				"The other player declines the draw\n", false); -				return; -			} -		} -		message_add(win1, "Draw agreed.\n", false); -		if (!oneboard) -			message_add(win2, "Draw agreed.\n", false); -		cleanup("Draw agreed."); -		break; - -	    case RESIGN: -		if (!pop_question(win, "Are you sure\nyou want to resign?")) -			return; -		if ((oneboard && !progflag) || (nexttomove == win->color)) { -			if (nexttomove == WHITE) -				s = "White resigns."; -			else -				s = "Black resigns."; -			if (oneboard) { -				message_add(win, s, false); -				message_add(win, "\n", false); -			} else { -				message_add(win1, s, false); -				message_add(win, "\n", false); -				message_add(win2, s, false); -				message_add(win, "\n", false); -			} -			sleep(5); -			cleanup(s); -		} else { -			message_add(win, "It's not your turn.\n", true); -		} -		break; - -	    case REPLAY: -		if (!oneboard) { -			message_add(win, "Just a sec...\n", false); -			if (!pop_question(((win == win1) ? win2 : win1), -"The other player wants\nto take back his last move.\nDo you let him?\n")) { -				message_add(win, -				"The other player refuses...\n", false); -				return; -			} -		} -		if (!moves) { -			message_add(win, "Can't back up...\n", true); -			break; -		} -		message_add(win1, "Replaying...\n", false); -		if (!oneboard) -			message_add(win2, "Replaying...\n", false); -		replay(); -		if (progflag) -		    replay(); -		break; - -	    case FORE: -		if (!oneboard) { -			message_add(win, "Just a sec...\n", false); -			if (!pop_question(((win == win1) ? win2 : win1), -"The other player wants\nto do a 'fore'.\nIs that ok with you?\n")) { -				message_add(win, -				"The other player refuses...\n", false); -				return; -			} -		} -		if (!foremoves) { -			message_add(win, "Can't go forward...\n", true); -			break; -		} -		message_add(win1, "Moving forward...\n", false); -		if (!oneboard) -			message_add(win2, "Moving forward...\n", false); -		forward(); -		break; - -	    case SWITCH: -		message_add(win, "You can't switch yet.\n", false); -		break; - -	    case SAVE: -		if (saveflag) { -			message_add(win, -				"Game is already being logged in file '", true); -			message_add(win, record_file, true); -			message_add(win, "'.\n", true); -		} else { -			message_add(win, "Saving game to file '", false); -			message_add(win, record_file, false); -			message_add(win, "'.\n", false); -			record_save(); -		} -		break; - -	    case STOP: -		if (loading_flag) { -			loading_paused = (loading_paused ? false : true); -			message_add(win, loading_paused ? -				"Stopped.\nHit 'Pause' again to restart.\n" : -				"Restarted.\n", false); -		} else if (clock_started) { -			if (!oneboard) { -				message_add(win, "Just a sec...\n", false); -				if (!pop_question(((win == win1) ? win2 : win1), -"The other player wants\nto stop the clock.\nDo you let him?\n")) { -					message_add(win, -					"The other player refuses to pause.\n", -					false); -					return; -				} -			} -			message_add(win1, -			"Clock stopped.\nHit 'Pause' again to restart.\n", -					false); -			if (!oneboard) -				message_add(win2, -			"Clock stopped.\nHit 'Pause' again to restart.\n", -					false); -			clock_started = false; -		} else { -			if (!oneboard) { -				message_add(win, "Just a sec...\n", false); -				if (!pop_question(((win == win1) ? win2 : win1), -"The other player wants\nto start the clock again.\nIs that ok?\n")) { -					message_add(win, -				"The other player refuses to resume.\n", -					false); -					return; -				} -			} -			message_add(win1, "Clock restarted.\n", false); -			if (!oneboard) -				message_add(win2, "Clock restarted.\n", false); -			clock_started = true; -		} -		break; - -	    case FLIP: -		message_add(win, "Flipping window...\n", false); -		win->flipped = win->flipped ? false : true; -		win_redraw(win, (XEvent *) NULL); -		break; - -	    case RESTART: -		if (!oneboard) { -			message_add(win, "Just a sec...\n", false); -			if (!pop_question(((win == win1) ? win2 : win1), -"The other player wants\nto restart the game.\nDo you agree?\n")) { -				message_add(win, -				"The other player refuses to reset\n", false); -				return; -			} -		} -		message_add(win, "Restarting game.\n", false); -		restart(); -		break; -	    case EASY: -		if (oneboard) { -			int x; -			if (easy) -				 easy = 0; -			else -				easy = 1; - -			if (easy) -				buts[EASY_OFFSET].label = " Easy "; -			else -				buts[EASY_OFFSET].label = "NoEasy"; - -			program_easy(easy); - -			x = (buts[EASY_OFFSET].width - -				   XTextWidth(win->large, -					 buts[EASY_OFFSET].label, -					 strlen(buts[EASY_OFFSET].label))) / 2; - -			XSetFont(win->display, DefaultGC(win->display, -							 0), win->large->fid); -			XSetForeground(win->display, -				       DefaultGC(win->display, 0), -				       win->textcolor.pixel); -			XSetBackground(win->display, -				       DefaultGC(win->display, 0), -				       win->textback.pixel); - -			XDrawImageString(win->display, -					 win->buttonwin, -					 DefaultGC(win->display, 0), -					 buts[EASY_OFFSET].x + x, -					 buts[EASY_OFFSET].y, -					 buts[EASY_OFFSET].label, -					 strlen(buts[EASY_OFFSET].label)); -		} -		break; -	} -	return; -} - diff --git a/gnu/games/chess/Xchess/clock.c b/gnu/games/chess/Xchess/clock.c deleted file mode 100644 index 88228b0bd0ae..000000000000 --- a/gnu/games/chess/Xchess/clock.c +++ /dev/null @@ -1,291 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:08 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/clock.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - * Do stuff with the clocks.  The way things work is as follows.  We call - * clock_init to draw the clocks initially, but they don't actually start - * running until we call clock_switch for the first time. - */ - -#include "xchess.h" - -int movesperunit = 0; -int timeunit = 0; -bool clock_started = false; -int whiteseconds, blackseconds; - -static bool white_running = true; -static long lastwhite, lastblack; -static bool firstmove = true; - -extern void dohands(), hilight(); - -#define PI 3.1415926535897932384 - -void -clock_draw(win, col) -	windata *win; -	color col; -{ -	int i; -	char buf[BSIZE]; -	int x = CLOCK_WIDTH / 2, y = CLOCK_WIDTH / 2; -	int xp, yp; -	int rad = CLOCK_WIDTH / 2 - 10; -	Window w = ((col == WHITE) ? win->wclockwin : win->bclockwin); - -	/* Draw a clock face and the hands. */ -	XCircle(w, x, y, rad, 0.0, 0.0, 1, 1, win->textcolor.pixel, GXcopy, -			AllPlanes); -	rad -= 8; - -	XSetFont(win->display, DefaultGC(win->display, 0), -		 win->small->fid); -	XSetForeground(win->display, DefaultGC(win->display, 0), -		       win->textcolor.pixel); -	XSetBackground(win->display, DefaultGC(win->display, 0), -		       win->textback.pixel); -	for (i = 1; i <= 12; i++) { -		xp = x + rad * cos(PI * 3 / 2 + i * PI / 6) - 4; -		yp = y + rad * sin(PI * 3 / 2 + i * PI / 6) - 5; -		sprintf(buf, "%d", i); -		XDrawString(win->display, w, DefaultGC(win->display, 0), -			    xp, yp, buf, strlen(buf)); -	} - -	dohands(win, col); - -	if (white_running) { -		hilight(win, WHITE, true); -		hilight(win, BLACK, false); -	} else { -		hilight(win, WHITE, false); -		hilight(win, BLACK, true); -	} -	return; -} - -void -clock_init(win, col) -	windata *win; -	color col; -{ -	whiteseconds = blackseconds = 0; -	clock_started = false; -	firstmove = true; -	clock_draw(win, col); - -	return; -} - -void -clock_update() -{ -	int now = time((long *) NULL); -	int i; - -	if (!clock_started) { -		lastwhite = lastblack = now; -		return; -	} - -	if (white_running) { -		whiteseconds += now - lastwhite; -		lastwhite = now; -		dohands(win1, WHITE); -		if (!oneboard) -			dohands(win2, WHITE); -		if (timeunit) { -			i = whiteseconds / timeunit; -			if ((i > 0) && (whiteseconds > i * timeunit) && -					(whiteseconds < i * timeunit + 10) && -					(movesperunit * i > movenum)) { -				message_add(win1, -					"White has exceeded his time limit\n", -						true); -				if (!oneboard) { -					message_add(win2, -					"White has exceeded his time limit\n", -						true); -				} -				timeunit = 0; -			} -		} -	} else { -		blackseconds += now - lastblack; -		lastblack = now; -		dohands(win1, BLACK); -		if (!oneboard) -			dohands(win2, BLACK); -		if (timeunit) { -			i = blackseconds / timeunit; -			if ((i > 0) && (blackseconds > i * timeunit) && -					(blackseconds < i * timeunit + 10) && -					(movesperunit * i > movenum)) { -				message_add(win1, -					"Black has exceeded his time limit\n", -						true); -				if (!oneboard) { -					message_add(win2, -					"Black has exceeded his time limit\n", -						true); -				} -				timeunit = 0; -			} -		} -	} -	return; -} - -void -clock_switch() -{ -	if (firstmove) { -		clock_started = true; -		firstmove = false; -		lastwhite = lastblack = time((long *) NULL); -	} -	if (white_running) { -		white_running = false; -		lastblack = time((long *) NULL); -		hilight(win1, WHITE, false); -		hilight(win1, BLACK, true); -		if (!oneboard) { -			hilight(win2, WHITE, false); -			hilight(win2, BLACK, true); -		} -	} else { -		white_running = true; -		lastwhite = time((long *) NULL); -		hilight(win1, WHITE, true); -		hilight(win1, BLACK, false); -		if (!oneboard) { -			hilight(win2, WHITE, true); -			hilight(win2, BLACK, false); -		} -	} -	return; -} - -static void -dohands(win, col) -	windata *win; -	color col; -{ -	int cx = CLOCK_WIDTH / 2, cy = CLOCK_WIDTH / 2; -	double *h = (col == WHITE) ? win->whitehands : win->blackhands; -	Window w = (col == WHITE) ? win->wclockwin : win->bclockwin; -	long secs = (col == WHITE) ? whiteseconds : blackseconds; -	int rad, x, y, i; - -	/* First erase the old hands. */ -	XSetState(win->display, DefaultGC(win->display, 0), -		  win->textback.pixel, win->textback.pixel, -		  GXcopy, AllPlanes); - -	rad = CLOCK_WIDTH / 2 - 30; -	for (i = 0; i < 3; i++) { -		x = cx + rad * sin(PI - h[i]); -		y = cy + rad * cos(PI - h[i]); -		XSetLineAttributes(win->display, -				   DefaultGC(win->display, 0), -				   i, LineSolid, 0, 0); -		XDrawLine(win->display, w, DefaultGC(win->display, 0), -			  cx, cy, x, y); -		rad -= 8; -	} - -	h[0] = (secs % 60) * 2 * PI / 60; -	h[1] = ((secs / 60) % 60) * 2 * PI / 60; -	h[2] = ((secs / 3600) % 12) * 2 * PI / 12; - -	/* Now draw the new ones. */ - -	XSetState(win->display, DefaultGC(win->display, 0), -		  win->textcolor.pixel, win->textback.pixel, -		  GXcopy, AllPlanes); - -	rad = CLOCK_WIDTH / 2 - 30; -	for (i = 0; i < 3; i++) { -		x = cx + rad * sin(PI - h[i]); -		y = cy + rad * cos(PI - h[i]); -		XSetLineAttributes(win->display, -				   DefaultGC(win->display, 0), -				   i, LineSolid, 0, 0); -		XDrawLine(win->display, w, DefaultGC(win->display, 0), -			  cx, cy, x, y); -		rad -= 8; -	} -	XFlush(win->display); -	return; -} - -static void -hilight(win, col, on) -	windata *win; -	color col; -	bool on; -{ -	Window w = (col == WHITE) ? win->wclockwin : win->bclockwin; -	char *s = (col == WHITE) ? " WHITE " : " BLACK "; -	int x; - - -	x = XTextWidth(win->large, s, strlen(s)); -	if (on) -		XSetState(win->display, DefaultGC(win->display, 0), -			  win->textback.pixel, -			  win->textcolor.pixel, -			  GXcopy, -			  AllPlanes); -	else -		XSetState(win->display, DefaultGC(win->display, 0), -			  win->textcolor.pixel, -			  win->textback.pixel, -			  GXcopy, AllPlanes); - -	XSetLineAttributes(win->display, DefaultGC(win->display, 0), -		      BORDER_WIDTH, LineSolid, CapButt, JoinMiter); -	XSetFont(win->display, DefaultGC(win->display, 0), -		 win->large->fid); - -	XDrawLine(win->display, w, DefaultGC(win->display, 0), -		  0, CLOCK_HEIGHT - 26, -		  CLOCK_WIDTH, CLOCK_HEIGHT - 26); - -	XDrawImageString(win->display, w, DefaultGC(win->display, 0), -			 (CLOCK_WIDTH - x) / 2, CLOCK_HEIGHT, -			 s, strlen(s)); - -	if (on) -		XSetState(win->display, DefaultGC(win->display, 0), -			  win->textcolor.pixel, -			  win->textback.pixel, -			  GXcopy, AllPlanes); -	return; -} - diff --git a/gnu/games/chess/Xchess/control.c b/gnu/games/chess/Xchess/control.c deleted file mode 100644 index 7d23a7698b5a..000000000000 --- a/gnu/games/chess/Xchess/control.c +++ /dev/null @@ -1,515 +0,0 @@ -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:11 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/control.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - * Deal with input from the user. - */ - -#include "xchess.h" - -move *moves; -move *foremoves; -color nexttomove = WHITE; -bool noisyflag = false; - -move *lastmove; -static move *thismove; - -static void screen_move(); - -void -button_pressed(event, win) -	XEvent *event; -	windata *win; -{ -	int x, y; -	XKeyEvent *ev = (XKeyEvent *) event; - -	if (!oneboard && (win->color != nexttomove)) { -		message_add(win, "Wrong player!\n", true); -		return; -	} -	if (progflag && (nexttomove == (blackflag ? WHITE : BLACK))) { -		message_add(win, "Wait for the computer...\n", true); -		return; -	} -	if (loading_flag) { -		message_add(win, "You'd better not do that now...\n", true); -		return; -	} - -	/* Figure out what piece he is pointing at. */ -	x = ev->x / (SQUARE_WIDTH + BORDER_WIDTH); -	y = ev->y / (SQUARE_HEIGHT + BORDER_WIDTH); - -	if (win->flipped) { -		y = SIZE - y - 1; -		x = SIZE - x - 1; -	} - -	if ((x < 0) || (x >= SIZE) || (y < 0) || (y >= SIZE)) { -		fprintf(stderr, "Bad coords (%d, %d)\n", x, y); -		return; -	} - -	if (oneboard && (chessboard->square[y][x].color != nexttomove)) { -		message_add(win, "Wrong player!\n", true); -		return; -	} else if (!oneboard && (chessboard->square[y][x].color != -			win->color)) { -		message_add(win, "Can't move that\n", true); -		return; -	} - -	thismove = alloc(move); -	thismove->fromx = x; -	thismove->fromy = y; -	thismove->piece.color = chessboard->square[y][x].color; -	thismove->piece.type = chessboard->square[y][x].type; - -	if (debug) -		fprintf(stderr, "%s selected his %s at (%d, %d)...\n", -				colornames[(int) thismove->piece.color], -				piecenames[(int) thismove->piece.type], -				thismove->fromy, thismove->fromx); -	return; -} - -void -button_released(event, win) -	XEvent *event; -	windata *win; -{ -	int x, y; -	XKeyEvent *ev = (XKeyEvent *) event; - -	if (!thismove) { -		/* fprintf(stderr, "Error: button hasn't been pressed\n"); */ -		return; -	} -	if (loading_flag) -		return; - -	/* Figure out what piece he is pointing at. */ -	x = ev->x / (SQUARE_WIDTH + BORDER_WIDTH); -	y = ev->y / (SQUARE_HEIGHT + BORDER_WIDTH); - -	if (win->flipped) { -		y = SIZE - y - 1; -		x = SIZE - x - 1; -	} - -	if ((x < 0) || (x >= SIZE) || (y < 0) || (y >= SIZE)) { -		fprintf(stderr, "Bad coords (%d, %d)\n", x, y); -		return; -	} - -	if ((thismove->fromx == x) && (thismove->fromy == y)) { -		message_add(win, "Hey, you touch it, you move it, buddy.\n", -				true); -		return; -	} -	if (chessboard->square[y][x].color == thismove->piece.color) { -		message_add(win, "Can't put one piece on top of another\n", -				true); -		return; -	} - -	thismove->tox = x; -	thismove->toy = y; -	thismove->taken.color = chessboard->square[y][x].color; -	thismove->taken.type = chessboard->square[y][x].type; -	if (thismove->taken.color != NONE) -		thismove->type = CAPTURE; -	else if ((thismove->piece.type == KING) && (thismove->fromx == 4) && -			(thismove->tox == 6) && -			(thismove->toy == thismove->fromy)) -		thismove->type = KCASTLE; -	else if ((thismove->piece.type == KING) && (thismove->tox == 2) && -			(thismove->fromx == 4) && -			(thismove->toy == thismove->fromy)) -		thismove->type = QCASTLE; -	else -		thismove->type = MOVE; - -	/* Now check the en-passant case... */ -	if ((thismove->type == MOVE) && ((thismove->tox == thismove->fromx + 1) -			|| (thismove->tox == thismove->fromx - 1)) && -			(thismove->piece.type == PAWN) && lastmove && -			(lastmove->tox == lastmove->fromx) && (lastmove->fromx -			== thismove->tox) && ((lastmove->fromy + lastmove->toy) -			/ 2 == thismove->toy)) { -		thismove->type = CAPTURE; -		thismove->enpassant = true; -		thismove->taken = lastmove->piece; -	} - -	if (!valid_move(thismove, chessboard)) { -		message_add(win, "Invalid move.\n", true); -		return; -	} - -	if (debug) -		fprintf(stderr, "\t... and moved it to (%d, %d), type %s\n", -				thismove->toy, thismove->tox, -				movetypenames[(int) thismove->type]); -	move_piece(thismove); - -	if (thismove->check) { -		message_add(win1, "Check.\n", true); -		if (!oneboard) { -			message_add(win2, "Check.\n", true); -		} -	} - -	if (!moves) -		moves = lastmove = thismove; -	else -		lastmove = lastmove->next = thismove; - -	if (progflag) -		program_send(thismove); - -	thismove = NULL; -	nexttomove = ((nexttomove == WHITE) ? BLACK : WHITE); -	clock_switch(); - -	return; -} - -void -prog_move(m) -	move *m; -{ -	if (debug) -		fprintf(stderr, "program moves from (%d, %d) to (%d, %d)\n", -				m->fromy, m->fromx, m->toy, m->tox); -	move_piece(m); - -	if (!moves) -		moves = lastmove = m; -	else -		lastmove = lastmove->next = m; - -	nexttomove = ((nexttomove == WHITE) ? BLACK : WHITE); -	clock_switch(); - -	return; -} - -void -move_piece(m) -	move *m; -{ -	/* Update the screen... */ -	screen_move(m); - -	/* Move the piece on the board... */ -	board_move(chessboard, m); - -	/* And record it... */ -	record_move(m); - -	if (noisyflag) { -	    XBell(win1->display, 50); -	    XBell(win2->display, 50); -	} -	return; -} - -static void -screen_move(m) -	move *m; -{ -	piece pp; - -	switch (m->type) { -	    case CAPTURE: -		jail_add(&m->taken); -		/* FALLTHRU */ - -	    case MOVE: -		win_erasepiece(m->fromy, m->fromx, WHITE); -		if (win_flashmove) -			win_flash(m, WHITE); -		win_drawpiece(&m->piece, m->toy, m->tox, WHITE); -		if (m->enpassant) -			win_erasepiece(m->toy + ((m->piece.color == WHITE) ? -					1 : -1), m->tox, WHITE); -		if (!oneboard) { -			win_erasepiece(m->fromy, m->fromx, BLACK); -			if (win_flashmove) -				win_flash(m, BLACK); -			win_drawpiece(&m->piece, m->toy, m->tox, BLACK); -			if (m->enpassant) -				win_erasepiece(m->toy + ((m->piece.color == -					WHITE) ? 1 : -1), m->tox, WHITE); -		} -		if ((m->piece.type == PAWN) && (((m->piece.color == BLACK) && -				(m->toy == 7)) || ((m->piece.color == WHITE) && -				(m->toy == 0)))) { -			pp.color = m->piece.color; -			pp.type = QUEEN; -			win_drawpiece(&pp,  m->toy, m->tox, WHITE); -			if (!oneboard) -				win_drawpiece(&m->piece, m->toy, m->tox, BLACK); -		} -		break; - -	    case KCASTLE: -		if (m->piece.color == WHITE) { -			win_erasepiece(7, 4, WHITE); -			win_erasepiece(7, 7, WHITE); -			if (win_flashmove) -				win_flash(m, WHITE); -			win_drawpiece(&m->piece, 7, 6, WHITE); -			win_drawpiece(&chessboard->square[7][7], 7, 5, WHITE); -			if (!oneboard) { -				win_erasepiece(7, 4, BLACK); -				win_erasepiece(7, 7, BLACK); -				if (win_flashmove) -					win_flash(m, BLACK); -				win_drawpiece(&m->piece, 7, 6, BLACK); -				win_drawpiece(&chessboard->square[7][7], 7, 5, -						BLACK); -			} -		} else { -			win_erasepiece(0, 4, WHITE); -			win_erasepiece(0, 7, WHITE); -			if (win_flashmove) -				win_flash(m, WHITE); -			win_drawpiece(&m->piece, 0, 6, WHITE); -			win_drawpiece(&chessboard->square[0][7], 0, 5, WHITE); -			if (!oneboard) { -				win_erasepiece(0, 4, BLACK); -				win_erasepiece(0, 7, BLACK); -				if (win_flashmove) -					win_flash(m, BLACK); -				win_drawpiece(&m->piece, 0, 6, BLACK); -				win_drawpiece(&chessboard->square[0][7], 0, 5, -						BLACK); -			} -		} -		break; - -	    case QCASTLE: -		if (m->piece.color == WHITE) { -			win_erasepiece(7, 4, WHITE); -			win_erasepiece(7, 0, WHITE); -			if (win_flashmove) -				win_flash(m, WHITE); -			win_drawpiece(&m->piece, 7, 2, WHITE); -			win_drawpiece(&chessboard->square[7][0], 7, 3, WHITE); -			if (!oneboard) { -				win_erasepiece(7, 4, BLACK); -				win_erasepiece(7, 0, BLACK); -				if (win_flashmove) -					win_flash(m, BLACK); -				win_drawpiece(&m->piece, 7, 2, BLACK); -				win_drawpiece(&chessboard->square[7][7], 7, 3, -						BLACK); -			} -		} else { -			win_erasepiece(0, 4, WHITE); -			win_erasepiece(0, 0, WHITE); -			if (win_flashmove) -				win_flash(m, WHITE); -			win_drawpiece(&m->piece, 0, 2, WHITE); -			win_drawpiece(&chessboard->square[0][0], 0, 3, WHITE); -			if (!oneboard) { -				win_erasepiece(0, 4, BLACK); -				win_erasepiece(0, 0, BLACK); -				if (win_flashmove) -					win_flash(m, BLACK); -				win_drawpiece(&m->piece, 0, 2, BLACK); -				win_drawpiece(&chessboard->square[0][7], 0, 3, -						BLACK); -			} -		} -		break; - -	    default: -		fprintf(stderr, "Bad move type %d\n", m->type); -	} -	return; -} - -/* Retract the last move made... */ - -void -replay() -{ -	move *m = lastmove, bm; - -	memset(&bm, 0, sizeof(bm)); -	switch (m->type) { -	    case MOVE: -		bm.type = MOVE; -		bm.piece = m->piece; -		bm.fromx = m->tox; -		bm.fromy = m->toy; -		bm.tox = m->fromx; -		bm.toy = m->fromy; -		board_move(chessboard, &bm); -		screen_move(&bm); -		break; - -	    case CAPTURE: -		bm.type = MOVE; -		bm.piece = m->piece; -		bm.fromx = m->tox; -		bm.fromy = m->toy; -		bm.tox = m->fromx; -		bm.toy = m->fromy; -		board_move(chessboard, &bm); -		screen_move(&bm); -		chessboard->square[m->toy][m->tox] = m->taken; -		bm.piece = m->taken; -		bm.fromx = bm.tox = m->tox; -		bm.fromy = bm.toy = m->toy; -		screen_move(&bm); -		jail_remove(&m->taken); -		break; - -	    case KCASTLE: -		bm.type = MOVE; -		bm.piece.type = KING; -		bm.piece.color = m->piece.color; -		bm.fromx = 6; -		bm.tox = 4; -		bm.fromy = bm.toy = (m->piece.color == WHITE) ? 7 : 0; -		board_move(chessboard, &bm); -		screen_move(&bm); -		bm.type = MOVE; -		bm.piece.type = ROOK; -		bm.piece.color = m->piece.color; -		bm.fromx = 5; -		bm.tox = 7; -		bm.fromy = bm.toy = (m->piece.color == WHITE) ? 7 : 0; -		board_move(chessboard, &bm); -		screen_move(&bm); -		if (m->piece.color == WHITE) -			chessboard->white_cant_castle_k = false; -		else -			chessboard->black_cant_castle_k = false; -		break; - -	    case QCASTLE: -		bm.type = MOVE; -		bm.piece.type = KING; -		bm.piece.color = m->piece.color; -		bm.fromx = 2; -		bm.tox = 4; -		bm.fromy = bm.toy = (m->piece.color == WHITE) ? 7 : 0; -		board_move(chessboard, &bm); -		screen_move(&bm); -		bm.type = MOVE; -		bm.piece.type = ROOK; -		bm.piece.color = m->piece.color; -		bm.fromx = 3; -		bm.tox = 0; -		bm.fromy = bm.toy = (m->piece.color == WHITE) ? 7 : 0; -		board_move(chessboard, &bm); -		screen_move(&bm); -		if (m->piece.color == WHITE) -			chessboard->white_cant_castle_q = false; -		else -			chessboard->black_cant_castle_q = false; -		break; -	} -	record_back(); - -	nexttomove = ((nexttomove == WHITE) ? BLACK : WHITE); -	clock_switch(); - -	if (!moves->next) { -		moves->next = foremoves; -		foremoves = moves; -		moves = lastmove = NULL; -	} else { -		for (m = moves; m->next; m = m->next) -			lastmove = m; -		lastmove->next->next = foremoves; -		foremoves = lastmove->next; -		lastmove->next = NULL; -	} - -	if (progflag) -		program_undo(); - -	return; -} - -/* Put back the last move undone. */ - -void -forward() -{ -	prog_move(foremoves); -	foremoves = foremoves->next; -	return; -} - -/* End the game. */ - -void -cleanup(s) -	char *s; -{ -	if (progflag) -		program_end(); -	record_end(s); -	XSync(win1->display, 0); -	if (!oneboard) { -	    XSync(win2->display, 0); -	} -	exit(0); -} - -void -restart() -{ -	moves = lastmove = thismove = NULL; -	nexttomove = WHITE; - -	clock_init(win1, WHITE); -	clock_init(win1, BLACK); -	jail_init(win1); -	if (!oneboard) { -		clock_init(win2, WHITE); -		clock_init(win2, BLACK); -		jail_init(win2); -	} -	board_init(chessboard); -	win_restart(); -	record_reset(); -	if (progflag) { -		program_end(); -		program_init(progname); -	} -	return; -} - diff --git a/gnu/games/chess/Xchess/jail.c b/gnu/games/chess/Xchess/jail.c deleted file mode 100644 index b3ed39178465..000000000000 --- a/gnu/games/chess/Xchess/jail.c +++ /dev/null @@ -1,327 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:12 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/jail.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - */ - -#include "xchess.h" - -#include "pawn_small.bitmap" -#include "rook_small.bitmap" -#include "knight_small.bitmap" -#include "bishop_small.bitmap" -#include "queen_small.bitmap" -#include "king_small.bitmap" - -#include "pawn_small_outline.bitmap" -#include "rook_small_outline.bitmap" -#include "knight_small_outline.bitmap" -#include "bishop_small_outline.bitmap" -#include "queen_small_outline.bitmap" -#include "king_small_outline.bitmap" - -static bool pos[32]; - -static piecetype pcs[] = { KING, QUEEN, ROOK, ROOK, BISHOP, BISHOP, KNIGHT, -		KNIGHT, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN, PAWN } ; - -extern int piecepos(); -extern char *bitsget(); - -void -jail_init(win) -	windata *win; -{ -	int i; - -	for (i = 0; i < 32; i++) -		pos[i] = false; -	jail_draw(win); -	return; -} - -#define JAIL_HEADER	"Captured Pieces" - -void -jail_draw(win) -	windata *win; -{ -	int i; -	char *bits; -	Pixmap tmpPM; -	piece p; - -	i = XTextWidth(win->large, JAIL_HEADER, strlen(JAIL_HEADER)); -	XSetFont(win->display, DefaultGC(win->display, 0), -		 win->large->fid); -	XSetForeground(win->display, DefaultGC(win->display, 0), -		       win->textcolor.pixel); -	XSetBackground(win->display, DefaultGC(win->display, 0), -		       win->textback.pixel); - -	XDrawImageString(win->display, win->jailwin, -			 DefaultGC(win->display, 0), -			 (JAIL_WIDTH - i) / 2, 20, JAIL_HEADER, -			strlen(JAIL_HEADER)); - -	XSetForeground(win->display, DefaultGC(win->display, 0), -		       win->blackpiece.pixel); -	XSetBackground(win->display, DefaultGC(win->display, 0), -		       win->textback.pixel); -	XSetFillStyle(win->display, DefaultGC(win->display, 0), -		      FillSolid); -	XSetFunction(win->display, DefaultGC(win->display, 0), -		     GXcopy); - -	for (i = 0; i < 16; i++) -		if (pos[i]) { -			p.color = WHITE; -			p.type = pcs[i]; -			bits = bitsget(&p); -			tmpPM = XCreateBitmapFromData(win->display, -				     win->jailwin, bits, -				     32, 32); - -			XCopyPlane(win->display, tmpPM, win->jailwin, -				  DefaultGC(win->display, 0), -				  0, 0, 32, 32, -				  5 + (i % 8) * 32, 25 + (i / 8) * 32, -				  1); -		        XFreePixmap(win->display, tmpPM); -		} else { -		    XFillRectangle(win->display, win->jailwin, -				   DefaultGC(win->display, 0), -				   5 + (i % 8) * 32, -				   25 + (i / 8) * 32, -				   32, 32); -		} -	for (i = 0; i < 16; i++) -		if (pos[i + 16]) { -		    p.color = BLACK; -		    p.type = pcs[i]; -		    bits = bitsget(&p); -		    tmpPM = XCreateBitmapFromData(win->display, -						  win->jailwin, bits, -						  32, 32); - -		    XCopyPlane(win->display, tmpPM, win->jailwin, -			       DefaultGC(win->display, 0), -			       0, 0, 32, 32, -			       5 + (i % 8) * 32, 94 + (i / 8) * 32, -			       1); -		    XFreePixmap(win->display, tmpPM); -		} else { -		    XFillRectangle(win->display, win->jailwin, -				   DefaultGC(win->display, 0), -				   5 + (i % 8) * 32, 94 + (i / 8) * 32, -				   32, 32); -		} - -	return; -} - -void -jail_add(p) -	piece *p; -{ -	int i = piecepos(p, false); -	char *bits; -	Pixmap tmpPM; - -	pos[i] = true; - -	bits = bitsget(p); - -	XSetState(win1->display, DefaultGC(win1->display, 0), -		       win1->blackpiece.pixel, -		       win1->textback.pixel, -		       GXcopy, -		       AllPlanes); - -	tmpPM = XCreateBitmapFromData(win1->display, -				      win1->jailwin, bits, -				      32, 32); - -	XCopyPlane(win1->display, tmpPM, win1->jailwin, -		   DefaultGC(win1->display, 0), -		   0, 0, 32, 32, -		   5 + (i % 8) * 32, ((i >= 16) ? 30 : 25) + (i / 8) * 32, -		   1); -	XFreePixmap(win1->display, tmpPM); - -	if (!oneboard) { -	    XSetState(win2->display, DefaultGC(win2->display, 0), -		      win2->blackpiece.pixel, -		      win2->textback.pixel, -		      GXcopy, -		      AllPlanes); - - -	    tmpPM = XCreateBitmapFromData(win2->display, -					  win2->jailwin, bits, -					  32, 32); - -	    XCopyPlane(win2->display, tmpPM, win2->jailwin, -		       DefaultGC(win2->display, 0), -		       0, 0, 32, 32, -		       5 + (i % 8) * 32, ((i >= 16) ? 30 : 25) + (i / 8) * 32, -		       1); -	    XFreePixmap(win2->display, tmpPM); -	} - -	return; -} - -void -jail_remove(p) -	piece *p; -{ -    int i = piecepos(p, true); - -    pos[i] = false; - - -    XSetForeground(win1->display, -		   DefaultGC(win1->display, 0), -		   win1->blackpiece.pixel); -    XSetBackground(win1->display, -		   DefaultGC(win1->display, 0), -		   win1->textback.pixel); -    XSetFillStyle(win1->display, -		  DefaultGC(win1->display, 0), -		  FillSolid); - -    XFillRectangle(win1->display, win1->jailwin, -		   DefaultGC(win1->display, 0), -		   5 + (i % 8) * 32, -		   ((i >= 16) ? 30 : 25) + (i / 8) * 32, -		   32, 32); - -    if (!oneboard) { -	XSetForeground(win2->display, -		       DefaultGC(win2->display, 0), -		       win2->blackpiece.pixel); -	XSetBackground(win2->display, -		       DefaultGC(win2->display, 0), -		       win2->textback.pixel); -	XSetFillStyle(win2->display, -		      DefaultGC(win2->display, 0), -		      FillSolid); - -	XFillRectangle(win2->display, win2->jailwin, -		       DefaultGC(win2->display, 0), -		       5 + (i % 8) * 32, -		       ((i >= 16) ? 30 : 25) + (i / 8) * 32, -		       32, 32); -    } - -    return; -} - -static char *bitsget(p) -	piece *p; -{ -	char *bits; - -	switch (p->type) { -	    case PAWN: -		bits = (p->color == WHITE) ? pawn_small_outline_bits : -				pawn_small_bits; -		break; - -	    case ROOK: -		bits = (p->color == WHITE) ? rook_small_outline_bits : -				rook_small_bits; -		break; - -	    case KNIGHT: -		bits = (p->color == WHITE) ? knight_small_outline_bits : -				knight_small_bits; -		break; - -	    case BISHOP: -		bits = (p->color == WHITE) ? bishop_small_outline_bits : -				bishop_small_bits; -		break; - -	    case QUEEN: -		bits = (p->color == WHITE) ? queen_small_outline_bits : -				queen_small_bits; -		break; - -	    case KING: -		bits = (p->color == WHITE) ? king_small_outline_bits : -				king_small_bits; -		break; -	} -	return (bits); -} - -static int -piecepos(p, there) -	piece *p; -	bool there; -{ -	int i, base = (p->color == WHITE) ? 0 : 16; - -	switch (p->type) { -	    case PAWN: -		for (i = base + 8; (i < base + 15) && pos[i]; i++) -			; -		if (there && !pos[i]) -			i--; -		break; - -	    case KING: -		/* Hmm... */ -		i = base; -		break; - -	    case QUEEN: -		i = base + 1; -		break; - -	    case ROOK: -		i = base + 2; -		if ((there && pos[i + 1]) || (!there && pos[i])) -			i++; -		break; - -	    case BISHOP: -		i = base + 4; -		if ((there && pos[i + 1]) || (!there && pos[i])) -			i++; -		break; - -	    case KNIGHT: -		i = base + 6; -		if ((there && pos[i + 1]) || (!there && pos[i])) -			i++; -		break; -	} -	return (i); -} diff --git a/gnu/games/chess/Xchess/king.bitmap b/gnu/games/chess/Xchess/king.bitmap deleted file mode 100644 index dd9178a2ed9e..000000000000 --- a/gnu/games/chess/Xchess/king.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define king_width 80 -#define king_height 80 -static char king_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x30, 0x18, 0x00, 0xfc, 0x1f, 0x00, -   0x00, 0xfe, 0x7f, 0x00, 0xb8, 0x3b, 0x00, 0xff, 0x7f, 0x00, 0x00, 0xff, -   0xff, 0x00, 0xb8, 0x3b, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x03, -   0xb8, 0x3b, 0xe0, 0xff, 0xff, 0x01, 0xc0, 0xff, 0xff, 0x0f, 0xb8, 0x3b, -   0xf0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x1f, 0xb8, 0x3b, 0xf8, 0xff, -   0xf8, 0x07, 0xe0, 0x1f, 0xc0, 0x3f, 0xb8, 0x3b, 0xfc, 0x07, 0xe2, 0x07, -   0xf0, 0xcf, 0x9f, 0x7f, 0x30, 0x18, 0xfe, 0xf3, 0xcf, 0x0f, 0xf0, 0xe7, -   0x3f, 0xfe, 0xf0, 0x1f, 0x7e, 0xfc, 0xdf, 0x0f, 0xf0, 0xf3, 0xff, 0xfc, -   0xf1, 0x1f, 0x3f, 0xff, 0x9f, 0x0f, 0xf8, 0xfb, 0xff, 0xfd, 0xf3, 0x9f, -   0xbf, 0xff, 0xbf, 0x1f, 0xf8, 0xf9, 0xff, 0xf9, 0xe3, 0x8f, 0xdf, 0xff, -   0x3f, 0x1f, 0xf8, 0xfd, 0xff, 0xf3, 0xef, 0xcf, 0xcf, 0xff, 0x7f, 0x1f, -   0xf8, 0xfd, 0xff, 0xe7, 0xef, 0xef, 0xef, 0xff, 0x7f, 0x1f, 0xfc, 0xfd, -   0xff, 0xcf, 0xff, 0xff, 0xe7, 0x3f, 0x7c, 0x3f, 0xfc, 0x3c, 0xfc, 0xdf, -   0xff, 0xfe, 0xf3, 0x3d, 0x7c, 0x3f, 0xfc, 0x3e, 0xfc, 0x9e, 0x7f, 0xfc, -   0xf9, 0x39, 0x7c, 0x3f, 0xfc, 0x3e, 0x7c, 0xbe, 0x3f, 0xf8, 0xf9, 0x3b, -   0x7c, 0x3f, 0xfc, 0x3e, 0x78, 0x3f, 0x7f, 0xfc, 0xfc, 0x3b, 0x7f, 0x3f, -   0xfc, 0xfe, 0x7b, 0x7f, 0xff, 0xfe, 0xfe, 0x9b, 0x7f, 0x3f, 0xf8, 0xfe, -   0xbb, 0x7f, 0xfe, 0x7f, 0xfe, 0xdb, 0x79, 0x1f, 0xf8, 0xfe, 0xb3, 0xff, -   0xfe, 0x7f, 0xff, 0xcb, 0x7c, 0x1f, 0xf8, 0x9e, 0xb7, 0xff, 0xfe, 0x7f, -   0xff, 0x2b, 0x3e, 0x1f, 0xf8, 0x3e, 0xa6, 0xff, 0xfc, 0x7f, 0xff, 0xa3, -   0xbf, 0x1f, 0xf8, 0xfe, 0xa8, 0xff, 0xfd, 0x3e, 0xff, 0xd3, 0xbf, 0x1f, -   0xf8, 0xfd, 0x83, 0xff, 0x7d, 0xbc, 0xff, 0xc3, 0xbf, 0x1f, 0xf0, 0xfd, -   0x8f, 0xff, 0x39, 0xb8, 0xff, 0xe3, 0xbf, 0x1f, 0xf0, 0xfd, 0x9f, 0xff, -   0x7b, 0xbc, 0xff, 0xf1, 0x9f, 0x0f, 0xf0, 0xf9, 0xbf, 0xff, 0xfb, 0xbe, -   0xff, 0xfd, 0xdf, 0x0f, 0xf0, 0xfb, 0x3f, 0xff, 0xf3, 0x9f, 0xff, 0xfd, -   0xdf, 0x0f, 0xf0, 0xf3, 0x7f, 0xff, 0xf7, 0xdf, 0xff, 0xfc, 0xdf, 0x0f, -   0xe0, 0xf7, 0x7f, 0xfe, 0xf7, 0xdf, 0xff, 0xfe, 0xdf, 0x07, 0xe0, 0xf7, -   0xff, 0xfe, 0xf7, 0xdf, 0x7f, 0xfe, 0xcf, 0x07, 0xe0, 0xe7, 0xff, 0xfe, -   0xf7, 0xdf, 0x7f, 0xff, 0xef, 0x07, 0xc0, 0xef, 0xff, 0xfc, 0xef, 0xee, -   0x7f, 0xff, 0xe7, 0x03, 0xc0, 0xcf, 0xff, 0xfd, 0x6f, 0xec, 0x3f, 0xff, -   0xf7, 0x03, 0x80, 0xdf, 0xff, 0xf9, 0xef, 0xee, 0xbf, 0xff, 0xf3, 0x01, -   0x80, 0x9f, 0xff, 0xfb, 0xef, 0xef, 0x9f, 0xff, 0xfb, 0x01, 0x00, 0xbf, -   0xff, 0xfb, 0xef, 0xef, 0xdf, 0xff, 0xf9, 0x00, 0x00, 0x7e, 0xff, 0xf3, -   0xef, 0xef, 0xdf, 0xff, 0x7e, 0x00, 0x00, 0x7e, 0xfe, 0xff, 0xef, 0xef, -   0xff, 0x7f, 0x7e, 0x00, 0x00, 0xfc, 0xfc, 0xff, 0xef, 0xef, 0xff, 0x7f, -   0x3f, 0x00, 0x00, 0xfc, 0xf9, 0xff, 0xef, 0xef, 0xff, 0x3f, 0x1f, 0x00, -   0x00, 0xf8, 0xfb, 0x03, 0xe0, 0x0f, 0x00, 0x9f, 0x1f, 0x00, 0x00, 0xf0, -   0x03, 0xf8, 0xff, 0xff, 0x7f, 0xc0, 0x0f, 0x00, 0x00, 0xe0, 0xff, 0xbf, -   0xf7, 0xde, 0xfb, 0xff, 0x07, 0x00, 0x00, 0xc0, 0xff, 0x1d, 0x63, 0x8c, -   0x71, 0xff, 0x03, 0x00, 0x00, 0x80, 0xef, 0xb8, 0xf7, 0xde, 0x3b, 0xee, -   0x01, 0x00, 0x00, 0x00, 0xc7, 0xfd, 0xff, 0xff, 0x7f, 0xc7, 0x00, 0x00, -   0x00, 0x00, 0xee, 0xff, 0x00, 0x00, 0xfc, 0x6f, 0x00, 0x00, 0x00, 0x00, -   0xfe, 0x03, 0xfe, 0xff, 0x01, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf8, -   0x7f, 0xfc, 0x7f, 0x60, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x1f, 0xf0, -   0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xff, 0x07, 0xc0, 0xff, 0x63, -   0x00, 0x00, 0x00, 0x00, 0x06, 0xff, 0x1f, 0xf0, 0xff, 0x60, 0x00, 0x00, -   0x00, 0x00, 0x06, 0xfc, 0x7f, 0xfc, 0x3f, 0x60, 0x00, 0x00, 0x00, 0x00, -   0x06, 0xff, 0xff, 0xff, 0xff, 0x60, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xff, -   0x00, 0x00, 0xfc, 0x63, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0xfe, 0xff, -   0x01, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x06, 0xf8, 0xff, 0xff, 0x7f, 0x60, -   0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, -   0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/king_mask.bitmap b/gnu/games/chess/Xchess/king_mask.bitmap deleted file mode 100644 index e1bb523cad10..000000000000 --- a/gnu/games/chess/Xchess/king_mask.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define king_mask_width 80 -#define king_mask_height 80 -static char king_mask_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0xf8, 0x3f, 0x00, 0xfe, -   0x3f, 0x00, 0x00, 0xff, 0xff, 0x00, 0xfc, 0x3f, 0x80, 0xff, 0x7f, 0x00, -   0x80, 0xff, 0xff, 0x01, 0xfc, 0x7f, 0xc0, 0xff, 0xff, 0x00, 0xc0, 0xff, -   0xff, 0x07, 0xfc, 0x7f, 0xe0, 0xff, 0xff, 0x01, 0xe0, 0xff, 0xff, 0x1f, -   0xfc, 0x7f, 0xf8, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x3f, 0xfc, 0x7f, -   0xfc, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x7f, 0xfc, 0x7f, 0xfe, 0xff, -   0xff, 0x0f, 0xf8, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xff, 0x1f, -   0xf8, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf8, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, -   0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, -   0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x3f, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, -   0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfc, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0x1f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x1f, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, -   0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x07, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, -   0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, -   0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xfc, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xf8, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x03, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, -   0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, -   0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, -   0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/king_outline.bitmap b/gnu/games/chess/Xchess/king_outline.bitmap deleted file mode 100644 index 173651c28efa..000000000000 --- a/gnu/games/chess/Xchess/king_outline.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define king_outline_width 80 -#define king_outline_height 80 -static char king_outline_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x1c, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x70, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x3c, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x0c, 0x60, 0x00, 0xfc, 0x1f, 0x00, -   0x00, 0x0e, 0x70, 0x00, 0x84, 0x43, 0x00, 0x07, 0x70, 0x00, 0x00, 0x03, -   0xc0, 0x00, 0xc4, 0x46, 0x80, 0x01, 0xc0, 0x00, 0x80, 0x01, 0x80, 0x03, -   0x44, 0x44, 0xe0, 0x00, 0x80, 0x01, 0xc0, 0x00, 0x00, 0x0e, 0x44, 0x44, -   0x30, 0x00, 0x00, 0x03, 0x60, 0x00, 0x00, 0x18, 0x44, 0x44, 0x18, 0x00, -   0x07, 0x06, 0x20, 0xe0, 0x3f, 0x30, 0xc4, 0x46, 0x0c, 0xf8, 0x1d, 0x04, -   0x30, 0x30, 0x60, 0x60, 0x8c, 0x63, 0x06, 0x0c, 0x30, 0x0c, 0x10, 0x18, -   0xc0, 0xc1, 0x08, 0x20, 0x82, 0x03, 0x20, 0x0c, 0x10, 0x0c, 0x00, 0x83, -   0x09, 0x20, 0xc3, 0x00, 0x60, 0x08, 0x18, 0x04, 0x00, 0x02, 0x8b, 0xa3, -   0x41, 0x00, 0x40, 0x18, 0x08, 0x06, 0x00, 0x06, 0x7a, 0xb6, 0x20, 0x00, -   0xc0, 0x10, 0x08, 0x02, 0x00, 0x0c, 0x3e, 0x7c, 0x30, 0x00, 0x80, 0x10, -   0x08, 0x02, 0x00, 0x18, 0x18, 0x18, 0x10, 0x00, 0x80, 0x10, 0x0c, 0x02, -   0x00, 0x30, 0x00, 0x00, 0x18, 0xc0, 0x83, 0x30, 0x04, 0xc3, 0x03, 0x20, -   0x00, 0x01, 0x0c, 0xc2, 0x83, 0x20, 0x04, 0xc1, 0x03, 0x61, 0x80, 0x03, -   0x06, 0xc6, 0x83, 0x20, 0x04, 0xc1, 0x83, 0x41, 0xc0, 0x07, 0x06, 0xc4, -   0x83, 0x20, 0x04, 0xc1, 0x87, 0xc0, 0x80, 0x03, 0x03, 0xc4, 0x80, 0x20, -   0x0c, 0x01, 0x84, 0x80, 0x00, 0x01, 0x01, 0x64, 0x80, 0x30, 0x08, 0x01, -   0x44, 0x80, 0x01, 0x80, 0x01, 0x24, 0x86, 0x10, 0x08, 0x01, 0x4c, 0x00, -   0x01, 0x80, 0x00, 0x34, 0x83, 0x10, 0x08, 0x61, 0x48, 0x00, 0x01, 0x80, -   0x00, 0xd4, 0xc1, 0x10, 0x08, 0xc1, 0x59, 0x00, 0x03, 0x80, 0x00, 0x5c, -   0x40, 0x10, 0x08, 0x01, 0x57, 0x00, 0x02, 0xc1, 0x00, 0x2c, 0x40, 0x10, -   0x18, 0x02, 0x7c, 0x00, 0x82, 0x43, 0x00, 0x3c, 0x40, 0x18, 0x10, 0x02, -   0x70, 0x00, 0xc6, 0x47, 0x00, 0x1c, 0x40, 0x18, 0x10, 0x02, 0x60, 0x00, -   0x84, 0x43, 0x00, 0x0e, 0x60, 0x08, 0x10, 0x06, 0x40, 0x00, 0x04, 0x41, -   0x00, 0x02, 0x20, 0x08, 0x10, 0x04, 0xc0, 0x00, 0x0c, 0x60, 0x00, 0x02, -   0x20, 0x0c, 0x30, 0x0c, 0x80, 0x00, 0x08, 0x20, 0x00, 0x03, 0x20, 0x0c, -   0x20, 0x08, 0x80, 0x01, 0x08, 0x20, 0x00, 0x01, 0x20, 0x04, 0x20, 0x08, -   0x00, 0x01, 0x08, 0x20, 0x80, 0x01, 0x30, 0x04, 0x60, 0x18, 0x00, 0x01, -   0x08, 0x20, 0x80, 0x00, 0x10, 0x06, 0x40, 0x10, 0x00, 0x03, 0x10, 0x11, -   0x80, 0x00, 0x18, 0x02, 0xc0, 0x30, 0x00, 0x02, 0x90, 0x13, 0xc0, 0x00, -   0x08, 0x03, 0x80, 0x20, 0x00, 0x06, 0x10, 0x11, 0x40, 0x00, 0x04, 0x01, -   0x80, 0x61, 0x00, 0x04, 0x10, 0x10, 0x60, 0x00, 0x84, 0x01, 0x00, 0x41, -   0x00, 0x04, 0x10, 0x10, 0x20, 0x00, 0xc6, 0x00, 0x00, 0x83, 0x00, 0x0c, -   0x10, 0x10, 0x20, 0x00, 0x41, 0x00, 0x00, 0x82, 0x01, 0x00, 0x10, 0x10, -   0x00, 0x80, 0x61, 0x00, 0x00, 0x06, 0x01, 0x00, 0x10, 0x10, 0x00, 0x80, -   0x30, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x10, 0x10, 0x00, 0xc0, 0x10, 0x00, -   0x00, 0x18, 0x02, 0xff, 0x1f, 0xf0, 0xff, 0x60, 0x18, 0x00, 0x00, 0x30, -   0xfe, 0x01, 0x00, 0x00, 0x80, 0x3f, 0x0c, 0x00, 0x00, 0x20, 0x00, 0x40, -   0x08, 0x21, 0x04, 0x00, 0x06, 0x00, 0x00, 0xc0, 0x00, 0xe2, 0x9c, 0x73, -   0x8e, 0x00, 0x03, 0x00, 0x00, 0x80, 0x11, 0x47, 0x08, 0x21, 0xc4, 0x11, -   0x01, 0x00, 0x00, 0x00, 0x3b, 0x02, 0x00, 0x00, 0x80, 0xb8, 0x00, 0x00, -   0x00, 0x00, 0x12, 0x00, 0xff, 0xff, 0x03, 0x90, 0x00, 0x00, 0x00, 0x00, -   0x02, 0xfc, 0x01, 0x00, 0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x07, -   0x80, 0x03, 0x80, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xe0, 0x0f, -   0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0xf8, 0x3f, 0x00, 0x5c, -   0x00, 0x00, 0x00, 0x00, 0xfa, 0x00, 0xe0, 0x0f, 0x00, 0x5f, 0x00, 0x00, -   0x00, 0x00, 0xfa, 0x03, 0x80, 0x03, 0xc0, 0x5f, 0x00, 0x00, 0x00, 0x00, -   0xfa, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, -   0xff, 0xff, 0x03, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x02, 0xfc, 0x01, 0x00, -   0xfe, 0x40, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x07, 0x00, 0x00, 0x80, 0x5f, -   0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, -   0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/king_small.bitmap b/gnu/games/chess/Xchess/king_small.bitmap deleted file mode 100644 index 38bb2b7e88b8..000000000000 --- a/gnu/games/chess/Xchess/king_small.bitmap +++ /dev/null @@ -1,15 +0,0 @@ - -#define king_small_width 32 -#define king_small_height 32 -static char king_small_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0x00, 0x00, 0x80, 0x9f, 0x00, 0x00, 0x70, 0x20, 0x00, -   0x00, 0x0c, 0x40, 0x00, 0x00, 0x02, 0x80, 0x01, 0x80, 0x01, 0x00, 0x03, -   0x40, 0x00, 0x00, 0x06, 0x40, 0x60, 0x30, 0x08, 0x20, 0x60, 0x30, 0x10, -   0x20, 0x00, 0x00, 0x60, 0x20, 0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x80, -   0x10, 0x00, 0x02, 0x80, 0x10, 0x00, 0x01, 0x80, 0x10, 0x01, 0x01, 0x80, -   0x10, 0x03, 0x1f, 0x84, 0x10, 0x02, 0x00, 0x84, 0x10, 0x06, 0x00, 0x86, -   0x20, 0x1c, 0x00, 0x42, 0x20, 0xf0, 0xff, 0x43, 0x20, 0x00, 0x00, 0x40, -   0x40, 0x00, 0x00, 0x20, 0x40, 0x00, 0x00, 0x20, 0x80, 0x01, 0x00, 0x18, -   0x00, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/king_small_outline.bitmap b/gnu/games/chess/Xchess/king_small_outline.bitmap deleted file mode 100644 index 18d569e9d7b9..000000000000 --- a/gnu/games/chess/Xchess/king_small_outline.bitmap +++ /dev/null @@ -1,15 +0,0 @@ - -#define king_small_outline_width 32 -#define king_small_outline_height 32 -static char king_small_outline_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x90, 0x00, 0x06, 0x10, 0xb1, 0x00, -   0x22, 0x12, 0xe1, 0x00, 0x24, 0x92, 0x9f, 0x00, 0x40, 0x72, 0xa0, 0x50, -   0x04, 0x0e, 0x40, 0x50, 0x40, 0x02, 0x80, 0x71, 0xc8, 0x01, 0x00, 0x73, -   0xd8, 0x00, 0x00, 0x46, 0xd8, 0x60, 0x30, 0x08, 0xa0, 0x60, 0x30, 0x10, -   0x20, 0x00, 0x00, 0x60, 0x20, 0x00, 0x00, 0x40, 0x10, 0x00, 0x00, 0x80, -   0x10, 0x00, 0x02, 0x80, 0x10, 0x00, 0x01, 0x80, 0x10, 0x01, 0x01, 0x80, -   0x10, 0x03, 0x1f, 0x84, 0x10, 0x02, 0x00, 0x84, 0x10, 0x06, 0x00, 0x86, -   0x20, 0x1c, 0x00, 0x42, 0x20, 0xf0, 0xff, 0x43, 0x20, 0x00, 0x00, 0x40, -   0x40, 0x00, 0x00, 0x20, 0x40, 0x00, 0x00, 0x20, 0x80, 0x01, 0x00, 0x18, -   0x00, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/knight.bitmap b/gnu/games/chess/Xchess/knight.bitmap deleted file mode 100644 index c5b1de1997f4..000000000000 --- a/gnu/games/chess/Xchess/knight.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define knight_width 80 -#define knight_height 80 -static char knight_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x18, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x38, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, -   0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xe0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xe0, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, -   0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xbf, 0xff, -   0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0xfe, 0x0f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xf8, 0xff, 0x01, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0x0f, 0xfc, 0xe3, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xf0, 0xe1, 0xf3, 0xcf, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfd, -   0xff, 0x1f, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0xfe, 0x7f, -   0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0xfe, 0xff, 0xfc, 0x07, -   0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xf1, 0x7f, 0x00, 0x00, -   0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xe7, 0x1f, 0x00, 0x00, 0x00, 0xe0, -   0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0x03, 0x00, 0x00, 0xf0, 0xff, 0xff, -   0xff, 0xff, 0x9f, 0x3f, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, -   0x3f, 0xff, 0x07, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, -   0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfc, 0x07, 0x00, -   0x00, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xfd, 0x01, 0x00, 0x00, 0xff, -   0xff, 0xff, 0xff, 0x3f, 0xff, 0xfb, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xff, -   0xff, 0xbf, 0xff, 0xf3, 0x03, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0x9f, -   0xff, 0xf7, 0x3f, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xef, -   0x07, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0xf3, 0xff, 0xcf, 0x7f, 0x00, -   0xe0, 0xff, 0xff, 0xff, 0x1f, 0xfd, 0xff, 0xdf, 0x07, 0x00, 0xe0, 0xff, -   0xff, 0xff, 0x83, 0xff, 0xf3, 0x9f, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x7f, -   0x80, 0xff, 0xf9, 0xbf, 0x0f, 0x00, 0xf0, 0xff, 0xff, 0x00, 0x80, 0x7f, -   0xfc, 0x7f, 0xff, 0x01, 0xf8, 0x3f, 0x7f, 0x00, 0x80, 0x81, 0xff, 0x7f, -   0x1e, 0x00, 0x18, 0x9f, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0x7f, 0xfe, 0x07, -   0x98, 0x8f, 0x1f, 0x00, 0xc0, 0xff, 0xcf, 0x7f, 0x3e, 0x00, 0xf8, 0x87, -   0x0f, 0x00, 0xe0, 0xff, 0xe3, 0xff, 0xfe, 0x07, 0xf0, 0xc3, 0x07, 0x00, -   0xf0, 0x1f, 0xfc, 0xff, 0x3c, 0x00, 0xf0, 0xe1, 0x03, 0x00, 0xf0, 0xc0, -   0xff, 0xff, 0xfc, 0x0f, 0x60, 0xe0, 0x01, 0x00, 0xf8, 0xff, 0xff, 0xff, -   0x7c, 0x00, 0x00, 0xf0, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xfc, 0x0f, -   0x00, 0x70, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x7c, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xf9, 0x0f, 0x00, 0x00, 0x00, 0x00, -   0xff, 0xff, 0xff, 0xff, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, -   0xff, 0xff, 0xf9, 0x0f, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, -   0xf9, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xf9, 0x1f, -   0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xf1, 0x01, 0x00, 0x00, -   0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xf1, 0x3f, 0x00, 0x00, 0x00, 0xf0, -   0xff, 0xff, 0xff, 0xff, 0xf3, 0x01, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, -   0xff, 0xff, 0xf3, 0x3f, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, -   0xf3, 0x01, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x3f, -   0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x01, 0x00, 0x00, -   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x3f, 0x00, 0x00, 0x00, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xf3, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xf3, 0x3f, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xf3, 0x01, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x3f, -   0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x01, 0x00, 0x00, -   0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x3f, 0x00, 0x00, 0xe0, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xf3, 0x01, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xf3, 0x3f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xf3, 0x01, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x3f, -   0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x01, 0x00, 0x00, -   0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x3f, 0x00, 0x00, 0xfc, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xf3, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xf3, 0x3f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xf3, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x3f, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/knight_mask.bitmap b/gnu/games/chess/Xchess/knight_mask.bitmap deleted file mode 100644 index 97d288c60554..000000000000 --- a/gnu/games/chess/Xchess/knight_mask.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define knight_mask_width 80 -#define knight_mask_height 80 -static char knight_mask_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x0f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xbe, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, -   0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x01, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x7f, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xf0, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, -   0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, -   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, -   0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, -   0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, -   0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, -   0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, -   0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xf8, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xfc, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x0f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x0f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, -   0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x80, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xc0, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x7f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, -   0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xf8, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xf8, 0xff, 0xff, 0xff, -   0xc7, 0xff, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, 0xff, 0xff, 0xc1, 0xff, -   0xff, 0xff, 0xff, 0x03, 0xfc, 0xff, 0xff, 0x01, 0xc0, 0xff, 0xff, 0xff, -   0xff, 0x0f, 0xfc, 0xff, 0xff, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x0f, -   0xfc, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xfc, 0xdf, -   0x3f, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xfc, 0xef, 0x1f, 0x00, -   0xf8, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf8, 0xf7, 0x0f, 0x00, 0xfc, 0xff, -   0xff, 0xff, 0xff, 0x1f, 0xf8, 0xfb, 0x07, 0x00, 0xfc, 0xff, 0xff, 0xff, -   0xff, 0x1f, 0xf0, 0xf9, 0x03, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x1f, -   0x00, 0xf8, 0x01, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xf8, -   0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x80, -   0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, -   0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x1f, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, -   0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, -   0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xfc, -   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, -   0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, -   0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, -   0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xc0, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, -   0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, -   0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf8, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, -   0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, -   0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/knight_outline.bitmap b/gnu/games/chess/Xchess/knight_outline.bitmap deleted file mode 100644 index a1ab938b773f..000000000000 --- a/gnu/games/chess/Xchess/knight_outline.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define knight_outline_width 80 -#define knight_outline_height 80 -static char knight_outline_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x18, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x38, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, -   0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf9, 0x01, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x0f, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x20, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x20, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, -   0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x80, -   0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x08, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0xf0, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x30, 0x58, 0x07, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x18, 0x4c, -   0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x78, 0x07, 0x00, -   0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x23, 0xe0, 0x01, 0x00, 0x00, 0x04, -   0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, -   0x00, 0xc0, 0x08, 0x00, 0x00, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x60, -   0x04, 0x00, 0x00, 0x40, 0x00, 0xf0, 0x03, 0x00, 0x00, 0x30, 0x02, 0x00, -   0x00, 0x60, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, 0x20, -   0x00, 0xe0, 0x07, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x80, -   0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x20, 0x00, 0x80, 0x07, 0x00, -   0x00, 0x26, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x00, 0x00, 0x13, -   0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x1f, 0x00, 0x00, 0x09, 0x40, 0x00, -   0x00, 0x18, 0x08, 0x00, 0x02, 0x00, 0x80, 0x05, 0xc0, 0x00, 0x00, 0x0c, -   0x0c, 0x00, 0x3e, 0x00, 0x80, 0x00, 0x80, 0x00, 0xc0, 0x03, 0x06, 0x00, -   0x04, 0x00, 0xc0, 0x00, 0x80, 0x01, 0x70, 0x01, 0xc3, 0x00, 0x7c, 0x00, -   0x60, 0x00, 0x00, 0x03, 0x1e, 0x81, 0x41, 0x00, 0x04, 0x00, 0x20, 0x00, -   0x00, 0xce, 0x83, 0x61, 0x60, 0x00, 0xfc, 0x00, 0x30, 0x00, 0x80, 0x7f, -   0x80, 0x1c, 0x30, 0x00, 0x08, 0x00, 0x10, 0xe0, 0xc1, 0x00, 0x80, 0x07, -   0x10, 0x00, 0xf8, 0x01, 0x18, 0x30, 0x61, 0x00, 0x80, 0x00, 0x08, 0x00, -   0x10, 0x00, 0x08, 0x98, 0x31, 0x00, 0xc0, 0x00, 0x0c, 0x00, 0xf0, 0x07, -   0x08, 0x8c, 0x18, 0x00, 0x40, 0x00, 0x03, 0x00, 0x20, 0x00, 0x18, 0x86, -   0x0c, 0x00, 0x60, 0xc0, 0x01, 0x00, 0xe0, 0x07, 0x10, 0xc3, 0x06, 0x00, -   0x30, 0x30, 0x00, 0x00, 0x20, 0x00, 0xf0, 0x61, 0x02, 0x00, 0x10, 0x1e, -   0x00, 0x00, 0xe0, 0x0f, 0x60, 0x30, 0x02, 0x00, 0x98, 0x03, 0x00, 0x00, -   0x40, 0x00, 0x00, 0x10, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xc0, 0x0f, -   0x00, 0xb0, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xc0, -   0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, -   0x03, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, -   0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, -   0x80, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, -   0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, -   0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x30, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, -   0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, -   0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x01, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, -   0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, -   0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x20, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x01, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, -   0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, -   0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x04, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x01, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/knight_small.bitmap b/gnu/games/chess/Xchess/knight_small.bitmap deleted file mode 100644 index 77c74517f0f6..000000000000 --- a/gnu/games/chess/Xchess/knight_small.bitmap +++ /dev/null @@ -1,15 +0,0 @@ - -#define knight_small_width 32 -#define knight_small_height 32 -static char knight_small_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0xee, 0x7f, 0x02, -   0x00, 0xfe, 0x7f, 0x01, 0x00, 0xff, 0xff, 0x04, 0x00, 0xff, 0xff, 0x02, -   0x80, 0xff, 0xff, 0x09, 0xc0, 0xfc, 0xff, 0x07, 0xe0, 0xfc, 0xff, 0x11, -   0xe0, 0xff, 0xff, 0x0d, 0xe0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x3f, -   0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x7f, 0xf8, 0xff, 0xff, 0x07, -   0xfc, 0xc7, 0xff, 0x7f, 0xfe, 0xc1, 0xff, 0x07, 0xfa, 0xc1, 0xff, 0x7f, -   0xce, 0xc0, 0xff, 0x07, 0x6c, 0xc0, 0xff, 0x7f, 0x28, 0xe0, 0xff, 0x07, -   0x00, 0xe0, 0xff, 0x7f, 0x00, 0xe0, 0xff, 0x0f, 0x00, 0xf0, 0xff, 0x7f, -   0x00, 0xf0, 0xff, 0x0f, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0xf8, 0xff, 0x0f, -   0x00, 0xf8, 0xff, 0x7f, 0x00, 0xfc, 0xff, 0x0f, 0x00, 0xff, 0xff, 0x7f, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/knight_small_outline.bitmap b/gnu/games/chess/Xchess/knight_small_outline.bitmap deleted file mode 100644 index c0e738c6db4c..000000000000 --- a/gnu/games/chess/Xchess/knight_small_outline.bitmap +++ /dev/null @@ -1,15 +0,0 @@ - -#define knight_small_outline_width 32 -#define knight_small_outline_height 32 -static char knight_small_outline_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x00, 0x00, 0xee, 0x7f, 0x02, -   0x00, 0x3a, 0x40, 0x01, 0x00, 0x03, 0xc0, 0x04, 0x00, 0x01, 0x80, 0x02, -   0x80, 0x01, 0x80, 0x09, 0xc0, 0x0c, 0x00, 0x07, 0x60, 0x0c, 0x00, 0x11, -   0x20, 0x00, 0x00, 0x0d, 0x20, 0x00, 0x00, 0x03, 0x30, 0x00, 0x00, 0x3e, -   0x10, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x7e, 0x18, 0x7c, 0x00, 0x04, -   0x0c, 0x47, 0x00, 0x7c, 0x06, 0x41, 0x00, 0x04, 0xf2, 0x41, 0x00, 0x7c, -   0xde, 0x40, 0x00, 0x04, 0x6c, 0x40, 0x00, 0x7c, 0x28, 0x60, 0x00, 0x04, -   0x00, 0x20, 0x00, 0x7c, 0x00, 0x20, 0x00, 0x08, 0x00, 0x30, 0x00, 0x78, -   0x00, 0x10, 0x00, 0x08, 0x00, 0x10, 0x00, 0x78, 0x00, 0x18, 0x00, 0x08, -   0x00, 0x08, 0x00, 0x78, 0x00, 0x0c, 0x00, 0x08, 0x00, 0xff, 0xff, 0x7f, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/message.c b/gnu/games/chess/Xchess/message.c deleted file mode 100644 index 26df73974c26..000000000000 --- a/gnu/games/chess/Xchess/message.c +++ /dev/null @@ -1,101 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:14 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/message.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - * Do stuff with the message window.  Font 0 is the normal font, font 1 - * is large, and font 2 is normal red. - */ - -#include "xchess.h" - -#define MESSAGE_HEADER	"\n1  XChess Messages0\n" - -void -message_init(win) -	windata *win; -{ -	TxtGrab(win->display, win->messagewin, "xchess", win->medium, -			win->textback.pixel, win->textcolor.pixel, -				win->cursorcolor.pixel); -	TxtAddFont(win->display, win->messagewin, 1, win->large, win->textcolor.pixel); -	TxtAddFont(win->display, win->messagewin, 2, win->medium, win->errortext.pixel); -	TxtAddFont(win->display, win->messagewin, 3, win->medium, win->playertext.pixel); - -	TxtWriteStr(win->display, win->messagewin, MESSAGE_HEADER); -	return; -} - -void -message_add(win, string, err) -	windata *win; -	char *string; -	bool err; -{ -	if (err) { -		TxtWriteStr(win->display, win->messagewin, "2"); -		TxtWriteStr(win->display, win->messagewin, string); -		TxtWriteStr(win->display, win->messagewin, "0"); -		XBell(win->display, 50); -	} else -		TxtWriteStr(win->display, win->messagewin, string); - -	XSync(win->display, 0); -	return; -} - -void -message_send(win, event) -	windata *win; -	XEvent *event; -{ -	XKeyEvent *ev = &event->xkey; -	KeySym keysym; -	windata *ow = (win == win1) ? win2 : win1; -	char buf[BSIZE], *s; -	int i; - -	i = XLookupString(ev, buf, sizeof(buf) - 1, &keysym, &s); -	buf[i] = '\0'; -	for (s = buf; *s; s++) -		if (*s == '\r') -			*s = '\n'; -		else if (*s == '\177') -			*s = ''; - -	TxtWriteStr(win->display, win->messagewin, "3"); -	TxtWriteStr(win->display, win->messagewin, buf); -	TxtWriteStr(win->display, win->messagewin, "0"); -	XSync(win->display, 0); -	if (ow) { -		TxtWriteStr(ow->display, ow->messagewin, "3"); -		TxtWriteStr(ow->display, ow->messagewin, buf); -		TxtWriteStr(ow->display, ow->messagewin, "0"); -		XSync(ow->display, 0); -	} -	return; -} - diff --git a/gnu/games/chess/Xchess/parse.c b/gnu/games/chess/Xchess/parse.c deleted file mode 100644 index 2dd94edc02d2..000000000000 --- a/gnu/games/chess/Xchess/parse.c +++ /dev/null @@ -1,386 +0,0 @@ -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:06 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/parse.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - * Parse a sequence of chess moves... - */ - -#include "xchess.h" - -bool loading_flag = false; -bool loading_paused = false; - -static char *line; - -/* Load a record file in.  This returns a number of things -- the board, the - * list of moves, and whose turn it is. - */ - -void -load_game(file) -	char *file; -{ -	FILE *fp; -	char buf[BSIZE]; -	bool eflag; -	move *m; -	board *tmpboard = alloc(board); - -	if (eq(file, "xchess.game") && saveflag) { -		message_add(win1, -			"Oops, I just overwrote the\nfile xchess.game...\n", -				true); -		message_add(win1, "I hope you had another copy.\n", true); -		return; -	} -	if (!(fp = fopen(file, "r"))) { -		perror(file); -		return; -	} - -	/* Get a few lines... */ -	fgets(buf, BSIZE, fp); -	message_add(win1, buf, false); -	if (!oneboard) -		message_add(win2, buf, false); - -	fgets(buf, BSIZE, fp); -	message_add(win1, buf, false); -	if (!oneboard) -		message_add(win2, buf, false); - -	fgets(buf, BSIZE, fp); -	if (eq(buf, "\tenglish\n")) -		eflag = true; -	else if (eq(buf, "\talgebraic\n")) -		eflag = false; -	else { -		fprintf(stderr, "Can't decide whether this is english...\n"); -		return; -	} - -	board_init(tmpboard); -	line = NULL; -	m = parse_file(fp, tmpboard, eflag); -	tfree(tmpboard); - -	/* Now apply these moves to the board we were given... */ -	loading_flag = true; -	while (m) { -		if (!quickflag) -			XSync(win1->display, 0); -		win_process(true); -		if (!quickflag) -			sleep(1); -		if (!loading_paused) { -			prog_move(m); -			m = m->next; -		} -	} -	loading_flag = false; -	if (line) -		message_add(win1, line, false); - -	while (fgets(buf, BSIZE, fp)) -		message_add(win1, buf, false); - -	fclose(fp); - -	return; -} - -/* Given a starting position (usually the beginning board configuration), - * read in a file of moves. - */ - -move * -parse_file(fp, b, english) -	FILE *fp; -	board *b; -	bool english; -{ -	move *mvs = NULL, *end = NULL; -	char buf[BSIZE], *s, *t; - -	while (fgets(buf, BSIZE, fp)) { -		if (*buf == '#') -			continue; -		s = buf; - -		/* The move number... */ -		if (!(t = gettok(&s))) -			break; -		if (!isdigit(*t)) { -			line = copy(buf); -			break; -		} - -		if (!(t = gettok(&s))) -			break; -		if (end) -			end = end->next = (english ? parse_move(b, t, WHITE) : -					parse_imove(b, t, WHITE)); -		else -			mvs = end = (english ? parse_move(b, t, WHITE) : -					parse_imove(b, t, WHITE)); -		if (!end) { -			fprintf(stderr, "Can't parse %s\n", buf); -			return (NULL); -		} -		board_move(b, end); - -		if (!(t = gettok(&s))) -			break; -		if (end) -			end = end->next = (english ? parse_move(b, t, BLACK) : -					parse_imove(b, t, BLACK)); -		else -			mvs = end = (english ? parse_move(b, t, BLACK) : -					parse_imove(b, t, BLACK)); -		if (!end) { -			fprintf(stderr, "Can't parse %s\n", buf); -			return (NULL); -		} -		board_move(b, end); -	} - -	return (mvs); -} - -/* Parse a move.  The move format accepted is as follows - - *	move:		spec-spec - *	capture:	specxspec - *	kcastle:	2 o's - *	qcastle:	3 o's - * A spec is either piece/pos, piece, or just pos.  A pos consists of a column - * name followed by a row number.  If the column name is kr, kn, kb, k, q, - * qb, qn, or qr, then the row number is according to the english system, - * or if it is a-h then it is according to the international system. - * - *** As of now the spec must include the position. - */ - -move * -parse_move(b, str, w) -	board *b; -	char *str; -	color w; -{ -	move *m = alloc(move); -	char *s; -	char spec1[16], spec2[16]; -	int i, j; - -if (debug) fprintf(stderr, "parsing %s\n", str); - -	/* Check for castles. */ -	for (s = str, i = 0; *s; s++) -		if ((*s == 'o') || (*s == 'O')) -			i++; -	if (i == 2) { -		m->type = KCASTLE; -		m->piece.type = KING; -		m->piece.color = w; -		return (m); -	} else if (i == 3) { -		m->type = QCASTLE; -		m->piece.type = KING; -		m->piece.color = w; -		return (m); -	} -	if (index(str, '-')) -		m->type = MOVE; -	else if (index(str, 'x')) -		m->type = CAPTURE; -	else -		return (NULL); -	for (i = 0; str[i]; i++) -		if ((str[i] == 'x') || (str[i] == '-')) -			break; -		else -			spec1[i] = str[i]; -	spec1[i] = '\0'; -	for (i++, j = 0; str[i]; i++, j++) -		if ((str[i] == 'x') || (str[i] == '-')) -			break; -		else -			spec2[j] = str[i]; -	spec2[j] = '\0'; - -	/* Now decode the specifications. */ -	s = spec1; -	switch (*s) { -	    case 'p': case 'P': -		m->piece.type = PAWN; break; -	    case 'r': case 'R': -		m->piece.type = ROOK; break; -	    case 'n': case 'N': -		m->piece.type = KNIGHT; break; -	    case 'b': case 'B': -		m->piece.type = BISHOP; break; -	    case 'q': case 'Q': -		m->piece.type = QUEEN; break; -	    case 'k': case 'K': -		m->piece.type = KING; break; -	    default: -		return (NULL); -	} -	m->piece.color = w; -	s += 2; - -	/* Now get the {q,k}{,b,n,r}n string... */ -	if ((s[0] == 'q') && (s[1] == 'r')) -		m->fromx = 0, s += 2; -	else if ((s[0] == 'q') && (s[1] == 'n')) -		m->fromx = 1, s += 2; -	else if ((s[0] == 'q') && (s[1] == 'b')) -		m->fromx = 2, s += 2; -	else if ((s[0] == 'q') && isdigit(s[1])) -		m->fromx = 3, s += 1; -	else if ((s[0] == 'k') && isdigit(s[1])) -		m->fromx = 4, s += 1; -	else if ((s[0] == 'k') && (s[1] == 'b')) -		m->fromx = 5, s += 2; -	else if ((s[0] == 'k') && (s[1] == 'n')) -		m->fromx = 6, s += 2; -	else if ((s[0] == 'k') && (s[1] == 'r')) -		m->fromx = 7, s += 2; -	m->fromy = ((w == WHITE) ? (SIZE - atoi(s)) : (atoi(s) - 1)); - -	if ((b->square[m->fromy][m->fromx].color != w) || -		     (b->square[m->fromy][m->fromx].type != m->piece.type)) { -		fprintf(stderr, "Error: bad stuff\n"); -		return (NULL); -	} - -	s = spec2; -	if (m->type == CAPTURE) { -		switch (*s) { -		    case 'p': case 'P': -			m->taken.type = PAWN; break; -		    case 'r': case 'R': -			m->taken.type = ROOK; break; -		    case 'n': case 'N': -			m->taken.type = KNIGHT; break; -		    case 'b': case 'B': -			m->taken.type = BISHOP; break; -		    case 'q': case 'Q': -			m->taken.type = QUEEN; break; -		    case 'k': case 'K': -			m->taken.type = KING; break; -		    default: -			return (NULL); -		} -		m->taken.color = ((w == WHITE) ? BLACK : WHITE); -		s += 2; -	} - -	/* Now get the {q,k}{,b,n,r}n string... */ -	if ((s[0] == 'q') && (s[1] == 'r')) -		m->tox = 0, s += 2; -	else if ((s[0] == 'q') && (s[1] == 'n')) -		m->tox = 1, s += 2; -	else if ((s[0] == 'q') && (s[1] == 'b')) -		m->tox = 2, s += 2; -	else if ((s[0] == 'q') && isdigit(s[1])) -		m->tox = 3, s += 1; -	else if ((s[0] == 'k') && isdigit(s[1])) -		m->tox = 4, s += 1; -	else if ((s[0] == 'k') && (s[1] == 'b')) -		m->tox = 5, s += 2; -	else if ((s[0] == 'k') && (s[1] == 'n')) -		m->tox = 6, s += 2; -	else if ((s[0] == 'k') && (s[1] == 'r')) -		m->tox = 7, s += 2; -	m->toy = ((w == WHITE) ? (SIZE - atoi(s)) : (atoi(s) - 1)); - -	if ((m->type == CAPTURE) && ((b->square[m->toy][m->tox].color != -			m->taken.color) || (b->square[m->toy][m->tox].type != -			m->taken.type))) { -		fprintf(stderr, "Error: bad stuff\n"); -		return (NULL); -	} - -	return (m); -} - -/* Parse an algebraic notation move.  This is a lot easier... */ - -move * -parse_imove(b, buf, w) -	board *b; -	char *buf; -	color w; -{ -	char *s; -	move *m = alloc(move); -	int n; - -if (debug) fprintf(stderr, "(alg) parsing %s\n", buf); - -	for (s = buf, n = 0; *s; s++) -		if ((*s == 'o') || (*s == 'O')) -			n++; -	s = buf; - -	if (n == 2) -		m->type = KCASTLE; -	else if (n == 3) -		m->type = QCASTLE; -	else { -		m->fromx = *s++ - 'a'; -		m->fromy = SIZE - (*s++ - '0'); -		m->tox = *s++ - 'a'; -		m->toy = SIZE - (*s++ - '0'); -		m->piece = b->square[m->fromy][m->fromx]; -		m->taken = b->square[m->toy][m->tox]; -		if (m->taken.color == NONE) -		    m->type = MOVE; -		else -		    m->type = CAPTURE; -		/* for pawns we must account for en passant */ -		if (m->piece.type == PAWN) { -		    if (m->type == MOVE && m->fromx != m->tox) { -			m->enpassant = 1; -			m->type = CAPTURE; -		    } -		} -	    } - -	if (m->piece.color != w) { -		fprintf(stderr, "Error: parse_imove: piece of wrong color!\n"); -		return (NULL); -	} -	if ((m->piece.type == KING) && (m->fromy == m->toy) && (m->fromx == 4) -			&& (m->tox == 6)) -		m->type = KCASTLE; -	else if ((m->piece.type == KING) && (m->fromy == m->toy) && -			(m->fromx == 4) && (m->tox == 2)) -		m->type = QCASTLE; - -	return (m); -} - diff --git a/gnu/games/chess/Xchess/pawn.bitmap b/gnu/games/chess/Xchess/pawn.bitmap deleted file mode 100644 index 5c3ff76dbf68..000000000000 --- a/gnu/games/chess/Xchess/pawn.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define pawn_width 80 -#define pawn_height 80 -static char pawn_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x80, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xf8, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xf8, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, -   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x01, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, -   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, -   0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, -   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x01, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x01, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xf8, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xf8, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, -   0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x07, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x07, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, -   0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x3f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, -   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, -   0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x01, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xf8, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, -   0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, -   0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x03, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xf0, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, -   0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, -   0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xc0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, -   0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, -   0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x3f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xfc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, -   0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, -   0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x03, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, -   0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, -   0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xfe, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x1f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/pawn_mask.bitmap b/gnu/games/chess/Xchess/pawn_mask.bitmap deleted file mode 100644 index 724875c59972..000000000000 --- a/gnu/games/chess/Xchess/pawn_mask.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define pawn_mask_width 80 -#define pawn_mask_height 80 -static char pawn_mask_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xf0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, -   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x01, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, -   0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, -   0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x07, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, -   0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, -   0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x03, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x07, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xfc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xfe, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, -   0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x80, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, -   0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, -   0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xf0, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, -   0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, -   0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, -   0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, -   0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, -   0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, -   0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x03, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, -   0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xf0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, -   0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, -   0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x7f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, -   0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x0f, -   0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xf0, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x0f, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, -   0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x80, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x3f, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x3f, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, -   0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/pawn_outline.bitmap b/gnu/games/chess/Xchess/pawn_outline.bitmap deleted file mode 100644 index 0c4a3a13229a..000000000000 --- a/gnu/games/chess/Xchess/pawn_outline.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define pawn_outline_width 80 -#define pawn_outline_height 80 -static char pawn_outline_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x80, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x70, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xc0, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x80, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x18, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, -   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x80, 0x01, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x80, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, -   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x03, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0xe0, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, -   0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, -   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, -   0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x03, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, -   0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x20, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, -   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, -   0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, -   0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, -   0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, -   0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, -   0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, -   0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, -   0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x30, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x18, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x06, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, -   0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0x00, 0xff, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x78, 0xc0, 0x81, 0x07, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x07, 0xc0, 0x7f, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, -   0x80, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, -   0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, -   0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, -   0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, -   0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x18, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/pawn_small.bitmap b/gnu/games/chess/Xchess/pawn_small.bitmap deleted file mode 100644 index 88ff7bbcd16f..000000000000 --- a/gnu/games/chess/Xchess/pawn_small.bitmap +++ /dev/null @@ -1,15 +0,0 @@ - -#define pawn_small_width 32 -#define pawn_small_height 32 -static char pawn_small_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xf0, 0x0f, 0x00, -   0x00, 0xf8, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, -   0x00, 0xf8, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0xf0, 0x0f, 0x00, -   0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x80, 0xff, 0xff, 0x01, -   0x80, 0xff, 0xff, 0x01, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, -   0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, -   0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, -   0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, -   0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0xfc, 0x3f, 0x00, -   0x00, 0xff, 0xff, 0x00, 0xe0, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0x0f, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/pawn_small_outline.bitmap b/gnu/games/chess/Xchess/pawn_small_outline.bitmap deleted file mode 100644 index e860f43f3d50..000000000000 --- a/gnu/games/chess/Xchess/pawn_small_outline.bitmap +++ /dev/null @@ -1,15 +0,0 @@ - -#define pawn_small_outline_width 32 -#define pawn_small_outline_height 32 -static char pawn_small_outline_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x30, 0x0c, 0x00, -   0x00, 0x18, 0x18, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, -   0x00, 0x08, 0x10, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x30, 0x0c, 0x00, -   0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, 0x80, 0x3f, 0xfc, 0x01, -   0x80, 0x3f, 0xfc, 0x01, 0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, -   0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, -   0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, -   0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x20, 0x04, 0x00, -   0x00, 0xf0, 0x0f, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x0c, 0x30, 0x00, -   0x00, 0x07, 0xe0, 0x00, 0xe0, 0x01, 0x80, 0x07, 0xf0, 0xff, 0xff, 0x0f, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/popup.c b/gnu/games/chess/Xchess/popup.c deleted file mode 100644 index 0995638b359b..000000000000 --- a/gnu/games/chess/Xchess/popup.c +++ /dev/null @@ -1,112 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:13 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/popup.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	 faustus@cad.berkeley.edu, ucbvax!faustus - * Permission is granted to modify and re-distribute this code in any manner - * as long as this notice is preserved.  All standard disclaimers apply. - * - * A simple pop-up menu system. - */ - -#include "xchess.h" - -/* Open a small window with some text in it and two buttons -- yes and no. - * Use black and white pixel, and the medium font. - */ - -bool -pop_question(win, text) -	windata *win; -	char *text; -{ -	char *s, *t; -	int nlines = 1, ncols = 0, i = 0, j; -	int x, y; -	Window w; -	bool ch; -	XEvent ev; - -	for (s = text; *s; s++) { -		if ((*s == '\n') && s[1]) -			nlines++; -		if ((*s == '\n') || !s[1]) { -			if (i > ncols) -				ncols = i; -			i = 0; -		} else -			i++; -	} - -	if (ncols < 12) -		ncols = 12; -	nlines += 4; -	ncols += 4; - -	x = (BASE_WIDTH - ncols * win->medium->max_bounds.width) / 2; -	y = (BASE_HEIGHT - nlines * win->medium->max_bounds.ascent) / 2; - -	w = XCreateSimpleWindow(win->display, win->basewin, -				x, y, ncols * win->medium->max_bounds.width, -				nlines * win->medium->ascent, -				BORDER_WIDTH, win->border.pixel, -				win->textback.pixel); -	XMapRaised(win->display, w); -	XSetFont(win->display, DefaultGC(win->display, 0), -		 win->medium->fid); - -	for (i = 0, s = text; i < nlines - 4; i++) { -		for (t = s, j = 0; *t && (*t != '\n'); t++, j++) -			; -		XDrawString(win->display, w, DefaultGC(win->display, 0), -			    (ncols - j) / 2 * win->medium->max_bounds.width, -			    (i + 1) * win->medium->ascent, -			    s, j); -		s = t + 1; -	} -	XDrawString(win->display, w, DefaultGC(win->display, 0), -		    (ncols - 8) * win->medium->max_bounds.width / 4, -		    (nlines - 2) * win->medium->ascent, -		    "YES", 3); -	XDrawString(win->display, w, DefaultGC(win->display, 0), -		    (ncols - 4) * win->medium->max_bounds.width * 3 / 4, -		    (nlines - 2) * win->medium->ascent, -		    "NO", 2); - -	XSync(win->display, 0); -	XSelectInput(win->display, w, ButtonPressMask); -	XWindowEvent(win->display, w, ButtonPressMask, &ev); -	x = ev.xkey.x; -	y = ev.xkey.y; - -	if (x > ncols * win->medium->max_bounds.width / 2) -		ch = false; -	else -		ch = true; - -	XDestroyWindow(win->display, w); -	XSync(win->display, 0); -	return (ch); -} - diff --git a/gnu/games/chess/Xchess/program.c b/gnu/games/chess/Xchess/program.c deleted file mode 100644 index e2eb186f98ed..000000000000 --- a/gnu/games/chess/Xchess/program.c +++ /dev/null @@ -1,204 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.3 $ on $Date: 1994/11/04 02:11:30 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/program.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - * The interface to whichever chess playing program we are using... - */ - -#include "xchess.h" -#include <signal.h> -#include <sys/time.h> - -static int pid; -static FILE *from; -static FILE *to; -static bool easy = 1; - -bool -program_init(name) -	char *name; -{ -	int toprog[2], fromprog[2]; -	char buf[BSIZE]; -	char time[10]; -	char moves[10]; - -	pipe(toprog); -	pipe(fromprog); - -	if (!(pid = fork())) { -		/* Start up the program. */ -		dup2(toprog[0], 0); -		dup2(fromprog[1], 1); -		close(toprog[0]); -		close(toprog[1]); -		close(fromprog[0]); -		close(fromprog[1]); -		sprintf (time, "%d", timeunit/60); -		sprintf (moves, "%d", movesperunit); -		if (proghost) -			execl("/usr/ucb/rsh", "rsh", proghost, name, -					moves, time, -					(char *) NULL); -		else -			execl(name, name, moves, time, (char *) NULL); -		perror(name); -		exit(1); -	} - -	close(toprog[0]); -	close(fromprog[1]); - -	from = fdopen(fromprog[0], "r"); -	setbuf(from, NULL); -	to = fdopen(toprog[1], "w"); -	setbuf(to, NULL); - -	/* Get the first line... */ -	fgets(buf, BSIZE, from); -	if (debug) -		fprintf(stderr, "program says %s", buf); -	if (blackflag) { -		fputs("switch\n", to); -		fflush(to); -		fgets(buf, BSIZE, from); -		if (debug) -			fprintf(stderr, "program says %s", buf); -		message_add(win1, "GNU Chess playing white\n", false); -	} else -		message_add(win1, "GNU Chess playing black\n", false); - -	return (true); -} - -void -program_end() -{ -	fclose(from); -	fclose(to); -	kill(pid, SIGTERM); -	return; -} - -void -program_send(m) -	move *m; -{ -	char buf[BSIZE]; - -	if ((m->type == MOVE) || (m->type == CAPTURE)) -		sprintf(buf, "%c%d%c%d\n", 'a' + m->fromx, SIZE - m->fromy, -				'a' + m->tox, SIZE - m->toy); -	else if (m->type == KCASTLE) -		strcpy(buf, (m->piece.color == WHITE) ? "e1g1\n" : "e8g8\n"); -	else if (m->type == QCASTLE) -		strcpy(buf, (m->piece.color == WHITE) ? "e1c1\n" : "e8c8\n"); - -	if (debug) -		fprintf(stderr, "sending program %s", buf); -	if (!easy) -		kill (pid, SIGINT); - -	fputs(buf, to); -	fflush(to); - -	/* One junk line... */ -	fgets(buf, BSIZE, from); -	if (debug) -		fprintf(stderr, "program says %s", buf); -	return; -} - -move * -program_get() -{ -	int rfd = (1 << fileno(from)), wfd = 0, xfd = 0; -	static struct timeval notime = { 0, 0 }; -	char buf[BSIZE], *s; -	move *m; -	int i; - -	/* Do a poll... */ - -#ifdef __FreeBSD__ -	if (!(i = select(32, &rfd, &wfd, &xfd, ¬ime))) { -#else -	if (!(i = select(32, &rfd, &wfd, &xfd, ¬ime)) && -			!from->_cnt) {		/* Bad stuff... */ -#endif -		if (debug) -			fprintf(stderr, "poll: nothing\n"); -		return (NULL); -	} -	if (i == -1) { -		perror("select"); -		return (NULL); -	} - -	fgets(buf, BSIZE, from); -	if (*buf == '\n' || *buf == '\0') { -	        message_add(win1, "program died", false); -		return (NULL); -	} - -	if (debug) -		fprintf(stderr, "got from program %s", buf); - -	for (s = buf; !isalpha(*s); s++) -		; -	m = parse_imove(chessboard, s, nexttomove); -	if (m == NULL) -	 	return (NULL); - -	if (!valid_move(m, chessboard)) { -		fprintf(stderr, "Error: move %s is invalid!!\n", buf); -		return (NULL); -	} - -	/* -	fgets(buf, BSIZE, from); -	if (debug) -		fprintf(stderr, "program says %s", buf); -	*/ -	message_add(win1, buf, false); -	return (m); -} - -void -program_undo() -{ -	fputs("undo\n", to); -	return; -} -void -program_easy (mode) -	bool mode; - -{ -	fputs("easy\n", to); -	easy = mode; -} diff --git a/gnu/games/chess/Xchess/queen.bitmap b/gnu/games/chess/Xchess/queen.bitmap deleted file mode 100644 index ab3817a123a9..000000000000 --- a/gnu/games/chess/Xchess/queen.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define queen_width 80 -#define queen_height 80 -static char queen_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x80, 0x01, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x80, 0x01, 0x00, 0x07, -   0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x80, 0x01, 0x80, 0x0f, 0x00, 0x00, -   0x00, 0x00, 0xf0, 0x01, 0xc0, 0x03, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0x00, 0xc0, 0x03, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, -   0xc0, 0x03, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x03, -   0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x03, 0x00, 0x03, -   0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x03, 0x00, 0x03, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0x01, 0xc0, 0x03, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, -   0xe0, 0x07, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0xe0, 0x07, -   0xc0, 0x03, 0x00, 0x00, 0x1c, 0x00, 0xc0, 0x03, 0xe0, 0x07, 0xc0, 0x03, -   0x00, 0x00, 0x3e, 0x00, 0xc0, 0x03, 0xe0, 0x07, 0xc0, 0x03, 0x00, 0x0e, -   0x3e, 0x00, 0xc0, 0x07, 0xe0, 0x07, 0xe0, 0x03, 0x00, 0x1f, 0x3e, 0x00, -   0xc0, 0x07, 0xe0, 0x07, 0xe0, 0x03, 0x00, 0x1f, 0x3c, 0x00, 0xc0, 0x07, -   0xe0, 0x07, 0xe0, 0x03, 0x00, 0x1f, 0x70, 0x00, 0xc0, 0x0f, 0xe0, 0x07, -   0xf0, 0x03, 0x00, 0x0e, 0x60, 0x00, 0xc0, 0x0f, 0xe0, 0x07, 0xf0, 0x03, -   0x00, 0x03, 0xe0, 0x00, 0xc0, 0x0f, 0xf0, 0x0f, 0xf0, 0x03, 0x80, 0x03, -   0xc0, 0x01, 0xc0, 0x1f, 0xf0, 0x0f, 0xf8, 0x03, 0x80, 0x01, 0xc0, 0x01, -   0xc0, 0x1f, 0xf0, 0x0f, 0xf8, 0x03, 0xc0, 0x01, 0xc0, 0x03, 0xc0, 0x1f, -   0xf0, 0x0f, 0xf8, 0x03, 0xe0, 0x01, 0xc0, 0x07, 0xc0, 0x1f, 0xf0, 0x0f, -   0xf8, 0x03, 0xe0, 0x01, 0xc0, 0x07, 0xc0, 0x3f, 0xf0, 0x0f, 0xfc, 0x03, -   0xf0, 0x01, 0xc0, 0x0f, 0xc0, 0x3f, 0xf0, 0x0f, 0xfc, 0x03, 0xf8, 0x01, -   0x80, 0x1f, 0xc0, 0x3f, 0xf0, 0x0f, 0xfc, 0x03, 0xf8, 0x01, 0x80, 0x1f, -   0xc0, 0x7f, 0xf0, 0x0f, 0xfe, 0x03, 0xfc, 0x01, 0x80, 0x3f, 0xc0, 0x7f, -   0xf8, 0x1f, 0xfe, 0x03, 0xfc, 0x00, 0x80, 0x3f, 0xc0, 0x7f, 0xf8, 0x1f, -   0xfe, 0x03, 0xfe, 0x00, 0x80, 0x7f, 0xc0, 0xff, 0xf8, 0x1f, 0xff, 0x03, -   0xff, 0x00, 0x80, 0xff, 0xc0, 0xff, 0xf8, 0x1f, 0xff, 0x03, 0xff, 0x00, -   0x00, 0xff, 0xc0, 0xff, 0xf8, 0x1f, 0xff, 0x83, 0xff, 0x00, 0x00, 0xff, -   0xc1, 0xff, 0xf9, 0x9f, 0xff, 0x83, 0xff, 0x00, 0x00, 0xff, 0xc3, 0xff, -   0xf9, 0x9f, 0xff, 0xc3, 0xff, 0x00, 0x00, 0xff, 0xc3, 0xff, 0xf9, 0x9f, -   0xff, 0xe3, 0x7f, 0x00, 0x00, 0xff, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xe3, -   0x7f, 0x00, 0x00, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x7f, 0x00, -   0x00, 0xfe, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xfb, 0x7f, 0x00, 0x00, 0xfe, -   0xdf, 0xff, 0xff, 0xff, 0xff, 0xfb, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x7f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, -   0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xfc, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xfc, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0x80, -   0xff, 0xff, 0x3f, 0x00, 0x00, 0xf8, 0xff, 0x03, 0xfc, 0x3f, 0xc0, 0xff, -   0x1f, 0x00, 0x00, 0xf0, 0x01, 0xf8, 0x7f, 0xfe, 0x1f, 0x80, 0x1f, 0x00, -   0x00, 0x30, 0xfc, 0xff, 0x1f, 0xf8, 0xff, 0x3f, 0x0c, 0x00, 0x00, 0xe0, -   0xe7, 0xff, 0x07, 0xe0, 0xff, 0xe7, 0x07, 0x00, 0x00, 0xc0, 0x81, 0xff, -   0x1f, 0xf8, 0xff, 0x81, 0x03, 0x00, 0x00, 0x80, 0x00, 0xfe, 0x7f, 0xfe, -   0x7f, 0x00, 0x03, 0x00, 0x00, 0x80, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, -   0x01, 0x00, 0x00, 0x00, 0xe7, 0xff, 0x01, 0x80, 0xff, 0xe7, 0x00, 0x00, -   0x00, 0x00, 0xff, 0x03, 0xfc, 0x3f, 0xc0, 0xff, 0x00, 0x00, 0x00, 0x80, -   0x01, 0xf8, 0xff, 0xff, 0x1f, 0x80, 0x01, 0x00, 0x00, 0x80, 0xfc, 0xff, -   0xff, 0xff, 0xff, 0x3f, 0x01, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x01, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x03, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, -   0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xe0, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/queen_mask.bitmap b/gnu/games/chess/Xchess/queen_mask.bitmap deleted file mode 100644 index 76a5904e8340..000000000000 --- a/gnu/games/chess/Xchess/queen_mask.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define queen_mask_width 80 -#define queen_mask_height 80 -static char queen_mask_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x60, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, -   0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x03, 0xc0, 0x03, -   0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x03, 0xc0, 0x03, 0xc0, 0x1f, -   0x00, 0x00, 0x00, 0x00, 0xf8, 0x03, 0xe0, 0x07, 0xc0, 0x1f, 0x00, 0x00, -   0x00, 0x00, 0xf8, 0x03, 0xe0, 0x07, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, -   0xf8, 0x01, 0xe0, 0x07, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, -   0xe0, 0x07, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xe0, 0x07, -   0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xe0, 0x07, 0x80, 0x07, -   0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0xe0, 0x07, 0x80, 0x07, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0x03, 0xf0, 0x0f, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0x07, 0xf0, 0x0f, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, -   0xf0, 0x0f, 0xc0, 0x07, 0x00, 0x00, 0x7e, 0x00, 0xe0, 0x07, 0xf0, 0x0f, -   0xe0, 0x07, 0x00, 0x00, 0x7f, 0x00, 0xe0, 0x0f, 0xf0, 0x0f, 0xe0, 0x07, -   0x00, 0x1f, 0x7f, 0x00, 0xe0, 0x0f, 0xf0, 0x0f, 0xe0, 0x07, 0x80, 0x3f, -   0x7f, 0x00, 0xe0, 0x0f, 0xf0, 0x0f, 0xf0, 0x07, 0x80, 0x3f, 0x7f, 0x00, -   0xe0, 0x0f, 0xf0, 0x0f, 0xf0, 0x07, 0x80, 0x3f, 0xff, 0x00, 0xe0, 0x1f, -   0xf0, 0x0f, 0xf0, 0x07, 0x80, 0x3f, 0xfe, 0x00, 0xe0, 0x1f, 0xf0, 0x0f, -   0xf8, 0x07, 0x80, 0x1f, 0xfc, 0x01, 0xe0, 0x1f, 0xf8, 0x1f, 0xf8, 0x07, -   0x80, 0x1f, 0xf0, 0x03, 0xe0, 0x3f, 0xf8, 0x1f, 0xf8, 0x07, 0xc0, 0x0f, -   0xf0, 0x07, 0xe0, 0x3f, 0xf8, 0x1f, 0xfc, 0x07, 0xe0, 0x03, 0xe0, 0x07, -   0xe0, 0x3f, 0xf8, 0x1f, 0xfc, 0x07, 0xf0, 0x03, 0xe0, 0x0f, 0xe0, 0x7f, -   0xf8, 0x1f, 0xfc, 0x07, 0xf0, 0x03, 0xe0, 0x1f, 0xe0, 0x7f, 0xf8, 0x1f, -   0xfc, 0x07, 0xf8, 0x03, 0xe0, 0x1f, 0xe0, 0x7f, 0xf8, 0x1f, 0xfe, 0x07, -   0xf8, 0x03, 0xe0, 0x3f, 0xe0, 0x7f, 0xf8, 0x1f, 0xfe, 0x07, 0xfc, 0x03, -   0xe0, 0x3f, 0xe0, 0xff, 0xf8, 0x1f, 0xfe, 0x07, 0xfe, 0x03, 0xc0, 0x7f, -   0xe0, 0xff, 0xfc, 0x3f, 0xff, 0x07, 0xfe, 0x03, 0xc0, 0xff, 0xe0, 0xff, -   0xfd, 0x3f, 0xff, 0x07, 0xff, 0x03, 0xc0, 0xff, 0xe1, 0xff, 0xfd, 0xff, -   0xff, 0x87, 0xff, 0x03, 0xc0, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0x87, -   0xff, 0x01, 0xc0, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xff, 0x01, -   0xc0, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xff, 0x01, 0x80, 0xff, -   0xef, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff, 0x01, 0x80, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xe7, 0xff, 0x01, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xf7, 0xff, 0x01, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, -   0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, -   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xfe, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x7f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x7f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, -   0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xf8, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xf0, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x07, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, -   0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x03, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x07, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, -   0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xf0, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xf0, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/queen_outline.bitmap b/gnu/games/chess/Xchess/queen_outline.bitmap deleted file mode 100644 index 2527216b3966..000000000000 --- a/gnu/games/chess/Xchess/queen_outline.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define queen_outline_width 80 -#define queen_outline_height 80 -static char queen_outline_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x03, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x60, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x80, 0x01, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x80, 0x01, 0x00, 0x07, -   0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x80, 0x01, 0x80, 0x0d, 0x00, 0x00, -   0x00, 0x00, 0xb0, 0x01, 0xc0, 0x03, 0x80, 0x08, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0x00, 0x40, 0x02, 0x80, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, -   0x40, 0x02, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x40, 0x02, -   0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x40, 0x02, 0x00, 0x03, -   0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x40, 0x02, 0x00, 0x03, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0x01, 0x40, 0x02, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, -   0x40, 0x01, 0x40, 0x02, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, -   0x60, 0x06, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x40, 0x03, 0x20, 0x04, -   0xc0, 0x02, 0x00, 0x00, 0x1c, 0x00, 0x40, 0x02, 0x20, 0x04, 0x40, 0x02, -   0x00, 0x00, 0x36, 0x00, 0x40, 0x02, 0x20, 0x04, 0x40, 0x02, 0x00, 0x0e, -   0x22, 0x00, 0x40, 0x06, 0x20, 0x04, 0x60, 0x02, 0x00, 0x1b, 0x36, 0x00, -   0x40, 0x04, 0x20, 0x04, 0x20, 0x02, 0x00, 0x11, 0x3c, 0x00, 0x40, 0x04, -   0x20, 0x04, 0x20, 0x02, 0x00, 0x1b, 0x70, 0x00, 0x40, 0x0c, 0x20, 0x04, -   0x30, 0x02, 0x00, 0x0e, 0x60, 0x00, 0x40, 0x08, 0x20, 0x04, 0x10, 0x02, -   0x00, 0x03, 0xe0, 0x00, 0x40, 0x08, 0x30, 0x0c, 0x10, 0x02, 0x80, 0x03, -   0xc0, 0x01, 0x40, 0x18, 0x10, 0x08, 0x18, 0x02, 0x80, 0x01, 0x40, 0x01, -   0x40, 0x10, 0x10, 0x08, 0x08, 0x02, 0xc0, 0x01, 0x40, 0x03, 0x40, 0x10, -   0x10, 0x08, 0x08, 0x02, 0x60, 0x01, 0x40, 0x06, 0x40, 0x10, 0x10, 0x08, -   0x08, 0x02, 0x20, 0x01, 0x40, 0x04, 0x40, 0x30, 0x10, 0x08, 0x0c, 0x02, -   0x30, 0x01, 0xc0, 0x0c, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x18, 0x01, -   0x80, 0x18, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x08, 0x01, 0x80, 0x10, -   0x40, 0x60, 0x10, 0x08, 0x06, 0x02, 0x8c, 0x01, 0x80, 0x30, 0x40, 0x40, -   0x18, 0x18, 0x02, 0x02, 0x84, 0x00, 0x80, 0x20, 0x40, 0x40, 0x08, 0x10, -   0x02, 0x02, 0x86, 0x00, 0x80, 0x60, 0x40, 0xc0, 0x08, 0x10, 0x03, 0x02, -   0x83, 0x00, 0x80, 0xc1, 0x40, 0x80, 0x08, 0x10, 0x01, 0x02, 0x81, 0x00, -   0x00, 0x81, 0x40, 0x80, 0x08, 0x10, 0x01, 0x82, 0x81, 0x00, 0x00, 0x81, -   0x41, 0x80, 0x09, 0x90, 0x01, 0x82, 0x80, 0x00, 0x00, 0x01, 0x43, 0x00, -   0x09, 0x90, 0x00, 0xc2, 0xc0, 0x00, 0x00, 0x01, 0x42, 0x00, 0x09, 0x90, -   0x00, 0x62, 0x40, 0x00, 0x00, 0x01, 0x46, 0x00, 0x0f, 0xf0, 0x00, 0x22, -   0x40, 0x00, 0x00, 0x03, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x32, 0x40, 0x00, -   0x00, 0x02, 0x48, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x40, 0x00, 0x00, 0x02, -   0x58, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x40, 0x00, 0x00, 0x02, 0x70, 0x00, -   0x00, 0x00, 0x00, 0x0e, 0x40, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x40, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x60, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, -   0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x04, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, 0xfe, 0x7f, -   0x00, 0x00, 0x30, 0x00, 0x00, 0x18, 0x00, 0xfc, 0x03, 0xc0, 0x3f, 0x00, -   0x10, 0x00, 0x00, 0x10, 0xfe, 0x07, 0x80, 0x01, 0xe0, 0x7f, 0x18, 0x00, -   0x00, 0x30, 0x03, 0x00, 0xe0, 0x07, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x60, -   0x18, 0x00, 0xf8, 0x1f, 0x00, 0x18, 0x06, 0x00, 0x00, 0x40, 0x7e, 0x00, -   0xe0, 0x07, 0x00, 0x7e, 0x02, 0x00, 0x00, 0x40, 0xff, 0x01, 0x80, 0x01, -   0x80, 0xff, 0x02, 0x00, 0x00, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7e, -   0x02, 0x00, 0x00, 0xc0, 0x18, 0x00, 0xfe, 0x7f, 0x00, 0x18, 0x03, 0x00, -   0x00, 0x80, 0x00, 0xfc, 0x03, 0xc0, 0x3f, 0x00, 0x01, 0x00, 0x00, 0x80, -   0xfe, 0x07, 0x00, 0x00, 0xe0, 0x7f, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x01, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x03, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, -   0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x60, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xe0, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/queen_small.bitmap b/gnu/games/chess/Xchess/queen_small.bitmap deleted file mode 100644 index d7ee50e9b820..000000000000 --- a/gnu/games/chess/Xchess/queen_small.bitmap +++ /dev/null @@ -1,15 +0,0 @@ - -#define queen_small_width 32 -#define queen_small_height 32 -static char queen_small_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, -   0x00, 0x80, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x00, -   0x80, 0x81, 0xc0, 0x00, 0x80, 0x81, 0xc0, 0x00, 0x00, 0xc1, 0x41, 0x00, -   0x00, 0xc1, 0x41, 0x00, 0x02, 0xc3, 0x61, 0x20, 0x06, 0xc3, 0x61, 0x30, -   0x04, 0xc3, 0x61, 0x10, 0x0c, 0xc3, 0x61, 0x18, 0x08, 0xc7, 0x71, 0x08, -   0x18, 0xc6, 0x31, 0x0c, 0x38, 0xc6, 0x31, 0x0e, 0x30, 0xce, 0x39, 0x06, -   0x70, 0xce, 0x39, 0x07, 0x60, 0xee, 0x3b, 0x03, 0xe0, 0xee, 0xbb, 0x03, -   0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0xc0, 0xff, 0xff, 0x01, -   0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 0xff, 0x7f, 0x00, -   0x80, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0x07, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/queen_small_outline.bitmap b/gnu/games/chess/Xchess/queen_small_outline.bitmap deleted file mode 100644 index 0b624b9587bc..000000000000 --- a/gnu/games/chess/Xchess/queen_small_outline.bitmap +++ /dev/null @@ -1,15 +0,0 @@ - -#define queen_small_outline_width 32 -#define queen_small_outline_height 32 -static char queen_small_outline_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, -   0x00, 0x80, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x00, -   0x80, 0x81, 0xc0, 0x00, 0x80, 0x81, 0xc0, 0x00, 0x00, 0xc1, 0x41, 0x00, -   0x00, 0x41, 0x41, 0x00, 0x02, 0x43, 0x61, 0x20, 0x06, 0x43, 0x61, 0x30, -   0x04, 0x43, 0x61, 0x10, 0x0c, 0x43, 0x61, 0x18, 0x08, 0x47, 0x71, 0x08, -   0x18, 0x46, 0x31, 0x0c, 0x38, 0x46, 0x31, 0x0e, 0x30, 0x4e, 0x39, 0x06, -   0x70, 0x4e, 0x29, 0x07, 0x60, 0x6a, 0x2b, 0x03, 0xe0, 0x2a, 0xab, 0x03, -   0xe0, 0x3b, 0xee, 0x03, 0x40, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x80, 0x01, -   0x80, 0xfc, 0x9f, 0x00, 0x80, 0x01, 0xc0, 0x00, 0x00, 0x01, 0x40, 0x00, -   0x80, 0xfd, 0xdf, 0x00, 0xf0, 0x00, 0x80, 0x07, 0xf0, 0xff, 0xff, 0x07, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/record.c b/gnu/games/chess/Xchess/record.c deleted file mode 100644 index b2fcea157635..000000000000 --- a/gnu/games/chess/Xchess/record.c +++ /dev/null @@ -1,315 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:09 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/record.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - * Deal with recording moves. - */ - -#include "xchess.h" - -#undef smartass - -bool record_english = true; -char *record_file = DEF_RECORD_FILE; -int movenum = 0; -bool saveflag = false; - -static char *colnames[] = { "qr", "qn", "qb", "q", "k", "kb", "kn", "kr" } ; -static char *pcnames[] = { "P", "R", "N", "B", "Q", "K" } ; - -static char *movestring(); -static char *tstring(); -static FILE *backup; - -#define RECORD_HEADER	"\n1    XChess Game Record0\n" - -void -record_init(win) -	windata *win; -{ -	int i; - -	i = XTextWidth(win->medium, RECORD_HEADER, -		       sizeof(RECORD_HEADER) - 1); -	i = (40 * win->small->max_bounds.width - i * -	     win->medium->max_bounds.width) / -			win->medium->max_bounds.width / 2; -	TxtGrab(win->display, win->recwin, "xchess", win->small, win->textback.pixel, -			win->textcolor.pixel, win->cursorcolor.pixel); -	TxtAddFont(win->display, win->recwin, 1, win->medium, win->textcolor.pixel); -	for (; i > 0; i++) -		TxtWriteStr(win->display, win->recwin, " "); -	TxtWriteStr(win->display, win->recwin, RECORD_HEADER); - -	if (saveflag) { -		if (!(backup = fopen(record_file, "w"))) { -			perror(record_file); -			saveflag = false; -		} else { -			fprintf(backup, "X Chess -- %s\n", datestring()); -			if (dispname2) -				fprintf(backup, "\tWhite on %s, black on %s\n", -						dispname1, dispname2); -			else -				fprintf(backup, "\tGame played on %s\n", -						dispname1); -			fprintf(backup, "\t%s\n", record_english ? "english" : -					"algebraic"); -			fflush(backup); -		} -	} - -	movenum = 0; -	return; -} - -void -record_reset() -{ -	TxtWriteStr(win1->display, win1->recwin, "\n\n1    New Game0\n\n"); -	if (!oneboard) { -		TxtWriteStr(win2->display, win2->recwin, "\n\n1    New Game0\n\n"); -	} -	movenum = 0; -	if (saveflag) { -		fprintf(backup, "\n\nNew Game\n\n"); -		fflush(backup); -	} -	return; -} - -void -record_end(s) -	char *s; -{ -	char buf[BSIZE]; - -	sprintf(buf, "\n%s\n", s); -	TxtWriteStr(win1->display, win1->recwin, s); -	if (!oneboard) { -		TxtWriteStr(win2->display, win2->recwin, s); -	} -	if (saveflag) { -		fprintf(backup, "\n%s\n", s); -		fprintf(backup, "Time: white: %s, ", tstring(whiteseconds)); -		fprintf(backup, "black: %s\n", tstring(blackseconds)); -		fclose(backup); -	} -	return; -} - -void -record_save() -{ -	move *m; -	FILE *fp; -	int i; -	char *s; - -	if (!(fp = fopen(record_file, "w"))) { -		perror(record_file); -		return; -	} -	fprintf(fp, "X Chess -- %s\n", datestring()); -	if (dispname2) -		fprintf(fp, "\tWhite on %s, black on %s\n", -				dispname1, dispname2); -	else -		fprintf(fp, "\tGame played on %s\n", dispname1); -	fprintf(fp, "\t%s\n", record_english ? "english" : "algebraic"); - -	for (m = moves, i = 1; m; i++) { -		s = movestring(m); -		fprintf(fp, "%2d. %-16s ", i, s); -		m = m->next; -		if (m) -			s = movestring(m); -		else -			s = ""; -		fprintf(fp, "%s\n", s); -		if (m) -			m = m->next; -	} -	fclose(fp); -	return; -} - -void -record_move(m) -	move *m; -{ -	char *s, buf[BSIZE]; - -	s = movestring(m); - -	if (m->piece.color == WHITE) { -		movenum++; -		sprintf(buf, "%2d. %-16s ", movenum, s); -	} else { -		sprintf(buf, "%s\n", s); -	} -	TxtWriteStr(win1->display, win1->recwin, buf); -	if (!oneboard) { -		TxtWriteStr(win2->display, win2->recwin, buf); -	} -	if (saveflag) { -		fprintf(backup, "%s", buf); -		fflush(backup); -	} - -	return; -} - -void -record_back() -{ -    extern move *lastmove; -    move *m = lastmove; -    char *s = movestring(m); -    char buf[BSIZE]; -    long i; - -    if (m->piece.color == WHITE) { -	sprintf(buf, "%2d. %-16s ", movenum, s); -    } else { -	sprintf(buf, "%s\n", s); -    } -    s = buf; -    for (i = 0; *s != '\0'; i++) -	*s++ = '';		/* control H, backspace */ - -    TxtWriteStr(win1->display, win1->recwin, buf); -    if (!oneboard) { -	TxtWriteStr(win2->display, win2->recwin, buf); -    } - -    if (nexttomove == BLACK) -	movenum--; -    if (saveflag) { -	fseek(backup, -i, 1); -	fflush(backup); -    } - -    return; -} - -static char * -movestring(m) -	move *m; -{ -	int fy, ty; -	static char buf[BSIZE]; - -	if (!record_english || (m->piece.color == WHITE)) { -		fy = SIZE - m->fromy; -		ty = SIZE - m->toy; -	} else { -		fy = m->fromy + 1; -		ty = m->toy + 1; -	} - -	switch (m->type) { -	    case MOVE: -		if (record_english) -			sprintf(buf, "%s/%s%d-%s%d%s", pcnames[(int) m->piece. -					type], colnames[m->fromx], fy, -					colnames[m->tox], ty, m->check ? "+" : -					""); -		else -			sprintf(buf, "%c%d%c%d", 'a' + m->fromx, fy, 'a' + -					m->tox, ty); -		break; -	    case CAPTURE: -		if (record_english) -			sprintf(buf, "%s/%s%dx%s/%s%d%s%s", -					pcnames[(int) m->piece.type], -					colnames[m->fromx], fy, -					pcnames[(int) m->taken.type], -					colnames[m->tox], ty, -					m->enpassant ? "e.p." : "", -					m->check ? "+" : ""); -		else -			sprintf(buf, "%c%d%c%d", 'a' + m->fromx, fy, 'a' + -					m->tox, ty); -		break; - -	    case KCASTLE: -		if (record_english) -			sprintf(buf, "O-O%s", m->check ? "ch" : ""); -		else if (m->piece.color == WHITE) -			strcpy(buf, "e1g1"); -		else -			strcpy(buf, "e8g8"); -		break; - -	    case QCASTLE: -		if (record_english) -			sprintf(buf, "O-O-O%s", m->check ? "ch" : ""); -		else if (m->piece.color == WHITE) -			strcpy(buf, "e1c1"); -		else -			strcpy(buf, "e8c8"); -		break; - -	    default: -		sprintf(buf, "something strange"); -		break; -	} -	if ((m->piece.type == PAWN) && (((m->piece.color == BLACK) && -			(m->toy == 7)) || ((m->piece.color == WHITE) && -			(m->toy == 0)))) -		strcat(buf, "(Q)"); - -#ifdef smartass -	if (!(random() % 50)) -		strcat(buf, "?"); -	else if (!(random() % 50)) -		strcat(buf, "!"); -	else if (!(random() % 500)) -		strcat(buf, "???"); -	else if (!(random() % 500)) -		strcat(buf, "!!!"); -#endif smartass - -	return (buf); -} - -static char * -tstring(s) -	int s; -{ -	static char buf[64]; - -	if (s > 3600) -		sprintf(buf, "%dh %dm %ds", s / 3600, (s % 3600) / 60, s % 60); -	else if (s > 60) -		sprintf(buf, "%dm %ds", (s % 3600) / 60, s % 60); -	else -		sprintf(buf, "%ds", s); -	return (buf); -} - diff --git a/gnu/games/chess/Xchess/rook.bitmap b/gnu/games/chess/Xchess/rook.bitmap deleted file mode 100644 index f274614eb9cb..000000000000 --- a/gnu/games/chess/Xchess/rook.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define rook_width 80 -#define rook_height 80 -static char rook_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xf8, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xf8, 0xff, 0x00, 0x3c, -   0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xf8, 0xff, 0x00, 0xfc, 0x0f, 0x00, -   0x00, 0xc0, 0xff, 0x01, 0xf8, 0xff, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0xc0, -   0xff, 0x01, 0xf8, 0xff, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0xc0, 0xff, 0x01, -   0xf8, 0xff, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0xc0, 0xff, 0x01, 0xff, 0xff, -   0x07, 0xfc, 0x1f, 0x00, 0x00, 0xc0, 0xff, 0xfd, 0x01, 0x00, 0xfc, 0xfd, -   0x1f, 0x00, 0x00, 0xc0, 0xff, 0x07, 0xfc, 0xff, 0x01, 0xff, 0x1f, 0x00, -   0x00, 0xc0, 0x1f, 0xf0, 0xff, 0xff, 0x7f, 0xc0, 0x1f, 0x00, 0x00, 0x40, -   0xc0, 0xff, 0x07, 0x00, 0xff, 0x1f, 0x10, 0x00, 0x00, 0xc0, 0xff, 0x1f, -   0xf0, 0x7f, 0xc0, 0xff, 0x1f, 0x00, 0x00, 0xc0, 0x7f, 0xc0, 0xfd, 0xff, -   0x1d, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, -   0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, -   0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, -   0xfd, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, -   0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0x7f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, -   0xff, 0xfe, 0x07, 0x10, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfe, -   0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfe, 0xff, 0x1f, -   0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfe, 0xff, 0x1f, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0xff, 0xff, 0xfe, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0xff, 0xff, 0xfe, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, -   0xff, 0xfe, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfe, -   0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfe, 0xff, 0x1f, -   0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfe, 0xff, 0x1f, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0xff, 0xff, 0xfe, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0xff, 0xff, 0xfe, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, -   0x0f, 0x80, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xe0, 0x3f, -   0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, -   0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, -   0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, -   0xfd, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, -   0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0xff, 0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, -   0xfd, 0xff, 0xfd, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, -   0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfd, 0xff, 0x1f, -   0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfd, 0xff, 0x1f, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0xff, 0xff, 0xfd, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0xff, 0xff, 0xfd, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, -   0xff, 0xfd, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfd, -   0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfd, 0xff, 0x1f, -   0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfd, 0xff, 0x1f, 0x00, 0x00, -   0x00, 0x00, 0xc0, 0xff, 0xff, 0xfd, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0xff, 0xff, 0xfd, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, -   0xff, 0xfd, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xfd, -   0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x10, -   0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, -   0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, -   0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x07, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, -   0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x20, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x20, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x3f, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/rook_mask.bitmap b/gnu/games/chess/Xchess/rook_mask.bitmap deleted file mode 100644 index c04441655879..000000000000 --- a/gnu/games/chess/Xchess/rook_mask.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define rook_mask_width 80 -#define rook_mask_height 80 -static char rook_mask_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0xfc, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xfc, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0xfc, 0xff, -   0x01, 0x7e, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x03, 0xfc, 0xff, 0x01, 0xfe, -   0x1f, 0x00, 0x00, 0xe0, 0xff, 0x03, 0xfc, 0xff, 0x01, 0xfe, 0x3f, 0x00, -   0x00, 0xe0, 0xff, 0x03, 0xfc, 0xff, 0x01, 0xfe, 0x3f, 0x00, 0x00, 0xe0, -   0xff, 0x03, 0xfc, 0xff, 0x1f, 0xfe, 0x3f, 0x00, 0x00, 0xe0, 0xff, 0x83, -   0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x3f, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x3f, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, -   0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xe0, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xe0, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x3f, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x3f, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, -   0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, -   0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, -   0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, -   0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, -   0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, -   0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, -   0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, -   0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, -   0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, -   0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, -   0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, -   0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, -   0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, -   0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, -   0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, -   0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, -   0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, -   0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, -   0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, -   0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, -   0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, -   0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, -   0xe0, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, -   0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, -   0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, -   0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x0f, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x1f, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, -   0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0xff, -   0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, -   0xff, 0xff, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x7f, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, -   0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/rook_outline.bitmap b/gnu/games/chess/Xchess/rook_outline.bitmap deleted file mode 100644 index f30107a3f277..000000000000 --- a/gnu/games/chess/Xchess/rook_outline.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define rook_outline_width 80 -#define rook_outline_height 80 -static char rook_outline_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xf8, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x08, 0x80, 0x00, 0x3c, -   0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x08, 0x80, 0x00, 0xe4, 0x0f, 0x00, -   0x00, 0xc0, 0x00, 0x01, 0x08, 0x80, 0x00, 0x04, 0x18, 0x00, 0x00, 0x40, -   0x00, 0x01, 0x08, 0x80, 0x00, 0x04, 0x10, 0x00, 0x00, 0x40, 0x00, 0x01, -   0x08, 0x80, 0x00, 0x04, 0x10, 0x00, 0x00, 0x40, 0x00, 0x01, 0x0f, 0x80, -   0x07, 0x04, 0x10, 0x00, 0x00, 0x40, 0x00, 0xfd, 0x01, 0x00, 0xfc, 0x05, -   0x10, 0x00, 0x00, 0x40, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x10, 0x00, -   0x00, 0x40, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x00, 0x10, 0x00, 0x00, 0x40, -   0x00, 0xf0, 0x07, 0x00, 0x7f, 0x00, 0x10, 0x00, 0x00, 0x40, 0xc0, 0x1f, -   0x00, 0x00, 0xc0, 0x1f, 0x10, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x02, 0x00, -   0x02, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x02, 0x10, -   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x02, 0x10, 0x00, 0x00, -   0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, -   0x40, 0x00, 0x02, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, -   0x02, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00, -   0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x02, 0x10, -   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x02, 0x10, 0x00, 0x00, -   0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, -   0x40, 0x80, 0xff, 0xff, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, -   0x00, 0x01, 0xf8, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, -   0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x10, -   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, -   0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, -   0x40, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, -   0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, -   0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x10, -   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, -   0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, -   0x40, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, -   0xf0, 0x7f, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x1f, 0xc0, -   0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x02, 0x10, -   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x02, 0x10, 0x00, 0x00, -   0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, -   0x40, 0x00, 0x02, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, -   0x02, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00, -   0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x02, 0x10, -   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x02, 0x10, 0x00, 0x00, -   0x00, 0x00, 0x40, 0x00, 0x02, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, -   0x40, 0x00, 0x02, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, -   0x02, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, -   0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x02, 0x00, 0x10, -   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x00, -   0x00, 0x00, 0x40, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, -   0x40, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, -   0x00, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x02, -   0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x02, 0x00, 0x10, -   0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x00, -   0x00, 0x00, 0x40, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, -   0x40, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, -   0x00, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x02, -   0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x1f, -   0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, -   0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, -   0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x07, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, -   0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x20, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x20, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, -   0x3f, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/rook_small.bitmap b/gnu/games/chess/Xchess/rook_small.bitmap deleted file mode 100644 index ddee75660d4b..000000000000 --- a/gnu/games/chess/Xchess/rook_small.bitmap +++ /dev/null @@ -1,15 +0,0 @@ - -#define rook_small_width 32 -#define rook_small_height 32 -static char rook_small_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0x73, 0xce, 0x03, 0xc0, 0x73, 0xce, 0x03, 0xc0, 0x73, 0xce, 0x03, -   0xc0, 0x73, 0xce, 0x03, 0xc0, 0xff, 0xff, 0x03, 0x00, 0xff, 0xff, 0x00, -   0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, -   0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, -   0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, -   0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, -   0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, -   0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, -   0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07, 0xe0, 0xff, 0xff, 0x07, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/rook_small_outline.bitmap b/gnu/games/chess/Xchess/rook_small_outline.bitmap deleted file mode 100644 index 523521b963b7..000000000000 --- a/gnu/games/chess/Xchess/rook_small_outline.bitmap +++ /dev/null @@ -1,15 +0,0 @@ - -#define rook_small_outline_width 32 -#define rook_small_outline_height 32 -static char rook_small_outline_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -   0xc0, 0x73, 0xce, 0x03, 0x40, 0x52, 0x4a, 0x02, 0x40, 0x52, 0x4a, 0x02, -   0x40, 0x52, 0x4a, 0x02, 0xc0, 0xff, 0xff, 0x03, 0x00, 0x01, 0x80, 0x00, -   0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, -   0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, -   0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, -   0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, -   0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, -   0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, -   0xe0, 0xff, 0xff, 0x07, 0x20, 0x00, 0x00, 0x04, 0xe0, 0xff, 0xff, 0x07, -   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/scrollText.c b/gnu/games/chess/Xchess/scrollText.c deleted file mode 100644 index b8484dda4eb4..000000000000 --- a/gnu/games/chess/Xchess/scrollText.c +++ /dev/null @@ -1,1877 +0,0 @@ -/* - * A Scrollable Text Output Window - * - * David Harrison - * University of California,  Berkeley - * 1986 - * - * The following is an implementation for a scrollable text output - * system.  It handles exposure events only (other interactions are - * under user control).  For scrolling,  a always present scroll bar - * is implemented.  It detects size changes and compensates accordingly. - */ - -#include <X11/X.h> -#include <X11/Xlib.h> -#include <X11/X10.h> -#include <sys/types.h> -#include "scrollText.h" - -extern char *malloc(); -extern char *realloc(); -#define alloc(type)		(type *) malloc(sizeof(type)) -#define numalloc(type, num)	(type *) malloc((unsigned) (num * sizeof(type))) -#define MAXINT		2147483647 - -extern XAssocTable *XCreateAssocTable(); -extern caddr_t XLookUpAssoc(); - -static XAssocTable *textWindows = (XAssocTable *) 0; - -#define NOOPTION	-1	/* Option hasn't been set yet                */ -#define NORMSCROLL	0	/* Smooth scroll on LineToTop and TopToHere  */ -#define JUMPSCROLL	1	/* Jump scrolling on LineToTop and TopToHere */ - -static int ScrollOption = NOOPTION; - -typedef char *Generic; - -#define DEFAULT_GC textInfo->fontGC[textInfo->curFont] - -#define BARSIZE		15 -#define BARBORDER	1 -#define MAXFONTS	8 -#define INITBUFSIZE	1024 -#define INITLINES	50 -#define INITEXPARY	50 -#define XPADDING	2 -#define YPADDING	2 -#define INTERLINE	5 -#define INTERSPACE	1 -#define CURSORWIDTH	2 -#define EXPANDPERCENT	40 -#define BUFSIZE		1024 -#define CUROFFSET	1 -#define MAXFOREIGN	250 -#define NOINDEX		-1 - -/* The wrap line indicator */ -#define WRAPINDSIZE	7 -#define STEMOFFSET	5 -#define arrow_width 7 -#define arrow_height 5 -static char arrow_bits[] = { -   0x24, 0x26, 0x3f, 0x06, 0x04}; - -#define NEWLINE		'\n' -#define BACKSPACE	'\010' -#define NEWFONT		'\006' -#define LOWCHAR		'\040' -#define HIGHCHAR	'\176' - -#define CHARMASK	0x00ff	/* Character mask */ -#define FONTMASK	0x0700	/* Character font */ -#define FONTSHIFT	8	/* Shift amount   */ - -#define WRAPFLAG	0x01	/* Line wrap flag */ - -/* - * Lines are represented by a pointer into the overall array of - * 16-bit characters.  The lower eight bits is used to indicate the character - * (in ASCII),  and the next two bits are used to indicate the font - * the character should be drawn in. - */ - -typedef struct txtLine { -    int lineLength;		/* Current line length               */ -    int lineHeight;		/* Full height of line in pixels     */ -    int lineBaseLine;		/* Current baseline of the line      */ -    int lineWidth;		/* Drawing position at end of line   */ -    int lineText;		/* Offset into master buffer         */ -    int lineFlags;		/* Line wrap flag is here            */ -}; - - -/* - * For ExposeCopy events,  we queue up the redraw requests collapsing - * them into line redraw requests until the CopyExpose event arrives. - * The queue is represented as a dynamic array of the following - * structure: - */ - -typedef struct expEvent { -    int lineIndex;		/* Index of line to redraw  */ -    int ypos;			/* Drawing position of line */ -}; - - -/* - * The text buffer is represented using a dynamic counted array - * of 16-bit quantities. This array expands as needed. - * For the screen representation,  a dynamic counted array - * of line structures is used.  This array points into the - * text buffer to denote the start of each line and its parameters. - * The windows are configured as one overall window which contains - * the scroll bar as a sub-window along its right edge.  Thus, - * the text drawing space is actually w-BARSIZE. - */ - -#define NOTATBOTTOM	0x01	/* Need to scroll to bottom before appending */ -#define FONTNUMWAIT	0x02	/* Waiting for font number                   */ -#define COPYEXPOSE	0x04	/* Need to process a copy expose event       */ -#define SCREENWRONG	0x08	/* TxtJamStr has invalidated screen contents */ - -typedef struct txtWin { -    /* Basic text buffer */ -    int bufAlloc;		/* Allocated size of buffer           */ -    int bufSpot;		/* Current writing position in buffer */ -    short *mainBuffer;		/* Main buffer of text                */ - -    /* Line information */ -    int numLines;		/* Number of display lines in buffer */ -    int allocLines;		/* Number of lines allocated 	     */ -    struct txtLine **txtBuffer;	/* Dynamic array of lines    	     */ - -    /* Current Window display information */ -    Window mainWindow;		/* Text display window       */ -    Window scrollBar;		/* Subwindow for scroll bar  */ -    Pixmap arrowMap;		/* line wrap indicator       */ -    int bgPix, fgPix;		/* Background and cursor     */ -    GC CursorGC;		/* gc for the cursor         */ -    GC bgGC;			/* gc for erasing things     */ -    GC fontGC[MAXFONTS];	/* gc for doing fonts        */ -    XFontStruct theFonts[MAXFONTS];/* Display fonts          */ -    int  theColors[MAXFONTS];	/* foregrounds of the fonts  */ -    int  curFont;		/* current font for tracking */ -    int w, h;			/* Current size              */ -    int startLine;		/* Top line in display       */ -    int endLine;		/* Bottom line in display    */ -    int bottomSpace;		/* Space at bottom of screen */ -    int flagWord;		/* If non-zero,  not at end  */ - -    /* For handling ExposeCopy events */ -    int exposeSize;		/* Current size of array      */ -    int exposeAlloc;		/* Allocated size             */ -    struct expEvent **exposeAry;/* Array of line indices      */ - -    /* Drawing position information */ -    int curLine;		/* Current line in buffer    */ -    int curX;			/* Current horizontal positi */ -    int curY;			/* Current vertical drawing  */ -}; - -/* Flags for the various basic character handling functions */ - -#define DODISP		0x01	/* Update the display  */ -#define NONEWLINE	0x02	/* Dont append newline */ - - - -static int InitLine(newLine) -struct txtLine *newLine;	/* Newly created line structure */ -/* - * This routine initializes a newly created line structure. - */ -{ -    newLine->lineLength = 0; -    newLine->lineHeight = 0; -    newLine->lineBaseLine = 0; -    newLine->lineWidth = XPADDING; -    newLine->lineText = NOINDEX; -    newLine->lineFlags = 0; -    return 1; -} - - - - -int TxtGrab(display, txtWin, program, mainFont, bg, fg, cur) -Display *display;		/* display window is on  */ -Window txtWin;			/* Window to take over as scrollable text    */ -char *program;			/* Program name for Xdefaults                */ -XFontStruct *mainFont;		/* Primary text font                         */ -int bg, fg, cur;		/* Background, foreground, and cursor colors */ -/* - * This routine takes control of 'txtWin' and makes it into a scrollable - * text output window.  It will create a sub-window for the scroll bar - * with a background of 'bg' and an bar with color 'fg'.  Both fixed width - * and variable width fonts are supported.  Additional fonts can be loaded - * using 'TxtAddFont'.  Returns 0 if there were problems,  non-zero if - * everything went ok. - */ -{ -    struct txtWin *newWin;	/* Text package specific information */ -    XWindowAttributes winInfo;	/* Window information                */ -    int index; -    XGCValues gc_val; - -    if (textWindows == (XAssocTable *) 0) { -	textWindows = XCreateAssocTable(32); -	if (textWindows == (XAssocTable *) 0) return(0); -    } -    if (XGetWindowAttributes(display, txtWin, &winInfo) == 0) return 0; - -    if (ScrollOption == NOOPTION) { -	/* Read to see if the user wants jump scrolling or not */ -	if (XGetDefault(display, program, "JumpScroll")) { -	    ScrollOption = JUMPSCROLL; -	} else { -	    ScrollOption = NORMSCROLL; -	} -    } - -    /* Initialize local structure */ -    newWin = alloc(struct txtWin); - -    /* Initialize arrow pixmap */ -    newWin->arrowMap = XCreatePixmapFromBitmapData(display, txtWin, -						   arrow_bits, -						   arrow_width, arrow_height, -						   cur, bg, -						   DisplayPlanes(display, 0)); - -    newWin->bufAlloc = INITBUFSIZE; -    newWin->bufSpot = 0; -    newWin->mainBuffer = numalloc(short, INITBUFSIZE); - -    newWin->numLines = 1; -    newWin->allocLines = INITLINES; -    newWin->txtBuffer = numalloc(struct txtLine *, INITLINES); -    for (index = 0;  index < INITLINES;  index++) { -	newWin->txtBuffer[index] = alloc(struct txtLine); -	InitLine(newWin->txtBuffer[index]); -    } - -    /* Window display information */ -    newWin->mainWindow = txtWin; -    newWin->w = winInfo.width; -    newWin->h = winInfo.height; -    newWin->startLine = 0; -    newWin->endLine = 0; -    newWin->bottomSpace = winInfo.height -      - YPADDING - mainFont->ascent - mainFont->descent - INTERLINE; -    newWin->flagWord = 0; -    newWin->bgPix = bg; -    newWin->fgPix = fg; - -    /* Scroll Bar Creation */ -    newWin->scrollBar = XCreateSimpleWindow(display, txtWin, -				      winInfo.width - BARSIZE, -				      0, BARSIZE - (2*BARBORDER), -				      winInfo.height - (2*BARBORDER), -				      BARBORDER, -				      fg, bg); -    XSelectInput(display, newWin->scrollBar, ExposureMask|ButtonReleaseMask); -    XMapRaised(display, newWin->scrollBar); - -    /* Font and Color Initialization */ -    newWin->theFonts[0] = *mainFont; -    newWin->theColors[0] = fg; -    gc_val.function = GXcopy; -    gc_val.plane_mask = AllPlanes; -    gc_val.foreground = fg; -    gc_val.background = bg; -    gc_val.graphics_exposures = 1; -    gc_val.font = mainFont->fid; -    gc_val.line_width = 1; -    gc_val.line_style = LineSolid; - -    newWin->fontGC[0] = XCreateGC(display, txtWin, -				  GCFunction | GCPlaneMask | -				  GCForeground | GCBackground | -				  GCGraphicsExposures | GCFont, -				  &gc_val); - -    gc_val.foreground = cur; -    newWin->CursorGC = XCreateGC(display, txtWin, -				 GCFunction | GCPlaneMask | -				  GCForeground | GCBackground | -				  GCLineStyle | GCLineWidth, -				  &gc_val); - -    gc_val.foreground = bg; -    newWin->bgGC = XCreateGC(display, txtWin, -				  GCFunction | GCPlaneMask | -				  GCForeground | GCBackground | -				  GCGraphicsExposures | GCFont, -				  &gc_val); - - -    for (index = 1;  index < MAXFONTS;  index++) { -	newWin->theFonts[index].fid = 0; -	newWin->fontGC[index] = 0; -    } - - -    /* Initialize size of first line */ -    newWin->txtBuffer[0]->lineHeight = newWin->theFonts[0].ascent + -	newWin->theFonts[0].descent; -    newWin->txtBuffer[0]->lineText = 0; - -    /* ExposeCopy array initialization */ -    newWin->exposeSize = 0; -    newWin->exposeAlloc = INITEXPARY; -    newWin->exposeAry = numalloc(struct expEvent *, INITEXPARY); -    for (index = 0;  index < newWin->exposeAlloc;  index++) -      newWin->exposeAry[index] = alloc(struct expEvent); -    /* Put plus infinity in last slot for sorting purposes */ -    newWin->exposeAry[0]->lineIndex = MAXINT; - -    /* Drawing Position Information */ -    newWin->curLine = 0; -    newWin->curX = 0; -    newWin->curY = YPADDING + mainFont->ascent + mainFont->descent; - -    /* Attach it to both windows */ -    XMakeAssoc(display, textWindows, (XID) txtWin, (caddr_t) newWin); -    XMakeAssoc(display, textWindows, (XID) newWin->scrollBar, (caddr_t) newWin); -    return 1; -} - - -int TxtRelease(display, w) -Display *display; -Window w;			/* Window to release */ -/* - * This routine releases all resources associated with the - * specified window which are consumed by the text - * window package. This includes the entire text buffer,  line start - * array,  and the scroll bar window.  However,  the window - * itself is NOT destroyed.  The routine will return zero if - * the window is not owned by the text window package. - */ -{ -    struct txtWin *textInfo; -    int index; - -    if ((textInfo = (struct txtWin *) XLookUpAssoc(display, -						 textWindows, (XID) w)) == 0) -      return 0; - -    for (index = 0; index < MAXFONTS; index++) -	if (textInfo->fontGC[index] != 0) -	    XFreeGC(display, textInfo->fontGC[index]); - -    free((Generic) textInfo->mainBuffer); -    for (index = 0;  index < textInfo->numLines;  index++) { -	free((Generic) textInfo->txtBuffer[index]); -    } -    free((Generic) textInfo->txtBuffer); -    XDestroyWindow(display, textInfo->scrollBar); -    for (index = 0;  index < textInfo->exposeSize;  index++) { -	free((Generic) textInfo->exposeAry[index]); -    } -    free((Generic) textInfo->exposeAry); -    XDeleteAssoc(display, textWindows, (XID) w); -    free((Generic) textInfo); -    return 1; -} - - - -static int RecompBuffer(textInfo) -struct txtWin *textInfo;	/* Text window information */ -/* - * This routine recomputes all line breaks in a buffer after - * a change in window size or font.  This is done by throwing - * away the old line start array and recomputing it.  Although - * a lot of this work is also done elsewhere,  it has been included - * inline here for efficiency. - */ -{ -    int startPos, endSize, linenum; -    register int index, chsize, curfont; -    register short *bufptr; -    register XFontStruct *fontptr; -    register struct txtLine *lineptr; -    char theChar; - -    /* Record the old position so we can come back to it */ -    for (startPos = textInfo->txtBuffer[textInfo->startLine]->lineText; -	 (startPos > 0) && (textInfo->mainBuffer[startPos] != '\n'); -	 startPos--) -      /* null loop body */; - -    /* Clear out the old line start array */ -    for (index = 0;  index < textInfo->numLines;  index++) { -	InitLine(textInfo->txtBuffer[index]); -    } - -    /* Initialize first line */ -    textInfo->txtBuffer[0]->lineHeight = -	textInfo->theFonts[0].ascent + textInfo->theFonts[0].descent; -    textInfo->txtBuffer[0]->lineText = 0; - -    /* Process the text back into lines */ -    endSize = textInfo->w - BARSIZE - WRAPINDSIZE; -    bufptr = textInfo->mainBuffer; -    lineptr = textInfo->txtBuffer[0]; -    linenum = 0; -    fontptr = &(textInfo->theFonts[0]); -    curfont = 0; -    for (index = 0;  index < textInfo->bufSpot;  index++) { -	theChar = bufptr[index] & CHARMASK; - -	if ((bufptr[index] & FONTMASK) != curfont) { -	    int newFontNum, heightDiff; - -	    /* Switch fonts */ -	    newFontNum = (bufptr[index] & FONTMASK) >> FONTSHIFT; -	    if (textInfo->theFonts[newFontNum].fid != 0) { -		/* Valid font */ -		curfont = bufptr[index] & FONTMASK; -		fontptr = &(textInfo->theFonts[newFontNum]); -		heightDiff = (fontptr->ascent + fontptr->descent) - -		    lineptr->lineHeight; -		if (heightDiff < 0) heightDiff = 0; -		lineptr->lineHeight += heightDiff; -	    } -	} -	if (theChar == '\n') { -	    /* Handle new line */ -	    if (linenum >= textInfo->allocLines-1) -	      /* Expand number of lines */ -	      ExpandLines(textInfo); -	    linenum++; -	    lineptr = textInfo->txtBuffer[linenum]; -	    /* Initialize next line */ -	    lineptr->lineHeight = fontptr->ascent + fontptr->descent; -	    lineptr->lineText = index+1; -	    /* Check to see if its the starting line */ -	    if (index == startPos) textInfo->startLine = linenum; -	} else { -	    /* Handle normal character */ -	    chsize = CharSize(textInfo, linenum, index); -	    if (lineptr->lineWidth + chsize > endSize) { -		/* Handle line wrap */ -		lineptr->lineFlags |= WRAPFLAG; -		if (linenum >= textInfo->allocLines-1) -		  /* Expand number of lines */ -		  ExpandLines(textInfo); -		linenum++; -		lineptr = textInfo->txtBuffer[linenum]; -		/* Initialize next line */ -		lineptr->lineHeight = fontptr->ascent + fontptr->descent; -		lineptr->lineText = index; -		lineptr->lineLength = 1; -		lineptr->lineWidth += chsize; -	    } else { -		/* Handle normal addition of character */ -		lineptr->lineLength += 1; -		lineptr->lineWidth += chsize; -	    } -	} -    } -    /* We now have a valid line array.  Let's clean up some other fields. */ -    textInfo->numLines = linenum+1; -    if (startPos == 0) { -	textInfo->startLine = 0; -    } -    textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -    textInfo->curLine = linenum; -    /* Check to see if we are at the bottom */ -    if (textInfo->endLine >= textInfo->numLines-1) { -	textInfo->curY = textInfo->h - textInfo->bottomSpace - -	  lineptr->lineHeight; -	textInfo->flagWord &= (~NOTATBOTTOM); -    } else { -	textInfo->flagWord |= NOTATBOTTOM; -    } -    return 1; -} - - - - -int TxtAddFont(display, textWin, fontNumber, newFont, newColor) -Display *display; -Window textWin;			/* Scrollable text window  */ -int fontNumber;			/* Place to add font (0-7) */ -XFontStruct *newFont;		/* Font to add             */ -int newColor;			/* Color of font           */ -/* - * This routine loads a new font so that it can be used in a previously - * created text window.  There are eight font slots numbered 0 through 7. - * If there is already a font in the specified slot,  it will be replaced - * and an automatic redraw of the window will take place.  See TxtWriteStr - * for details on using alternate fonts.  The color specifies the foreground - * color of the text.  The default foreground color is used if this - * parameter is TXT_NO_COLOR.  Returns a non-zero value if - * everything went well. - */ -{ -    struct txtWin *textInfo; -    int redrawFlag; -    XGCValues gc_val; - -    if ((fontNumber < 0) || (fontNumber >= MAXFONTS)) return 0; -    if ((textInfo = (struct txtWin *) -	 XLookUpAssoc(display, textWindows, (XID) textWin)) == 0) -      return 0; -    if (newColor == TXT_NO_COLOR) { -	newColor = textInfo->fgPix; -    } - -    gc_val.font = newFont->fid; -    gc_val.foreground = newColor; -    gc_val.background = textInfo->bgPix; -    gc_val.plane_mask = AllPlanes; -    gc_val.graphics_exposures = 1; -    gc_val.function = GXcopy; - -    if (textInfo->fontGC[fontNumber] != 0) -    { -	XChangeGC(display, textInfo->fontGC[fontNumber], -		  GCFont | GCForeground, &gc_val); -    } -    else -	textInfo->fontGC[fontNumber] = XCreateGC(display, textWin, -						 GCFont | -						 GCForeground | -						 GCBackground | -						 GCFunction | -						 GCPlaneMask | -						 GCGraphicsExposures, -						 &gc_val); - - -    redrawFlag = (textInfo->theFonts[fontNumber].fid != 0) && -      (((newFont) && (newFont->fid != textInfo->theFonts[fontNumber].fid)) || -       (newColor != textInfo->theColors[fontNumber])); -    if (newFont) { -	textInfo->theFonts[fontNumber] = *newFont; -    } -    textInfo->theColors[fontNumber] = newColor; - -    if (redrawFlag) { -	RecompBuffer(textInfo); -	XClearWindow(display, textWin); -	TxtRepaint(display, textWin); -    } -    return 1; -} - - - -int TxtWinP(display, w) -Display *display; -Window w; -/* - * Returns a non-zero value if the window has been previously grabbed - * using TxtGrab and 0 if it has not. - */ -{ -    if (XLookUpAssoc(display, textWindows, (XID) w)) -      return(1); -    else return(0); -} - - - -static int FindEndLine(textInfo, botSpace) -struct txtWin *textInfo; -int *botSpace; -/* - * Given the starting line in 'textInfo->startLine',  this routine - * determines the index of the last line that can be drawn given the - * current size of the screen.  If there are not enough lines to - * fill the screen,  the index of the last line will be returned. - * The amount of empty bottom space is returned in 'botSpace'. - */ -{ -    int index, height, lineHeight; - -    height = YPADDING; -    index = textInfo->startLine; -    while (index < textInfo->numLines) { -	lineHeight = textInfo->txtBuffer[index]->lineHeight + INTERLINE; -	if (height + lineHeight > textInfo->h) break; -	height += lineHeight; -	index++; -    } -    if (botSpace) { -	*botSpace = textInfo->h - height; -    } -    return index - 1; -} - - - -static int UpdateScroll(display, textInfo) -Display *display; -struct txtWin *textInfo;	/* Text window information */ -/* - * This routine computes the current extent of the scroll bar - * indicator and repaints the bar with the correct information. - */ -{ -    int top, bottom; - -    if (textInfo->numLines > 1) { -	top = textInfo->startLine * (textInfo->h - 2*BARBORDER) / -	  (textInfo->numLines - 1); -	bottom = textInfo->endLine * (textInfo->h - 2*BARBORDER) / -	  (textInfo->numLines - 1); -    } else { -	top = 0; -	bottom = textInfo->h - (2*BARBORDER); -    } - -    /* Draw it - make sure there is a little padding */ -    if (top == 0) top++; -    if (bottom == textInfo->h-(2*BARBORDER)) bottom--; - -    XFillRectangle(display, textInfo->scrollBar, -		   textInfo->bgGC, -		   0, 0, BARSIZE, top-1); -#ifdef __FreeBSD__ -    XFillRectangle(display, textInfo->scrollBar, -		   DEFAULT_GC, top, BARSIZE - (2*BARBORDER) - 2, -		   BARSIZE, bottom - top); -#else -    XFillRectangle(display, textInfo->scrollBar, -		   DEFAULT_GC, top, BARSIZE - (2*BARBORDER) - 2, -		   bottom - top); -#endif -    XFillRectangle(display, textInfo->scrollBar, DEFAULT_GC, -		   0, bottom+1, BARSIZE, -		   textInfo->h - (2 * BARBORDER) - bottom); - -    return 1; -} - - - - -int TxtClear(display, w) -Display *display; -Window w; -/* - * This routine clears a scrollable text window.  It resets the current - * writing position to the upper left hand corner of the screen. - * NOTE:  THIS ALSO CLEARS THE CONTENTS OF THE TEXT WINDOW BUFFER AND - * RESETS THE SCROLL BAR.  Returns 0 if the window is not a text window. - * This should be used *instead* of XClear. - */ -{ -    struct txtWin *textInfo; -    int index; - -    if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)) == 0) -      return 0; - -    /* Zero out the arrays */ -    textInfo->bufSpot = 0; -    for (index = 0;  index < textInfo->numLines;  index++) { -	InitLine(textInfo->txtBuffer[index]); -    } -    textInfo->txtBuffer[0]->lineHeight = -      textInfo->theFonts[textInfo->curFont].ascent + -	  textInfo->theFonts[textInfo->curFont].descent; - -    textInfo->numLines = 1; -    textInfo->startLine = 0; -    textInfo->endLine = 0; -    textInfo->curLine = 0; -    textInfo->curX = 0; -    textInfo->curY = YPADDING + textInfo->theFonts[textInfo->curFont].ascent -	+ textInfo->theFonts[textInfo->curFont].descent; - -    textInfo->bottomSpace = textInfo->h - YPADDING - -      textInfo->theFonts[textInfo->curFont].ascent - INTERLINE - -	  textInfo->theFonts[textInfo->curFont].descent; -    /* Actually clear the window */ -    XClearWindow(display, w); - -    /* Draw the current cursor */ -    XFillRectangle(display, w, textInfo->CursorGC, -		   XPADDING + CUROFFSET, textInfo->curY, -		   CURSORWIDTH, -		   textInfo->theFonts[textInfo->curFont].ascent + -		   textInfo->theFonts[textInfo->curFont].descent); - -    /* Update the scroll bar */ -    UpdateScroll(display, textInfo); -    return 1; -} - - -static int WarpToBottom(display, textInfo) -Display *display; -struct txtWin *textInfo;	/* Text Information */ -/* - * This routine causes the specified text window to display its - * last screen of information.   It updates the scroll bar - * to the appropriate spot.  The implementation scans backward - * through the buffer to find an appropriate starting spot for - * the window. - */ -{ -    int index, height, lineHeight; - -    index = textInfo->numLines-1; -    height = 0; -    while (index >= 0) { -	lineHeight = textInfo->txtBuffer[index]->lineHeight + INTERLINE; -	if (height + lineHeight > textInfo->h) break; -	height += lineHeight; -	index--; -    } -    textInfo->startLine = index + 1; -    textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -    textInfo->curY = textInfo->h - textInfo->bottomSpace - -      textInfo->txtBuffer[textInfo->endLine]->lineHeight; -    XClearWindow(display, textInfo->mainWindow); -    TxtRepaint(display, textInfo->mainWindow); -    return 1; -} - - - -static int UpdateExposures(display, textInfo) -Display *display; -struct txtWin *textInfo;	/* Text window information */ -/* - * Before a new scrolling action occurs,  the text window package - * must handle all COPYEXPOSE events generated by the last scrolling - * action.  This routine is called to do this.  Foreign events (those - * not handled by TxtFilter) are queued up and replaced on the queue - * after the processing of the exposure events is complete. - */ -{ -#if 0 -    XEvent foreignQueue[MAXFOREIGN]; -    int index, lastItem = 0; - -    while (textInfo->flagWord & COPYEXPOSE) { -	XNextEvent(display, &(foreignQueue[lastItem])); -	if (!TxtFilter(display, &(foreignQueue[lastItem]))) -	  lastItem++; -	if (lastItem >= MAXFOREIGN) { -	    printf("Too many foreign events to queue!\n"); -	    textInfo->flagWord &= (~COPYEXPOSE); -	} -    } -    for (index = 0;  index < lastItem;  index++) { -	XPutBackEvent(display, &(foreignQueue[index])); -    } -#endif -    return 1; -} - - -static int ScrollDown(display,textInfo) -Display *display; -struct txtWin *textInfo;	/* Text window information */ -/* - * This routine scrolls the indicated text window down by one - * line.  The line below the current line must exist.  The window - * is scrolled so that the line below the last line is fully - * displayed.  This may cause many lines to scroll off the top. - * Scrolling is done using XCopyArea.  The exposure events should - * be caught using ExposeCopy. - */ -{ -    int lineSum, index, targetSpace, freeSpace, updateFlag; - -    lineSum = 0; -    if (textInfo->endLine + 1 >= textInfo->numLines) return 0; -    targetSpace = textInfo->txtBuffer[textInfo->endLine+1]->lineHeight + -      INTERLINE; -    if (textInfo->bottomSpace < targetSpace) { -	index = textInfo->startLine; -	while (index < textInfo->endLine) { -	    lineSum += (textInfo->txtBuffer[index]->lineHeight + INTERLINE); -	    if (textInfo->bottomSpace + lineSum >= targetSpace) break; -	    index++; -	} - -	/* Must move upward by 'lineSum' pixels */ -	XCopyArea(display, textInfo->mainWindow, textInfo->mainWindow, -		  DEFAULT_GC, 0, lineSum, -		  textInfo->w - BARSIZE, textInfo->h, -		  0, 0); - -	textInfo->flagWord |= COPYEXPOSE; -	/* Repair the damage to the structures */ -	textInfo->startLine = index + 1; -	updateFlag = 1; -    } else { -	updateFlag = 0; -    } -    /* More lines might be able to fit.  Let's check. */ -    freeSpace = textInfo->bottomSpace + lineSum - targetSpace; -    index = textInfo->endLine + 1; -    while (index < textInfo->numLines-1) { -	if (freeSpace - textInfo->txtBuffer[index+1]->lineHeight - INTERLINE < 0) -	  break; -	freeSpace -= (textInfo->txtBuffer[index+1]->lineHeight + INTERLINE); -	index++; -    } -    textInfo->endLine = index; -    textInfo->bottomSpace = freeSpace; -    if (updateFlag) { -	UpdateExposures(display, textInfo); -    } -    UpdateScroll(display, textInfo); -    return 1; -} - - - - -static int ExpandLines(textInfo) -struct txtWin *textInfo;	/* Text Information */ -/* - * This routine allocates and initializes additional space in - * the line start array (txtBuffer).  The new space - * is allocated using realloc.  The expansion factor is a percentage - * given by EXPANDPERCENT. - */ -{ -    int newSize, index; - -    newSize = textInfo->allocLines; -    newSize += (newSize * EXPANDPERCENT) / 100; - -    textInfo->txtBuffer = (struct txtLine **) -      realloc((char *) textInfo->txtBuffer, -	      (unsigned) (newSize * sizeof(struct txtLine *))); -    for (index = textInfo->allocLines;  index < newSize;  index++) { -	textInfo->txtBuffer[index] = alloc(struct txtLine); -	InitLine(textInfo->txtBuffer[index]); -    } -    textInfo->allocLines = newSize; -    return 1; -} - -static int ExpandBuffer(textInfo) -struct txtWin *textInfo;	/* Text information */ -/* - * Expands the basic character buffer using realloc.  The expansion - * factor is a percentage given by EXPANDPERCENT. - */ -{ -    int newSize; - -    newSize = textInfo->bufAlloc + (textInfo->bufAlloc * EXPANDPERCENT) / 100; -    textInfo->mainBuffer = (short *) -      realloc((char *) textInfo->mainBuffer, (unsigned) newSize * sizeof(short)); -    textInfo->bufAlloc = newSize; -    return 1; -} - - - -static int HandleNewLine(display, textInfo, flagWord) -Display *display; -struct txtWin *textInfo;	/* Text Information            */ -int flagWord;			/* DODISP or NONEWLINE or both */ -/* - * This routine initializes the next line for drawing by setting - * its height to the current font height,  scrolls the screen down - * one line,  and updates the current drawing position to the - * left edge of the newly cleared line.  If DODISP is specified, - * the screen will be updated (otherwise not).  If NONEWLINE is - * specified,  no newline character will be added to the text buffer - * (this is for line wrap). - */ -{ -    struct txtLine *curLine, *nextLine; - -    /* Check to see if a new line must be allocated */ -    if (textInfo->curLine >= textInfo->allocLines-1) -      /* Expand the number of lines */ -      ExpandLines(textInfo); -    textInfo->numLines += 1; - -    /* Then we initialize the next line */ -    nextLine = textInfo->txtBuffer[textInfo->numLines-1]; -    nextLine->lineHeight = -	textInfo->theFonts[textInfo->curFont].ascent + -	    textInfo->theFonts[textInfo->curFont].descent; - -    curLine = textInfo->txtBuffer[textInfo->curLine]; -    if (flagWord & DODISP) { -	/* Scroll down a line if required */ -	if ((textInfo->curY + curLine->lineHeight + -	     nextLine->lineHeight + (INTERLINE * 2)) > textInfo->h) -	  { -	      ScrollDown(display, textInfo); -	  } -	else -	  { -	      /* Update the bottom space appropriately */ -	      textInfo->bottomSpace -= (nextLine->lineHeight + INTERLINE); -	      textInfo->endLine += 1; -	  } -	/* Update drawing position */ -	textInfo->curY = textInfo->h - -	  (textInfo->bottomSpace  + nextLine->lineHeight); -    } - -    /* Move down a line */ -    textInfo->curLine += 1; -    if (!(flagWord & NONEWLINE)) { -	/* Append end-of-line to text buffer */ -	if (textInfo->bufSpot >= textInfo->bufAlloc) { -	    /* Allocate more space in main text buffer */ -	    ExpandBuffer(textInfo); -	} -	textInfo->mainBuffer[(textInfo->bufSpot)++] = -	  (textInfo->curFont << FONTSHIFT) | '\n'; -    } -    nextLine->lineText = textInfo->bufSpot; -    textInfo->curX = 0; -    return 1; -} - - - -static int CharSize(textInfo, lineNum, charNum) -struct txtWin *textInfo;	/* Current Text Information */ -int lineNum;			/* Line in buffer           */ -int charNum;			/* Character in line        */ -/* - * This routine determines the size of the specified character. - * It takes in account the font of the character and whether its - * fixed or variable.  The size includes INTERSPACE spacing between - * the characters. - */ -{ -    register XFontStruct *charFont; -    register short *theLine; -    register short theChar; - -    theLine = &(textInfo->mainBuffer[textInfo->txtBuffer[lineNum]->lineText]); -    theChar = theLine[charNum] & CHARMASK; -    charFont = &(textInfo->theFonts[(theChar & FONTMASK) >> FONTSHIFT]); -    if (theChar <= charFont->min_char_or_byte2 || -	theChar >= charFont->max_char_or_byte2 || -	charFont->per_char == 0) -	return  charFont->max_bounds.width + 1; -    else -	return charFont->per_char[theChar].width + 1; -} - - - - - -static int HandleBackspace(display, textInfo, flagWord) -Display *display; -struct txtWin *textInfo;	/* Text Information  */ -int flagWord;			/* DODISP or nothing */ -/* - * This routine handles a backspace found in the input stream.  The - * character before the current writing position will be erased and - * the drawing position will move back one character.  If the writing - * position is at the left margin,  the drawing position will move - * up to the previous line.  If it is a line that has been wrapped, - * the character at the end of the previous line will be erased. - */ -{ -    struct txtLine *thisLine, *prevLine; -    int chSize; - -    thisLine = textInfo->txtBuffer[textInfo->curLine]; -    /* First,  determine whether we need to go back a line */ -    if (thisLine->lineLength == 0) { -	/* Bleep if at top of buffer */ -	if (textInfo->curLine == 0) { -	    XBell(display, 50); -	    return 0; -	} - -	/* See if we have to scroll in the other direction */ -	if ((flagWord & DODISP) && (textInfo->curY <= YPADDING)) { -	    /* This will display the last lines of the buffer */ -	    WarpToBottom(display, textInfo); -	} - -	/* Set drawing position at end of previous line */ -	textInfo->curLine -= 1; -	prevLine = textInfo->txtBuffer[textInfo->curLine]; -	textInfo->numLines -= 1; -	if (flagWord & DODISP) { -	    textInfo->curY -= (prevLine->lineHeight + INTERLINE); -	    textInfo->bottomSpace += (thisLine->lineHeight + INTERLINE); -	    textInfo->endLine -= 1; -	} - -	/* We are unlinewrapping if the previous line has flag set */ -	if (prevLine->lineFlags & WRAPFLAG) { -	    /* Get rid of line wrap indicator */ -	    if (flagWord & DODISP) { -		XFillRectangle(display, textInfo->mainWindow, -			       textInfo->bgGC, -			       textInfo->w - BARSIZE - WRAPINDSIZE, -			       textInfo->curY,  WRAPINDSIZE, -			       prevLine->lineHeight); -	    } -	    prevLine->lineFlags &= (~WRAPFLAG); -	    /* Call recursively to wipe out the ending character */ -	    HandleBackspace(display, textInfo, flagWord); -	} else { -	    /* Delete the end-of-line in the primary buffer */ -	    textInfo->bufSpot -= 1; -	} -    } else { -	/* Normal deletion of character */ -	chSize = -	  CharSize(textInfo, textInfo->curLine, -		   textInfo->txtBuffer[textInfo->curLine]->lineLength - 1); -	/* Move back appropriate amount and wipe it out */ -	thisLine->lineWidth -= chSize; -	if (flagWord & DODISP) { -	    XFillRectangle(display, textInfo->mainWindow, -			   textInfo->bgGC, -			   thisLine->lineWidth, textInfo->curY, -			   chSize, thisLine->lineHeight); -	} -	/* Delete from buffer */ -	textInfo->txtBuffer[textInfo->curLine]->lineLength -= 1; -	textInfo->bufSpot -= 1; -    } -    return 1; -} - - - -static int DrawLineWrap(display, win, x, y, h, col) -Display *display; -Window win;			/* What window to draw it in     */ -int x, y;			/* Position of upper left corner */ -int h;				/* Height of indicator           */ -int col;			/* Color of indicator            */ -/* - * This routine draws a line wrap indicator at the end of a line. - * Visually,  it is an arrow of the specified height directly against - * the scroll bar border.  The bitmap used for the arrow is stored - * in 'arrowMap' with size 'arrow_width' and 'arrow_height'. - */ -{ -    struct txtWin *textInfo; - -    textInfo = (struct txtWin *)XLookUpAssoc(display, textWindows, -					     (XID) win); - -    /* First,  draw the arrow */ -#ifdef __FreeBSD__ -    XCopyArea(display, textInfo->arrowMap, textInfo->mainWindow, -	       textInfo->CursorGC, -	       0, 0, arrow_width, arrow_height, -	       x, y + h - arrow_height); -#else -    XCopyArea(display, textInfo->arrowMap, textInfo->mainWindow, -	       textInfo->CursorGC, -	       0, 0, arrow_width, arrow_height, -	       x, y + h - arrow_height, 1); -#endif - -    /* Then draw the stem */ -    XDrawLine(display, textInfo->mainWindow, textInfo->CursorGC, -	      x + STEMOFFSET, y, -	      x + STEMOFFSET, y + h - arrow_height); -    return 1; -} - - - - -static int DrawLine(display, textInfo, lineIndex, ypos) -Display *display; -struct txtWin *textInfo;	/* Text window information   */ -int lineIndex;			/* Index of line to draw     */ -int ypos;			/* Y position for line       */ -/* - * This routine destructively draws the indicated line in the - * indicated window at the indicated position.  It does not - * clear to end of line however.  It draws a line wrap indicator - * if needed but does not draw a cursor. - */ -{ -    int index, startPos, curFont, theColor, curX, saveX, fontIndex; -    struct txtLine *someLine; -    char lineBuffer[BUFSIZE], *glyph; -    short *linePointer; -    XFontStruct *theFont; -    XGCValues gc; - -    /* First,  we draw the text */ -    index = 0; -    curX = XPADDING; -    someLine = textInfo->txtBuffer[lineIndex]; -    linePointer = &(textInfo->mainBuffer[someLine->lineText]); -    while (index < someLine->lineLength) { -	startPos = index; -	saveX = curX; -	curFont = linePointer[index] & FONTMASK; -	fontIndex = curFont >> FONTSHIFT; -	theFont = &(textInfo->theFonts[fontIndex]); -	theColor = textInfo->theColors[fontIndex]; -	glyph = &(lineBuffer[0]); -	while ((index < someLine->lineLength) && -	       ((linePointer[index] & FONTMASK) == curFont)) -	{ -	    *glyph = linePointer[index] & CHARMASK; -	    index++; -	    curX += CharSize(textInfo, lineIndex, index); -	    glyph++; -	} - -	/* Flush out the glyphs */ -	XFillRectangle(display, textInfo->mainWindow, -		       textInfo->bgGC, -		       saveX, ypos, -		   textInfo->w - BARSIZE, -		   someLine->lineHeight + YPADDING + INTERLINE); - -	XDrawString(display, textInfo->mainWindow, -		    textInfo->fontGC[fontIndex], -		    saveX, ypos, -		    lineBuffer, someLine->lineLength); -    } -    /* Then the line wrap indicator (if needed) */ -    if (someLine->lineFlags & WRAPFLAG) { -	DrawLineWrap(display, textInfo->mainWindow, -		     textInfo->w - BARSIZE - WRAPINDSIZE, -		     ypos, someLine->lineHeight, -		     textInfo->fgPix); -    } -    return 1; -} - - - - -static int HandleNewFont(display, fontNum, textInfo, flagWord) -Display *display; -int fontNum;			/* Font number       */ -struct txtWin *textInfo;	/* Text information  */ -int flagWord;			/* DODISP or nothing */ -/* - * This routine handles a new font request.  These requests take - * the form "^F<digit>".  The parsing is done in TxtWriteStr. - * This routine is called only if the form is valid.  It may return - * a failure (0 status) if the requested font is not loaded. - * If the new font is larger than any of the current - * fonts on the line,  it will change the line height and redisplay - * the line. - */ -{ -    struct txtLine *thisLine; -    int heightDiff, baseDiff, redrawFlag; - -    if (textInfo->theFonts[fontNum].fid == 0) { -	return 0; -    } else { -	thisLine = textInfo->txtBuffer[textInfo->curLine]; -	textInfo->curFont = fontNum; -	redrawFlag = 0; -	heightDiff = textInfo->theFonts[fontNum].ascent + -	    textInfo->theFonts[fontNum].descent - -		thisLine->lineHeight; - -	if (heightDiff > 0) { -	    redrawFlag = 1; -	} else { -	    heightDiff = 0; -	} - -	if (redrawFlag) { -	    if (flagWord & DODISP) { -		/* Clear current line */ -		XFillRectangle(display, textInfo->mainWindow, -			       textInfo->bgGC, -			       0, textInfo->curY, textInfo->w, -			       thisLine->lineHeight); - -		/* Check to see if it requires scrolling */ -		if ((textInfo->curY + thisLine->lineHeight + heightDiff + -		     INTERLINE) > textInfo->h) -		  { -		      /* -		       * General approach:  "unscroll" the last line up -		       * and then call ScrollDown to do the right thing. -		       */ -		      textInfo->endLine -= 1; -		      textInfo->bottomSpace += thisLine->lineHeight + -			  INTERLINE; - -		      XFillRectangle(display, textInfo->mainWindow, -				     textInfo->bgGC, -				     0, textInfo->h - textInfo->bottomSpace, -				     textInfo->w, textInfo->bottomSpace); - -		      thisLine->lineHeight += heightDiff; -		      ScrollDown(display, textInfo); -		      textInfo->curY = textInfo->h - -			(textInfo->bottomSpace + INTERLINE + -			 thisLine->lineHeight); -		  } -		else -		  { -		      /* Just update bottom space */ -		      textInfo->bottomSpace -= heightDiff; -		      thisLine->lineHeight += heightDiff; -		  } -		/* Redraw the current line */ -		DrawLine(display, textInfo, textInfo->curLine, textInfo->curY); -	    } else { -		/* Just update line height */ -		thisLine->lineHeight += heightDiff; -	    } -	} -	return 1; -    } -} - - - -int TxtWriteStr(display, w, str) -Display *display; -Window w;			/* Text window            */ -register char *str;		/* 0 terminated string */ -/* - * This routine writes a string to the specified text window. - * The following notes apply: - *   - Text is always appended to the end of the text buffer. - *   - If the scroll bar is positioned such that the end of the - *     text is not visible,  an automatic scroll to the bottom - *     will be done before the appending of text. - *   - Non-printable ASCII characters are not displayed. - *   - The '\n' character causes the current text position to - *     advance one line and start at the left. - *   - Tabs are not supported. - *   - Lines too long for the screen will be wrapped and a line wrap - *     indication will be drawn. - *   - Backspace clears the previous character.  It will do the right - *     thing if asked to backspace past a wrapped line. - *   - A new font can be chosen using the sequence '^F<digit>' where - *     <digit> is 0-7.  The directive will be ignored if - *     there is no font in the specified slot. - * Returns 0 if something went wrong. - */ -{ -    register int fontIndex; -    register struct txtWin *textInfo; -    register struct txtLine *thisLine; - -    if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)) == 0) -      return 0; - -    /* See if screen needs to be updated */ -    if (textInfo->flagWord & SCREENWRONG) { -	TxtRepaint(display, textInfo->mainWindow); -    } - -    /* See if we have to scroll down to the bottom */ -    if (textInfo->flagWord & NOTATBOTTOM) { -	WarpToBottom(display, textInfo); -	textInfo->flagWord &= (~NOTATBOTTOM); -    } - -    /* Undraw the current cursor */ -    thisLine = textInfo->txtBuffer[textInfo->curLine]; - -    XFillRectangle(display, w, textInfo->bgGC, -	    thisLine->lineWidth + CUROFFSET, -	    textInfo->curY, -	    CURSORWIDTH, -	    thisLine->lineHeight); - -    for ( /* str is ok */ ; (*str != 0) ; str++) { -	/* Check to see if we are waiting on a font */ -	if (textInfo->flagWord & FONTNUMWAIT) { -	    textInfo->flagWord &= (~FONTNUMWAIT); -	    fontIndex = *str - '0'; -	    if ((fontIndex >= 0) && (fontIndex < MAXFONTS)) { -		/* Handle font -- go get next character */ -		if (HandleNewFont(display, fontIndex, textInfo, DODISP)) -		    continue; -	    } -	} - -	/* Inline code for handling normal character case */ -	if ((*str >= LOWCHAR) && (*str <= HIGHCHAR)) { -	    register XFontStruct *thisFont; -	    register struct txtLine *thisLine; -	    register int charWidth; -	    int thisColor; - -	    /* Determine size of character */ -	    thisFont = &(textInfo->theFonts[textInfo->curFont]); -	    thisColor = textInfo->theColors[textInfo->curFont]; -	    if (*str <= thisFont->min_char_or_byte2 || -		*str >= thisFont->max_char_or_byte2 || -		thisFont->per_char == 0) -		charWidth = thisFont->max_bounds.width + 1; -	    else -		charWidth = thisFont->per_char[*str].width + 1; - -	    /* Check to see if line wrap is required */ -	    thisLine = textInfo->txtBuffer[textInfo->curLine]; -	    if (thisLine->lineWidth + charWidth > -		(textInfo->w-BARSIZE-WRAPINDSIZE)) -	      { -		  DrawLineWrap(display, textInfo->mainWindow, -			       textInfo->w-BARSIZE-WRAPINDSIZE, -			       textInfo->curY, thisLine->lineHeight, -			       textInfo->fgPix); -		  thisLine->lineFlags |= WRAPFLAG; -		  /* Handle the spacing problem the same way as a newline */ -		  HandleNewLine(display, textInfo, DODISP | NONEWLINE); -		  thisLine = textInfo->txtBuffer[textInfo->curLine]; -	      } - -	    /* Ready to draw character */ -	    XDrawString(display, textInfo->mainWindow, -			DEFAULT_GC, -			textInfo->curX += charWidth, -			textInfo->curY + thisLine->lineHeight, -			str, 1); - -	    /* Append character onto main buffer */ -	    if (textInfo->bufSpot >= textInfo->bufAlloc) -	      /* Make room for more characters */ -	      ExpandBuffer(textInfo); -	    textInfo->mainBuffer[(textInfo->bufSpot)++] = -	      (textInfo->curFont << FONTSHIFT) | (*str); - -	    /* Update the line start array */ -	    thisLine->lineLength += 1; -	    thisLine->lineWidth += charWidth; -	} else if (*str == NEWLINE) { -	    HandleNewLine(display, textInfo, DODISP); -	} else if (*str == NEWFONT) { -	    /* Go into waiting for font number mode */ -	    textInfo->flagWord |= FONTNUMWAIT; -	} else if (*str == BACKSPACE) { -	    HandleBackspace(display, textInfo, DODISP); -	} else { -	    /* Ignore all others */ -	} -    } -    /* Draw the cursor in its new position */ -    thisLine = textInfo->txtBuffer[textInfo->curLine]; - -    XFillRectangle(display, w, textInfo->CursorGC, -	    thisLine->lineWidth + CUROFFSET, -	    textInfo->curY /* + thisLine->lineHeight */, -	    CURSORWIDTH, thisLine->lineHeight); - -    return 1; -} - - - -int TxtJamStr(display, w, str) -Display *display; -Window w;			/* Text window            */ -register char *str;		/* NULL terminated string */ -/* - * This is the same as TxtWriteStr except the screen is NOT updated. - * After a call to this routine,  TxtRepaint should be called to - * update the screen.  This routine is meant to be used to load - * a text buffer with information and then allow the user to - * scroll through it at will. - */ -{ -    register int fontIndex; -    register struct txtWin *textInfo; - -    if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w) -	 ) == 0) -      return 0; - -    for ( /* str is ok */ ; (*str != 0) ; str++) { -	/* Check to see if we are waiting on a font */ -	if (textInfo->flagWord & FONTNUMWAIT) { -	    textInfo->flagWord &= (~FONTNUMWAIT); -	    fontIndex = *str - '0'; -	    if ((fontIndex >= 0) && (fontIndex < MAXFONTS)) { -		if (HandleNewFont(display, fontIndex, textInfo, 0)) { -		    /* Handled font -- go get next character */ -		    continue; -		} -	    } -	} -	/* Inline code for handling normal character case */ -	if ((*str >= LOWCHAR) && (*str <= HIGHCHAR)) { -	    register XFontStruct *thisFont; -	    register struct txtLine *thisLine; -	    register int charWidth; - -	    /* Determine size of character */ -	    thisFont = &(textInfo->theFonts[textInfo->curFont]); - -	    if (*str <= thisFont->min_char_or_byte2 || -		*str >= thisFont->max_char_or_byte2 || -		thisFont->per_char == 0) -		charWidth = thisFont->max_bounds.width + 1; -	    else -		charWidth = thisFont->per_char[*str].width + 1; - -	    /* Check to see if line wrap is required */ -	    thisLine = textInfo->txtBuffer[textInfo->curLine]; -	    if (thisLine->lineWidth + charWidth > -		(textInfo->w-BARSIZE-WRAPINDSIZE)) -	      { -		  thisLine->lineFlags |= WRAPFLAG; -		  /* Handle the spacing problem the same way as a newline */ -		  HandleNewLine(display, textInfo, NONEWLINE); -		  thisLine = textInfo->txtBuffer[textInfo->curLine]; -	      } -	    /* Append character onto main buffer */ -	    if (textInfo->bufSpot >= textInfo->bufAlloc) -	      /* Make room for more characters */ -	      ExpandBuffer(textInfo); -	    textInfo->mainBuffer[(textInfo->bufSpot)++] = -	      (textInfo->curFont << FONTSHIFT) | (*str); - -	    /* Update the line start array */ -	    thisLine->lineLength += 1; -	    thisLine->lineWidth += charWidth; -	} else if (*str == NEWLINE) { -	    HandleNewLine(display, textInfo, 0); -	} else if (*str == NEWFONT) { -	    /* Go into waiting for font number mode */ -	    textInfo->flagWord |= FONTNUMWAIT; -	} else if (*str == BACKSPACE) { -	    HandleBackspace(display, textInfo, 0); -	} else { -	    /* Ignore all others */ -	} -    } -    textInfo->flagWord |= SCREENWRONG; -    return 1; -} - - - -int TxtRepaint(display,w) -Display *display; -Window w; -/* - * Repaints the given scrollable text window.  The routine repaints - * the entire window.  For handling exposure events,  the TxtFilter - * routine should be used. - */ -{ -    struct txtWin *textInfo; -    int index, ypos; - -    if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w) -	 ) == 0) -      return 0; - -    /* Check to see if the screen is up to date */ -    if (textInfo->flagWord & SCREENWRONG) { -	textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -	textInfo->flagWord &= (~SCREENWRONG); -    } - -    ypos = YPADDING; -    index = textInfo->startLine; -    for (;;) { -	DrawLine(display, textInfo, index, ypos); -	if (index >= textInfo->endLine) break; -	ypos += (textInfo->txtBuffer[index]->lineHeight + INTERLINE); -	index++; -    } -    /* Draw the cursor (if on screen) */ -    if (textInfo->endLine == textInfo->curLine) { -	XFillRectangle(display, w, textInfo->CursorGC, -		       textInfo->txtBuffer[index]->lineWidth + CUROFFSET, -		       ypos /* + textInfo->txtBuffer[index]->lineHeight */, -		       CURSORWIDTH, textInfo->txtBuffer[index]->lineHeight); - -    } -    /* Update the scroll bar */ -    UpdateScroll(display, textInfo); -    return 1; -} - - - -static int InsertIndex(textInfo, thisIndex, ypos) -struct txtWin *textInfo;	/* Text Window Information    */ -int thisIndex;			/* Line index of exposed line */ -int ypos;			/* Drawing position of line   */ -/* - * This routine inserts the supplied line index into the copy - * exposure array for 'textInfo'.  The array is kept sorted - * from lowest to highest using insertion sort.  The array - * is dynamically expanded if needed. - */ -{ -    struct expEvent *newItem; -    int newSize, index, downIndex; - -    /* Check to see if we need to expand it */ -    if ((textInfo->exposeSize + 3) >= textInfo->exposeAlloc) { -	newSize = textInfo->exposeAlloc + -	  (textInfo->exposeAlloc * EXPANDPERCENT / 100); -	textInfo->exposeAry = (struct expEvent **) -	  realloc((char *) textInfo->exposeAry, -		  (unsigned) (newSize * sizeof(struct expEvent *))); -	for (index = textInfo->exposeAlloc;  index < newSize;  index++) -	  textInfo->exposeAry[index] = alloc(struct expEvent); -	textInfo->exposeAlloc = newSize; -    } -    /* Find spot for insertion.  NOTE: last spot has big number */ -    for (index = 0;  index <= textInfo->exposeSize;  index++) { -	if (textInfo->exposeAry[index]->lineIndex >= thisIndex) { -	    if (textInfo->exposeAry[index]->lineIndex > thisIndex) { -		/* Insert before this entry */ -		newItem = textInfo->exposeAry[textInfo->exposeSize+1]; -		for (downIndex = textInfo->exposeSize; -		     downIndex >= index; -		     downIndex--) -		  { -		      textInfo->exposeAry[downIndex+1] = -			textInfo->exposeAry[downIndex]; -		  } -		/* Put a free structure at this spot */ -		textInfo->exposeAry[index] = newItem; -		/* Fill it in */ -		textInfo->exposeAry[index]->lineIndex = thisIndex; -		textInfo->exposeAry[index]->ypos = ypos; -		/* Break out of loop */ -		textInfo->exposeSize += 1; -	    } -	    break; -	} -    } -    return 1; -} - - - -static int ScrollUp(display, textInfo) -Display *display; -struct txtWin *textInfo;	/* Text window information   */ -/* - * This routine scrolls the indicated text window up by one - * line.  The line above the current line must exist.  The - * window is scrolled so that the line above the start line - * is displayed at the top of the screen.  This may cause - * many lines to scroll off the bottom.  The scrolling is - * done using XCopyArea.  The exposure events should be caught - * by ExposeCopy. - */ -{ -    int targetSpace; - -    /* Make sure all exposures have been handled by now */ -    if (textInfo->startLine == 0) return 0; -    targetSpace = textInfo->txtBuffer[textInfo->startLine-1]->lineHeight + -      INTERLINE; -    /* Move the area downward by the target amount */ -    XCopyArea(display, textInfo->mainWindow, textInfo->mainWindow, -	      DEFAULT_GC, -	      0, YPADDING, textInfo->w - BARSIZE, -	      textInfo->h, 0, targetSpace); - -    textInfo->flagWord |= COPYEXPOSE; -    /* Update the text window parameters */ -    textInfo->startLine -= 1; -    textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); - -    /* Clear out bottom space region */ -#ifdef __FreeBSD__ -    XClearArea(display, textInfo->mainWindow, -	       0, textInfo->h - textInfo->bottomSpace, -	       textInfo->w, textInfo->bottomSpace, 1); -#else -    XClearArea(display, textInfo->mainWindow, -	       0, textInfo->h - textInfo->bottomSpace, -	       textInfo->w, textInfo->bottomSpace); -#endif - -    UpdateExposures(display, textInfo); -    UpdateScroll(display, textInfo); - -    return 1; -} - - -static int ScrollToSpot(display, textInfo, ySpot) -Display *display; -struct txtWin *textInfo;	/* Text window information          */ -int ySpot;			/* Button position in scroll window */ -/* - * This routine scrolls the specified text window relative to the - * position of the mouse in the scroll bar.  The center of the screen - * will be positioned to correspond to the mouse position. - */ -{ -    int targetLine, aboveLines; - -    targetLine = textInfo->numLines * ySpot / textInfo->h; -    textInfo->startLine = targetLine; -    textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -    aboveLines = 0; -    /* Make the target line the *center* of the window */ -    while ((textInfo->startLine > 0) && -	   (aboveLines < textInfo->endLine - targetLine)) -      { -	  textInfo->startLine -= 1; -	  textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -	  aboveLines++; -      } -    if (textInfo->endLine == textInfo->numLines-1) { -	WarpToBottom(display, textInfo); -    } else { -	XClearWindow(display, textInfo->mainWindow); -	TxtRepaint(display, textInfo->mainWindow); -    } -    return 1; -} - - - -static int LineToTop(display, textInfo, pos) -Display *display; -struct txtWin *textInfo;	/* Text window information */ -int pos;			/* Y position of mouse     */ -/* - * This routine scrolls the screen down until the line at the - * mouse position is at the top of the screen.  It stops - * if it can't scroll the buffer down that far.  If the - * global 'ScrollOption' is NORMSCROLL,  a smooth scroll - * is used.  Otherwise,  it jumps to the right position - * and repaints the screen. - */ -{ -    int index, sum; - -    /* First,  we find the current line */ -    sum = 0; -    for (index = textInfo->startLine;  index <= textInfo->endLine;  index++) { -	if (sum + textInfo->txtBuffer[index]->lineHeight + INTERLINE> pos) break; -	sum += textInfo->txtBuffer[index]->lineHeight + INTERLINE; -    } -    /* We always want to scroll down at least one line */ -    if (index == textInfo->startLine) index++; -    if (ScrollOption == NORMSCROLL) { -	/* Scroll down until 'index' is the starting line */ -	while ((textInfo->startLine < index) && ScrollDown(display, textInfo)) -	{ -	    /* Empty Loop Body */ -	} -    } else { -	/* Immediately jump to correct spot */ -	textInfo->startLine = index; -	textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -	if (textInfo->endLine == textInfo->numLines-1) { -	    WarpToBottom(display, textInfo); -	} else { -	    XClearWindow(display, textInfo->mainWindow); -	    TxtRepaint(display, textInfo->mainWindow); -	} -    } -    /* Check to see if at end of buffer */ -    if (textInfo->endLine >= textInfo->numLines-1) { -	textInfo->flagWord &= (~NOTATBOTTOM); -    } -    return 1; -} - - - -static int TopToHere(display, textInfo, pos) -Display *display; -struct txtWin *textInfo;	/* Text window information */ -int pos;			/* Y position of mouse     */ -/* - * This routine scrolls the screen up until the top line of - * the screen is at the current Y position of the mouse.  Again, - * it will stop if it can't scroll that far.  If the global - * 'ScrollOption' is NORMSCROLL,  a smooth scroll is used. - * If it's not,  it will simply redraw the screen at the - * correct spot. - */ -{ -    int sum, target, linesup, index; - -    target = pos - textInfo->txtBuffer[textInfo->startLine]->lineHeight; -    /* We always want to scroll up at least one line */ -    if (target <= 0) target = 1; -    sum = 0; -    linesup = 0; -    /* Check to see if we are at the top anyway */ -    if (textInfo->startLine == 0) return 0; -    if (ScrollOption == NORMSCROLL) { -	/* Scroll up until sum of new top lines greater than target */ -	while ((sum < target) && ScrollUp(display, textInfo)) { -	    sum += textInfo->txtBuffer[textInfo->startLine]->lineHeight; -	    linesup++; -	} -    } else { -	/* Search backward to find index */ -	index = textInfo->startLine - 1; -	while ((index > 0) && (sum < target)) { -	    sum += textInfo->txtBuffer[index]->lineHeight; -	    linesup++; -	    index--; -	} -	/* Go directly to the index */ -	textInfo->startLine = index; -	textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -	XClearWindow(display, textInfo->mainWindow); -	TxtRepaint(display, textInfo->mainWindow); -    } -    /* If we scrolled,  assert we are not at bottom of buffer */ -    if (linesup > 0) { -	textInfo->flagWord |= NOTATBOTTOM; -    } -    return 1; -} - - - -int TxtFilter(display, evt) -Display *display; -XEvent *evt; -/* - * This routine handles events associated with scrollable text windows. - * It will handle all exposure events and any button released events - * in the scroll bar of a text window.  It does NOT handle any other - * events.  If it cannot handle the event,  it will return 0. - */ -{ -    XExposeEvent *expose = &evt->xexpose; -    XButtonEvent *btEvt = &evt->xbutton; -    XGraphicsExposeEvent *gexpose = &evt->xgraphicsexpose; -    XNoExposeEvent *noexpose = &evt->xnoexpose; -    struct txtWin *textInfo; -    int index, ypos; -    Window w, sw; - -    if (textWindows == (XAssocTable *) 0) { -	textWindows = XCreateAssocTable(32); -	if (textWindows == (XAssocTable *) 0) return(0); -    } -    if (evt->type == Expose) { -	w = expose->window; -	sw = 0; -    } -    else if (evt->type == GraphicsExpose) { -	w = gexpose->drawable; -	sw = 0; -    } -    else if (evt->type == NoExpose) { -	w = noexpose->drawable; -	sw = 0; -    } -    else if (evt->type == ButtonRelease) { -	w = btEvt->window; -	sw = btEvt->subwindow; -    } -    else -	return 0; - -    if ((textInfo = (struct txtWin *) -	 XLookUpAssoc(display, textWindows, (XID) w)) == 0) -	return 0; - -    /* Determine whether it's main window or not */ -    if ((w == textInfo->mainWindow) && (sw == 0)) { -	/* Main Window - handle exposures */ -	switch (evt->type) { -	case Expose: -	    ypos = 0 /*YPADDING*/; -	    for (index = textInfo->startLine; -		 index <= textInfo->endLine; -		 index++) -	      { -		  int lh = textInfo->txtBuffer[index]->lineHeight; - -		  if (((ypos + lh) >= expose->y) && -		      (ypos <= (expose->y + expose->height))) -		    { -			/* Intersection region */ -			/* Draw line immediately */ -			DrawLine(display, textInfo, index, ypos); -			/* And possibly draw cursor */ -			if (textInfo->curLine == index) { -			    XFillRectangle(display, w, textInfo->CursorGC, -				       textInfo->txtBuffer[index]->lineWidth + -					   CUROFFSET, -					   ypos, -					   CURSORWIDTH, -					   lh); -			} -		    } -		  ypos += lh + INTERLINE; -	      } -	    break; -	case GraphicsExpose: -	    ypos = 0 /*YPADDING*/; -	    for (index = textInfo->startLine; -		 index <= textInfo->endLine; -		 index++) -	      { -		  int lh = textInfo->txtBuffer[index]->lineHeight; - -		  if (((ypos + lh) >= gexpose->y) && -		      (ypos <= (gexpose->y + gexpose->height))) -		    { -			/* Intersection region */ -			/* Draw line immediately */ -			DrawLine(display, textInfo, index, ypos); -			/* And possibly draw cursor */ -			if (textInfo->curLine == index) { -			    XFillRectangle(display, w, textInfo->CursorGC, -				    textInfo->txtBuffer[index]->lineWidth + -				    CUROFFSET, -				    ypos, -				    CURSORWIDTH, -				    lh); -			} -		    } -		  ypos += lh + INTERLINE; -	      } -	    break; -	case NoExpose: -	    break; -	default: -	    /* Not one of our events */ -	    return 0; -	} -    } else { -	switch (evt->type) { -	case Expose: -	    UpdateScroll(display, textInfo); -	    break; -	case ButtonRelease: -	    /* Find out which button */ -	    switch (btEvt->button) { -	    case Button1: -		/* Scroll up until top line is at mouse position */ -		TopToHere(display, textInfo, btEvt->y); -		break; -	    case Button2: -		/* Scroll to spot relative to position */ -		ScrollToSpot(display, textInfo, btEvt->y); -		if (textInfo->endLine >= textInfo->numLines-1) { -		    textInfo->flagWord &= (~NOTATBOTTOM); -		} else { -		    textInfo->flagWord |= NOTATBOTTOM; -		} -		break; -	    case Button3: -		/* Scroll down until pointed line is at top */ -		LineToTop(display, textInfo, btEvt->y); -		break; -	    } -	    break; -	default: -	    /* Not one of our events */ -	    return 0; -	} -    } -    return 1; -} diff --git a/gnu/games/chess/Xchess/scrollText.h b/gnu/games/chess/Xchess/scrollText.h deleted file mode 100644 index d9d05b08dc0b..000000000000 --- a/gnu/games/chess/Xchess/scrollText.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Scrollable Text Window Header File - * - * David Harrison - * University of California,  Berkeley - * 1986 - * - * This file contains definitions for a scrollable text window - * with scroll bar support. - */ - -int TxtGrab(); -   /* Take hold of a previously created window */ - -#define TXT_NO_COLOR	-1 - -int TxtAddFont(); -   /* Loads a new font for use later */ -int TxtWinP(); -   /* Returns non-zero value if the window is text window */ -int TxtClear(); -   /* Clears text window and resets text buffer */ - -int TxtWriteStr(); -   /* Writes a string to window with immediate update */ -int TxtJamStr(); -   /* Write a string without causing update to screen */ - -int TxtRepaint(); -   /* Repaints entire scrollable text window */ -int TxtFilter(); -   /* Handles events related to text window */ diff --git a/gnu/games/chess/Xchess/scrollText/scrollText.c b/gnu/games/chess/Xchess/scrollText/scrollText.c deleted file mode 100644 index aefb5999b2fd..000000000000 --- a/gnu/games/chess/Xchess/scrollText/scrollText.c +++ /dev/null @@ -1,1858 +0,0 @@ -/* - * A Scrollable Text Output Window - * - * David Harrison - * University of California,  Berkeley - * 1986 - * - * The following is an implementation for a scrollable text output - * system.  It handles exposure events only (other interactions are - * under user control).  For scrolling,  a always present scroll bar - * is implemented.  It detects size changes and compensates accordingly. - */ - -#include <X11/X.h> -#include <X11/Xlib.h> -#include <X11/X10.h> -#include <sys/types.h> -#include "scrollText.h" - -extern char *malloc(); -extern char *realloc(); -#define alloc(type)		(type *) malloc(sizeof(type)) -#define numalloc(type, num)	(type *) malloc((unsigned) (num * sizeof(type))) -#define MAXINT		2147483647 - -extern XAssocTable *XCreateAssocTable(); -extern caddr_t XLookUpAssoc(); - -static XAssocTable *textWindows = (XAssocTable *) 0; - -#define NOOPTION	-1	/* Option hasn't been set yet                */ -#define NORMSCROLL	0	/* Smooth scroll on LineToTop and TopToHere  */ -#define JUMPSCROLL	1	/* Jump scrolling on LineToTop and TopToHere */ - -static int ScrollOption = NOOPTION; - -typedef char *Generic; - -#define DEFAULT_GC textInfo->fontGC[textInfo->curFont] - -#define BARSIZE		15 -#define BARBORDER	1 -#define MAXFONTS	8 -#define INITBUFSIZE	1024 -#define INITLINES	50 -#define INITEXPARY	50 -#define XPADDING	2 -#define YPADDING	2 -#define INTERLINE	5 -#define INTERSPACE	1 -#define CURSORWIDTH	2 -#define EXPANDPERCENT	40 -#define BUFSIZE		1024 -#define CUROFFSET	1 -#define MAXFOREIGN	250 -#define NOINDEX		-1 - -/* The wrap line indicator */ -#define WRAPINDSIZE	7 -#define STEMOFFSET	5 -#define arrow_width 7 -#define arrow_height 5 -static char arrow_bits[] = { -   0x24, 0x26, 0x3f, 0x06, 0x04}; - -#define NEWLINE		'\n' -#define BACKSPACE	'\010' -#define NEWFONT		'\006' -#define LOWCHAR		'\040' -#define HIGHCHAR	'\176' - -#define CHARMASK	0x00ff	/* Character mask */ -#define FONTMASK	0x0700	/* Character font */ -#define FONTSHIFT	8	/* Shift amount   */ - -#define WRAPFLAG	0x01	/* Line wrap flag */ - -/* - * Lines are represented by a pointer into the overall array of - * 16-bit characters.  The lower eight bits is used to indicate the character - * (in ASCII),  and the next two bits are used to indicate the font - * the character should be drawn in. - */ - -typedef struct txtLine { -    int lineLength;		/* Current line length               */ -    int lineHeight;		/* Full height of line in pixels     */ -    int lineBaseLine;		/* Current baseline of the line      */ -    int lineWidth;		/* Drawing position at end of line   */ -    int lineText;		/* Offset into master buffer         */ -    int lineFlags;		/* Line wrap flag is here            */ -}; - - -/* - * For ExposeCopy events,  we queue up the redraw requests collapsing - * them into line redraw requests until the CopyExpose event arrives. - * The queue is represented as a dynamic array of the following - * structure: - */ - -typedef struct expEvent { -    int lineIndex;		/* Index of line to redraw  */ -    int ypos;			/* Drawing position of line */ -}; - - -/* - * The text buffer is represented using a dynamic counted array - * of 16-bit quantities. This array expands as needed. - * For the screen representation,  a dynamic counted array - * of line structures is used.  This array points into the - * text buffer to denote the start of each line and its parameters. - * The windows are configured as one overall window which contains - * the scroll bar as a sub-window along its right edge.  Thus, - * the text drawing space is actually w-BARSIZE. - */ - -#define NOTATBOTTOM	0x01	/* Need to scroll to bottom before appending */ -#define FONTNUMWAIT	0x02	/* Waiting for font number                   */ -#define COPYEXPOSE	0x04	/* Need to process a copy expose event       */ -#define SCREENWRONG	0x08	/* TxtJamStr has invalidated screen contents */ - -typedef struct txtWin { -    /* Basic text buffer */ -    int bufAlloc;		/* Allocated size of buffer           */ -    int bufSpot;		/* Current writing position in buffer */ -    short *mainBuffer;		/* Main buffer of text                */ - -    /* Line information */ -    int numLines;		/* Number of display lines in buffer */ -    int allocLines;		/* Number of lines allocated 	     */ -    struct txtLine **txtBuffer;	/* Dynamic array of lines    	     */ - -    /* Current Window display information */ -    Window mainWindow;		/* Text display window       */ -    Window scrollBar;		/* Subwindow for scroll bar  */ -    Pixmap arrowMap;		/* line wrap indicator       */ -    int bgPix, fgPix;		/* Background and cursor     */ -    GC CursorGC;		/* gc for the cursor         */ -    GC bgGC;			/* gc for erasing things     */ -    GC fontGC[MAXFONTS];	/* gc for doing fonts        */ -    XFontStruct theFonts[MAXFONTS];/* Display fonts          */ -    int  theColors[MAXFONTS];	/* foregrounds of the fonts  */ -    int  curFont;		/* current font for tracking */ -    int w, h;			/* Current size              */ -    int startLine;		/* Top line in display       */ -    int endLine;		/* Bottom line in display    */ -    int bottomSpace;		/* Space at bottom of screen */ -    int flagWord;		/* If non-zero,  not at end  */ - -    /* For handling ExposeCopy events */ -    int exposeSize;		/* Current size of array      */ -    int exposeAlloc;		/* Allocated size             */ -    struct expEvent **exposeAry;/* Array of line indices      */ - -    /* Drawing position information */ -    int curLine;		/* Current line in buffer    */ -    int curX;			/* Current horizontal positi */ -    int curY;			/* Current vertical drawing  */ -}; - -/* Flags for the various basic character handling functions */ - -#define DODISP		0x01	/* Update the display  */ -#define NONEWLINE	0x02	/* Dont append newline */ - - - -static int InitLine(newLine) -struct txtLine *newLine;	/* Newly created line structure */ -/* - * This routine initializes a newly created line structure. - */ -{ -    newLine->lineLength = 0; -    newLine->lineHeight = 0; -    newLine->lineBaseLine = 0; -    newLine->lineWidth = XPADDING; -    newLine->lineText = NOINDEX; -    newLine->lineFlags = 0; -    return 1; -} - - - - -int TxtGrab(display, txtWin, program, mainFont, bg, fg, cur) -Display *display;		/* display window is on  */ -Window txtWin;			/* Window to take over as scrollable text    */ -char *program;			/* Program name for Xdefaults                */ -XFontStruct *mainFont;		/* Primary text font                         */ -int bg, fg, cur;		/* Background, foreground, and cursor colors */ -/* - * This routine takes control of 'txtWin' and makes it into a scrollable - * text output window.  It will create a sub-window for the scroll bar - * with a background of 'bg' and an bar with color 'fg'.  Both fixed width - * and variable width fonts are supported.  Additional fonts can be loaded - * using 'TxtAddFont'.  Returns 0 if there were problems,  non-zero if - * everything went ok. - */ -{ -    struct txtWin *newWin;	/* Text package specific information */ -    XWindowAttributes winInfo;	/* Window information                */ -    int index; -    XGCValues gc_val; - -    if (textWindows == (XAssocTable *) 0) { -	textWindows = XCreateAssocTable(32); -	if (textWindows == (XAssocTable *) 0) return(0); -    } -    if (XGetWindowAttributes(display, txtWin, &winInfo) == 0) return 0; - -    if (ScrollOption == NOOPTION) { -	/* Read to see if the user wants jump scrolling or not */ -	if (XGetDefault(display, program, "JumpScroll")) { -	    ScrollOption = JUMPSCROLL; -	} else { -	    ScrollOption = NORMSCROLL; -	} -    } - -    /* Initialize local structure */ -    newWin = alloc(struct txtWin); - -    /* Initialize arrow pixmap */ -    newWin->arrowMap = XCreatePixmapFromBitmapData(display, txtWin, -						   arrow_bits, -						   arrow_width, arrow_height, -						   cur, bg, -						   DisplayPlanes(display, 0)); - -    newWin->bufAlloc = INITBUFSIZE; -    newWin->bufSpot = 0; -    newWin->mainBuffer = numalloc(short, INITBUFSIZE); - -    newWin->numLines = 1; -    newWin->allocLines = INITLINES; -    newWin->txtBuffer = numalloc(struct txtLine *, INITLINES); -    for (index = 0;  index < INITLINES;  index++) { -	newWin->txtBuffer[index] = alloc(struct txtLine); -	InitLine(newWin->txtBuffer[index]); -    } - -    /* Window display information */ -    newWin->mainWindow = txtWin; -    newWin->w = winInfo.width; -    newWin->h = winInfo.height; -    newWin->startLine = 0; -    newWin->endLine = 0; -    newWin->bottomSpace = winInfo.height -      - YPADDING - mainFont->ascent - mainFont->descent - INTERLINE; -    newWin->flagWord = 0; -    newWin->bgPix = bg; -    newWin->fgPix = fg; - -    /* Scroll Bar Creation */ -    newWin->scrollBar = XCreateSimpleWindow(display, txtWin, -				      winInfo.width - BARSIZE, -				      0, BARSIZE - (2*BARBORDER), -				      winInfo.height - (2*BARBORDER), -				      BARBORDER, -				      fg, bg); -    XSelectInput(display, newWin->scrollBar, ExposureMask|ButtonReleaseMask); -    XMapRaised(display, newWin->scrollBar); - -    /* Font and Color Initialization */ -    newWin->theFonts[0] = *mainFont; -    newWin->theColors[0] = fg; -    gc_val.function = GXcopy; -    gc_val.plane_mask = AllPlanes; -    gc_val.foreground = fg; -    gc_val.background = bg; -    gc_val.graphics_exposures = 1; -    gc_val.font = mainFont->fid; -    gc_val.line_width = 1; -    gc_val.line_style = LineSolid; - -    newWin->fontGC[0] = XCreateGC(display, txtWin, -				  GCFunction | GCPlaneMask | -				  GCForeground | GCBackground | -				  GCGraphicsExposures | GCFont, -				  &gc_val); - -    gc_val.foreground = cur; -    newWin->CursorGC = XCreateGC(display, txtWin, -				 GCFunction | GCPlaneMask | -				  GCForeground | GCBackground | -				  GCLineStyle | GCLineWidth, -				  &gc_val); - -    gc_val.foreground = bg; -    newWin->bgGC = XCreateGC(display, txtWin, -				  GCFunction | GCPlaneMask | -				  GCForeground | GCBackground | -				  GCGraphicsExposures | GCFont, -				  &gc_val); - - -    for (index = 1;  index < MAXFONTS;  index++) { -	newWin->theFonts[index].fid = 0; -	newWin->fontGC[index] = 0; -    } - - -    /* Initialize size of first line */ -    newWin->txtBuffer[0]->lineHeight = newWin->theFonts[0].ascent + -	newWin->theFonts[0].descent; -    newWin->txtBuffer[0]->lineText = 0; - -    /* ExposeCopy array initialization */ -    newWin->exposeSize = 0; -    newWin->exposeAlloc = INITEXPARY; -    newWin->exposeAry = numalloc(struct expEvent *, INITEXPARY); -    for (index = 0;  index < newWin->exposeAlloc;  index++) -      newWin->exposeAry[index] = alloc(struct expEvent); -    /* Put plus infinity in last slot for sorting purposes */ -    newWin->exposeAry[0]->lineIndex = MAXINT; - -    /* Drawing Position Information */ -    newWin->curLine = 0; -    newWin->curX = 0; -    newWin->curY = YPADDING + mainFont->ascent + mainFont->descent; - -    /* Attach it to both windows */ -    XMakeAssoc(display, textWindows, (XID) txtWin, (caddr_t) newWin); -    XMakeAssoc(display, textWindows, (XID) newWin->scrollBar, (caddr_t) newWin); -    return 1; -} - - -int TxtRelease(display, w) -Display *display; -Window w;			/* Window to release */ -/* - * This routine releases all resources associated with the - * specified window which are consumed by the text - * window package. This includes the entire text buffer,  line start - * array,  and the scroll bar window.  However,  the window - * itself is NOT destroyed.  The routine will return zero if - * the window is not owned by the text window package. - */ -{ -    struct txtWin *textInfo; -    int index; - -    if ((textInfo = (struct txtWin *) XLookUpAssoc(display, -						 textWindows, (XID) w)) == 0) -      return 0; - -    for (index = 0; index < MAXFONTS; index++) -	if (textInfo->fontGC[index] != 0) -	    XFreeGC(display, textInfo->fontGC[index]); - -    free((Generic) textInfo->mainBuffer); -    for (index = 0;  index < textInfo->numLines;  index++) { -	free((Generic) textInfo->txtBuffer[index]); -    } -    free((Generic) textInfo->txtBuffer); -    XDestroyWindow(display, textInfo->scrollBar); -    for (index = 0;  index < textInfo->exposeSize;  index++) { -	free((Generic) textInfo->exposeAry[index]); -    } -    free((Generic) textInfo->exposeAry); -    XDeleteAssoc(display, textWindows, (XID) w); -    free((Generic) textInfo); -    return 1; -} - - - -static int RecompBuffer(textInfo) -struct txtWin *textInfo;	/* Text window information */ -/* - * This routine recomputes all line breaks in a buffer after - * a change in window size or font.  This is done by throwing - * away the old line start array and recomputing it.  Although - * a lot of this work is also done elsewhere,  it has been included - * inline here for efficiency. - */ -{ -    int startPos, endSize, linenum; -    register int index, chsize, curfont; -    register short *bufptr; -    register XFontStruct *fontptr; -    register struct txtLine *lineptr; -    char theChar; - -    /* Record the old position so we can come back to it */ -    for (startPos = textInfo->txtBuffer[textInfo->startLine]->lineText; -	 (startPos > 0) && (textInfo->mainBuffer[startPos] != '\n'); -	 startPos--) -      /* null loop body */; - -    /* Clear out the old line start array */ -    for (index = 0;  index < textInfo->numLines;  index++) { -	InitLine(textInfo->txtBuffer[index]); -    } - -    /* Initialize first line */ -    textInfo->txtBuffer[0]->lineHeight = -	textInfo->theFonts[0].ascent + textInfo->theFonts[0].descent; -    textInfo->txtBuffer[0]->lineText = 0; - -    /* Process the text back into lines */ -    endSize = textInfo->w - BARSIZE - WRAPINDSIZE; -    bufptr = textInfo->mainBuffer; -    lineptr = textInfo->txtBuffer[0]; -    linenum = 0; -    fontptr = &(textInfo->theFonts[0]); -    curfont = 0; -    for (index = 0;  index < textInfo->bufSpot;  index++) { -	theChar = bufptr[index] & CHARMASK; - -	if ((bufptr[index] & FONTMASK) != curfont) { -	    int newFontNum, heightDiff; - -	    /* Switch fonts */ -	    newFontNum = (bufptr[index] & FONTMASK) >> FONTSHIFT; -	    if (textInfo->theFonts[newFontNum].fid != 0) { -		/* Valid font */ -		curfont = bufptr[index] & FONTMASK; -		fontptr = &(textInfo->theFonts[newFontNum]); -		heightDiff = (fontptr->ascent + fontptr->descent) - -		    lineptr->lineHeight; -		if (heightDiff < 0) heightDiff = 0; -		lineptr->lineHeight += heightDiff; -	    } -	} -	if (theChar == '\n') { -	    /* Handle new line */ -	    if (linenum >= textInfo->allocLines-1) -	      /* Expand number of lines */ -	      ExpandLines(textInfo); -	    linenum++; -	    lineptr = textInfo->txtBuffer[linenum]; -	    /* Initialize next line */ -	    lineptr->lineHeight = fontptr->ascent + fontptr->descent; -	    lineptr->lineText = index+1; -	    /* Check to see if its the starting line */ -	    if (index == startPos) textInfo->startLine = linenum; -	} else { -	    /* Handle normal character */ -	    chsize = CharSize(textInfo, linenum, index); -	    if (lineptr->lineWidth + chsize > endSize) { -		/* Handle line wrap */ -		lineptr->lineFlags |= WRAPFLAG; -		if (linenum >= textInfo->allocLines-1) -		  /* Expand number of lines */ -		  ExpandLines(textInfo); -		linenum++; -		lineptr = textInfo->txtBuffer[linenum]; -		/* Initialize next line */ -		lineptr->lineHeight = fontptr->ascent + fontptr->descent; -		lineptr->lineText = index; -		lineptr->lineLength = 1; -		lineptr->lineWidth += chsize; -	    } else { -		/* Handle normal addition of character */ -		lineptr->lineLength += 1; -		lineptr->lineWidth += chsize; -	    } -	} -    } -    /* We now have a valid line array.  Let's clean up some other fields. */ -    textInfo->numLines = linenum+1; -    if (startPos == 0) { -	textInfo->startLine = 0; -    } -    textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -    textInfo->curLine = linenum; -    /* Check to see if we are at the bottom */ -    if (textInfo->endLine >= textInfo->numLines-1) { -	textInfo->curY = textInfo->h - textInfo->bottomSpace - -	  lineptr->lineHeight; -	textInfo->flagWord &= (~NOTATBOTTOM); -    } else { -	textInfo->flagWord |= NOTATBOTTOM; -    } -    return 1; -} - - - - -int TxtAddFont(display, textWin, fontNumber, newFont, newColor) -Display *display; -Window textWin;			/* Scrollable text window  */ -int fontNumber;			/* Place to add font (0-7) */ -XFontStruct *newFont;		/* Font to add             */ -int newColor;			/* Color of font           */ -/* - * This routine loads a new font so that it can be used in a previously - * created text window.  There are eight font slots numbered 0 through 7. - * If there is already a font in the specified slot,  it will be replaced - * and an automatic redraw of the window will take place.  See TxtWriteStr - * for details on using alternate fonts.  The color specifies the foreground - * color of the text.  The default foreground color is used if this - * parameter is TXT_NO_COLOR.  Returns a non-zero value if - * everything went well. - */ -{ -    struct txtWin *textInfo; -    int redrawFlag; -    XGCValues gc_val; - -    if ((fontNumber < 0) || (fontNumber >= MAXFONTS)) return 0; -    if ((textInfo = (struct txtWin *) -	 XLookUpAssoc(display, textWindows, (XID) textWin)) == 0) -      return 0; -    if (newColor == TXT_NO_COLOR) { -	newColor = textInfo->fgPix; -    } - -    gc_val.font = newFont->fid; -    gc_val.foreground = newColor; -    gc_val.background = textInfo->bgPix; -    gc_val.plane_mask = AllPlanes; -    gc_val.graphics_exposures = 1; -    gc_val.function = GXcopy; - -    if (textInfo->fontGC[fontNumber] != 0) -    { -	XChangeGC(display, textInfo->fontGC[fontNumber], -		  GCFont | GCForeground, &gc_val); -    } -    else -	textInfo->fontGC[fontNumber] = XCreateGC(display, textWin, -						 GCFont | -						 GCForeground | -						 GCBackground | -						 GCFunction | -						 GCPlaneMask | -						 GCGraphicsExposures, -						 &gc_val); - - -    redrawFlag = (textInfo->theFonts[fontNumber].fid != 0) && -      (((newFont) && (newFont->fid != textInfo->theFonts[fontNumber].fid)) || -       (newColor != textInfo->theColors[fontNumber])); -    if (newFont) { -	textInfo->theFonts[fontNumber] = *newFont; -    } -    textInfo->theColors[fontNumber] = newColor; - -    if (redrawFlag) { -	RecompBuffer(textInfo); -	XClearWindow(display, textWin); -	TxtRepaint(display, textWin); -    } -    return 1; -} - - - -int TxtWinP(display, w) -Display *display; -Window w; -/* - * Returns a non-zero value if the window has been previously grabbed - * using TxtGrab and 0 if it has not. - */ -{ -    if (XLookUpAssoc(display, textWindows, (XID) w)) -      return(1); -    else return(0); -} - - - -static int FindEndLine(textInfo, botSpace) -struct txtWin *textInfo; -int *botSpace; -/* - * Given the starting line in 'textInfo->startLine',  this routine - * determines the index of the last line that can be drawn given the - * current size of the screen.  If there are not enough lines to - * fill the screen,  the index of the last line will be returned. - * The amount of empty bottom space is returned in 'botSpace'. - */ -{ -    int index, height, lineHeight; - -    height = YPADDING; -    index = textInfo->startLine; -    while (index < textInfo->numLines) { -	lineHeight = textInfo->txtBuffer[index]->lineHeight + INTERLINE; -	if (height + lineHeight > textInfo->h) break; -	height += lineHeight; -	index++; -    } -    if (botSpace) { -	*botSpace = textInfo->h - height; -    } -    return index - 1; -} - - - -static int UpdateScroll(display, textInfo) -Display *display; -struct txtWin *textInfo;	/* Text window information */ -/* - * This routine computes the current extent of the scroll bar - * indicator and repaints the bar with the correct information. - */ -{ -    int top, bottom; - -    if (textInfo->numLines > 1) { -	top = textInfo->startLine * (textInfo->h - 2*BARBORDER) / -	  (textInfo->numLines - 1); -	bottom = textInfo->endLine * (textInfo->h - 2*BARBORDER) / -	  (textInfo->numLines - 1); -    } else { -	top = 0; -	bottom = textInfo->h - (2*BARBORDER); -    } - -    /* Draw it - make sure there is a little padding */ -    if (top == 0) top++; -    if (bottom == textInfo->h-(2*BARBORDER)) bottom--; - -    XFillRectangle(display, textInfo->scrollBar, -		   textInfo->bgGC, -		   0, 0, BARSIZE, top-1); -    XFillRectangle(display, textInfo->scrollBar, -		   DEFAULT_GC, top, BARSIZE - (2*BARBORDER) - 2, -		   bottom - top); -    XFillRectangle(display, textInfo->scrollBar, DEFAULT_GC, -		   0, bottom+1, BARSIZE, -		   textInfo->h - (2 * BARBORDER) - bottom); - -    return 1; -} - - - - -int TxtClear(display, w) -Display *display; -Window w; -/* - * This routine clears a scrollable text window.  It resets the current - * writing position to the upper left hand corner of the screen. - * NOTE:  THIS ALSO CLEARS THE CONTENTS OF THE TEXT WINDOW BUFFER AND - * RESETS THE SCROLL BAR.  Returns 0 if the window is not a text window. - * This should be used *instead* of XClear. - */ -{ -    struct txtWin *textInfo; -    int index; - -    if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)) == 0) -      return 0; - -    /* Zero out the arrays */ -    textInfo->bufSpot = 0; -    for (index = 0;  index < textInfo->numLines;  index++) { -	InitLine(textInfo->txtBuffer[index]); -    } -    textInfo->txtBuffer[0]->lineHeight = -      textInfo->theFonts[textInfo->curFont].ascent + -	  textInfo->theFonts[textInfo->curFont].descent; - -    textInfo->numLines = 1; -    textInfo->startLine = 0; -    textInfo->endLine = 0; -    textInfo->curLine = 0; -    textInfo->curX = 0; -    textInfo->curY = YPADDING + textInfo->theFonts[textInfo->curFont].ascent -	+ textInfo->theFonts[textInfo->curFont].descent; - -    textInfo->bottomSpace = textInfo->h - YPADDING - -      textInfo->theFonts[textInfo->curFont].ascent - INTERLINE - -	  textInfo->theFonts[textInfo->curFont].descent; -    /* Actually clear the window */ -    XClearWindow(display, w); - -    /* Draw the current cursor */ -    XFillRectangle(display, w, textInfo->CursorGC, -		   XPADDING + CUROFFSET, textInfo->curY, -		   CURSORWIDTH, -		   textInfo->theFonts[textInfo->curFont].ascent + -		   textInfo->theFonts[textInfo->curFont].descent); - -    /* Update the scroll bar */ -    UpdateScroll(display, textInfo); -    return 1; -} - - -static int WarpToBottom(display, textInfo) -Display *display; -struct txtWin *textInfo;	/* Text Information */ -/* - * This routine causes the specified text window to display its - * last screen of information.   It updates the scroll bar - * to the appropriate spot.  The implementation scans backward - * through the buffer to find an appropriate starting spot for - * the window. - */ -{ -    int index, height, lineHeight; - -    index = textInfo->numLines-1; -    height = 0; -    while (index >= 0) { -	lineHeight = textInfo->txtBuffer[index]->lineHeight + INTERLINE; -	if (height + lineHeight > textInfo->h) break; -	height += lineHeight; -	index--; -    } -    textInfo->startLine = index + 1; -    textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -    textInfo->curY = textInfo->h - textInfo->bottomSpace - -      textInfo->txtBuffer[textInfo->endLine]->lineHeight; -    XClearWindow(display, textInfo->mainWindow); -    TxtRepaint(display, textInfo->mainWindow); -    return 1; -} - - - -static int UpdateExposures(display, textInfo) -Display *display; -struct txtWin *textInfo;	/* Text window information */ -/* - * Before a new scrolling action occurs,  the text window package - * must handle all COPYEXPOSE events generated by the last scrolling - * action.  This routine is called to do this.  Foreign events (those - * not handled by TxtFilter) are queued up and replaced on the queue - * after the processing of the exposure events is complete. - */ -{ -#if 0 -    XEvent foreignQueue[MAXFOREIGN]; -    int index, lastItem = 0; - -    while (textInfo->flagWord & COPYEXPOSE) { -	XNextEvent(display, &(foreignQueue[lastItem])); -	if (!TxtFilter(display, &(foreignQueue[lastItem]))) -	  lastItem++; -	if (lastItem >= MAXFOREIGN) { -	    printf("Too many foreign events to queue!\n"); -	    textInfo->flagWord &= (~COPYEXPOSE); -	} -    } -    for (index = 0;  index < lastItem;  index++) { -	XPutBackEvent(display, &(foreignQueue[index])); -    } -#endif -    return 1; -} - - -static int ScrollDown(display,textInfo) -Display *display; -struct txtWin *textInfo;	/* Text window information */ -/* - * This routine scrolls the indicated text window down by one - * line.  The line below the current line must exist.  The window - * is scrolled so that the line below the last line is fully - * displayed.  This may cause many lines to scroll off the top. - * Scrolling is done using XCopyArea.  The exposure events should - * be caught using ExposeCopy. - */ -{ -    int lineSum, index, targetSpace, freeSpace, updateFlag; - -    lineSum = 0; -    if (textInfo->endLine + 1 >= textInfo->numLines) return 0; -    targetSpace = textInfo->txtBuffer[textInfo->endLine+1]->lineHeight + -      INTERLINE; -    if (textInfo->bottomSpace < targetSpace) { -	index = textInfo->startLine; -	while (index < textInfo->endLine) { -	    lineSum += (textInfo->txtBuffer[index]->lineHeight + INTERLINE); -	    if (textInfo->bottomSpace + lineSum >= targetSpace) break; -	    index++; -	} - -	/* Must move upward by 'lineSum' pixels */ -	XCopyArea(display, textInfo->mainWindow, textInfo->mainWindow, -		  DEFAULT_GC, 0, lineSum, -		  textInfo->w - BARSIZE, textInfo->h, -		  0, 0); - -	textInfo->flagWord |= COPYEXPOSE; -	/* Repair the damage to the structures */ -	textInfo->startLine = index + 1; -	updateFlag = 1; -    } else { -	updateFlag = 0; -    } -    /* More lines might be able to fit.  Let's check. */ -    freeSpace = textInfo->bottomSpace + lineSum - targetSpace; -    index = textInfo->endLine + 1; -    while (index < textInfo->numLines-1) { -	if (freeSpace - textInfo->txtBuffer[index+1]->lineHeight - INTERLINE < 0) -	  break; -	freeSpace -= (textInfo->txtBuffer[index+1]->lineHeight + INTERLINE); -	index++; -    } -    textInfo->endLine = index; -    textInfo->bottomSpace = freeSpace; -    if (updateFlag) { -	UpdateExposures(display, textInfo); -    } -    UpdateScroll(display, textInfo); -    return 1; -} - - - - -static int ExpandLines(textInfo) -struct txtWin *textInfo;	/* Text Information */ -/* - * This routine allocates and initializes additional space in - * the line start array (txtBuffer).  The new space - * is allocated using realloc.  The expansion factor is a percentage - * given by EXPANDPERCENT. - */ -{ -    int newSize, index; - -    newSize = textInfo->allocLines; -    newSize += (newSize * EXPANDPERCENT) / 100; - -    textInfo->txtBuffer = (struct txtLine **) -      realloc((char *) textInfo->txtBuffer, -	      (unsigned) (newSize * sizeof(struct txtLine *))); -    for (index = textInfo->allocLines;  index < newSize;  index++) { -	textInfo->txtBuffer[index] = alloc(struct txtLine); -	InitLine(textInfo->txtBuffer[index]); -    } -    textInfo->allocLines = newSize; -    return 1; -} - -static int ExpandBuffer(textInfo) -struct txtWin *textInfo;	/* Text information */ -/* - * Expands the basic character buffer using realloc.  The expansion - * factor is a percentage given by EXPANDPERCENT. - */ -{ -    int newSize; - -    newSize = textInfo->bufAlloc + (textInfo->bufAlloc * EXPANDPERCENT) / 100; -    textInfo->mainBuffer = (short *) -      realloc((char *) textInfo->mainBuffer, (unsigned) newSize * sizeof(short)); -    textInfo->bufAlloc = newSize; -    return 1; -} - - - -static int HandleNewLine(display, textInfo, flagWord) -Display *display; -struct txtWin *textInfo;	/* Text Information            */ -int flagWord;			/* DODISP or NONEWLINE or both */ -/* - * This routine initializes the next line for drawing by setting - * its height to the current font height,  scrolls the screen down - * one line,  and updates the current drawing position to the - * left edge of the newly cleared line.  If DODISP is specified, - * the screen will be updated (otherwise not).  If NONEWLINE is - * specified,  no newline character will be added to the text buffer - * (this is for line wrap). - */ -{ -    struct txtLine *curLine, *nextLine; - -    /* Check to see if a new line must be allocated */ -    if (textInfo->curLine >= textInfo->allocLines-1) -      /* Expand the number of lines */ -      ExpandLines(textInfo); -    textInfo->numLines += 1; - -    /* Then we initialize the next line */ -    nextLine = textInfo->txtBuffer[textInfo->numLines-1]; -    nextLine->lineHeight = -	textInfo->theFonts[textInfo->curFont].ascent + -	    textInfo->theFonts[textInfo->curFont].descent; - -    curLine = textInfo->txtBuffer[textInfo->curLine]; -    if (flagWord & DODISP) { -	/* Scroll down a line if required */ -	if ((textInfo->curY + curLine->lineHeight + -	     nextLine->lineHeight + (INTERLINE * 2)) > textInfo->h) -	  { -	      ScrollDown(display, textInfo); -	  } -	else -	  { -	      /* Update the bottom space appropriately */ -	      textInfo->bottomSpace -= (nextLine->lineHeight + INTERLINE); -	      textInfo->endLine += 1; -	  } -	/* Update drawing position */ -	textInfo->curY = textInfo->h - -	  (textInfo->bottomSpace  + nextLine->lineHeight); -    } - -    /* Move down a line */ -    textInfo->curLine += 1; -    if (!(flagWord & NONEWLINE)) { -	/* Append end-of-line to text buffer */ -	if (textInfo->bufSpot >= textInfo->bufAlloc) { -	    /* Allocate more space in main text buffer */ -	    ExpandBuffer(textInfo); -	} -	textInfo->mainBuffer[(textInfo->bufSpot)++] = -	  (textInfo->curFont << FONTSHIFT) | '\n'; -    } -    nextLine->lineText = textInfo->bufSpot; -    textInfo->curX = 0; -    return 1; -} - - - -static int CharSize(textInfo, lineNum, charNum) -struct txtWin *textInfo;	/* Current Text Information */ -int lineNum;			/* Line in buffer           */ -int charNum;			/* Character in line        */ -/* - * This routine determines the size of the specified character. - * It takes in account the font of the character and whether its - * fixed or variable.  The size includes INTERSPACE spacing between - * the characters. - */ -{ -    register XFontStruct *charFont; -    register short *theLine; -    register short theChar; - -    theLine = &(textInfo->mainBuffer[textInfo->txtBuffer[lineNum]->lineText]); -    theChar = theLine[charNum] & CHARMASK; -    charFont = &(textInfo->theFonts[(theChar & FONTMASK) >> FONTSHIFT]); -    if (theChar <= charFont->min_char_or_byte2 || -	theChar >= charFont->max_char_or_byte2 || -	charFont->per_char == 0) -	return  charFont->max_bounds.width + 1; -    else -	return charFont->per_char[theChar].width + 1; -} - - - - - -static int HandleBackspace(display, textInfo, flagWord) -Display *display; -struct txtWin *textInfo;	/* Text Information  */ -int flagWord;			/* DODISP or nothing */ -/* - * This routine handles a backspace found in the input stream.  The - * character before the current writing position will be erased and - * the drawing position will move back one character.  If the writing - * position is at the left margin,  the drawing position will move - * up to the previous line.  If it is a line that has been wrapped, - * the character at the end of the previous line will be erased. - */ -{ -    struct txtLine *thisLine, *prevLine; -    int chSize; - -    thisLine = textInfo->txtBuffer[textInfo->curLine]; -    /* First,  determine whether we need to go back a line */ -    if (thisLine->lineLength == 0) { -	/* Bleep if at top of buffer */ -	if (textInfo->curLine == 0) { -	    XBell(display, 50); -	    return 0; -	} - -	/* See if we have to scroll in the other direction */ -	if ((flagWord & DODISP) && (textInfo->curY <= YPADDING)) { -	    /* This will display the last lines of the buffer */ -	    WarpToBottom(display, textInfo); -	} - -	/* Set drawing position at end of previous line */ -	textInfo->curLine -= 1; -	prevLine = textInfo->txtBuffer[textInfo->curLine]; -	textInfo->numLines -= 1; -	if (flagWord & DODISP) { -	    textInfo->curY -= (prevLine->lineHeight + INTERLINE); -	    textInfo->bottomSpace += (thisLine->lineHeight + INTERLINE); -	    textInfo->endLine -= 1; -	} - -	/* We are unlinewrapping if the previous line has flag set */ -	if (prevLine->lineFlags & WRAPFLAG) { -	    /* Get rid of line wrap indicator */ -	    if (flagWord & DODISP) { -		XFillRectangle(display, textInfo->mainWindow, -			       textInfo->bgGC, -			       textInfo->w - BARSIZE - WRAPINDSIZE, -			       textInfo->curY,  WRAPINDSIZE, -			       prevLine->lineHeight); -	    } -	    prevLine->lineFlags &= (~WRAPFLAG); -	    /* Call recursively to wipe out the ending character */ -	    HandleBackspace(display, textInfo, flagWord); -	} else { -	    /* Delete the end-of-line in the primary buffer */ -	    textInfo->bufSpot -= 1; -	} -    } else { -	/* Normal deletion of character */ -	chSize = -	  CharSize(textInfo, textInfo->curLine, -		   textInfo->txtBuffer[textInfo->curLine]->lineLength - 1); -	/* Move back appropriate amount and wipe it out */ -	thisLine->lineWidth -= chSize; -	if (flagWord & DODISP) { -	    XFillRectangle(display, textInfo->mainWindow, -			   textInfo->bgGC, -			   thisLine->lineWidth, textInfo->curY, -			   chSize, thisLine->lineHeight); -	} -	/* Delete from buffer */ -	textInfo->txtBuffer[textInfo->curLine]->lineLength -= 1; -	textInfo->bufSpot -= 1; -    } -    return 1; -} - - - -static int DrawLineWrap(display, win, x, y, h, col) -Display *display; -Window win;			/* What window to draw it in     */ -int x, y;			/* Position of upper left corner */ -int h;				/* Height of indicator           */ -int col;			/* Color of indicator            */ -/* - * This routine draws a line wrap indicator at the end of a line. - * Visually,  it is an arrow of the specified height directly against - * the scroll bar border.  The bitmap used for the arrow is stored - * in 'arrowMap' with size 'arrow_width' and 'arrow_height'. - */ -{ -    struct txtWin *textInfo; - -    textInfo = (struct txtWin *)XLookUpAssoc(display, textWindows, -					     (XID) win); - -    /* First,  draw the arrow */ -    XCopyArea(display, textInfo->arrowMap, textInfo->mainWindow, -	       textInfo->CursorGC, -	       0, 0, arrow_width, arrow_height, -	       x, y + h - arrow_height, 1); - -    /* Then draw the stem */ -    XDrawLine(display, textInfo->mainWindow, textInfo->CursorGC, -	      x + STEMOFFSET, y, -	      x + STEMOFFSET, y + h - arrow_height); -    return 1; -} - - - - -static int DrawLine(display, textInfo, lineIndex, ypos) -Display *display; -struct txtWin *textInfo;	/* Text window information   */ -int lineIndex;			/* Index of line to draw     */ -int ypos;			/* Y position for line       */ -/* - * This routine destructively draws the indicated line in the - * indicated window at the indicated position.  It does not - * clear to end of line however.  It draws a line wrap indicator - * if needed but does not draw a cursor. - */ -{ -    int index, startPos, curFont, theColor, curX, saveX, fontIndex; -    struct txtLine *someLine; -    char lineBuffer[BUFSIZE], *glyph; -    short *linePointer; -    XFontStruct *theFont; -    XGCValues gc; - -    /* First,  we draw the text */ -    index = 0; -    curX = XPADDING; -    someLine = textInfo->txtBuffer[lineIndex]; -    linePointer = &(textInfo->mainBuffer[someLine->lineText]); -    while (index < someLine->lineLength) { -	startPos = index; -	saveX = curX; -	curFont = linePointer[index] & FONTMASK; -	fontIndex = curFont >> FONTSHIFT; -	theFont = &(textInfo->theFonts[fontIndex]); -	theColor = textInfo->theColors[fontIndex]; -	glyph = &(lineBuffer[0]); -	while ((index < someLine->lineLength) && -	       ((linePointer[index] & FONTMASK) == curFont)) -	{ -	    *glyph = linePointer[index] & CHARMASK; -	    index++; -	    curX += CharSize(textInfo, lineIndex, index); -	    glyph++; -	} - -	/* Flush out the glyphs */ -	XFillRectangle(display, textInfo->mainWindow, -		       textInfo->bgGC, -		       saveX, ypos, -		   textInfo->w - BARSIZE, -		   someLine->lineHeight + YPADDING + INTERLINE); - -	XDrawString(display, textInfo->mainWindow, -		    textInfo->fontGC[fontIndex], -		    saveX, ypos, -		    lineBuffer, someLine->lineLength); -    } -    /* Then the line wrap indicator (if needed) */ -    if (someLine->lineFlags & WRAPFLAG) { -	DrawLineWrap(display, textInfo->mainWindow, -		     textInfo->w - BARSIZE - WRAPINDSIZE, -		     ypos, someLine->lineHeight, -		     textInfo->fgPix); -    } -    return 1; -} - - - - -static int HandleNewFont(display, fontNum, textInfo, flagWord) -Display *display; -int fontNum;			/* Font number       */ -struct txtWin *textInfo;	/* Text information  */ -int flagWord;			/* DODISP or nothing */ -/* - * This routine handles a new font request.  These requests take - * the form "^F<digit>".  The parsing is done in TxtWriteStr. - * This routine is called only if the form is valid.  It may return - * a failure (0 status) if the requested font is not loaded. - * If the new font is larger than any of the current - * fonts on the line,  it will change the line height and redisplay - * the line. - */ -{ -    struct txtLine *thisLine; -    int heightDiff, baseDiff, redrawFlag; - -    if (textInfo->theFonts[fontNum].fid == 0) { -	return 0; -    } else { -	thisLine = textInfo->txtBuffer[textInfo->curLine]; -	textInfo->curFont = fontNum; -	redrawFlag = 0; -	heightDiff = textInfo->theFonts[fontNum].ascent + -	    textInfo->theFonts[fontNum].descent - -		thisLine->lineHeight; - -	if (heightDiff > 0) { -	    redrawFlag = 1; -	} else { -	    heightDiff = 0; -	} - -	if (redrawFlag) { -	    if (flagWord & DODISP) { -		/* Clear current line */ -		XFillRectangle(display, textInfo->mainWindow, -			       textInfo->bgGC, -			       0, textInfo->curY, textInfo->w, -			       thisLine->lineHeight); - -		/* Check to see if it requires scrolling */ -		if ((textInfo->curY + thisLine->lineHeight + heightDiff + -		     INTERLINE) > textInfo->h) -		  { -		      /* -		       * General approach:  "unscroll" the last line up -		       * and then call ScrollDown to do the right thing. -		       */ -		      textInfo->endLine -= 1; -		      textInfo->bottomSpace += thisLine->lineHeight + -			  INTERLINE; - -		      XFillRectangle(display, textInfo->mainWindow, -				     textInfo->bgGC, -				     0, textInfo->h - textInfo->bottomSpace, -				     textInfo->w, textInfo->bottomSpace); - -		      thisLine->lineHeight += heightDiff; -		      ScrollDown(display, textInfo); -		      textInfo->curY = textInfo->h - -			(textInfo->bottomSpace + INTERLINE + -			 thisLine->lineHeight); -		  } -		else -		  { -		      /* Just update bottom space */ -		      textInfo->bottomSpace -= heightDiff; -		      thisLine->lineHeight += heightDiff; -		  } -		/* Redraw the current line */ -		DrawLine(display, textInfo, textInfo->curLine, textInfo->curY); -	    } else { -		/* Just update line height */ -		thisLine->lineHeight += heightDiff; -	    } -	} -	return 1; -    } -} - - - -int TxtWriteStr(display, w, str) -Display *display; -Window w;			/* Text window            */ -register char *str;		/* 0 terminated string */ -/* - * This routine writes a string to the specified text window. - * The following notes apply: - *   - Text is always appended to the end of the text buffer. - *   - If the scroll bar is positioned such that the end of the - *     text is not visible,  an automatic scroll to the bottom - *     will be done before the appending of text. - *   - Non-printable ASCII characters are not displayed. - *   - The '\n' character causes the current text position to - *     advance one line and start at the left. - *   - Tabs are not supported. - *   - Lines too long for the screen will be wrapped and a line wrap - *     indication will be drawn. - *   - Backspace clears the previous character.  It will do the right - *     thing if asked to backspace past a wrapped line. - *   - A new font can be chosen using the sequence '^F<digit>' where - *     <digit> is 0-7.  The directive will be ignored if - *     there is no font in the specified slot. - * Returns 0 if something went wrong. - */ -{ -    register int fontIndex; -    register struct txtWin *textInfo; -    register struct txtLine *thisLine; - -    if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)) == 0) -      return 0; - -    /* See if screen needs to be updated */ -    if (textInfo->flagWord & SCREENWRONG) { -	TxtRepaint(display, textInfo->mainWindow); -    } - -    /* See if we have to scroll down to the bottom */ -    if (textInfo->flagWord & NOTATBOTTOM) { -	WarpToBottom(display, textInfo); -	textInfo->flagWord &= (~NOTATBOTTOM); -    } - -    /* Undraw the current cursor */ -    thisLine = textInfo->txtBuffer[textInfo->curLine]; - -    XFillRectangle(display, w, textInfo->bgGC, -	    thisLine->lineWidth + CUROFFSET, -	    textInfo->curY, -	    CURSORWIDTH, -	    thisLine->lineHeight); - -    for ( /* str is ok */ ; (*str != 0) ; str++) { -	/* Check to see if we are waiting on a font */ -	if (textInfo->flagWord & FONTNUMWAIT) { -	    textInfo->flagWord &= (~FONTNUMWAIT); -	    fontIndex = *str - '0'; -	    if ((fontIndex >= 0) && (fontIndex < MAXFONTS)) { -		/* Handle font -- go get next character */ -		if (HandleNewFont(display, fontIndex, textInfo, DODISP)) -		    continue; -	    } -	} - -	/* Inline code for handling normal character case */ -	if ((*str >= LOWCHAR) && (*str <= HIGHCHAR)) { -	    register XFontStruct *thisFont; -	    register struct txtLine *thisLine; -	    register int charWidth; -	    int thisColor; - -	    /* Determine size of character */ -	    thisFont = &(textInfo->theFonts[textInfo->curFont]); -	    thisColor = textInfo->theColors[textInfo->curFont]; -	    if (*str <= thisFont->min_char_or_byte2 || -		*str >= thisFont->max_char_or_byte2 || -		thisFont->per_char == 0) -		charWidth = thisFont->max_bounds.width + 1; -	    else -		charWidth = thisFont->per_char[*str].width + 1; - -	    /* Check to see if line wrap is required */ -	    thisLine = textInfo->txtBuffer[textInfo->curLine]; -	    if (thisLine->lineWidth + charWidth > -		(textInfo->w-BARSIZE-WRAPINDSIZE)) -	      { -		  DrawLineWrap(display, textInfo->mainWindow, -			       textInfo->w-BARSIZE-WRAPINDSIZE, -			       textInfo->curY, thisLine->lineHeight, -			       textInfo->fgPix); -		  thisLine->lineFlags |= WRAPFLAG; -		  /* Handle the spacing problem the same way as a newline */ -		  HandleNewLine(display, textInfo, DODISP | NONEWLINE); -		  thisLine = textInfo->txtBuffer[textInfo->curLine]; -	      } - -	    /* Ready to draw character */ -	    XDrawString(display, textInfo->mainWindow, -			DEFAULT_GC, -			textInfo->curX += charWidth, -			textInfo->curY + thisLine->lineHeight, -			str, 1); - -	    /* Append character onto main buffer */ -	    if (textInfo->bufSpot >= textInfo->bufAlloc) -	      /* Make room for more characters */ -	      ExpandBuffer(textInfo); -	    textInfo->mainBuffer[(textInfo->bufSpot)++] = -	      (textInfo->curFont << FONTSHIFT) | (*str); - -	    /* Update the line start array */ -	    thisLine->lineLength += 1; -	    thisLine->lineWidth += charWidth; -	} else if (*str == NEWLINE) { -	    HandleNewLine(display, textInfo, DODISP); -	} else if (*str == NEWFONT) { -	    /* Go into waiting for font number mode */ -	    textInfo->flagWord |= FONTNUMWAIT; -	} else if (*str == BACKSPACE) { -	    HandleBackspace(display, textInfo, DODISP); -	} else { -	    /* Ignore all others */ -	} -    } -    /* Draw the cursor in its new position */ -    thisLine = textInfo->txtBuffer[textInfo->curLine]; - -    XFillRectangle(display, w, textInfo->CursorGC, -	    thisLine->lineWidth + CUROFFSET, -	    textInfo->curY /* + thisLine->lineHeight */, -	    CURSORWIDTH, thisLine->lineHeight); - -    return 1; -} - - - -int TxtJamStr(display, w, str) -Display *display; -Window w;			/* Text window            */ -register char *str;		/* NULL terminated string */ -/* - * This is the same as TxtWriteStr except the screen is NOT updated. - * After a call to this routine,  TxtRepaint should be called to - * update the screen.  This routine is meant to be used to load - * a text buffer with information and then allow the user to - * scroll through it at will. - */ -{ -    register int fontIndex; -    register struct txtWin *textInfo; - -    if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w) -	 ) == 0) -      return 0; - -    for ( /* str is ok */ ; (*str != 0) ; str++) { -	/* Check to see if we are waiting on a font */ -	if (textInfo->flagWord & FONTNUMWAIT) { -	    textInfo->flagWord &= (~FONTNUMWAIT); -	    fontIndex = *str - '0'; -	    if ((fontIndex >= 0) && (fontIndex < MAXFONTS)) { -		if (HandleNewFont(display, fontIndex, textInfo, 0)) { -		    /* Handled font -- go get next character */ -		    continue; -		} -	    } -	} -	/* Inline code for handling normal character case */ -	if ((*str >= LOWCHAR) && (*str <= HIGHCHAR)) { -	    register XFontStruct *thisFont; -	    register struct txtLine *thisLine; -	    register int charWidth; - -	    /* Determine size of character */ -	    thisFont = &(textInfo->theFonts[textInfo->curFont]); - -	    if (*str <= thisFont->min_char_or_byte2 || -		*str >= thisFont->max_char_or_byte2 || -		thisFont->per_char == 0) -		charWidth = thisFont->max_bounds.width + 1; -	    else -		charWidth = thisFont->per_char[*str].width + 1; - -	    /* Check to see if line wrap is required */ -	    thisLine = textInfo->txtBuffer[textInfo->curLine]; -	    if (thisLine->lineWidth + charWidth > -		(textInfo->w-BARSIZE-WRAPINDSIZE)) -	      { -		  thisLine->lineFlags |= WRAPFLAG; -		  /* Handle the spacing problem the same way as a newline */ -		  HandleNewLine(display, textInfo, NONEWLINE); -		  thisLine = textInfo->txtBuffer[textInfo->curLine]; -	      } -	    /* Append character onto main buffer */ -	    if (textInfo->bufSpot >= textInfo->bufAlloc) -	      /* Make room for more characters */ -	      ExpandBuffer(textInfo); -	    textInfo->mainBuffer[(textInfo->bufSpot)++] = -	      (textInfo->curFont << FONTSHIFT) | (*str); - -	    /* Update the line start array */ -	    thisLine->lineLength += 1; -	    thisLine->lineWidth += charWidth; -	} else if (*str == NEWLINE) { -	    HandleNewLine(display, textInfo, 0); -	} else if (*str == NEWFONT) { -	    /* Go into waiting for font number mode */ -	    textInfo->flagWord |= FONTNUMWAIT; -	} else if (*str == BACKSPACE) { -	    HandleBackspace(display, textInfo, 0); -	} else { -	    /* Ignore all others */ -	} -    } -    textInfo->flagWord |= SCREENWRONG; -    return 1; -} - - - -int TxtRepaint(display,w) -Display *display; -Window w; -/* - * Repaints the given scrollable text window.  The routine repaints - * the entire window.  For handling exposure events,  the TxtFilter - * routine should be used. - */ -{ -    struct txtWin *textInfo; -    int index, ypos; - -    if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w) -	 ) == 0) -      return 0; - -    /* Check to see if the screen is up to date */ -    if (textInfo->flagWord & SCREENWRONG) { -	textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -	textInfo->flagWord &= (~SCREENWRONG); -    } - -    ypos = YPADDING; -    index = textInfo->startLine; -    for (;;) { -	DrawLine(display, textInfo, index, ypos); -	if (index >= textInfo->endLine) break; -	ypos += (textInfo->txtBuffer[index]->lineHeight + INTERLINE); -	index++; -    } -    /* Draw the cursor (if on screen) */ -    if (textInfo->endLine == textInfo->curLine) { -	XFillRectangle(display, w, textInfo->CursorGC, -		       textInfo->txtBuffer[index]->lineWidth + CUROFFSET, -		       ypos /* + textInfo->txtBuffer[index]->lineHeight */, -		       CURSORWIDTH, textInfo->txtBuffer[index]->lineHeight); - -    } -    /* Update the scroll bar */ -    UpdateScroll(display, textInfo); -    return 1; -} - - - -static int InsertIndex(textInfo, thisIndex, ypos) -struct txtWin *textInfo;	/* Text Window Information    */ -int thisIndex;			/* Line index of exposed line */ -int ypos;			/* Drawing position of line   */ -/* - * This routine inserts the supplied line index into the copy - * exposure array for 'textInfo'.  The array is kept sorted - * from lowest to highest using insertion sort.  The array - * is dynamically expanded if needed. - */ -{ -    struct expEvent *newItem; -    int newSize, index, downIndex; - -    /* Check to see if we need to expand it */ -    if ((textInfo->exposeSize + 3) >= textInfo->exposeAlloc) { -	newSize = textInfo->exposeAlloc + -	  (textInfo->exposeAlloc * EXPANDPERCENT / 100); -	textInfo->exposeAry = (struct expEvent **) -	  realloc((char *) textInfo->exposeAry, -		  (unsigned) (newSize * sizeof(struct expEvent *))); -	for (index = textInfo->exposeAlloc;  index < newSize;  index++) -	  textInfo->exposeAry[index] = alloc(struct expEvent); -	textInfo->exposeAlloc = newSize; -    } -    /* Find spot for insertion.  NOTE: last spot has big number */ -    for (index = 0;  index <= textInfo->exposeSize;  index++) { -	if (textInfo->exposeAry[index]->lineIndex >= thisIndex) { -	    if (textInfo->exposeAry[index]->lineIndex > thisIndex) { -		/* Insert before this entry */ -		newItem = textInfo->exposeAry[textInfo->exposeSize+1]; -		for (downIndex = textInfo->exposeSize; -		     downIndex >= index; -		     downIndex--) -		  { -		      textInfo->exposeAry[downIndex+1] = -			textInfo->exposeAry[downIndex]; -		  } -		/* Put a free structure at this spot */ -		textInfo->exposeAry[index] = newItem; -		/* Fill it in */ -		textInfo->exposeAry[index]->lineIndex = thisIndex; -		textInfo->exposeAry[index]->ypos = ypos; -		/* Break out of loop */ -		textInfo->exposeSize += 1; -	    } -	    break; -	} -    } -    return 1; -} - - - -static int ScrollUp(display, textInfo) -Display *display; -struct txtWin *textInfo;	/* Text window information   */ -/* - * This routine scrolls the indicated text window up by one - * line.  The line above the current line must exist.  The - * window is scrolled so that the line above the start line - * is displayed at the top of the screen.  This may cause - * many lines to scroll off the bottom.  The scrolling is - * done using XCopyArea.  The exposure events should be caught - * by ExposeCopy. - */ -{ -    int targetSpace; - -    /* Make sure all exposures have been handled by now */ -    if (textInfo->startLine == 0) return 0; -    targetSpace = textInfo->txtBuffer[textInfo->startLine-1]->lineHeight + -      INTERLINE; -    /* Move the area downward by the target amount */ -    XCopyArea(display, textInfo->mainWindow, textInfo->mainWindow, -	      DEFAULT_GC, -	      0, YPADDING, textInfo->w - BARSIZE, -	      textInfo->h, 0, targetSpace); - -    textInfo->flagWord |= COPYEXPOSE; -    /* Update the text window parameters */ -    textInfo->startLine -= 1; -    textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); - -    /* Clear out bottom space region */ -    XClearArea(display, textInfo->mainWindow, -	       0, textInfo->h - textInfo->bottomSpace, -	       textInfo->w, textInfo->bottomSpace); - -    UpdateExposures(display, textInfo); -    UpdateScroll(display, textInfo); - -    return 1; -} - - -static int ScrollToSpot(display, textInfo, ySpot) -Display *display; -struct txtWin *textInfo;	/* Text window information          */ -int ySpot;			/* Button position in scroll window */ -/* - * This routine scrolls the specified text window relative to the - * position of the mouse in the scroll bar.  The center of the screen - * will be positioned to correspond to the mouse position. - */ -{ -    int targetLine, aboveLines; - -    targetLine = textInfo->numLines * ySpot / textInfo->h; -    textInfo->startLine = targetLine; -    textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -    aboveLines = 0; -    /* Make the target line the *center* of the window */ -    while ((textInfo->startLine > 0) && -	   (aboveLines < textInfo->endLine - targetLine)) -      { -	  textInfo->startLine -= 1; -	  textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -	  aboveLines++; -      } -    if (textInfo->endLine == textInfo->numLines-1) { -	WarpToBottom(display, textInfo); -    } else { -	XClearWindow(display, textInfo->mainWindow); -	TxtRepaint(display, textInfo->mainWindow); -    } -    return 1; -} - - - -static int LineToTop(display, textInfo, pos) -Display *display; -struct txtWin *textInfo;	/* Text window information */ -int pos;			/* Y position of mouse     */ -/* - * This routine scrolls the screen down until the line at the - * mouse position is at the top of the screen.  It stops - * if it can't scroll the buffer down that far.  If the - * global 'ScrollOption' is NORMSCROLL,  a smooth scroll - * is used.  Otherwise,  it jumps to the right position - * and repaints the screen. - */ -{ -    int index, sum; - -    /* First,  we find the current line */ -    sum = 0; -    for (index = textInfo->startLine;  index <= textInfo->endLine;  index++) { -	if (sum + textInfo->txtBuffer[index]->lineHeight + INTERLINE> pos) break; -	sum += textInfo->txtBuffer[index]->lineHeight + INTERLINE; -    } -    /* We always want to scroll down at least one line */ -    if (index == textInfo->startLine) index++; -    if (ScrollOption == NORMSCROLL) { -	/* Scroll down until 'index' is the starting line */ -	while ((textInfo->startLine < index) && ScrollDown(display, textInfo)) -	{ -	    /* Empty Loop Body */ -	} -    } else { -	/* Immediately jump to correct spot */ -	textInfo->startLine = index; -	textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -	if (textInfo->endLine == textInfo->numLines-1) { -	    WarpToBottom(display, textInfo); -	} else { -	    XClearWindow(display, textInfo->mainWindow); -	    TxtRepaint(display, textInfo->mainWindow); -	} -    } -    /* Check to see if at end of buffer */ -    if (textInfo->endLine >= textInfo->numLines-1) { -	textInfo->flagWord &= (~NOTATBOTTOM); -    } -    return 1; -} - - - -static int TopToHere(display, textInfo, pos) -Display *display; -struct txtWin *textInfo;	/* Text window information */ -int pos;			/* Y position of mouse     */ -/* - * This routine scrolls the screen up until the top line of - * the screen is at the current Y position of the mouse.  Again, - * it will stop if it can't scroll that far.  If the global - * 'ScrollOption' is NORMSCROLL,  a smooth scroll is used. - * If it's not,  it will simply redraw the screen at the - * correct spot. - */ -{ -    int sum, target, linesup, index; - -    target = pos - textInfo->txtBuffer[textInfo->startLine]->lineHeight; -    /* We always want to scroll up at least one line */ -    if (target <= 0) target = 1; -    sum = 0; -    linesup = 0; -    /* Check to see if we are at the top anyway */ -    if (textInfo->startLine == 0) return 0; -    if (ScrollOption == NORMSCROLL) { -	/* Scroll up until sum of new top lines greater than target */ -	while ((sum < target) && ScrollUp(display, textInfo)) { -	    sum += textInfo->txtBuffer[textInfo->startLine]->lineHeight; -	    linesup++; -	} -    } else { -	/* Search backward to find index */ -	index = textInfo->startLine - 1; -	while ((index > 0) && (sum < target)) { -	    sum += textInfo->txtBuffer[index]->lineHeight; -	    linesup++; -	    index--; -	} -	/* Go directly to the index */ -	textInfo->startLine = index; -	textInfo->endLine = FindEndLine(textInfo, &(textInfo->bottomSpace)); -	XClearWindow(display, textInfo->mainWindow); -	TxtRepaint(display, textInfo->mainWindow); -    } -    /* If we scrolled,  assert we are not at bottom of buffer */ -    if (linesup > 0) { -	textInfo->flagWord |= NOTATBOTTOM; -    } -    return 1; -} - - - -int TxtFilter(display, evt) -Display *display; -XEvent *evt; -/* - * This routine handles events associated with scrollable text windows. - * It will handle all exposure events and any button released events - * in the scroll bar of a text window.  It does NOT handle any other - * events.  If it cannot handle the event,  it will return 0. - */ -{ -    XExposeEvent *expose = &evt->xexpose; -    XButtonEvent *btEvt = &evt->xbutton; -    XGraphicsExposeEvent *gexpose = &evt->xgraphicsexpose; -    XNoExposeEvent *noexpose = &evt->xnoexpose; -    struct txtWin *textInfo; -    int index, ypos; -    Window w, sw; - -    if (textWindows == (XAssocTable *) 0) { -	textWindows = XCreateAssocTable(32); -	if (textWindows == (XAssocTable *) 0) return(0); -    } -    if (evt->type == Expose) { -	w = expose->window; -	sw = 0; -    } -    else if (evt->type == GraphicsExpose) { -	w = gexpose->drawable; -	sw = 0; -    } -    else if (evt->type == NoExpose) { -	w = noexpose->drawable; -	sw = 0; -    } -    else if (evt->type == ButtonRelease) { -	w = btEvt->window; -	sw = btEvt->subwindow; -    } -    else -	return 0; - -    if ((textInfo = (struct txtWin *) -	 XLookUpAssoc(display, textWindows, (XID) w)) == 0) -	return 0; - -    /* Determine whether it's main window or not */ -    if ((w == textInfo->mainWindow) && (sw == 0)) { -	/* Main Window - handle exposures */ -	switch (evt->type) { -	case Expose: -	    ypos = 0 /*YPADDING*/; -	    for (index = textInfo->startLine; -		 index <= textInfo->endLine; -		 index++) -	      { -		  int lh = textInfo->txtBuffer[index]->lineHeight; - -		  if (((ypos + lh) >= expose->y) && -		      (ypos <= (expose->y + expose->height))) -		    { -			/* Intersection region */ -			/* Draw line immediately */ -			DrawLine(display, textInfo, index, ypos); -			/* And possibly draw cursor */ -			if (textInfo->curLine == index) { -			    XFillRectangle(display, w, textInfo->CursorGC, -				       textInfo->txtBuffer[index]->lineWidth + -					   CUROFFSET, -					   ypos, -					   CURSORWIDTH, -					   lh); -			} -		    } -		  ypos += lh + INTERLINE; -	      } -	    break; -	case GraphicsExpose: -	    ypos = 0 /*YPADDING*/; -	    for (index = textInfo->startLine; -		 index <= textInfo->endLine; -		 index++) -	      { -		  int lh = textInfo->txtBuffer[index]->lineHeight; - -		  if (((ypos + lh) >= gexpose->y) && -		      (ypos <= (gexpose->y + gexpose->height))) -		    { -			/* Intersection region */ -			/* Draw line immediately */ -			DrawLine(display, textInfo, index, ypos); -			/* And possibly draw cursor */ -			if (textInfo->curLine == index) { -			    XFillRectangle(display, w, textInfo->CursorGC, -				    textInfo->txtBuffer[index]->lineWidth + -				    CUROFFSET, -				    ypos, -				    CURSORWIDTH, -				    lh); -			} -		    } -		  ypos += lh + INTERLINE; -	      } -	    break; -	case NoExpose: -	    break; -	default: -	    /* Not one of our events */ -	    return 0; -	} -    } else { -	switch (evt->type) { -	case Expose: -	    UpdateScroll(display, textInfo); -	    break; -	case ButtonRelease: -	    /* Find out which button */ -	    switch (btEvt->button) { -	    case Button1: -		/* Scroll up until top line is at mouse position */ -		TopToHere(display, textInfo, btEvt->y); -		break; -	    case Button2: -		/* Scroll to spot relative to position */ -		ScrollToSpot(display, textInfo, btEvt->y); -		if (textInfo->endLine >= textInfo->numLines-1) { -		    textInfo->flagWord &= (~NOTATBOTTOM); -		} else { -		    textInfo->flagWord |= NOTATBOTTOM; -		} -		break; -	    case Button3: -		/* Scroll down until pointed line is at top */ -		LineToTop(display, textInfo, btEvt->y); -		break; -	    } -	    break; -	default: -	    /* Not one of our events */ -	    return 0; -	} -    } -    return 1; -} diff --git a/gnu/games/chess/Xchess/scrollText/scrollText.h b/gnu/games/chess/Xchess/scrollText/scrollText.h deleted file mode 100644 index d9d05b08dc0b..000000000000 --- a/gnu/games/chess/Xchess/scrollText/scrollText.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Scrollable Text Window Header File - * - * David Harrison - * University of California,  Berkeley - * 1986 - * - * This file contains definitions for a scrollable text window - * with scroll bar support. - */ - -int TxtGrab(); -   /* Take hold of a previously created window */ - -#define TXT_NO_COLOR	-1 - -int TxtAddFont(); -   /* Loads a new font for use later */ -int TxtWinP(); -   /* Returns non-zero value if the window is text window */ -int TxtClear(); -   /* Clears text window and resets text buffer */ - -int TxtWriteStr(); -   /* Writes a string to window with immediate update */ -int TxtJamStr(); -   /* Write a string without causing update to screen */ - -int TxtRepaint(); -   /* Repaints entire scrollable text window */ -int TxtFilter(); -   /* Handles events related to text window */ diff --git a/gnu/games/chess/Xchess/shade.bitmap b/gnu/games/chess/Xchess/shade.bitmap deleted file mode 100644 index a32ac80611ce..000000000000 --- a/gnu/games/chess/Xchess/shade.bitmap +++ /dev/null @@ -1,71 +0,0 @@ - -#define shade_width 80 -#define shade_height 80 -static char shade_bits[] = { -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x22, 0x22, -   0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x11, 0x11, 0x11, 0x11, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, -   0x44, 0x44, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, -   0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x88, 0x88, -   0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88}; diff --git a/gnu/games/chess/Xchess/std.c b/gnu/games/chess/Xchess/std.c deleted file mode 100644 index 2bbd113d65cf..000000000000 --- a/gnu/games/chess/Xchess/std.c +++ /dev/null @@ -1,427 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.3 $ on $Date: 1994/11/04 02:11:33 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/std.c,v $ - * Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group - * - * Utility routines. - */ - -#include "std.h" - -#ifndef IBMPC -#include <sys/types.h> -#endif not IBMPC -#ifdef UNIX -#include <signal.h> -#include <pwd.h> -#endif UNIX -#ifdef BSD -#include <sys/time.h> -#include <sys/resource.h> -#endif BSD - -extern char **environ; - -bool -prefix(p, s) -	register char *p, *s; -{ -	while (*p && (*p == *s)) -		p++, s++; -	if (!*p) -		return (true); -	else -		return (false); -} - -/* Create a copy of a string. */ - -char * -copy(str) -	char *str; -{ -	char *p, *tmalloc(); - -	p = tmalloc(strlen(str) + 1); -	strcpy(p, str); -	return(p); -} - -/* Determine whether sub is a substring of str. */ - -bool -substring(sub, str) -	register char *str, *sub; -{ -	register char *s; - -	while(*str) { -		if(*str == *sub) { -			for(s = sub; *s; s++) -				if(*s != *str++) -					break; -			if(*s == '\0') -				return (true); -		} -		str++; -	} -	return (false); -} - -/* Malloc num bytes and initialize to zero. Fatal error if the space can't - * be malloc'd. - */ - -char * -tmalloc(num) -	register int num; -{ -	register char *s; -	char *malloc(); - -	s = malloc((unsigned) num); -	if (!s) { -		fatal("malloc: can't allocate %d bytes", num); -	} -	bzero(s, num); -	return(s); -} - -char * -trealloc(ptr, num) -	char *ptr; -	int num; -{ -	register char *s; -	char *realloc(); - -	s = realloc(ptr, (unsigned) num); -	if (!s) { -		fatal("realloc: can't allocate %d bytes", num); -	} -	/* Well, this won't be zeroed... Too bad... */ -	return(s); -} - -/* Append one character to a string. Don't check for overflow. */ - -void -appendc(s, c) -	char *s, c; -{ -	while (*s) -		s++; -	*s++ = c; -	*s = '\0'; -	return; -} - -int -scannum(str) -	char *str; -{ -	int i = 0; - -	while(isdigit(*str)) -		i = i * 10 + *(str++) - '0'; -	return(i); -} - -/* Case insensitive prefix. */ - -bool -ciprefix(p, s) -	register char *p, *s; -{ -	while (*p) { -		if ((isupper(*p) ? tolower(*p) : *p) != -		    (isupper(*s) ? tolower(*s) : *s)) -			return(false); -		p++; -		s++; -	} -	return (true); -} - -/* Case insensitive strcmp... */ - -bool -cieq(p, s) -	register char *p, *s; -{ -	while (*p) { -		if ((isupper(*p) ? tolower(*p) : *p) != -		    (isupper(*s) ? tolower(*s) : *s)) -			return(false); -		p++; -		s++; -	} -	return (!*s); -} - -#ifdef BSD - -/* Return the date. Return value is static data. */ - -char * -datestring() -{ -	register char *tzn; -	struct tm *tp; -	static char tbuf[40]; -	char *ap; -	struct timeval tv; -	struct timezone tz; -	char *timezone(), *asctime(); -	int i; -	struct tm *localtime(); - -	(void) gettimeofday(&tv, &tz); -	tp = localtime((time_t *) &tv.tv_sec); -	ap = asctime(tp); -	tzn = timezone(tz.tz_minuteswest, tp->tm_isdst); -	sprintf(tbuf, "%.20s", ap); -	if (tzn) -		strcat(tbuf, tzn); -	strcat(tbuf, ap + 19); -	i = strlen(tbuf); -	tbuf[i - 1] = '\0'; -	return (tbuf); -} - -#else BSD - -/* Give it a try... */ - -char * -datestring() -{ -	long i; -	static char buf[64]; - -	i = time(0); -	strcpy(buf, ctime(&i)); -	buf[strlen(buf) - 1] = '\0';	/* Kill the nl. */ -	return (buf); -} - -#endif - -/* How many seconds have elapsed in running time. */ - -int -seconds() -{ -#ifdef BSD -	struct rusage ruse; - -	getrusage(RUSAGE_SELF, &ruse); -	return (ruse.ru_utime.tv_sec); -#else BSD -#endif BSD -} - -/* A few things that may not exist on non-unix systems. */ - -#ifndef BSD - -#ifndef index - -char * -index(s, c) -	register char *s; -	register char c; -{ -	while ((*s != c) && (*s != '\0')) -		s++; -	if (*s == '\0') -		return ((char *) 0); -	else -		return (s); -} - -#endif not index - -#ifndef rindex - -char * -rindex(s, c) -	register char *s; -	register char c; -{ -	register char *t; - -	for (t = s; *t != '\0'; t++); -	while ((*t != c) && (t != s)) -		t--; -	if (t == s) -		return ((char *) 0); -	else -		return (t); -} - -#endif not rindex - -#ifndef bcopy - -void -bcopy(from, to, num) -	register char *from, *to; -	register int num; -{ -	while (num-- > 0) -		*to++ = *from++; -	return; -} - -#endif not bcopy - -#ifndef bzero - -void -bzero(ptr, num) -	register char *ptr; -	register int num; -{ -	while (num-- > 0) -		*ptr++ = '\0'; -	return; -} - -#endif not bzero - -/* This might not be around... If not then forget about sorting... */ - -void qsort() {} - -#endif BSD - -char * -gettok(s) -	char **s; -{ -	char buf[BSIZE]; -	int i = 0; - -	while (isspace(**s)) -		(*s)++; -	if (!**s) -		return (NULL); -	while (**s && !isspace(**s)) -		buf[i++] = *(*s)++; -	buf[i] = '\0'; -	while (isspace(**s)) -		(*s)++; -	return (copy(buf)); -} - -/* Die horribly. */ - -/* VARARGS1 */ -void -fatal(s, args) -        char *s; -{ -	fputs("Internal Error: ", stderr); -#ifndef __FreeBSD__ -	_doprnt(s, &args, stderr); -#endif -	putc('\n', stderr); - -	kill(getpid(), SIGIOT); -	/* NOTREACHED */ -} - -void -setenv(name, value) -	char *name, *value; -{ -	int i; -	char **xx, *s; - -	s = tmalloc(strlen(name) + 2); -	sprintf(s, "%s=", name); - -	/* Copy the old environment... */ -	for (i = 0; environ[i]; i++) -		if (prefix(s, environ[i])) -			break; -	if (!environ[i]) { -		xx = (char **) tmalloc((i + 2) * sizeof (char *)); -		for (i = 0; environ[i]; i++) -			xx[i] = environ[i]; -		xx[i + 1] = NULL; -		environ = xx; -	} else -		xx = environ; - -	xx[i] = tmalloc(strlen(name) + strlen(value) + 2); -	sprintf(xx[i], "%s=%s", name, value); -	return; -} - -char * -getusername() -{ -	int i = getuid(); -	struct passwd *pw = getpwuid(i); - -	return (pw ? pw->pw_name : NULL); -} - -char * -gethome() -{ -	int i = getuid(); -	struct passwd *pw = getpwuid(i); - -	return (pw ? pw->pw_dir : "/strange"); -} - -char * -tildexpand(s) -	char *s; -{ -	struct passwd *pw; -	char *n, buf[64]; -	int i; - -	if (*s != '~') -		return (copy(s)); - -	for (s++, i = 0; *s != '/'; s++, i++) -		buf[i] = *s; -	buf[i] = '\0'; -	if (!i) -		pw = getpwuid(getuid()); -	else -		pw = getpwnam(buf); -	if (!pw) -		return (s); -	n = tmalloc(strlen(s) + strlen(pw->pw_dir) + 1); -	strcpy(n, pw->pw_dir); -	strcat(n, s); -	return (n); -} - diff --git a/gnu/games/chess/Xchess/std.h b/gnu/games/chess/Xchess/std.h deleted file mode 100644 index 19cb1da8c813..000000000000 --- a/gnu/games/chess/Xchess/std.h +++ /dev/null @@ -1,105 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:06 $ - *		   $Source: /home/ncvs/src/gnu/games/chess/Xchess/std.h,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - * - * Standard definitions. - */ - -#define UNIX -#define BSD - -#ifndef FILE -#include <stdio.h> -#endif -#ifndef isalpha -#include <ctype.h> -#endif -#ifndef HUGE -#include <math.h> -#endif -#include <strings.h> - -typedef int bool; - -#define false 0 -#define true 1 - -/* Externs defined in std.c */ - -extern char *tmalloc(); -extern char *trealloc(); -extern char *copy(); -extern char *datestring(); -extern char *getusername(); -extern char *gethome(); -extern char *gettok(); -extern char *tildexpand(); -extern void fatal(); -extern void setenv(); -extern void appendc(); -extern int scannum(); -extern int seconds(); -extern bool prefix(); -extern bool ciprefix(); -extern bool cieq(); -extern bool substring(); - -/* Externs from libc */ - -extern char *getenv(); -extern int errno; -/* extern char *sys_errlist[];  */ - -/* Should use BSIZE instead of BUFSIZ... */ - -#define BSIZE	   512 - -/* Some standard macros. */ - -#define eq(a,b)	 (!strcmp((a), (b))) -#define isalphanum(c)   (isalpha(c) || isdigit(c)) -#define alloc(strname)  ((struct strname *) tmalloc(sizeof(struct strname))) -#define tfree(ptr)  { if (ptr) free((char *) ptr); ptr = 0; } -#define hexnum(c) ((((c) >= '0') && ((c) <= '9')) ? ((c) - '0') : ((((c) >= \ -		'a') && ((c) <= 'f')) ? ((c) - 'a' + 10) : ((((c) >= 'A') && \ -		((c) <= 'F')) ? ((c) - 'A' + 10) : 0))) - -#ifndef BSD -#define random rand -#define srandom srand -#endif BSD - -#ifdef VMS - -#define EXIT_NORMAL	1 -#define EXIT_BAD	0 - -#else VMS - -#define EXIT_NORMAL	0 -#define EXIT_BAD	1 - -#endif VMS - diff --git a/gnu/games/chess/Xchess/valid.c b/gnu/games/chess/Xchess/valid.c deleted file mode 100644 index 06d1f29b067d..000000000000 --- a/gnu/games/chess/Xchess/valid.c +++ /dev/null @@ -1,264 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:08 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/valid.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - * Validate a move. - */ - -#include "xchess.h" - -extern bool ischeck(), couldmove(); - -bool -valid_move(m, b) -	move *m; -	board *b; -{ -	board tb; - -	/* First check that the piece can make the move at all... */ -	if (!couldmove(m, b)) -		return (false); - -	/* Now see if the king is in check now. */ -	bcopy((char *) b, (char *) &tb, sizeof (board)); -	board_move(&tb, m); -	if (ischeck(&tb, m->piece.color)) -		return (false); - -	if (ischeck(&tb, ((m->piece.color == WHITE) ? BLACK : WHITE))) -		m->check = true; - -	return (true); -} - -static bool -couldmove(m, b) -	move *m; -	board *b; -{ -	int x, y; - -	switch (m->type) { -	    case KCASTLE: -		if ((m->piece.color == WHITE) && (b->white_cant_castle_k) || -				(m->piece.color == BLACK) && -				(b->black_cant_castle_k)) -			return (false); -		if ((b->square[m->fromy][5].color != NONE) || -				(b->square[m->fromy][6].color != NONE)) -			return (false); -		if (ischeck(b, m->piece.color)) -			return (false); -		break; - -	    case QCASTLE: -		if ((m->piece.color == WHITE) && (b->white_cant_castle_q) || -				(m->piece.color == BLACK) && -				(b->black_cant_castle_q)) -			return (false); -		if ((b->square[m->fromy][1].color != NONE) || -				(b->square[m->fromy][2].color != NONE) || -				(b->square[m->fromy][3].color != NONE)) -			return (false); -		if (ischeck(b, m->piece.color)) -			return (false); -		break; - -	    case MOVE: -	    case CAPTURE: -		/* There is one special case here, that of taking a pawn -		 * en passant.  In this case we change the move field to -		 * CAPTURE if it's ok. -		 */ -		switch (m->piece.type) { -		    case PAWN: -			if ((m->type == MOVE) && (m->fromx == m->tox)) { -				/* A normal move. */ -				if ((m->piece.color == WHITE) && (m->fromy == -						m->toy + 1)) -					break; -				if ((m->piece.color == WHITE) && (m->fromy == -						6) && (m->toy == 4) && -						(b->square[5][m->fromx].color -						== NONE)) -					break; -				if ((m->piece.color == BLACK) && (m->fromy == -						m->toy - 1)) -					break; -				if ((m->piece.color == BLACK) && (m->fromy == -						1) && (m->toy == 3) && -						(b->square[2][m->fromx].color -						== NONE)) -					break; -				return (false); -			} else if (m->type == CAPTURE) { -				if ((((m->piece.color == WHITE) && (m->fromy == -					    m->toy + 1)) || ((m->piece.color == -					    BLACK) && (m->fromy == m->toy - -					    1))) && ((m->fromx == m->tox + 1) || -					    (m->fromx == m->tox - 1))) -					break; -				/* Now maybe it's enpassant...  We've already -				 * checked for some of these things in the -				 * calling routine. -				 */ -				if (m->enpassant) { -					if (b->square[(m->piece.color == WHITE) -						    ? 3 : 4][m->tox].color == -						    ((m->piece.color == WHITE) ? -						    BLACK : WHITE)) -						break; -				} -				return (false); -			} -			return (false); - -		    case ROOK: -			if (m->fromx == m->tox) { -				for (y = m->fromy + ((m->fromy > m->toy) ? -1 : -						1); y != m->toy; y += ((m->fromy -						> m->toy) ? -1 : 1)) -					if (b->square[y][m->tox].color != NONE) -						return (false); -				break; -			} -			if (m->fromy == m->toy) { -				for (x = m->fromx + ((m->fromx > m->tox) ? -1 : -						1); x != m->tox; x += ((m->fromx -						> m->tox) ? -1 : 1)) -					if (b->square[m->toy][x].color != NONE) -						return (false); -				break; -			} -			return (false); - -		    case KNIGHT: -			x = m->fromx - m->tox; -			y = m->fromy - m->toy; -			if ((((x == 2) || (x == -2)) && -					((y == 1) || (y == -1))) || -					(((x == 1) || (x == -1)) && -					((y == 2) || (y == -2)))) -				break; -			return (false); - -		    case BISHOP: -			x = m->fromx - m->tox; -			y = m->fromy - m->toy; -			if ((x != y) && (x != - y)) -				return (false); -			for (x = m->fromx + ((m->fromx > m->tox) ? -1 : 1), y = -					m->fromy + ((m->fromy > m->toy) ? -1 : -					1); x != m->tox; -					x += ((m->fromx > m->tox) ? -1 : 1), -					y += ((m->fromy > m->toy) ? -1 : 1)) -				if (b->square[y][x].color != NONE) -					return (false); -			break; - -		    case QUEEN: -			if (m->fromx == m->tox) { -				for (y = m->fromy + ((m->fromy > m->toy) ? -1 : -						1); y != m->toy; y += ((m->fromy -						> m->toy) ? -1 : 1)) -					if (b->square[y][m->tox].color != NONE) -						return (false); -				break; -			} -			if (m->fromy == m->toy) { -				for (x = m->fromx + ((m->fromx > m->tox) ? -1 : -						1); x != m->tox; x += ((m->fromx -						> m->tox) ? -1 : 1)) -					if (b->square[m->toy][x].color != NONE) -						return (false); -				break; -			} -			x = m->fromx - m->tox; -			y = m->fromy - m->toy; -			if ((x != y) && (x != - y)) -				return (false); -			for (x = m->fromx + ((m->fromx > m->tox) ? -1 : 1), y = -					m->fromy + ((m->fromy > m->toy) ? -1 : -					1); x != m->tox; -					x += ((m->fromx > m->tox) ? -1 : 1), -					y += ((m->fromy > m->toy) ? -1 : 1)) -				if (b->square[y][x].color != NONE) -					return (false); -			break; - -		    case KING: -			x = m->fromx - m->tox; -			y = m->fromy - m->toy; -			if ((x >= -1) && (x <= 1) && (y >= -1) && (y <= 1)) -				break; -			return (false); -		} -		break; -	} -	return (true); -} - -/* Say whether either king is in check...  If move is non-NULL, say whether he - * in in check after the move takes place.  We do this in a rather stupid way. - */ - -static bool -ischeck(b, col) -	board *b; -	color col; -{ -	int x, y, kx, ky; -	move ch; - -	for (x = 0; x < SIZE; x++) -		for (y = 0; y < SIZE; y++) -			if ((b->square[y][x].color == col) && -				    (b->square[y][x].type == KING)) { -				kx = x; -				ky = y; -			} - -	for (x = 0; x < SIZE; x++) -		for (y = 0; y < SIZE; y++) -			if (b->square[y][x].color == ((col == WHITE) ? -					BLACK : WHITE)) { -				ch.type = CAPTURE; -				ch.piece.color = b->square[y][x].color; -				ch.piece.type = b->square[y][x].type; -				ch.fromx = x; -				ch.fromy = y; -				ch.tox = kx; -				ch.toy = ky; -				ch.enpassant = false; -				if (couldmove(&ch, b)) -					return (true); -			} - -	return (false); -} - diff --git a/gnu/games/chess/Xchess/window.c b/gnu/games/chess/Xchess/window.c deleted file mode 100644 index c33ef812d806..000000000000 --- a/gnu/games/chess/Xchess/window.c +++ /dev/null @@ -1,952 +0,0 @@ -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:08 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/window.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - * Deal with the two (or one) windows. - */ - -#include "xchess.h" -#include <X11/Xutil.h> -#include <sys/time.h> - -#include "pawn.bitmap" -#include "rook.bitmap" -#include "knight.bitmap" -#include "bishop.bitmap" -#include "queen.bitmap" -#include "king.bitmap" - -#include "pawn_outline.bitmap" -#include "rook_outline.bitmap" -#include "knight_outline.bitmap" -#include "bishop_outline.bitmap" -#include "queen_outline.bitmap" -#include "king_outline.bitmap" - -#include "pawn_mask.bitmap" -#include "rook_mask.bitmap" -#include "knight_mask.bitmap" -#include "bishop_mask.bitmap" -#include "queen_mask.bitmap" -#include "king_mask.bitmap" - -#include "shade.bitmap" - -#include "xchess.cur" -#include "xchess_mask.cur" - -#include "xchess.icon" - -windata *win1, *win2; -bool win_flashmove = false; - -extern bool setup(); -extern void service(), drawgrid(), icon_refresh(); - -bool -win_setup(disp1, disp2) -	char *disp1, *disp2; -{ -	win1 = alloc(windata); -	if (!oneboard) -		win2 = alloc(windata); - -	if (!setup(disp1, win1) || (!oneboard && !setup(disp2, win2))) -		return (false); - -	if (blackflag) { -		win1->color = BLACK; -		win1->flipped = true; -	} else -		win1->color = WHITE; -	win_drawboard(win1); - -	if (!oneboard) { -		win2->color = BLACK; -		win2->flipped = true; -		win_drawboard(win2); -	} - -	return(true); -} - -/* Draw the chess board... */ - -void -win_drawboard(win) -	windata *win; -{ -	int i, j; - -	drawgrid(win); - -	/* Now toss on the squares... */ -	for (i = 0; i < SIZE; i++) -		for (j = 0; j < SIZE; j++) -			win_erasepiece(j, i, win->color); - -	return; -} - -/* Draw one piece. */ - -void -win_drawpiece(p, y, x, wnum) -	piece *p; -	int y, x; -	color wnum; -{ -    char *bits, *maskbits, *outline; -    windata *win; -    char buf[BSIZE]; -    XImage *tmpImage; -    Pixmap tmpPM, maskPM; -    XGCValues gc; - -    if (oneboard || (wnum == win1->color)) -	win = win1; -    else -	win = win2; - -    if (win->flipped) { -	y = SIZE - y - 1; -	x = SIZE - x - 1; -    } - -    /* -      if (debug) -      fprintf(stderr, "draw a %s at (%d, %d) on board %d\n", -      piecenames[(int) p->type], y, x, wnum); -      */ - -    if ((x < 0) || (x > 7) || (y < 0) || (y > 7)) exit(1); - -    switch (p->type) { -    case PAWN: -	bits = pawn_bits; -	maskbits = pawn_mask_bits; -	outline = pawn_outline_bits; -	break; - -    case ROOK: -	bits = rook_bits; -	maskbits = rook_mask_bits; -	outline = rook_outline_bits; -	break; - -    case KNIGHT: -	bits = knight_bits; -	maskbits = knight_mask_bits; -	outline = knight_outline_bits; -	break; - -    case BISHOP: -	bits = bishop_bits; -	maskbits = bishop_mask_bits; -	outline = bishop_outline_bits; -	break; - -    case QUEEN: -	bits = queen_bits; -	maskbits = queen_mask_bits; -	outline = queen_outline_bits; -	break; - -    case KING: -	bits = king_bits; -	maskbits = king_mask_bits; -	outline = king_outline_bits; -	break; - -    default: -	fprintf(stderr, -		"Internal Error: win_drawpiece: bad piece type %d\n", -		p->type); -    } - -    /* There are two things we can do... If this is a black and white -     * display, we have to shade the square and use an outline if the piece -     * is white.  We also have to use a mask...  Since we don't want -     * to use up too many bitmaps, create the mask bitmap, put the bits, -     * and then destroy it. -     */ -    if (win->bnw && (p->color == WHITE)) -	bits = outline; -    if (win->bnw && !iswhite(win, x, y)) { -	XSetState(win->display, DefaultGC(win->display, 0), -		  BlackPixel(win->display, 0), -		  WhitePixel(win->display, 0), GXcopy, AllPlanes); - -	tmpPM = XCreateBitmapFromData(win->display, win->boardwin, -				shade_bits, SQUARE_WIDTH, SQUARE_HEIGHT); - -	XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0), -		   0, 0, SQUARE_WIDTH, SQUARE_HEIGHT, -		   x * (SQUARE_WIDTH + BORDER_WIDTH), -		   y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); - -	XFreePixmap(win->display, tmpPM); - -	XSetFunction(win->display, DefaultGC(win->display, 0), -		     GXandInverted); -	maskPM = XCreateBitmapFromData(win->display, win->boardwin, -				      maskbits, SQUARE_WIDTH, SQUARE_HEIGHT); -	XCopyPlane(win->display, maskPM, win->boardwin, DefaultGC(win->display, 0), -		   0, 0, SQUARE_WIDTH, SQUARE_HEIGHT, -		   x * (SQUARE_WIDTH + BORDER_WIDTH), -		   y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); -	XFreePixmap(win->display, maskPM); - -	XSetFunction(win->display, DefaultGC(win->display, 0), -		     GXor); -	tmpPM = XCreateBitmapFromData(win->display, win->boardwin, -				bits, SQUARE_WIDTH, SQUARE_HEIGHT); -	XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0), -		   0, 0, SQUARE_WIDTH, SQUARE_HEIGHT, -		   x * (SQUARE_WIDTH + BORDER_WIDTH), -		   y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); -	XFreePixmap(win->display, tmpPM); - -	XSetFunction(win->display, DefaultGC(win->display, 0), GXcopy); - -    } else if (win->bnw){ -	XSetState(win->display, DefaultGC(win->display, 0), -		  BlackPixel(win->display, 0), -		  WhitePixel(win->display, 0), GXcopy, AllPlanes); - -	tmpPM = XCreateBitmapFromData(win->display, win->boardwin, -				bits, SQUARE_WIDTH, SQUARE_HEIGHT); -	XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0), -		   0, 0, SQUARE_WIDTH, SQUARE_HEIGHT, -		   x * (SQUARE_WIDTH + BORDER_WIDTH), -		   y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); -	XFreePixmap(win->display, tmpPM); -    } else { -	XSetState(win->display, DefaultGC(win->display, 0), -		 ((p->color == WHITE) ? win->whitepiece.pixel : -		  			win->blackpiece.pixel), -		  (iswhite(win, x, y) ? win->whitesquare.pixel : -		   			win->blacksquare.pixel), -		  GXcopy, AllPlanes); -	tmpPM = XCreateBitmapFromData(win->display, win->boardwin, -				bits, SQUARE_WIDTH, SQUARE_HEIGHT); -	XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0), -		   0, 0, SQUARE_WIDTH, SQUARE_HEIGHT, -		   x * (SQUARE_WIDTH + BORDER_WIDTH), -		   y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); -	XFreePixmap(win->display, tmpPM); -    } - -    if (!record_english) { -	gc.foreground = win->textcolor.pixel; -	if (iswhite(win, x, y) || win->bnw) -	    gc.background = win->whitesquare.pixel; -	else -	    gc.background = win->blacksquare.pixel; - -	gc.font = win->small->fid; - -	XChangeGC(win->display, DefaultGC(win->display, 0), -		  GCForeground | GCBackground | GCFont, &gc); - -	if (!x) { -	    sprintf(buf, " %d", SIZE - y); -	    XDrawImageString(win->display, win->boardwin, -			     DefaultGC(win->display, 0), -			     1, (y + 1) * (SQUARE_HEIGHT + -					   BORDER_WIDTH) - BORDER_WIDTH + -			     win->small->max_bounds.ascent - 1, buf, 2); -	} -	if (y == SIZE - 1) { -	    sprintf(buf, "%c", 'A' + x); -	    XDrawImageString(win->display, win->boardwin, -			     DefaultGC(win->display, 0), -			     x * (SQUARE_WIDTH + BORDER_WIDTH) + 1, -			     SIZE * (SQUARE_HEIGHT + BORDER_WIDTH) - BORDER_WIDTH + -			     win->small->max_bounds.ascent - 1, buf, 1); -	} -    } -    return; -} - -void -win_erasepiece(y, x, wnum) -	int y, x; -	color wnum; -{ -    windata *win; -    char buf[BSIZE]; -    XGCValues gc; -    Pixmap tmpPM; - -    if (oneboard || (wnum == win1->color)) -	win = win1; -    else -	win = win2; - -    if (win->flipped) { -	y = SIZE - y - 1; -	x = SIZE - x - 1; -    } - -    /* -      if (debug) -      fprintf(stderr, "erase square (%d, %d) on board %d\n", y, x, -      wnum); -      */ - -    if ((x < 0) || (x > 7) || (y < 0) || (y > 7)) exit(1); - -    if (win->bnw && !iswhite(win, x, y)) { -	XSetState(win->display, DefaultGC(win->display, 0), -		  BlackPixel(win->display, 0), -		  WhitePixel(win->display, 0), GXcopy, AllPlanes); -	tmpPM = XCreateBitmapFromData(win->display, win->boardwin, -				shade_bits, SQUARE_WIDTH, SQUARE_HEIGHT); - -	XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0), -		   0, 0, SQUARE_WIDTH, SQUARE_HEIGHT, -		   x * (SQUARE_WIDTH + BORDER_WIDTH), -		   y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); - -	XFreePixmap(win->display, tmpPM); -    } else { -	XSetFillStyle(win->display, DefaultGC(win->display, 0), -		      FillSolid); -	XSetForeground(win->display, DefaultGC(win->display, 0), -		       iswhite(win, x, y) ? win->whitesquare.pixel : -		       win->blacksquare.pixel); -	XFillRectangle(win->display, win->boardwin, -		       DefaultGC(win->display, 0), -		       x * (SQUARE_WIDTH + BORDER_WIDTH), -		       y * (SQUARE_HEIGHT + BORDER_WIDTH), -		       SQUARE_WIDTH, SQUARE_HEIGHT); -    } - -    if (!record_english) { -	gc.foreground = win->textcolor.pixel; -	if (iswhite(win, x, y) || win->bnw) -	    gc.background = win->whitesquare.pixel; -	else -	    gc.background = win->blacksquare.pixel; - -	gc.font = win->small->fid; - -	XChangeGC(win->display, DefaultGC(win->display, 0), -		  GCForeground | GCBackground | GCFont, &gc); - -	if (!x) { -	    sprintf(buf, " %d", SIZE - y); -	    XDrawImageString(win->display, win->boardwin, -			     DefaultGC(win->display, 0), -			     1, (y + 1) * (SQUARE_HEIGHT + -					   BORDER_WIDTH) - BORDER_WIDTH + -			     win->small->max_bounds.ascent - 1, buf, 2); -	} -	if (y == SIZE - 1) { -	    sprintf(buf, "%c", 'A' + x); -	    XDrawImageString(win->display, win->boardwin, -			     DefaultGC(win->display, 0), -			     x * (SQUARE_WIDTH + BORDER_WIDTH) + 1, -			     SIZE * (SQUARE_HEIGHT + BORDER_WIDTH) - BORDER_WIDTH + -			     win->small->max_bounds.ascent - 1, buf, 1); -	} -    } - - -    return; -} - -void -win_flash(m, wnum) -	move *m; -	color wnum; -{ -	windata *win; -	int sx, sy, ex, ey, i; - -	if (oneboard || (wnum == win1->color)) -		win = win1; -	else -		win = win2; - -	if (win->flipped) { -		sx = SIZE - m->fromx - 1; -		sy = SIZE - m->fromy - 1; -		ex = SIZE - m->tox - 1; -		ey = SIZE - m->toy - 1; -	} else { -		sx = m->fromx; -		sy = m->fromy; -		ex = m->tox; -		ey = m->toy; -	} -	sx = sx * (SQUARE_WIDTH + BORDER_WIDTH) + SQUARE_WIDTH / 2; -	sy = sy * (SQUARE_HEIGHT + BORDER_WIDTH) + SQUARE_HEIGHT / 2; -	ex = ex * (SQUARE_WIDTH + BORDER_WIDTH) + SQUARE_WIDTH / 2; -	ey = ey * (SQUARE_HEIGHT + BORDER_WIDTH) + SQUARE_HEIGHT / 2; - -	XSetFunction(win->display, DefaultGC(win->display, 0), GXinvert); -	XSetLineAttributes(win->display, DefaultGC(win->display, 0), -		0, LineSolid, 0, 0); -	for (i = 0; i < num_flashes * 2; i++) { -	    XDrawLine(win->display,win->boardwin, -		      DefaultGC(win->display, 0), -		      sx, sy, ex, ey); -	} - -	XSetFunction(win->display, DefaultGC(win->display, 0), GXcopy); -	return; -} - -/* Handle input from the players. */ - -void -win_process(quick) -	bool quick; -{ -	int i, rfd = 0, wfd = 0, xfd = 0; -	struct timeval timeout; - -	timeout.tv_sec = 0; -	timeout.tv_usec = (quick ? 0 : 500000); - -	if (XPending(win1->display)) -		service(win1); -	if (!oneboard) { -	    if (XPending(win1->display)) -		service(win2); -	} - -	if (oneboard) -		rfd = 1 << win1->display->fd; -	else -		rfd = (1 << win1->display->fd) | (1 << win2->display->fd); -	if (!(i = select(32, &rfd, &wfd, &xfd, &timeout))) -		return; -	if (i == -1) { -		perror("select"); -		exit(1); -	} -	if (rfd & (1 << win1->display->fd)) -		service(win1); -	if (!oneboard && (rfd & (1 << win2->display->fd))) -		service(win2); - -	return; -} - -static void -service(win) -	windata *win; -{ -	XEvent ev; - -	while(XPending(win->display)) { -		XNextEvent(win->display, &ev); -		if (TxtFilter(win->display, &ev)) -			continue; - -		if (ev.xany.window == win->boardwin) { -			switch (ev.type) { -			    case ButtonPress: -				button_pressed(&ev, win); -				break; - -			    case ButtonRelease: -				button_released(&ev, win); -				break; - -			    case Expose: -				/* Redraw... */ -				win_redraw(win, &ev); -				break; - -			    case 0: -			    case NoExpose: -				break; -			    default: -				fprintf(stderr, "Bad event type %d\n", ev.type); -				exit(1); -			} -		} else if (ev.xany.window == win->wclockwin) { -			switch (ev.type) { -			    case Expose: -				clock_draw(win, WHITE); -				break; - -			    case 0: -			    case NoExpose: -				break; -			    default: -				fprintf(stderr, "Bad event type %d\n", ev.type); -				exit(1); -			} -		} else if (ev.xany.window == win->bclockwin) { -			switch (ev.type) { -			    case Expose: -				clock_draw(win, BLACK); -				break; - -			    case 0: -			    case NoExpose: -				break; -			    default: -				fprintf(stderr, "Bad event type %d\n", ev.type); -				exit(1); -			} -		} else if (ev.xany.window == win->jailwin) { -			switch (ev.type) { -			    case Expose: -				jail_draw(win); -				break; - -			    case 0: -			    case NoExpose: -				break; -			    default: -				fprintf(stderr, "Bad event type %d\n", ev.type); -				exit(1); -			} -		} else if (ev.xany.window == win->buttonwin) { -			switch (ev.type) { -			    case ButtonPress: -				button_service(win, &ev); -				break; - -			    case Expose: -				button_draw(win); -				break; - -			    case 0: -			    case NoExpose: -				break; -			    default: -				fprintf(stderr, "Bad event type %d\n", ev.type); -				exit(1); -			} -		} else if (ev.xany.window == win->icon) { -			icon_refresh(win); -		} else if (ev.xany.window == win->basewin) { -			message_send(win, &ev); -		} else { -			fprintf(stderr, "Internal Error: service: bad win\n"); -			fprintf(stderr, "window = %d, event = %d\n", ev.xany.window, -					ev.type); -		} -	} -	return; -} - -void -win_redraw(win, event) -	windata *win; -	XEvent *event; -{ -	XExposeEvent *ev = &event->xexpose; -	int x1, y1, x2, y2, i, j; - -	drawgrid(win); -	if (ev) { -		x1 = ev->x / (SQUARE_WIDTH + BORDER_WIDTH); -		y1 = ev->y / (SQUARE_HEIGHT + BORDER_WIDTH); -		x2 = (ev->x + ev->width) / (SQUARE_WIDTH + BORDER_WIDTH); -		y2 = (ev->y + ev->height) / (SQUARE_HEIGHT + BORDER_WIDTH); -	} else { -		x1 = 0; -		y1 = 0; -		x2 = SIZE - 1; -		y2 = SIZE - 1; -	} - -	if (x1 < 0) x1 = 0; -	if (y1 < 0) y1 = 0; -	if (x2 < 0) x2 = 0; -	if (y2 < 0) y2 = 0; -	if (x1 > SIZE - 1) x1 = SIZE - 1; -	if (y1 > SIZE - 1) y1 = SIZE - 1; -	if (x2 > SIZE - 1) x2 = SIZE - 1; -	if (y2 > SIZE - 1) y2 = SIZE - 1; - -	if (win->flipped) { -		y1 = SIZE - y2 - 1; -		y2 = SIZE - y1 - 1; -		x1 = SIZE - x2 - 1; -		x2 = SIZE - x1 - 1; -	} - -	for (i = x1; i <= x2; i++) -		for (j = y1; j <= y2; j++) { -			if (chessboard->square[j][i].color == NONE) -				win_erasepiece(j, i, WHITE); -			else -				win_drawpiece(&chessboard->square[j][i], j, i, -						WHITE); -			if (!oneboard) { -				if (chessboard->square[j][i].color == NONE) -					win_erasepiece(j, i, BLACK); -				else -					win_drawpiece(&chessboard->square[j][i], -							j, i, BLACK); -			} -		} - -	return; -} - -static bool -setup(dispname, win) -	char *dispname; -	windata *win; -{ -	char buf[BSIZE], *s; -	Pixmap bm, bmask; -	Cursor cur; -	extern char *program, *recfile; -	XSizeHints xsizes; - - -	if (!(win->display = XOpenDisplay(dispname))) -		return (false); - - -	/* Now get boolean defaults... */ -	if ((s = XGetDefault(win->display, program, "noisy")) && eq(s, "on")) -		noisyflag = true; -	if ((s = XGetDefault(win->display, program, "savemoves")) && eq(s, "on")) -		saveflag = true; -	if ((s = XGetDefault(win->display, program, "algebraic")) && eq(s, "on")) -		record_english = false; -	if ((s = XGetDefault(win->display, program, "blackandwhite")) && eq(s, "on")) -		bnwflag = true; -	if ((s = XGetDefault(win->display, program, "quickrestore")) && eq(s, "on")) -		quickflag = true; -	if ((s = XGetDefault(win->display, program, "flash")) && eq(s, "on")) -		win_flashmove = true; - -	/* ... numeric variables ... */ -	if (s = XGetDefault(win->display, program, "numflashes")) -		num_flashes = atoi(s); -	if (s = XGetDefault(win->display, program, "flashsize")) -		flash_size = atoi(s); - -	/* ... and strings. */ -	if (s = XGetDefault(win->display, program, "progname")) -		progname = s; -	if (s = XGetDefault(win->display, program, "proghost")) -		proghost = s; -	if (s = XGetDefault(win->display, program, "recordfile")) -		recfile = s; -	if (s = XGetDefault(win->display, program, "blackpiece")) -		black_piece_color = s; -	if (s = XGetDefault(win->display, program, "whitepiece")) -		white_piece_color = s; -	if (s = XGetDefault(win->display, program, "blacksquare")) -		black_square_color = s; -	if (s = XGetDefault(win->display, program, "whitesquare")) -		white_square_color = s; -	if (s = XGetDefault(win->display, program, "bordercolor")) -		border_color = s; -	if (s = XGetDefault(win->display, program, "textcolor")) -		text_color = s; -	if (s = XGetDefault(win->display, program, "textback")) -		text_back = s; -	if (s = XGetDefault(win->display, program, "errortext")) -		error_text = s; -	if (s = XGetDefault(win->display, program, "playertext")) -		player_text = s; -	if (s = XGetDefault(win->display, program, "cursorcolor")) -		cursor_color = s; - -	if ((DisplayPlanes(win->display, 0) == 1) || bnwflag) -		win->bnw = true; - -	/* Allocate colors... */ -	if (win->bnw) { -		win->blackpiece.pixel = BlackPixel (win->display, 0); -		win->whitepiece.pixel = WhitePixel (win->display, 0); -		win->blacksquare.pixel = BlackPixel (win->display, 0); -		win->whitesquare.pixel = WhitePixel (win->display, 0); -		win->border.pixel = BlackPixel (win->display, 0); -		win->textcolor.pixel = BlackPixel (win->display, 0); -		win->textback.pixel = WhitePixel (win->display, 0); -		win->playertext.pixel = BlackPixel (win->display, 0); -		win->errortext.pixel = BlackPixel (win->display, 0); -		win->cursorcolor.pixel = BlackPixel (win->display, 0) ; -	} else { -	    if (!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     black_piece_color, &win->blackpiece) || -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     white_piece_color, &win->whitepiece) || -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     black_square_color, &win->blacksquare) || -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     white_square_color, &win->whitesquare) || -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     border_color, &win->border) || -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     text_color, &win->textcolor) || -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     text_back, &win->textback) || -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     error_text, &win->errortext) || -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     player_text, &win->playertext) || -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     cursor_color, &win->cursorcolor) || -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->blackpiece) || -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->whitepiece) || -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->blacksquare) || -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->whitesquare) || -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->border) || -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->textcolor) || -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->textback) || -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->errortext) || -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->playertext) || -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->cursorcolor)) -		fprintf(stderr, "Can't get colors...\n"); -	} - -	/* Get fonts... */ -	if ((win->small = XLoadQueryFont(win->display,SMALL_FONT)) == -	    NULL) -		fprintf(stderr, "Can't get small font...\n"); - -	if ((win->medium = XLoadQueryFont(win->display,MEDIUM_FONT)) -	    == NULL) -	    fprintf(stderr, "Can't get medium font...\n"); - -	if ((win->large = XLoadQueryFont(win->display,LARGE_FONT)) == -	    NULL) -	    fprintf(stderr, "Can't get large font...\n"); - - -	/* Create the windows... */ - -	win->basewin = -	    XCreateSimpleWindow(win->display,DefaultRootWindow(win->display), -			  BASE_XPOS, BASE_YPOS, -			  BASE_WIDTH, BASE_HEIGHT, 0, -			  BlackPixel(win->display, 0), -			  WhitePixel(win->display, 0)); -	win->boardwin = XCreateSimpleWindow(win->display,win->basewin, -					    BOARD_XPOS, BOARD_YPOS, -					    BOARD_WIDTH, BOARD_HEIGHT, -					    BORDER_WIDTH, -					    win->border.pixel, -					    WhitePixel(win->display, 0)); -	win->recwin = XCreateSimpleWindow(win->display,win->basewin, -					  RECORD_XPOS, RECORD_YPOS, -					  RECORD_WIDTH, RECORD_HEIGHT, -					  BORDER_WIDTH, win->border.pixel, -					  win->textback.pixel); -	win->jailwin = XCreateSimpleWindow(win->display,win->basewin, -					   JAIL_XPOS, JAIL_YPOS, -					   JAIL_WIDTH, JAIL_HEIGHT, -					   BORDER_WIDTH, -					   win->border.pixel, -					   win->textback.pixel); -	win->wclockwin = XCreateSimpleWindow(win->display,win->basewin, -					     WCLOCK_XPOS, WCLOCK_YPOS, -					     CLOCK_WIDTH, CLOCK_HEIGHT, -					     BORDER_WIDTH, win->border.pixel, -					     win->textback.pixel); -	win->bclockwin = XCreateSimpleWindow(win->display,win->basewin, -					     BCLOCK_XPOS, BCLOCK_YPOS, -					     CLOCK_WIDTH, CLOCK_HEIGHT, -					     BORDER_WIDTH, win->border.pixel, -					     win->textback.pixel); -	win->messagewin = XCreateSimpleWindow(win->display,win->basewin, -					      MESS_XPOS, MESS_YPOS, -					      MESS_WIDTH, MESS_HEIGHT, -					      BORDER_WIDTH, win->border.pixel, -					      win->textback.pixel); -	win->buttonwin = XCreateSimpleWindow(win->display,win->basewin, -					     BUTTON_XPOS, BUTTON_YPOS, -					     BUTTON_WIDTH, BUTTON_HEIGHT, -					     BORDER_WIDTH, win->border.pixel, -					     win->textback.pixel); - -	/* Let's define an icon... */ -	win->iconpixmap = XCreatePixmapFromBitmapData(win->display, -						      win->basewin, icon_bits, -						      icon_width, icon_height, -						      win->blacksquare.pixel, -						      win->whitesquare.pixel, -						      1); -	xsizes.flags = PSize | PMinSize | PPosition; -	xsizes.min_width = BASE_WIDTH; -	xsizes.min_height = BASE_HEIGHT; -	xsizes.x = BASE_XPOS; -	xsizes.y = BASE_YPOS; -	XSetStandardProperties(win->display, win->basewin, -			       program, program, win->iconpixmap, -			       0, NULL, &xsizes); - -	bm = XCreateBitmapFromData(win->display, -				   win->basewin, xchess_bits, -				   xchess_width, xchess_height); -	bmask = XCreateBitmapFromData(win->display, -				   win->basewin, xchess_mask_bits, -				   xchess_width, xchess_height); -	cur = XCreatePixmapCursor(win->display, bm, bmask, -			    &win->cursorcolor, -			    &WhitePixel(win->display, 0), -			    xchess_x_hot, xchess_y_hot); -	XFreePixmap(win->display, bm); -	XFreePixmap(win->display, bmask); - -	XDefineCursor(win->display,win->basewin, cur); - -	XMapSubwindows(win->display,win->basewin); -	XMapRaised(win->display,win->basewin); - -	XSelectInput(win->display,win->basewin, KeyPressMask); -	XSelectInput(win->display,win->boardwin, -		     ButtonPressMask | ButtonReleaseMask | ExposureMask); -	XSelectInput(win->display,win->recwin, -		     ButtonReleaseMask | ExposureMask); -	XSelectInput(win->display,win->jailwin, ExposureMask); -	XSelectInput(win->display,win->wclockwin, ExposureMask); -	XSelectInput(win->display,win->bclockwin, ExposureMask); -	XSelectInput(win->display,win->messagewin, -		     ButtonReleaseMask | ExposureMask); -	XSelectInput(win->display,win->buttonwin, -		     ButtonPressMask | ExposureMask); - -	message_init(win); -	record_init(win); -	button_draw(win); -	jail_init(win); -	clock_init(win, WHITE); -	clock_init(win, BLACK); -	if (timeunit) { -		if (timeunit > 1800) -			sprintf(buf, "%d moves every %.2lg hours.\n", -				movesperunit, ((double) timeunit) / 3600); -		else if (timeunit > 30) -			sprintf(buf, "%d moves every %.2lg minutes.\n", -				movesperunit, ((double) timeunit) / 60); -		else -			sprintf(buf, "%d moves every %d seconds.\n", -				movesperunit, timeunit); -		message_add(win, buf, false); -	} -	return (true); -} - -static void -drawgrid(win) -	windata *win; -{ -	int i; -	XGCValues gc; - -	gc.function = GXcopy; -	gc.plane_mask = AllPlanes; -	gc.foreground = win->border.pixel; -	gc.line_width = 0; -	gc.line_style = LineSolid; - -	XChangeGC(win->display, -		  DefaultGC(win->display, 0), -		  GCFunction | GCPlaneMask | GCForeground | -		  GCLineWidth | GCLineStyle, &gc); - -	/* Draw the lines... horizontal, */ -	for (i = 1; i < SIZE; i++) -		XDrawLine(win->display, win->boardwin, -			  DefaultGC(win->display, 0), 0, -			  i * (SQUARE_WIDTH + BORDER_WIDTH) - -			      BORDER_WIDTH / 2, -			  SIZE * (SQUARE_WIDTH + BORDER_WIDTH), -			  i * (SQUARE_WIDTH + BORDER_WIDTH) - -			      BORDER_WIDTH / 2); - -	/* and vertical... */ -	for (i = 1; i < SIZE; i++) -		XDrawLine(win->display, win->boardwin, -			  DefaultGC(win->display, 0), -			  i * (SQUARE_WIDTH + BORDER_WIDTH) - -				BORDER_WIDTH / 2, 0, -			  i * (SQUARE_WIDTH + BORDER_WIDTH) - -			        BORDER_WIDTH / 2, -			  SIZE * (SQUARE_WIDTH + BORDER_WIDTH)); -	return; -} - -void -win_restart() -{ -	win1->flipped = false; -	win_redraw(win1, (XEvent *) NULL); -	if (!oneboard) { -		win2->flipped = true; -		win_redraw(win2, (XEvent *) NULL); -	} -	return; -} - -static void -icon_refresh(win) -	windata *win; -{ -	XCopyArea(win->display, win->iconpixmap, win->icon, -		  DefaultGC(win->display, 0), -		  0, 0, icon_width, icon_height, 0, 0); -	return; -} - diff --git a/gnu/games/chess/Xchess/window.c.bm b/gnu/games/chess/Xchess/window.c.bm deleted file mode 100644 index 19134d0cdc14..000000000000 --- a/gnu/games/chess/Xchess/window.c.bm +++ /dev/null @@ -1,928 +0,0 @@ -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.5 $ on $Date: 86/11/26 12:11:15 $ - *           $Source: /users/faustus/xchess/RCS/window.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - * Deal with the two (or one) windows. - */ - -#include "xchess.h" -#include <sys/time.h> - -#include "pawn.bitmap" -#include "rook.bitmap" -#include "knight.bitmap" -#include "bishop.bitmap" -#include "queen.bitmap" -#include "king.bitmap" - -#include "pawn_outline.bitmap" -#include "rook_outline.bitmap" -#include "knight_outline.bitmap" -#include "bishop_outline.bitmap" -#include "queen_outline.bitmap" -#include "king_outline.bitmap" - -#include "pawn_mask.bitmap" -#include "rook_mask.bitmap" -#include "knight_mask.bitmap" -#include "bishop_mask.bitmap" -#include "queen_mask.bitmap" -#include "king_mask.bitmap" - -#include "shade.bitmap" - -#include "xchess.cur" -#include "xchess_mask.cur" - -#include "xchess.icon" - -windata *win1, *win2; -bool win_flashmove = false; - -extern bool setup(); -extern void service(), drawgrid(), icon_refresh(); - -bool -win_setup(disp1, disp2) -	char *disp1, *disp2; -{ -	win1 = alloc(windata); -	if (!oneboard) -		win2 = alloc(windata); - -	if (!setup(disp1, win1) || (!oneboard && !setup(disp2, win2))) -		return (false); - -	if (blackflag) { -		win1->color = BLACK; -		win1->flipped = true; -	} else -		win1->color = WHITE; -	win_drawboard(win1); - -	if (!oneboard) { -		win2->color = BLACK; -		win2->flipped = true; -		win_drawboard(win2); -	} -	 -	return(true); -} - -/* Draw the chess board... */ - -void -win_drawboard(win) -	windata *win; -{ -	int i, j; - -	drawgrid(win); - -	/* Now toss on the squares... */ -	for (i = 0; i < SIZE; i++) -		for (j = 0; j < SIZE; j++) -			win_erasepiece(j, i, win->color); - -	return; -} - -/* Draw one piece. */ - -void -win_drawpiece(p, y, x, wnum) -	piece *p; -	int y, x; -	color wnum; -{ -    char *bits, *maskbits, *outline; -    windata *win; -    char buf[BSIZE]; -    XImage *tmpImage; -    Pixmap tmpPM, maskPM; -    XGCValues gc; - -    if (oneboard || (wnum == win1->color)) -	win = win1; -    else -	win = win2; - -    if (win->flipped) { -	y = SIZE - y - 1; -	x = SIZE - x - 1; -    } - -    /* -      if (debug) -      fprintf(stderr, "draw a %s at (%d, %d) on board %d\n", -      piecenames[(int) p->type], y, x, wnum); -      */ - -    if ((x < 0) || (x > 7) || (y < 0) || (y > 7)) exit(1); - -    switch (p->type) { -    case PAWN: -	bits = pawn_bits; -	maskbits = pawn_mask_bits; -	outline = pawn_outline_bits; -	break; - -    case ROOK: -	bits = rook_bits; -	maskbits = rook_mask_bits; -	outline = rook_outline_bits; -	break; - -    case KNIGHT: -	bits = knight_bits; -	maskbits = knight_mask_bits; -	outline = knight_outline_bits; -	break; - -    case BISHOP: -	bits = bishop_bits; -	maskbits = bishop_mask_bits; -	outline = bishop_outline_bits; -	break; - -    case QUEEN: -	bits = queen_bits; -	maskbits = queen_mask_bits; -	outline = queen_outline_bits; -	break; - -    case KING: -	bits = king_bits; -	maskbits = king_mask_bits; -	outline = king_outline_bits; -	break; - -    default: -	fprintf(stderr, -		"Internal Error: win_drawpiece: bad piece type %d\n", -		p->type); -    } - -    /* There are two things we can do... If this is a black and white -     * display, we have to shade the square and use an outline if the piece -     * is white.  We also have to use a mask...  Since we don't want -     * to use up too many bitmaps, create the mask bitmap, put the bits, -     * and then destroy it. -     */ -    if (win->bnw && (p->color == WHITE)) -	bits = outline; -    if (win->bnw && !iswhite(win, x, y)) { -	XSetState(win->display, DefaultGC(win->display, 0), -		  BlackPixel(win->display, 0), -		  WhitePixel(win->display, 0), GXcopy, AllPlanes); -	 -	tmpPM = XCreateBitmapFromData(win->display, win->boardwin, -				shade_bits, SQUARE_WIDTH, SQUARE_HEIGHT); - -	XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0), -		   0, 0, SQUARE_WIDTH, SQUARE_HEIGHT, -		   x * (SQUARE_WIDTH + BORDER_WIDTH), -		   y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); - -	XFreePixmap(win->display, tmpPM); -	 -	XSetFunction(win->display, DefaultGC(win->display, 0), -		     GXandInverted); -	maskPM = XCreateBitmapFromData(win->display, win->boardwin, -				      maskbits, SQUARE_WIDTH, SQUARE_HEIGHT); -	XCopyPlane(win->display, maskPM, win->boardwin, DefaultGC(win->display, 0), -		   0, 0, SQUARE_WIDTH, SQUARE_HEIGHT, -		   x * (SQUARE_WIDTH + BORDER_WIDTH), -		   y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); -	XFreePixmap(win->display, maskPM); - -	XSetFunction(win->display, DefaultGC(win->display, 0), -		     GXor); -	tmpPM = XCreateBitmapFromData(win->display, win->boardwin, -				bits, SQUARE_WIDTH, SQUARE_HEIGHT); -	XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0), -		   0, 0, SQUARE_WIDTH, SQUARE_HEIGHT, -		   x * (SQUARE_WIDTH + BORDER_WIDTH), -		   y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); -	XFreePixmap(win->display, tmpPM); - -	XSetFunction(win->display, DefaultGC(win->display, 0), GXcopy); - -    } else if (win->bnw){ -	XSetState(win->display, DefaultGC(win->display, 0), -		  BlackPixel(win->display, 0), -		  WhitePixel(win->display, 0), GXcopy, AllPlanes); - -	tmpPM = XCreateBitmapFromData(win->display, win->boardwin, -				bits, SQUARE_WIDTH, SQUARE_HEIGHT); -	XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0), -		   0, 0, SQUARE_WIDTH, SQUARE_HEIGHT, -		   x * (SQUARE_WIDTH + BORDER_WIDTH), -		   y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); -	XFreePixmap(win->display, tmpPM); -    } else { -	XSetState(win->display, DefaultGC(win->display, 0), -		 ((p->color == WHITE) ? win->whitepiece.pixel : -		  			win->blackpiece.pixel), -		  (iswhite(win, x, y) ? win->whitesquare.pixel : -		   			win->blacksquare.pixel), -		  GXcopy, AllPlanes); -	tmpPM = XCreateBitmapFromData(win->display, win->boardwin, -				bits, SQUARE_WIDTH, SQUARE_HEIGHT); -	XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0), -		   0, 0, SQUARE_WIDTH, SQUARE_HEIGHT, -		   x * (SQUARE_WIDTH + BORDER_WIDTH), -		   y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); -	XFreePixmap(win->display, tmpPM); -    } - -    if (!record_english) { -	gc.foreground = win->textcolor.pixel; -	if (iswhite(win, x, y) || win->bnw) -	    gc.background = win->whitesquare.pixel; -	else -	    gc.background = win->blacksquare.pixel; - -	gc.font = win->small->fid; -	     -	XChangeGC(win->display, DefaultGC(win->display, 0), -		  GCForeground | GCBackground | GCFont, &gc); -	     -	if (!x) { -	    sprintf(buf, " %d", SIZE - y); -	    XDrawImageString(win->display, win->boardwin, -			     DefaultGC(win->display, 0), -			     1, (y + 1) * (SQUARE_HEIGHT +  -					   BORDER_WIDTH) - BORDER_WIDTH +  -			     win->small->max_bounds.ascent - 1, buf, 2); -	} -	if (y == SIZE - 1) { -	    sprintf(buf, "%c", 'A' + x); -	    XDrawImageString(win->display, win->boardwin, -			     DefaultGC(win->display, 0), -			     x * (SQUARE_WIDTH + BORDER_WIDTH) + 1, -			     SIZE * (SQUARE_HEIGHT + BORDER_WIDTH) - BORDER_WIDTH +  -			     win->small->max_bounds.ascent - 1, buf, 1); -	} -    } -    return; -} - -void -win_erasepiece(y, x, wnum) -	int y, x; -	color wnum; -{ -    windata *win; -    char buf[BSIZE]; -    XGCValues gc; -    Pixmap tmpPM; -     -    if (oneboard || (wnum == win1->color)) -	win = win1; -    else -	win = win2; -		 -    if (win->flipped) { -	y = SIZE - y - 1; -	x = SIZE - x - 1; -    } - -    /* -      if (debug) -      fprintf(stderr, "erase square (%d, %d) on board %d\n", y, x, -      wnum); -      */ - -    if ((x < 0) || (x > 7) || (y < 0) || (y > 7)) exit(1); - -    if (win->bnw && !iswhite(win, x, y)) { -	XSetState(win->display, DefaultGC(win->display, 0), -		  BlackPixel(win->display, 0), -		  WhitePixel(win->display, 0), GXcopy, AllPlanes); -	tmpPM = XCreateBitmapFromData(win->display, win->boardwin, -				shade_bits, SQUARE_WIDTH, SQUARE_HEIGHT); - -	XCopyPlane(win->display, tmpPM, win->boardwin, DefaultGC(win->display, 0), -		   0, 0, SQUARE_WIDTH, SQUARE_HEIGHT, -		   x * (SQUARE_WIDTH + BORDER_WIDTH), -		   y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); - -	XFreePixmap(win->display, tmpPM); -    } else { -	XSetFillStyle(win->display, DefaultGC(win->display, 0), -		      FillSolid); -	XSetForeground(win->display, DefaultGC(win->display, 0), -		       iswhite(win, x, y) ? win->whitesquare.pixel : -		       win->blacksquare.pixel); -	XFillRectangle(win->display, win->boardwin, -		       DefaultGC(win->display, 0), -		       x * (SQUARE_WIDTH + BORDER_WIDTH), -		       y * (SQUARE_HEIGHT + BORDER_WIDTH), -		       SQUARE_WIDTH, SQUARE_HEIGHT); -    } - -    if (!record_english) { -	gc.foreground = win->textcolor.pixel; -	if (iswhite(win, x, y) || win->bnw) -	    gc.background = win->whitesquare.pixel; -	else -	    gc.background = win->blacksquare.pixel; - -	gc.font = win->small->fid; -	     -	XChangeGC(win->display, DefaultGC(win->display, 0), -		  GCForeground | GCBackground | GCFont, &gc); -	     -	if (!x) { -	    sprintf(buf, " %d", SIZE - y); -	    XDrawImageString(win->display, win->boardwin, -			     DefaultGC(win->display, 0), -			     1, (y + 1) * (SQUARE_HEIGHT +  -					   BORDER_WIDTH) - BORDER_WIDTH +  -			     win->small->max_bounds.ascent - 1, buf, 2); -	} -	if (y == SIZE - 1) { -	    sprintf(buf, "%c", 'A' + x); -	    XDrawImageString(win->display, win->boardwin, -			     DefaultGC(win->display, 0), -			     x * (SQUARE_WIDTH + BORDER_WIDTH) + 1, -			     SIZE * (SQUARE_HEIGHT + BORDER_WIDTH) - BORDER_WIDTH +  -			     win->small->max_bounds.ascent - 1, buf, 1); -	} -    } -     - -    return; -} - -void -win_flash(m, wnum) -	move *m; -	color wnum; -{ -	windata *win; -	int sx, sy, ex, ey, i; - -	if (oneboard || (wnum == win1->color)) -		win = win1; -	else -		win = win2; -		 -	if (win->flipped) { -		sx = SIZE - m->fromx - 1; -		sy = SIZE - m->fromy - 1; -		ex = SIZE - m->tox - 1; -		ey = SIZE - m->toy - 1; -	} else { -		sx = m->fromx; -		sy = m->fromy; -		ex = m->tox; -		ey = m->toy; -	} -	sx = sx * (SQUARE_WIDTH + BORDER_WIDTH) + SQUARE_WIDTH / 2; -	sy = sy * (SQUARE_HEIGHT + BORDER_WIDTH) + SQUARE_HEIGHT / 2; -	ex = ex * (SQUARE_WIDTH + BORDER_WIDTH) + SQUARE_WIDTH / 2; -	ey = ey * (SQUARE_HEIGHT + BORDER_WIDTH) + SQUARE_HEIGHT / 2; - -	for (i = 0; i < num_flashes * 2; i++) -	    XDrawLine(win->display,win->boardwin, -		      DefaultGC(win->display, 0), -		      sx, sy, ex, ey); -	return; -} - -/* Handle input from the players. */ - -void -win_process(quick) -	bool quick; -{ -	int i, rfd = 0, wfd = 0, xfd = 0; -	struct timeval timeout; - -	timeout.tv_sec = 0; -	timeout.tv_usec = (quick ? 0 : 500000); - -	if (XPending(win1->display)) -		service(win1); -	if (!oneboard) { -	    if (XPending(win1->display)) -		service(win2); -	} - -	if (oneboard) -		rfd = 1 << win1->display->fd; -	else -		rfd = (1 << win1->display->fd) | (1 << win2->display->fd); -	if (!(i = select(32, &rfd, &wfd, &xfd, &timeout))) -		return; -	if (i == -1) { -		perror("select"); -		exit(1); -	} -	if (rfd & (1 << win1->display->fd)) -		service(win1); -	if (!oneboard && (rfd & (1 << win2->display->fd))) -		service(win2); - -	return; -} - -static void -service(win) -	windata *win; -{ -	XEvent ev; - -	while(XPending(win->display)) { -		XNextEvent(win->display, &ev); -		if (TxtFilter(win->display, &ev)) -			continue; - -		if (ev.xany.window == win->boardwin) { -			switch (ev.type) { -			    case ButtonPress: -				button_pressed(&ev, win); -				break; - -			    case ButtonRelease: -				button_released(&ev, win); -				break; - -			    case Expose: -				/* Redraw... */ -				win_redraw(win, &ev); -				break; - -			    case 0: -			    case NoExpose: -				break; -			    default: -				fprintf(stderr, "Bad event type %d\n", ev.type); -				exit(1); -			} -		} else if (ev.xany.window == win->wclockwin) { -			switch (ev.type) { -			    case Expose: -				clock_draw(win, WHITE); -				break; - -			    case 0: -			    case NoExpose: -				break; -			    default: -				fprintf(stderr, "Bad event type %d\n", ev.type); -				exit(1); -			} -		} else if (ev.xany.window == win->bclockwin) { -			switch (ev.type) { -			    case Expose: -				clock_draw(win, BLACK); -				break; - -			    case 0: -			    case NoExpose: -				break; -			    default: -				fprintf(stderr, "Bad event type %d\n", ev.type); -				exit(1); -			} -		} else if (ev.xany.window == win->jailwin) { -			switch (ev.type) { -			    case Expose: -				jail_draw(win); -				break; - -			    case 0: -			    case NoExpose: -				break; -			    default: -				fprintf(stderr, "Bad event type %d\n", ev.type); -				exit(1); -			} -		} else if (ev.xany.window == win->buttonwin) { -			switch (ev.type) { -			    case ButtonPress: -				button_service(win, &ev); -				break; - -			    case Expose: -				button_draw(win); -				break; - -			    case 0: -			    case NoExpose: -				break; -			    default: -				fprintf(stderr, "Bad event type %d\n", ev.type); -				exit(1); -			} -		} else if (ev.xany.window == win->icon) { -			icon_refresh(win); -		} else if (ev.xany.window == win->basewin) { -			message_send(win, &ev); -		} else { -			fprintf(stderr, "Internal Error: service: bad win\n"); -			fprintf(stderr, "window = %d, event = %d\n", ev.xany.window, -					ev.type); -		} -	} -	return; -} - -void -win_redraw(win, event) -	windata *win; -	XEvent *event; -{ -	XExposeEvent *ev = &event->xexpose; -	int x1, y1, x2, y2, i, j; - -	drawgrid(win); -	if (ev) { -		x1 = ev->x / (SQUARE_WIDTH + BORDER_WIDTH); -		y1 = ev->y / (SQUARE_HEIGHT + BORDER_WIDTH); -		x2 = (ev->x + ev->width) / (SQUARE_WIDTH + BORDER_WIDTH); -		y2 = (ev->y + ev->height) / (SQUARE_HEIGHT + BORDER_WIDTH); -	} else { -		x1 = 0; -		y1 = 0; -		x2 = SIZE - 1; -		y2 = SIZE - 1; -	} - -	if (x1 < 0) x1 = 0; -	if (y1 < 0) y1 = 0; -	if (x2 < 0) x2 = 0; -	if (y2 < 0) y2 = 0; -	if (x1 > SIZE - 1) x1 = SIZE - 1; -	if (y1 > SIZE - 1) y1 = SIZE - 1; -	if (x2 > SIZE - 1) x2 = SIZE - 1; -	if (y2 > SIZE - 1) y2 = SIZE - 1; - -	if (win->flipped) { -		y1 = SIZE - y2 - 1; -		y2 = SIZE - y1 - 1; -		x1 = SIZE - x2 - 1; -		x2 = SIZE - x1 - 1; -	} - -	for (i = x1; i <= x2; i++)  -		for (j = y1; j <= y2; j++) { -			if (chessboard->square[j][i].color == NONE) -				win_erasepiece(j, i, WHITE); -			else -				win_drawpiece(&chessboard->square[j][i], j, i, -						WHITE); -			if (!oneboard) { -				if (chessboard->square[j][i].color == NONE) -					win_erasepiece(j, i, BLACK); -				else -					win_drawpiece(&chessboard->square[j][i], -							j, i, BLACK); -			} -		} -	 -	return; -} - -static bool -setup(dispname, win) -	char *dispname; -	windata *win; -{ -	char buf[BSIZE], *s; -	Pixmap bm, bmask; -	Cursor cur; -	extern char *program, *recfile; -	 - -	if (!(win->display = XOpenDisplay(dispname))) -		return (false); -	 - -	/* Now get boolean defaults... */ -	if ((s = XGetDefault(win->display, program, "noisy")) && eq(s, "on")) -		noisyflag = true; -	if ((s = XGetDefault(win->display, program, "savemoves")) && eq(s, "on")) -		saveflag = true; -	if ((s = XGetDefault(win->display, program, "algebraic")) && eq(s, "on")) -		record_english = false; -	if ((s = XGetDefault(win->display, program, "blackandwhite")) && eq(s, "on")) -		bnwflag = true; -	if ((s = XGetDefault(win->display, program, "quickrestore")) && eq(s, "on")) -		quickflag = true; -	if ((s = XGetDefault(win->display, program, "flash")) && eq(s, "on")) -		win_flashmove = true; -	 -	/* ... numeric variables ... */ -	if (s = XGetDefault(win->display, program, "numflashes")) -		num_flashes = atoi(s); -	if (s = XGetDefault(win->display, program, "flashsize")) -		flash_size = atoi(s); -	 -	/* ... and strings. */ -	if (s = XGetDefault(win->display, program, "progname")) -		progname = s; -	if (s = XGetDefault(win->display, program, "proghost")) -		proghost = s; -	if (s = XGetDefault(win->display, program, "recordfile")) -		recfile = s; -	if (s = XGetDefault(win->display, program, "blackpiece")) -		black_piece_color = s; -	if (s = XGetDefault(win->display, program, "whitepiece")) -		white_piece_color = s; -	if (s = XGetDefault(win->display, program, "blacksquare")) -		black_square_color = s; -	if (s = XGetDefault(win->display, program, "whitesquare")) -		white_square_color = s; -	if (s = XGetDefault(win->display, program, "bordercolor")) -		border_color = s; -	if (s = XGetDefault(win->display, program, "textcolor")) -		text_color = s; -	if (s = XGetDefault(win->display, program, "textback")) -		text_back = s; -	if (s = XGetDefault(win->display, program, "errortext")) -		error_text = s; -	if (s = XGetDefault(win->display, program, "playertext")) -		player_text = s; -	if (s = XGetDefault(win->display, program, "cursorcolor")) -		cursor_color = s; - -	if ((DisplayPlanes(win->display, 0) == 1) || bnwflag) -		win->bnw = true; -	 -	/* Allocate colors... */ -	if (win->bnw) { -		win->blackpiece.pixel = BlackPixel (win->display, 0); -		win->whitepiece.pixel = WhitePixel (win->display, 0); -		win->blacksquare.pixel = BlackPixel (win->display, 0); -		win->whitesquare.pixel = WhitePixel (win->display, 0); -		win->border.pixel = BlackPixel (win->display, 0); -		win->textcolor.pixel = BlackPixel (win->display, 0); -		win->textback.pixel = WhitePixel (win->display, 0); -		win->playertext.pixel = BlackPixel (win->display, 0); -		win->errortext.pixel = BlackPixel (win->display, 0); -		win->cursorcolor.pixel = BlackPixel (win->display, 0) ; -	} else { -	    if (!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     black_piece_color, &win->blackpiece) ||   -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     white_piece_color, &win->whitepiece) ||   -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     black_square_color, &win->blacksquare) ||   -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     white_square_color, &win->whitesquare) ||   -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     border_color, &win->border) ||   -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     text_color, &win->textcolor) ||   -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     text_back, &win->textback) ||   -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     error_text, &win->errortext) ||   -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     player_text, &win->playertext) ||   -		!XParseColor(win->display, -			     DefaultColormap(win->display, 0), -			     cursor_color, &win->cursorcolor) || -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->blackpiece) ||   -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->whitepiece) ||   -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->blacksquare) ||   -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->whitesquare) ||    -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->border) ||   -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->textcolor) ||   -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->textback) ||   -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->errortext) ||   -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->playertext) ||   -		!XAllocColor(win->display, -			     DefaultColormap(win->display, 0), -			     &win->cursorcolor))    -		fprintf(stderr, "Can't get color...\n"); -	} - -	/* Get fonts... */ -	win->small = XLoadQueryFont(win->display,SMALL_FONT); -	win->medium = XLoadQueryFont(win->display,MEDIUM_FONT); -	win->large = XLoadQueryFont(win->display,LARGE_FONT); -	 -	/* Create the windows... */ - -	win->basewin = -	    XCreateSimpleWindow(win->display,DefaultRootWindow(win->display), -			  BASE_XPOS, BASE_YPOS,  -			  BASE_WIDTH, BASE_HEIGHT, 0, -			  BlackPixel(win->display, 0), -			  WhitePixel(win->display, 0));  -	win->boardwin = XCreateSimpleWindow(win->display,win->basewin, -					    BOARD_XPOS, BOARD_YPOS,  -					    BOARD_WIDTH, BOARD_HEIGHT, -					    BORDER_WIDTH, -					    win->border.pixel, -					    WhitePixel(win->display, 0)); -	win->recwin = XCreateSimpleWindow(win->display,win->basewin, -					  RECORD_XPOS, RECORD_YPOS, -					  RECORD_WIDTH, RECORD_HEIGHT, -					  BORDER_WIDTH, win->border.pixel, -					  win->textback.pixel); -	win->jailwin = XCreateSimpleWindow(win->display,win->basewin, -					   JAIL_XPOS, JAIL_YPOS, -					   JAIL_WIDTH, JAIL_HEIGHT, -					   BORDER_WIDTH, -					   win->border.pixel, -					   win->textback.pixel); -	win->wclockwin = XCreateSimpleWindow(win->display,win->basewin, -					     WCLOCK_XPOS, WCLOCK_YPOS, -					     CLOCK_WIDTH, CLOCK_HEIGHT, -					     BORDER_WIDTH, win->border.pixel, -					     win->textback.pixel); -	win->bclockwin = XCreateSimpleWindow(win->display,win->basewin, -					     BCLOCK_XPOS, BCLOCK_YPOS, -					     CLOCK_WIDTH, CLOCK_HEIGHT, -					     BORDER_WIDTH, win->border.pixel, -					     win->textback.pixel); -	win->messagewin = XCreateSimpleWindow(win->display,win->basewin, -					      MESS_XPOS, MESS_YPOS, -					      MESS_WIDTH, MESS_HEIGHT, -					      BORDER_WIDTH, win->border.pixel, -					      win->textback.pixel); -	win->buttonwin = XCreateSimpleWindow(win->display,win->basewin, -					     BUTTON_XPOS, BUTTON_YPOS, -					     BUTTON_WIDTH, BUTTON_HEIGHT, -					     BORDER_WIDTH, win->border.pixel, -					     win->textback.pixel); -	 -	/* Let's define an icon... */ -	win->iconpixmap = XCreatePixmapFromBitmapData(win->display, -						      win->basewin, icon_bits, -						      icon_width, icon_height, -						      win->blacksquare.pixel, -						      win->whitesquare.pixel, -						      1); -	 -	bm = XCreateBitmapFromData(win->display, -				   win->basewin, xchess_bits, -				   xchess_width, xchess_height); -	bmask = XCreateBitmapFromData(win->display, -				   win->basewin, xchess_mask_bits, -				   xchess_width, xchess_height); -	cur = XCreatePixmapCursor(win->display, bm, bmask, -			    &win->cursorcolor, -			    &WhitePixel(win->display, 0), -			    xchess_x_hot, xchess_y_hot); -	XFreePixmap(win->display, bm); -	XFreePixmap(win->display, bmask); -	 -	XDefineCursor(win->display,win->basewin, cur); - -	XMapSubwindows(win->display,win->basewin); -	XMapRaised(win->display,win->basewin); - -	XSelectInput(win->display,win->basewin, KeyPressMask); -	XSelectInput(win->display,win->boardwin, -		     ButtonPressMask | ButtonReleaseMask | ExposureMask); -	XSelectInput(win->display,win->recwin, -		     ButtonReleaseMask | ExposureMask); -	XSelectInput(win->display,win->jailwin, ExposureMask); -	XSelectInput(win->display,win->wclockwin, ExposureMask); -	XSelectInput(win->display,win->bclockwin, ExposureMask); -	XSelectInput(win->display,win->messagewin, -		     ButtonReleaseMask | ExposureMask); -	XSelectInput(win->display,win->buttonwin, -		     ButtonPressMask | ExposureMask); -	 -	message_init(win); -	record_init(win); -	button_draw(win); -	jail_init(win); -	clock_init(win, WHITE); -	clock_init(win, BLACK); -	if (timeunit) { -		if (timeunit > 1800) -			sprintf(buf, "%d moves every %.2lg hours.\n", -				movesperunit, ((double) timeunit) / 3600); -		else if (timeunit > 30) -			sprintf(buf, "%d moves every %.2lg minutes.\n", -				movesperunit, ((double) timeunit) / 60); -		else -			sprintf(buf, "%d moves every %d seconds.\n", -				movesperunit, timeunit); -		message_add(win, buf, false); -	} -	 -	return (true); -} - -static void -drawgrid(win) -	windata *win; -{ -	int i; -	XGCValues gc; - -	gc.function = GXcopy; -	gc.plane_mask = AllPlanes; -	gc.foreground = win->border.pixel; -	gc.line_width = 0; -	gc.line_style = LineSolid; -	 -	XChangeGC(win->display, -		  DefaultGC(win->display, 0), -		  GCFunction | GCPlaneMask | GCForeground | -		  GCLineWidth | GCLineStyle, &gc); -	 -	/* Draw the lines... horizontal, */ -	for (i = 1; i < SIZE; i++) -		XDrawLine(win->display, win->boardwin, -			  DefaultGC(win->display, 0), 0, -			  i * (SQUARE_WIDTH + BORDER_WIDTH) - -			      BORDER_WIDTH / 2, -			  SIZE * (SQUARE_WIDTH + BORDER_WIDTH), -			  i * (SQUARE_WIDTH + BORDER_WIDTH) - -			      BORDER_WIDTH / 2); - -	/* and vertical... */ -	for (i = 1; i < SIZE; i++) -		XDrawLine(win->display, win->boardwin, -			  DefaultGC(win->display, 0), -			  i * (SQUARE_WIDTH + BORDER_WIDTH) - -				BORDER_WIDTH / 2, 0, -			  i * (SQUARE_WIDTH + BORDER_WIDTH) - -			        BORDER_WIDTH / 2,  -			  SIZE * (SQUARE_WIDTH + BORDER_WIDTH)); -	return; -} - -void -win_restart() -{ -	win1->flipped = false; -	win_redraw(win1, (XEvent *) NULL); -	if (!oneboard) { -		win2->flipped = true; -		win_redraw(win2, (XEvent *) NULL); -	} -	return; -} - -static void -icon_refresh(win) -	windata *win; -{ -	XCopyArea(win->display, win->iconpixmap, win->icon, -		  DefaultGC(win->display, 0), -		  0, 0, icon_width, icon_height, 0, 0); -	return; -} - diff --git a/gnu/games/chess/Xchess/xchess.1 b/gnu/games/chess/Xchess/xchess.1 deleted file mode 100644 index e6875136100c..000000000000 --- a/gnu/games/chess/Xchess/xchess.1 +++ /dev/null @@ -1,217 +0,0 @@ - -.TH XCHESS 1 "14 Nov 1986" "X Version 10" -.SH NAME -xchess \- X chess display -.SH SYNOPSIS -.B xchess -[ option ... ] [ white-display ] [ black-display ] -.SH DESCRIPTION -.PP -.B xchess -is a chess display program which allows players to play a game on either -one or two displays, or play a chess-playing program.  It uses the -.B X -window system.  If one or no display names are given, it will open up one -window and both black and white at the same board.  If two displays are -given, -.B xchess -will accept moves from each player in his turn.  Black's board will be drawn -with his pieces at the bottom. -.PP -.B xchess -will not allow a player to make an illegal move.  It accepts all legal moves, -including castling and pawn capture \fIen passant\fR. -.SH OPTIONS -.TP 8 -.B -d -Turn on debugging. -.TP 8 -.B -f record-file -Use \fBrecord-file\fR for saving the game when the \fBSave\fR button is -selected, or if the \fB-s\fR flag is given.  The default is "xchess.game". -.TP 8 -.B -r saved-game -Start with the position at the end of the saved game in the named file. -This file may be the result of the \fBSave\fR command, and may be in -either English or International format.  When reading moves, one move -it made per second. -.TP 8 -.B -q -Don't pause for a second every time a move is made when a game is being -restored. -.TP 8 -.B -v -Whenever a piece is moved, outline the path with a "lightning bolt". -This option and the \fB-n\fR option are useful if you don't want to miss -an opponent's move when he makes it. -.TP 8 -.B -i -Use International format for recording moves (squares numbered 1-8, a-h) -as opposed to English (e.g, \fIp/k4xp/q5\fR). -.TP 8 -.B -t moves/timeunit -Allows \fBtimeunit\fR seconds for every \fBmoves\fR moves.  If either player -exceeds this allowance both recieve a message saying informing them of -this fact. -.TP 8 -.B -c -Play the computer. -.B xchess -will start up a chess-playing program (currently the only one it knows -how to talk to is \fBGNU Chess\fR). -.TP 8 -.B -p program -The name of the program to use if the \fB-c\fR option is given.  The -default is "/usr/public/gnuchess".  Note that \fBgnuchess\fR must be -compiled with the \fIcompat\fR flag (in the file "main.c") set to 1. -.TP 8 -.B -b -If the \fB-c\fR flag was given, have the computer play white. -.TP 8 -.B -bnw -If the display has more than one display plane (i.e, is color), pretend -it's black and white. -.TP 8 -.B -s -Save the moves in the record file as they are made.  This is useful if -you don't want your game to be lost when \fBxchess\fR core dumps. -.TP 8 -.B -n -Be noisy \- beep after every move is made. -.TP 8 -.B -h host -Run GNU Chess on the specified \fBhost\fR. -.TP 8 -.B -R -Randomly chose who plays white and who plays black, if two displays are -given. -.SH CONTROLS -.PP -The window is divided up into several sub-windows.  The pieces are moved by -pushing down any mouse button on top of the piece, moving to the destination -square, and releasing it.  Castling is done by moving the king to the -right square.  If you push down on a piece and then let the button -up without moving it, you must move that piece. ("Touch it, move it.") -.PP -The progress of the game is listed in the "Game Record" window.  Error -messages and such things are printed in the "Message" window.  Both these -windows have scroll bars that you can use to move around. -There are also windows for clocks and for a record of the pieces captured. -.PP -If you type any keys in the window, the text will go into the message -window of both players.  This provides a simple communication facility. -.PP -There are 9 buttons in the control window.  They are as follows: -.TP 8 -.B Draw -Both players must push this button to agree on a draw (just one is ok -if only one display is being used). -.TP 8 -.B Resign -The player whose turn it is to move resigns. -.TP 8 -.B Reset -Start over from the beginning. -.TP 8 -.B Back -Retract a move.  If two displays are being used the other player will be -asked to confirm this. -.TP 8 -.B Fwd -This will re-play the most recently retracted move.  This button in conjunction -with \fBBack\fR is useful for "scrolling around" in a saved game. -.TP 8 -.B Save -Save the game in the record file. -.TP 8 -.B Flip -Rotate the board so that Black will have his pieces at the bottom. -.TP 8 -.B Switch -Change the mapping of boards to players. -.TP 8 -.B Pause -This button has two functions.  When a game is being restored, pieces will -be moved once a second.  Hitting \fBPause\fR will stop this process, and -hitting it again will restart it.  During the time that it is stopped no -other action can be made except restarting it.  While a game is being played, -\fBPause\fR will stop the clock and restart it. -.SH DEFAULTS -.PP -\fBxchess\fR uses the following \fI.Xdefaults\fR: -.TP 8 -.B Noisy -The -n flag. -.TP 8 -.B SaveMoves -The -s flag. -.TP 8 -.B Algebraic -The -i flag. -.TP 8 -.B BlackAndWhite -The -bnw flag. -.TP 8 -.B QuickRestore -The -q flag. -.TP 8 -.B Flash -The -v flag. -.TP 8 -.B NumFlashes -How many times to flash the move.  The default is 5. -.TP 8 -.B FlashWidth -How big to make the lightning bolt.  The default is 10 pixels. -.TP 8 -.B ProgName -The -p option.  This may also be changed in the Makefile (-DDEF_PROG_NAME). -.TP 8 -.B ProgHost -The -h option. -.TP 8 -.B RecordFile -The -f option. -.TP 8 -.B BlackPiece -The color of the black pieces. -.TP 8 -.B WhitePiece -The color of the white pieces. -.TP 8 -.B BorderColor -The color of the borders. -.TP 8 -.B BlackSquare -The color of the black squares. -.TP 8 -.B WhiteSquare -The color of the white squares. -.TP 8 -.B TextColor -The color of routine messages and the move record text. -.TP 8 -.B ErrorText -The color of error messages. -.TP 8 -.B PlayerText -The color of player-entered text. -.TP 8 -.B TextBack -The background color for the two text windows. -.TP 8 -.B CursorColor -The color of the mouse and the text cursors. -.SH "SEE ALSO" -X(8), gnuchess(1), chess(5) -.SH AUTHOR -Wayne A. Christopher (faustus@ic.berkeley.edu) -.SH BUGS -.PP -Checkmate and stalemate are not detected, so the appropriate player must resign -or agree to a draw respectively. -.PP -\fBSwitch\fR doesn't work. -.PP -If you are playing \fBgnuchess\fR, and you select Undo a few times so that it -is \fBgnuchess\fR's turn to move, it won't do anything. diff --git a/gnu/games/chess/Xchess/xchess.c b/gnu/games/chess/Xchess/xchess.c deleted file mode 100644 index 74d010f2c717..000000000000 --- a/gnu/games/chess/Xchess/xchess.c +++ /dev/null @@ -1,205 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:09 $ - *           $Source: /home/ncvs/src/gnu/games/chess/Xchess/xchess.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - */ - -#define USAGE	"xchess [ -d ] [ -f recordfile ] [ -r savedfile ] [ -i ]\n\ -\t[ -t moves/timeunit ] [ -c ] [ -p program ]  [ -b ] [ -bnw ] [ -s ]\n\ -\t[ -n ] [ -h host ] [ -v ] [ -R ] [ whitedisplay ] [ blackdisplay ]" - -#include <signal.h> -#include "xchess.h" - -bool debug = false; -bool oneboard = false; -bool bnwflag = false; -bool progflag = false; -bool blackflag = false; -bool quickflag = false; - -char *progname = DEF_PROGRAM; -char *proghost = NULL; -char *piecenames[] = { "pawn", "rook", "knight", "bishop", "queen", "king" } ; -char *colornames[] = { "white", "black", "none" } ; -char *movetypenames[] = { "move", "qcastle", "kcastle", "capture" } ; -char *dispname1 = NULL, *dispname2 = NULL; - -char *black_piece_color = BLACK_PIECE_COLOR; -char *white_piece_color = WHITE_PIECE_COLOR; -char *black_square_color = BLACK_SQUARE_COLOR; -char *white_square_color = WHITE_SQUARE_COLOR; -char *border_color = BORDER_COLOR; -char *text_color = TEXT_COLOR; -char *text_back = TEXT_BACK; -char *error_text = ERROR_TEXT; -char *player_text = PLAYER_TEXT; -char *cursor_color = CURSOR_COLOR; - -int num_flashes = NUM_FLASHES; -int flash_size = FLASH_SIZE; -char *program; -char *recfile = NULL; - -#ifdef notdef -/* - * Serves no purpose. - */ -die () { -fprintf(stderr, "child proc changed status?!\n"); -} -#endif - -void -main(ac, av) -	char **av; -{ -	bool randflag = false; -	move *m; -	char *s; - -	program = av[0]; - -#ifdef notdef -	signal(SIGCHLD, die); -#endif - -	/* Process args. */ -	av++; ac--; -	while (ac > 0 && **av == '-') { -		if (eq(*av, "-d")) { -			debug = true; -		} else if (eq(*av, "-f")) { -			av++; ac--; -			if (*av) -				record_file = *av; -			else -				goto usage; -		} else if (eq(*av, "-r")) { -			av++; ac--; -			if (*av) -				recfile = *av; -			else -				goto usage; -		} else if (eq(*av, "-i")) { -			record_english = false; -		} else if (eq(*av, "-R")) { -			randflag = true; -		} else if (eq(*av, "-v")) { -			win_flashmove = true; -		} else if (eq(*av, "-q")) { -			quickflag = true; -		} else if (eq(*av, "-t")) { -			av++; ac--; -			if (*av) { -				movesperunit = atoi(*av); -				if (s = index(*av, '/')) -					timeunit = atoi(s + 1) * 60; -				else -					timeunit = 60; -			} else -				goto usage; -		} else if (eq(*av, "-p")) { -			av++; ac--; -			if (*av) -				progname = *av; -			else -				goto usage; -		} else if (eq(*av, "-h")) { -			av++; ac--; -			if (*av) -				proghost = *av; -			else -				goto usage; -		} else if (eq(*av, "-b")) { -			blackflag = true; -		} else if (eq(*av, "-c")) { -			progflag = true; -		} else if (eq(*av, "-bnw")) { -			bnwflag = true; -		} else if (eq(*av, "-s")) { -			saveflag = true; -		} else if (eq(*av, "-n")) { -			noisyflag = true; -		} else -			goto usage; -		av++; ac--; -	} -	if (ac > 0) -		dispname1 = av[0]; -	if (ac > 1) -		dispname2 = av[1]; -	if (ac > 2) -		goto usage; - -	if (!dispname2) -		oneboard = true; - -	srandom(getpid()); - -	if (!oneboard && randflag && (random() % 2)) { -		s = dispname1; -		dispname1 = dispname2; -		dispname2 = s; -	} - -	if (!dispname1) -		dispname1 = getenv("DISPLAY"); - -	/* Set up the board. */ -	board_setup(); - -	/* Create the windows. */ -	win_setup(dispname1, dispname2); - -	board_drawall(); - -	/* Start the program if necessary. */ -	if (progflag) -		if (!program_init(progname)) -			exit(1); - -	if (recfile) -		load_game(recfile); - -	/* Go into a loop of prompting players alternately for moves, checking -	 * them, and updating things. -	 */ -	for (;;) { -		win_process(false); -		clock_update(); -		if (progflag && ((!blackflag && (nexttomove == BLACK)) || -				(blackflag && (nexttomove == WHITE)))) { -			m = program_get(); -			if (m) -				prog_move(m); -		} -	} - -usage:	fprintf(stderr, "Usage: %s\n", USAGE); -	exit(1); -} - diff --git a/gnu/games/chess/Xchess/xchess.c.150 b/gnu/games/chess/Xchess/xchess.c.150 deleted file mode 100644 index 2c17906c3571..000000000000 --- a/gnu/games/chess/Xchess/xchess.c.150 +++ /dev/null @@ -1,197 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.5 $ on $Date: 86/11/26 12:11:32 $ - *           $Source: /users/faustus/xchess/RCS/xchess.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - */ - -#define USAGE	"xchess [ -d ] [ -f recordfile ] [ -r savedfile ] [ -i ]\n\ -\t[ -t moves/timeunit ] [ -c ] [ -p program ]  [ -b ] [ -bnw ] [ -s ]\n\ -\t[ -n ] [ -h host ] [ -v ] [ -R ] [ whitedisplay ] [ blackdisplay ]" - -#include <signal.h> -#include "xchess.h" - -bool debug = false; -bool oneboard = false; -bool bnwflag = false; -bool progflag = false; -bool blackflag = false; -bool quickflag = false; - -char *progname = DEF_PROGRAM; -char *proghost = NULL; -char *piecenames[] = { "pawn", "rook", "knight", "bishop", "queen", "king" } ; -char *colornames[] = { "white", "black", "none" } ; -char *movetypenames[] = { "move", "qcastle", "kcastle", "capture" } ; -char *dispname1 = NULL, *dispname2 = NULL; - -char *black_piece_color = BLACK_PIECE_COLOR; -char *white_piece_color = WHITE_PIECE_COLOR; -char *black_square_color = BLACK_SQUARE_COLOR; -char *white_square_color = WHITE_SQUARE_COLOR; -char *border_color = BORDER_COLOR; -char *text_color = TEXT_COLOR; -char *text_back = TEXT_BACK; -char *error_text = ERROR_TEXT; -char *player_text = PLAYER_TEXT; -char *cursor_color = CURSOR_COLOR; - -int num_flashes = NUM_FLASHES; -int flash_size = FLASH_SIZE; -char *program; -char *recfile = NULL; - -die () { -fprintf(stderr, "child proc changed status?!\n"); -} - -void -main(ac, av) -	char **av; -{ -	bool randflag = false; -	move *m; -	char *s; - -	program = av[0]; -	 -	signal(SIGCHLD, die); -	/* Process args. */ -	av++; ac--; -	while (ac > 0 && **av == '-') { -		if (eq(*av, "-d")) { -			debug = true; -		} else if (eq(*av, "-f")) { -			av++; ac--; -			if (*av) -				record_file = *av; -			else -				goto usage; -		} else if (eq(*av, "-r")) { -			av++; ac--; -			if (*av) -				recfile = *av; -			else -				goto usage; -		} else if (eq(*av, "-i")) { -			record_english = false; -		} else if (eq(*av, "-R")) { -			randflag = true; -		} else if (eq(*av, "-v")) { -			win_flashmove = true; -		} else if (eq(*av, "-q")) { -			quickflag = true; -		} else if (eq(*av, "-t")) { -			av++; ac--; -			if (*av) { -				movesperunit = atoi(*av); -				if (s = index(*av, '/')) -					timeunit = atoi(s + 1) * 60; -				else -					timeunit = 60; -			} else -				goto usage; -		} else if (eq(*av, "-p")) { -			av++; ac--; -			if (*av) -				progname = *av; -			else -				goto usage; -		} else if (eq(*av, "-h")) { -			av++; ac--; -			if (*av) -				proghost = *av; -			else -				goto usage; -		} else if (eq(*av, "-b")) { -			blackflag = true; -		} else if (eq(*av, "-c")) { -			progflag = true; -		} else if (eq(*av, "-bnw")) { -			bnwflag = true; -		} else if (eq(*av, "-s")) { -			saveflag = true; -		} else if (eq(*av, "-n")) { -			noisyflag = true; -		} else -			goto usage; -		av++; ac--; -	} -	if (ac > 0) -		dispname1 = av[0]; -	if (ac > 1) -		dispname2 = av[1]; -	if (ac > 2) -		goto usage; - -	if (!dispname2) -		oneboard = true; -	 -	srandom(getpid()); - -	if (!oneboard && randflag && (random() % 2)) { -		s = dispname1; -		dispname1 = dispname2; -		dispname2 = s; -	} -		 -	if (!dispname1) -		dispname1 = getenv("DISPLAY"); -	 -	/* Set up the board. */ -	board_setup(); - -	/* Create the windows. */ -	win_setup(dispname1, dispname2); - -	board_drawall(); - -	/* Start the program if necessary. */ -	if (progflag) -		if (!program_init(progname)) -			exit(1); - -	if (recfile) -		load_game(recfile); - -	/* Go into a loop of prompting players alternately for moves, checking -	 * them, and updating things. -	 */ -	for (;;) { -		win_process(false); -		clock_update(); -		if (progflag && ((!blackflag && (nexttomove == BLACK)) || -				(blackflag && (nexttomove == WHITE)))) { -			m = program_get(); -			if (m) -				prog_move(m); -		} -	} - -usage:	fprintf(stderr, "Usage: %s\n", USAGE); -	exit(1); -} - diff --git a/gnu/games/chess/Xchess/xchess.cur b/gnu/games/chess/Xchess/xchess.cur deleted file mode 100644 index ef3750dbdd7f..000000000000 --- a/gnu/games/chess/Xchess/xchess.cur +++ /dev/null @@ -1,9 +0,0 @@ - -#define xchess_width 16 -#define xchess_height 16 -#define xchess_x_hot 9 -#define xchess_y_hot 8 -static char xchess_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0xf8, 0x00, 0xfe, 0x80, 0xff, -   0xc0, 0xff, 0x60, 0xff, 0xb0, 0xfd, 0xd8, 0x66, 0x6c, 0x3b, 0x76, 0x1d, -   0x98, 0x1d, 0xcc, 0x0c, 0x60, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/Xchess/xchess.game b/gnu/games/chess/Xchess/xchess.game deleted file mode 100644 index 2302334080c7..000000000000 --- a/gnu/games/chess/Xchess/xchess.game +++ /dev/null @@ -1,8 +0,0 @@ - -X Chess -- Sun Sep 18 18:01:17 EDT 1988 -	Game played on pitcairn:0 -	english - 1. P/kb2-kb4        P/k2-k3 - 2. P/k2-k4           -Draw agreed. -Time: white: 6s, black: 43s diff --git a/gnu/games/chess/Xchess/xchess.h b/gnu/games/chess/Xchess/xchess.h deleted file mode 100644 index 355731d8b403..000000000000 --- a/gnu/games/chess/Xchess/xchess.h +++ /dev/null @@ -1,301 +0,0 @@ - -/* This file contains code for X-CHESS. -   Copyright (C) 1986 Free Software Foundation, Inc. - -This file is part of X-CHESS. - -X-CHESS is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY.  No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing.  Refer to the X-CHESS General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -X-CHESS, but only under the conditions described in the -X-CHESS General Public License.   A copy of this license is -supposed to have been given to you along with X-CHESS so you -can know your rights and responsibilities.  It should be in a -file named COPYING.  Among other things, the copyright notice -and this notice must be preserved on all copies.  */ - - -/* RCS Info: $Revision: 1.5 $ on $Date: 86/11/26 12:11:39 $ - *           $Source: /users/faustus/xchess/RCS/xchess.h,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group - *	Permission is granted to do anything with this code except sell it - *	or remove this message. - * - * Definitions for the X chess program. - */ - -#include "std.h" -#include <X11/Xlib.h> -#include "scrollText/scrollText.h" - -#define SIZE	8 - -typedef enum piecetype { PAWN, ROOK, KNIGHT, BISHOP, QUEEN, KING } piecetype; -typedef enum movetype { MOVE, QCASTLE, KCASTLE, CAPTURE } movetype; -typedef enum color { WHITE, BLACK, NONE } color; - -typedef struct piece { -	enum piecetype type; -	enum color color; -} piece; - -/* The board has y=0 and black at the top...  This probably isn't the best - * place to keep track of who can castle, but it's part of the game state... - */ - -typedef struct board { -	piece square[SIZE][SIZE]; -	bool white_cant_castle_k; -	bool white_cant_castle_q; -	bool black_cant_castle_k; -	bool black_cant_castle_q; -} board; - -typedef struct move { -	movetype type; -	piece piece; -	piece taken; -	int fromx, fromy; -	int tox, toy; -	struct move *next; -	bool enpassant; -	bool check; -} move; - -#define iswhite(win, i, j)	(!(((i) + (j)) % 2)) - -/* Stuff for the display. */ - -typedef struct windata { -	Display *display; -	Window basewin; -	Window boardwin; -	Window recwin; -	Window wclockwin; -	Window bclockwin; -	Window messagewin; -	Window buttonwin; -	Window jailwin; -	Window icon; -	Pixmap iconpixmap; -	XColor blackpiece; -	XColor whitepiece; -	XColor blacksquare; -	XColor whitesquare; -	XColor border; -	XColor textcolor; -	XColor textback; -	XColor errortext; -	XColor playertext; -	XColor cursorcolor; -	XFontStruct *small; -	XFontStruct *medium; -	XFontStruct *large; -	bool bnw; -	color color; -	bool flipped; -	double whitehands[3]; -	double blackhands[3]; -	char *txtassoc; -} windata; - -#define SMALL_FONT	"6x10" -#define MEDIUM_FONT	"8x13" -#define LARGE_FONT	"9x15" -#define JAIL_FONT	"6x10" - -#define SQUARE_WIDTH	80 -#define SQUARE_HEIGHT	80 - -#define BORDER_WIDTH	3 - -#define BOARD_WIDTH	8 * SQUARE_WIDTH + 7 * BORDER_WIDTH -#define BOARD_HEIGHT	8 * SQUARE_HEIGHT + 7 * BORDER_WIDTH -#define BOARD_XPOS	0 -#define BOARD_YPOS	0 - -#define RECORD_WIDTH	265	/* 40 chars * 6 pixels / character. */ -#define RECORD_HEIGHT	433 -#define RECORD_XPOS	BOARD_WIDTH + BORDER_WIDTH -#define RECORD_YPOS	0 - -#define JAIL_WIDTH	RECORD_WIDTH -#define JAIL_HEIGHT	163 -#define JAIL_XPOS	RECORD_XPOS -#define JAIL_YPOS	RECORD_YPOS + RECORD_HEIGHT + BORDER_WIDTH - -#define CLOCK_WIDTH	131 -#define CLOCK_HEIGHT	131 + BORDER_WIDTH + 20 -#define WCLOCK_XPOS	RECORD_XPOS -#define WCLOCK_YPOS	RECORD_HEIGHT + JAIL_HEIGHT + BORDER_WIDTH * 2 -#define BCLOCK_XPOS	WCLOCK_XPOS + CLOCK_WIDTH + BORDER_WIDTH -#define BCLOCK_YPOS	WCLOCK_YPOS - -#define MESS_WIDTH	329 -#define MESS_HEIGHT	92 -#define MESS_XPOS	0 -#define MESS_YPOS	BOARD_HEIGHT + BORDER_WIDTH - -#define BUTTON_WIDTH	MESS_WIDTH -#define BUTTON_HEIGHT	MESS_HEIGHT -#define BUTTON_XPOS	MESS_WIDTH + BORDER_WIDTH -#define BUTTON_YPOS	MESS_YPOS - -#define BASE_WIDTH	BOARD_WIDTH + RECORD_WIDTH + BORDER_WIDTH * 3 -#define BASE_HEIGHT	BOARD_HEIGHT + MESS_HEIGHT + BORDER_WIDTH * 3 - -#define BASE_XPOS	50 -#define BASE_YPOS	50 - -#define BLACK_PIECE_COLOR	"#202020" -#define WHITE_PIECE_COLOR	"#FFFFCC" -#define BLACK_SQUARE_COLOR	"#77A26D" -#define WHITE_SQUARE_COLOR	"#C8C365" -#define BORDER_COLOR		"#902E39" -#define TEXT_COLOR		"#006D6D" -#define TEXT_BACK		"#FFFFDD" -#define ERROR_TEXT		"Red" -#define PLAYER_TEXT		"Blue" -#define CURSOR_COLOR		"#FF606F" - -#define DEF_RECORD_FILE		"xchess.game" - -#define NUM_FLASHES		5 -#define FLASH_SIZE		10 - -/* xchess.c */ - -extern void main(); -extern bool debug; -extern char *progname; -extern char *proghost; -extern char *piecenames[]; -extern char *colornames[]; -extern char *movetypenames[]; -extern char *dispname1, *dispname2; -extern bool oneboard; -extern bool bnwflag; -extern bool progflag; -extern bool blackflag; -extern bool quickflag; -extern int num_flashes; -extern int flash_size; -extern char *black_piece_color; -extern char *white_piece_color; -extern char *black_square_color; -extern char *white_square_color; -extern char *border_color; -extern char *text_color; -extern char *text_back; -extern char *error_text; -extern char *player_text; -extern char *cursor_color; - -/* board.c */ - -extern void board_setup(); -extern void board_drawall(); -extern void board_move(); -extern board *chessboard; -extern void board_init(); - -/* window.c */ - -extern bool win_setup(); -extern void win_redraw(); -extern void win_restart(); -extern void win_drawboard(); -extern void win_drawpiece(); -extern void win_erasepiece(); -extern void win_process(); -extern void win_flash(); -extern windata *win1, *win2; -extern bool win_flashmove; - -/* control.c */ - -extern void button_pressed(); -extern void button_released(); -extern void move_piece(); -extern void prog_move(); -extern move *moves; -extern move *foremoves; -extern color nexttomove; -extern void replay(); -extern void forward(); -extern void cleanup(); -extern void restart(); -extern bool noisyflag; - -/* valid.c */ - -extern bool valid_move(); - -/* record.c */ - -extern void record_move(); -extern void record_reset(); -extern void record_save(); -extern void record_back(); -extern void record_init(); -extern void record_end(); -extern bool record_english; -extern char *record_file; -extern int movenum; -extern bool saveflag; - -/* message.c */ - -extern void message_init(); -extern void message_add(); -extern void message_send(); - -/* clock.c */ - -extern void clock_init(); -extern void clock_draw(); -extern void clock_update(); -extern void clock_switch(); -extern bool clock_started; -extern int movesperunit; -extern int timeunit; -extern int whiteseconds; -extern int blackseconds; - -/* button.c */ - -extern void button_draw(); -extern void button_service(); - -/* jail.c */ - -extern void jail_init(); -extern void jail_draw(); -extern void jail_add(); -extern void jail_remove(); - -/* program.c */ -extern bool program_init(); -extern void program_end(); -extern void program_send(); -extern void program_undo(); -extern move *program_get(); - -/* parse.c */ - -extern void load_game(); -extern move *parse_file(); -extern move *parse_move(); -extern move *parse_imove(); -extern bool loading_flag; -extern bool loading_paused; - -/* popup.c */ - -extern bool pop_question(); - diff --git a/gnu/games/chess/Xchess/xchess.icon b/gnu/games/chess/Xchess/xchess.icon deleted file mode 100644 index 78c68f1ba46b..000000000000 --- a/gnu/games/chess/Xchess/xchess.icon +++ /dev/null @@ -1,28 +0,0 @@ - -#define icon_width 48 -#define icon_height 48 -static char icon_bits[] = { -   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, -   0xc1, 0xff, 0xff, 0xff, 0xff, 0x83, 0x41, 0x00, 0x00, 0x00, 0x00, 0x82, -   0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, 0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, -   0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, 0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, -   0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, 0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, -   0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, 0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, -   0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, 0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, -   0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, 0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, -   0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, 0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, -   0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, 0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, -   0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, 0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, -   0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, 0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, -   0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, 0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, -   0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, 0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, -   0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, 0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, -   0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, 0x41, 0xf0, 0xf0, 0xf0, 0xf0, 0x82, -   0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, 0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, -   0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, 0x41, 0x0f, 0x0f, 0x0f, 0x0f, 0x82, -   0x41, 0x00, 0x00, 0x00, 0x00, 0x82, 0xc1, 0xff, 0xff, 0xff, 0xff, 0x83, -   0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x41, 0xc4, 0x89, 0x3c, 0xcf, 0x83, -   0x41, 0x24, 0x88, 0x04, 0x41, 0x80, 0x81, 0x22, 0x88, 0x04, 0x41, 0x80, -   0x01, 0x21, 0xf8, 0x1c, 0xcf, 0x83, 0x81, 0x22, 0x88, 0x04, 0x08, 0x82, -   0x41, 0x24, 0x88, 0x04, 0x08, 0x82, 0x41, 0xc4, 0x89, 0x3c, 0xcf, 0x83, -   0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; diff --git a/gnu/games/chess/Xchess/xchess_mask.cur b/gnu/games/chess/Xchess/xchess_mask.cur deleted file mode 100644 index 6408b7e0b915..000000000000 --- a/gnu/games/chess/Xchess/xchess_mask.cur +++ /dev/null @@ -1,7 +0,0 @@ - -#define xchess_mask_width 16 -#define xchess_mask_height 16 -static char xchess_mask_bits[] = { -   0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0xf8, 0x00, 0xfe, 0x80, 0xff, -   0xc0, 0xff, 0x60, 0xff, 0xb0, 0xfd, 0xd8, 0x66, 0x6c, 0x3b, 0x76, 0x1d, -   0x98, 0x1d, 0xcc, 0x0c, 0x60, 0x00, 0x00, 0x00}; diff --git a/gnu/games/chess/chess.6 b/gnu/games/chess/chess.6 deleted file mode 100644 index bbf0aa4abf98..000000000000 --- a/gnu/games/chess/chess.6 +++ /dev/null @@ -1,161 +0,0 @@ -.TH Chess GNU -.SH NAME -Chess \- GNU Chess -.SH SYNOPSIS -.B Chess -[ -.B arg1 arg2 -] -.SH DESCRIPTION -.I Chess -plays a game of chess against the user or it plays against itself. -.PP -.I Chess -has a simple alpha-numeric board display or it can be compiled for -use with the CHESSTOOL program on a SUN workstation. -The program gets its opening moves from the file gnuchess.book which -should be located in the same directory as gnuchess. -To invoke the prgram, type 'gnuchess' or type 'chesstool gnuchess' -on a SUN workstation where 'CHESSTOOL' is installed. -The 'gnuchess' command can be followed by up to 2 command line arguments. -If one argument is given it determines the programs search time in -seconds.  If two arguments are given, they will be used to set tournament -time controls with the first argument being the number of moves and the second -being the total clock time in minutes.  Thus, entering 'chess 60 5' will set -the clocks for 5 minutes (300 seconds) for the first 60 moves. -If no argument is given the program will prompt the user for level of -play. -For use with CHESSTOOL, see the documentation on that program. -.PP -Once -.I Chess -is invoked, the program will display the board and prompt the user -for a move. To enter a move, use the notation 'e2e4' where the first -letter-number pair indicates the origination square -and the second letter-number pair indicates the destination square. -An alternative is to use the notation 'nf3' where -the first letter indicates the piece type (p,n,b,r,q,k). -To castle, type the origin and destination squares -of the king just as you would do for a regular move, or type -"o-o" for kingside castling and "o-o-o" for queenside. -.SH COMMANDS -.PP -In addition to legal moves, the following commands are available as responses. -.PP -.I beep --- causes the program to beep after each move. -.PP -.I bd --- updates the current board position on the display. -.PP -.I book --- turns off use of the opening library. -.PP -.I both --- causes the computer to play both sides of a chess game. -.PP -.I black --- causes the computer to take the black pieces with the move -and begin searching. -.PP -.I level --- allows the user to set time controls such as -60 moves in 5 minutes etc.  In tournament mode, the program will -vary the time it takes for each -move depending on the situation.  If easy mode is disabled (using -the 'easy' command), the program -will often respond with its move immediately, saving time on -its clock for use later on. -.PP -.I depth --- allows the user to change the -search depth of the program.  The maximum depth is 29 ply. -Normally the depth is set to 29 and the computer terminates -its search based on elapsed time rather than depth. -Using the depth command allows setting depth to say -4 ply and setting response time to a large number such as -9999 seconds. The program will then search until all moves -have been examined to a depth of 4 ply (with extensions up -to 11 additional ply for sequences of checks and captures).  -.PP -.I easy --- toggles easy mode (thinking on opponents time) -on and off. The default is easy mode ON.  If easy mode is disabled, -the user must enter a 'break' or '^C' to get the programs -attention before entering each move. -.PP -.I edit --- allows the user to set up a board position. -In this mode, the '#' command will clear the board, the 'c' -command will toggle piece color, and the '.' command will exit -setup mode.  Pieces are entered by typing a letter (p,n,b,r,q,k) for -the piece followed by the coordinate.  For example "pb3" would -place a pawn on square b3. -.PP -.I force --- allows the user to enter moves for both -sides. To get the program to play after a sequence of moves -has been entered use the 'white' or 'black' commands. -.PP -.I get --- retrieves a game from disk.  The program will -prompt the user for a file name. -.PP -.I help --- displays a short description of the commands. -.PP -.I hint --- causes the program to supply the user with -its predicted move. -.PP -.I list --- writes the game moves and some statistics -on search depth, nodes, and time to the file 'chess.lst'. -.PP -.I new --- starts a new game. -.PP -.I post --- causes the program to display the principle -variation and the score during the search.  A score of -100 is equivalent to a 1 pawn advantage for the computer. -.PP -.I random --- causes the program to randomize its move -selection slightly. -.PP -.I reverse --- causes the board display to be reversed.  That -is, the white pieces will now appear at the top of the board. -.PP -.I quit --- exits the game. -.PP -.I save --- saves a game to disk.  The program will prompt -the user for a file name. -.PP -.I switch --- causes the program to switch places with -the opponent and begin searching. -.PP -.I undo --- undoes the last move whether it was the computer's -or the human's. You may also type "remove". This is equivalent -to two "undo's" (e.g. retract one move for each side). -.PP -.I white --- causes the computer to take the white pieces -with the move and begin searching. -.SH BUGS -.PP -Pawn promotion to pieces other than a queen is not allowed. -En-Passant does not work properly with CHESSTOOOL. -The transposition table may not work properly in some -positions so the default is to turn this off.  -.fi -.SH SEE ALSO -.nf -chesstool(6) -.fi - diff --git a/gnu/games/chess/gnuchess.book b/gnu/games/chess/gnuchess.book deleted file mode 100644 index 7e8a3b5d756e..000000000000 --- a/gnu/games/chess/gnuchess.book +++ /dev/null @@ -1,3878 +0,0 @@ -! -! Opening Library for CHESS -! -! Copyright (C) 1986, 1987, 1988 Free Software Foundation, Inc. -! Copyright (c) 1987 by Stuart Cracraft and John Stanback -! -! This file is part of CHESS. -! -! CHESS is distributed in the hope that it will be useful, -! but WITHOUT ANY WARRANTY.  No author or distributor -! accepts responsibility to anyone for the consequences of using it -! or for whether it serves any particular purpose or works at all, -! unless he says so in writing.  Refer to the CHESS General Public -! License for full details. -! -! Everyone is granted permission to copy, modify and redistribute -! CHESS, but only under the conditions described in the -! CHESS General Public License.   A copy of this license is -! supposed to have been given to you along with CHESS so you -! can know your rights and responsibilities.  It should be in a -! file named COPYING.  Among other things, the copyright notice -! and this notice must be preserved on all copies. -! -! -! -! Four Knight's Game -e2e4  e7e5 -g1f3  b8c6 -b1c3  g8f6 -f1b5  f8b4 -o-o   o-o -d2d3  b4c3 -b2c3  d7d6 -c1g5  d8e7 -f1e1  c6d8 -d3d4  d8e6 -! Giuoco Piano -e2e4  e7e5 -g1f3  b8c6 -f1c4  f8c5 -d2d3  g8f6 -b1c3  d7d6 -c1g5  h7h6 -g5f6  d8f6 -c3d5  f6d8 -! Two Knights Defence -e2e4  e7e5 -g1f3  b8c6 -f1c4  g8f6 -f3g5  d7d5 -e4d5  c6a5 -c4b5  c7c6 -d5c6  b7c6 -b5e2  h7h6 -! Two Knights Defence -- Max Lange Attack -e2e4  e7e5 -g1f3  b8c6 -f1c4  g8f6 -d2d4  e5d4 -o-o   f8c5 -e4e5  d7d5 -e5f6  d5c4 -f6g7  h8g8 -! Petrov's Defence -e2e4  e7e5 -g1f3  g8f6 -f3e5  d7d6 -e5f3  f6e4 -d2d4  d6d5 -f1d3  f8d6 -o-o   o-o -c2c4  c8g4 -c4d5  f7f5 -b1c3  b8d7 -! Petrov's Defence -e2e4  e7e5 -g1f3  g8f6 -d2d4  e5d4 -e4e5  f6e4 -d1d4  d7d5 -! -! Vienna Game -e2e4 e7e5 -b1c3 f8c5 -g1f3 d7d6 -d2d4 e5d4 -f3d4 g8f6 -c1g5 h7h6 -g5h4 b1c3 -! -e2e4 e7e5 -b1c3 b8c6 -g1f3 g7g6 -d2d4 e5d4 -c3d5 f8g7 -c1g5 c6e7 -f3d4 c7c6 -d5c3 h7h6 -! - - - - - - -! ECO C25/1-2 -e2e4 e7e5 -b1c3 f8c5 -f1c4 d7d6 -d2d3 c8e6 -c4e6 f7f6 -d1h5 e7d7 -c1e3 c5b6 -g1e2 b8c6 -o-o  g8f6 -h5h3 d8e8 -! -e2e4 e7e5 -b1c3 f8c5 -g1f3 d7d6 -d2d4 e5d4 -f3d4 g8f6 -c1g5 h7h6 -g5h4 b8c6 -d4c6 b7c6 -f1d3 e8e7 -o-o  g7g5 -! ECO C25/3-9 -e2e4 e7e5 -b1c3 b8c6 -f2f4 e5f4 -g1f3 g7g5 -h2h4 g5g4 -f3g5 h7h6 -g5f7 e7f7 -d2d4 d7d5 -c1f4 f8b4 -f1e2 b4c3 -b2c3 g8f6 -! -e2e4 e7e5 -b1c3 b8c6 -f2f4 e5f4 -g1f3 g7g5 -d2d4 g5g4 -f1c4 g4f3 -o-o  d7d5 -e4d5 c8g4 -d1d2 c6e7 -d2f4 g8h6 -! -e2e4 e7e5 -b1c3 b8c6 -f2f4 e5f4 -d2d4 d8h4 -e1e2 d7d5 -e4d5 c8g4 -g1f3 o-o-o -d5c6 f8c5 -d1e1 h4h5 -c6b7 e8b8 -e2d2 g4f3 -! -e2e4 e7e5 -b1c3 b8c6 -f2f4 e5f4 -d2d4 d8h4 -e1e2 d7d6 -g1f3 c8g4 -c1f4 o-o-o -e2e3 h4h5 -f1e2 g7g5 -f3g5 f7f5 -h2h3 g4e2 -! -e2e4 e7e5 -b1c3 b8c6 -g2g3 f8c5 -f1g2 a7a6 -g1e2 d7d6 -d1d3 c8g4 -h2h3 g4e6 -o-o  g8e7 -c3d5  o-o -c2c3 c5a7 -g1h2 f7f6 -! -e2e4 e7e5 -b1c3 b8c6 -g2g3 f8c5 -f1g2 d7d6 -c3a4 g8e7 -a4c5 d6c5 -d2d3 o-o  -g2e3 b7b6 -d1d2 c8e6 -g1e2 d8d7 -o-o  a8d8 -! -e2e4 e7e5 -b1c3 b8c6 -f1c4 f8c5 -d1g4 g7g6 -d4f3 g8f6 -g1e2 d7d6 -d2d3 c8g4 -f3g3 h7h6 -f2f4 d7e7 -c3d5 f6d5 -g3g4 d5e3 -! ECO C26/1-10 -e2e4 e7e5 -b1c3 g8f6 -g2g3 c7c6 -f1g2 d7d6 -g1e2 b7b5 -o-o  b8d7 -h2h3 d8c7 -g3g4 b5b4 -c3b1 a7a5 -a2a3 c8a6 -a3b4 a5b4 -! -e2e4 e7e5 -b1c3 g8f6 -g2g3 d7d5 -e4d5 f6d5 -f1g2 c8e6 -g1f3 b8c6 -o-o  f8e7 -f1e1 e7f6 -c3e4  o-o -d2d3 f6e7 -a2a3 d5b6 -! -e2e4 e7e5 -b1c3 g8f6 -g2g3 d7d5 -e4d5 f6d5 -f1g2 d5c3 -b2c3 f8d6 -g1f3  o-o -o-o  b8d7 -d2d3 a1b8 -a2a4 b7b6 -a4a5 c8b7 -! -e2e4 e7e5 -b1c3 g8f6 -g2g3 f8b4 -f1g2 c7c6 -g1e2  o-o -o-o  d7d5 -e4d5 c6d5 -d2d4 e5d4 -e2d4 b8c6 -c1g5 b4e7 -f1e1 h7h6 -! -e2e4 e7e5 -b1c3 g8f6 -g2g3 f8c5 -f1g2 b8c6 -g1e2 d7d6 -o-o   o-o -d2d3 c8e6 -c3d5 e6d5 -e4d5 c6e7 -c1g5 f6d7 -d3d4 e5d4 -! -e2e4 e7e5 -b1c3 g8f6 -g2g3 f8c5 -f1g2 b8c6 -g1f3 d7d6 -d2d3 a7a6 -o-o   o-o -c1g5 h7h6 -g5e3 c5e3 -f2e3 d6d5 -e4d5 f6d5 -! -e2e4 e7e5 -b1c3 g8f6 -g2g3 f8c5 -f1g2  o-o -d2d3 f8e8 -g1e2 c7c6 -o-o  d7d5 -e5d5 f6d5 -g1h1 c8g4 -h2h3 g4e6 -c3e4 c5e7 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 f8b4 -g1e2  o-o -d2d3 c7c6 -o-o  d7d5 -c4b3 d5e4 -c3e4 b8d7 -e2g3 f6e4 -d3e4 d7c5 -d1h5 c5b3 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 f8c5 -d2d3 d7d6 -c1g5 c8e6 -d1d2 b8d7 -g1e2 e6c4 -d3c4 h7h6 -g5e3 d8e7 -e2g3 c5e3 -f2e3 g7g6 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 f8c5 -d2d3 d7d6 -f2f4 b8c6 -f4f5 b6d4 -g1f3 c7c6 -f3d4 c5d4 -d1f3 b7b5 -c4b3 a7a5 -a2a3 a5a4 -! ECO C27/1-2 -e2e4 e7e5 -b1c3 g8f6 -f1c4 f6e4 -d1h5 e4d6 -h5e5 d8e7 -e5e7 f8e7 -c4b3 d6f5 -c3d5 e7d8 -d5e3 f5d4 -b3c4 c7c6 -g1e2 d4e2 -c4e2 d7d5 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 f6e4 -d1h5 e4d6 -c4b3 b8c6 -c3b5 g7g6 -h5f3 f7f6 -b5c7 d8c7 -f3f6 b7b6 -g1f3 c8a6 -f3e5 c6e5 -f6e5 e8d8 -! ECO C27/3-5 -e2e4 e7e5 -b1c3 g8f6 -f1c4 f6e4 -d1h5 e4d6 -c4b3 b8c6 -c3b5 g7g6 -h5f3 f7f5 -f3d5 d8e7 -b5c7 e8d8 -c7a8 b7b6 -d2d3 c8b7 -h2h4 f5f4 -d5f3 f8h6 -b3d5 b7a8 -f3g4 h8f8 -g1e2 e5e4 -c1f4 h6f4 -e2f4 e7e5 -g4g5 e5g5 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 f6e4 -d1h5 e4d6 -c4b3 b8c6 -c3b5 g7g6 -h5f3 f7f5 -f3d5 d8e7 -b5c7 e8d8 -c7a8 b7b6 -g1f3 c8b7 -d3d4 c6d4 -c1g5 d4f3 -d5f3 e7g5 -b3d5 e5e4 -f3b3 b7a6 -b3a4 f8h6 -a4d4 h8e8 -g2g3 g5g4 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 f6e4 -d1h5 e4d6 -c4b3 b8c6 -c3b5 g7g6 -h5f3 f7f5 -f3d5 d8e7 -b5c7 e8d8 -c7a8 b7b6 -a8b6 a7b6 -d5f3 c8b7 -d2d3 c6d4 -f3h3 e5e4 -c1e3 e4d3 -o-o-o d4c2 -e3b6 d8e8 -h3d3 f8h6 -c1b1 b7e4 -! ECO C27/6-7 -e2e4 e7e5 -b1c3 g8f6 -f1c4 f6e4 -d1h5 e4d6 -c4b3 f8e7 -g1f3 b8c6 -f3e5  o-o -o-o  c6d4 -c3d5 d4b3 -a2b3 d6e8 -h5e2 e8f6 -e5c6 d7c6 -d5e7 g8h8 -e7c8 d8c8 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 f6e4 -d1h5 e4d6 -c4b3 f8e7 -g1f3  o-o -h2h4 b8c6 -f3g5 h7h6 -h5g6 e7g5 -h4g5 d8g5 -d2d3 d6f5 -c1g5 c6d4 -c3d5 d4b3 -! ECO C28/1-7 -e2e4 e7e5 -b1c3 g8f6 -f1c4 b8c6 -f2f3 f6e4 -g1f3 e4c3 -d2c3 d8e7 -b2b4 d7d6 -o-o  c8e6 -c4e6 e7e6 -b4b5 c6d8 -f4e5 d6e5 -f3e5 f8d6 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 b8c6 -d2d3 c6a5 -g1e2 a5c4 -d3c4 d7d6 -o-o  c8e6 -b2b3 c7c6 -e2g3 g7g6 -h2h3 h7h5 -d1d3 f8e7 -c1e3 d8d7 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 b8c6 -d2d3 f8c5 -c1g5 h7h6 -g5h4 d7d6 -c3a4 c8e6 -a4c5 d6c5 -b2b3 e6c4 -b3c4 d8d6 -g1e2 c6d4 -h4f6 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 b8c6 -d2d3 f8b4 -g1e2 d7d5 -e4d5 f6d5 -c4d5 d8d5 -o-o  d5d8 -f2f4 e5f4 -c1f4  o-o -d1e1 b4d6 -e1g3 b6f4 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 b8c6 -d2d3 f8b4 -c1g5 d7d6 -g1e2 c8e6 -o-o  h7h6 -g5f6 d8f6 -c3d5 e6d5 -c4d5 b4c5 -c2c3  o-o -g1h1 c6e7 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 b8c6 -d2d3 f8b4 -c1g5 h7h6 -g5f6 b4c3 -b2c3 d8f6 -g1e2 d7d6 -d1d2 c1e6 -c4b5 f6g5 -e2g3  o-o -b5c6 b7c6 -! -e2e4 e7e5 -b1c3 g8f6 -f1c4 b8c6 -d2d3 f8b4 -g1f3 d7d6 -o-o  b4c3 -b2c3 c6a5 -c4b3 a5b3 -a2b3  o-o -c3c4 b7b6 -d1e2 f6d7 -c1g5 f7f6 -! ECO C29/1 -e2e4 e7e5 -b1c3 g8f6 -f1f4 d7d5 -d2d3 e5f4 -e4d5 f6d5 -c3d5 d8d5 -c1f4 f8d6 -f4d6 d5d6 -d1d2  o-o -g1f3 c8g4 -f1e2 g4f3 -! ECO C29/2-12 -e2e4 e7e5 -b1c3 g8f6 -f2f4 d7d5 -f4e5 f6e4 -d1f3 b8c6 -f1b5 e4c3 -b2c3 f8e7 -d2d4  o-o -b5d3 f7f6 -f3h5 g7g6 -d3g6 h7g6 -h5g6 g8h8 -g6h6 h8g8 -! -e2e4 e7e5 -b1c3 g8f6 -f2f4 d7d5 -f4e5 f6e4 -d1f3 f7f5 -d2d3 e4c3 -b2c3 d5d4 -f3g3 b8c6 -f1e2 c8e6 -e2f3 d8d7 -g1e2 f8c5 -c3c4  o-o -o-o  e6c4 -! -e2e4 e7e5 -b1c3 g8f6 -f2f4 d7d5 -f4e5 f6e4 -d2d3 d8h4 -g2g3 e4g3 -g1f3 h4h5 -c3d5 c8g4 -f1g2 g3h1 -d5c7 e8d7 -c7h8 b8c6 -c1e3 f7f6 -d3d4 f6e5 -! -e2e4 e7e5 -b1c3 g8f6 -f2f4 d7d5 -f4e5 f6e4 -d2d3 f1b4 -d3e4 d8h4 -e1e2 b8c6 -g1f3 c8g4 -c3d5 o-o-o -c2c3 f7f5 -e5f6 h8e8 -c3b4 e8e4 -c1e3 g7f6 -! -e2e4 e7e5 -b1c3 g8f6 -f2f4 d7d5 -f4e5 f6e4 -d2d3 e4c3 -b2c3 d5d4 -g1f3 b8c6 -c3d4 f8b4 -c1d2 b4d2 -d1d2 c6d4 -c2c3 d4f3 -g2f3 d8h4 -d2f2 h4f2 -! -e2e4 e7e5 -b1c3 g8f6 -f2f4 d7d5 -f4e5 f6e4 -g1f3 f1b4 -d1e2 b4c3 -b2c3  o-o -e2e3 b8c6 -f1d3 f7f5 -o-o  c8e6 -c1a3 f8e8 -a1b1 a8b8 -a3b5 e6d7 -! -e2e4 e7e5 -b1c3 g8f6 -f2f4 d7d5 -f4e5 f6e4 -g1f3 b8c6 -f1b5 f8c5 -d2d4 c5b4 -c1d2 b4c3 -b2c3  o-o -o-o  c1g4 -d1e1 f7f6 -d2e3 g4d7 -e5f6 d8f6 -! -e2e4 e7e5 -b1c3 g8f6 -f2f4 d7d5 -f4e5 f6e4 -g1f3 f8c5 -d1e2 c5f2 -e1d1 e4c3 -d2c3 f2b6 -c3g5 d8d7 -d1d2  o-o -a1d1 d7a4 -a2a3 c7c5 -d2c1 c8e6 -! -e2e4 e7e5 -b1c3 g8f6 -f2f4 d7d5 -f4e5 f6e4 -g1f3 c8g4 -d1e2 e4g5 -h2h4 g5f3 -g2f3 g4e6 -d2d4 b8c6 -c1e3 f8e7 -e2f2 d8d7 -o-o-o o-o-o -f1b5 a7a6 -! -e2e4 e7e5 -b1c3 g8f6 -f2f4 d7d5 -f4e5 f6e4 -g1f3 f8e7 -d1e2 e4c3 -d2c3  o-o -c1f4 c7c5 -o-o-o d8a5 -c1b1 b8c6 -a4b5 c8e6 -b5a5 f3g5 -! -e2e4 e7e5 -b1c3 g8f6 -f2f4 d7d5 -f4e5 f6e4 -g1f3 f8e7 -d2d4  o-o -f1d3 f7f6 -e5f6 e7f6 -o-o  b8c6 -c3e4 d5e4 -d3e4 c6d4 -f3g5 c8f5 -c2c3 f7g5 -! -! Vienna Game -e2e4  e7e5 -b1c3  f8c5 -g1f3  d7d6 -d2d4  e5d4 -f3d4  g8f6 -c1g5  h7h6 -g5h4  b1c3 -! Three Knights Game -e2e4  e7e5 -b1c3  b8c6 -g1f3  g7g6 -d2d4  e5d4 -c3d5  f8g7 -c1g5  c6e7 -f3d4  c7c6 -d5c3  h7h6 -! Bishop's Opening -e2e4  e7e5 -f1c4  g8f6 -d2d4  e5d4 -g1f3  f6e4 -d1d4  e4c5 -o-o   c5e6 -f1e1  c7c6 -b1c3  d7d5 -c4d3  f8e7 -! Ruy Lopez -- Classical Defence -e2e4  e7e5 -g1f3  b8c6 -f1b5  f8c5 -c2c3  g8f6 -d2d4  e5d4 -e4e5  f6e4 -o-o   d7d5 -! Ruy Lopez -- Birds Defence -e2e4  e7e5 -g1f3  b8c6 -f1b5  c6d4 -b5a4  f8c5 -o-o   d4f3 -d1f3  g8e7 -d2d3  o-o -c1e3  c5b6 -b1c3  d7d6 -! Ruy Lopez -- Schliemann Defence -e2e4  e7e5 -g1f3  b8c6 -f1b5  f7f5 -b1c3  f5e4 -c3e4  d7d5 -f3e5  d5e4 -e5c6  d8d5 -c2c4  d5d6 -c6a7  c8d7 -! Ruy Lopez -- Old Steinitz Defence -e2e4  e7e5 -g1f3  b8c6 -f1b5  d7d6 -d2d4  c8d7 -b1c3  g8f6 -o-o   f8e7 -f1e1  e5d4 -f3d4  o-o -d4f5  f8e8 -! Ruy Lopez -- Old Steinitz Defence -e2e4  e7e5 -g1f3  b8c6 -f1b5  d7d6 -d2d4  c8d7 -b1c3  g8f6 -b5c6  d7c6 -d1d3  e5d4 -f3d4  f8e7 -c1g5  c6d7 -! Ruy Lopez -- Modern Steinitz Defence -e2e4  e7e5 -g1f3  b8c6 -f1b5  a7a6 -b5a4  d7d6 -d2d4  b7b5 -a4b3  c6d4 -f3d4  e5d4 -c2c3  d4c3 -b1c3  c8b7 -! Ruy Lopez -- Open Defence -e2e4  e7e5 -g1f3  b8c6 -f1b5  a7a6 -b5a4  g8f6 -o-o   f6e4 -d2d4  b7b5 -a4b3  d7d5 -d4e5  c8e6 -c2c3  f8c5 -b1d2  o-o -! Ruy Lopez -- Open Defence -e2e4  e7e5 -g1f3  b8c6 -f1b5  a7a6 -b5a4  g8f6 -o-o   f8e7 -f1e1  b7b5 -a4b3  d7d6 -c2c3  o-o -h2h3  c6a5 -b3c2  c2c4 -d2d4  d8c7 -! Ruy Lopez -e2e4  e7e5 -g1f3  b8c6 -f1b5  a7a6 -b5c6  d7c6 -d2d4  e5d4 -d1d4  d8d4 -f3d4  c8d7 -c1e3  o-o-o -b1d2  g8e7 -! Scotch Game -e2e4  e7e5 -g1f3  b8c6 -d2d4  e5d4 -f3d4  f8c5 -c1e3  d8f6 -c2c3  g8e7 -b1d2  d7d6 -e3c5  d6c5 -! Philidor's Defence -e2e4  e7e5 -g1f3  d7d6 -d2d4  g8f6 -b8c6  b1d2 -f8c5  f1e2 -o-o   o-o -d1e2  c7c6 -! Alekhine's Defence -e2e4  g8f6 -e4e5  f6d5 -c2c4  d5b6 -d2d4  d7d6 -f2f4  d6e5 -f4e5  b8c6 -c1e3  c8f5 -b1c3  e7e6 -g1f3  f8e7 -! Alekhine's Defence -e2e4  g8f6 -e4e5  f6d5 -d2d4  d7d6 -g1f3  c8g4 -f1e2  e7e6 -o-o   f8e7 -h2h3  g4h5 -c2c4  d5b6 -! Kings Gambit Accepted -e2e4  e7e5 -f2f4  e5f4 -g1f3  d7d6 -f1c4  h7h6 -d2d4  g7g5 -o-o   f8g7 -c2c3  b8c6 -d1b3  d8e7 -! Ponziani's Opening -e2e4  e7e5 -g1f3  b8c6 -c2c3  d7d5 -d1a4  g8f6 -f3e5  f8d6 -e5c6  b7c6 -d2d3  o-o -c1g5  h7h6 -! Caro-Kann Defence -e2e4  c7c6 -d2d4  d7d5 -e4d5  c6d5 -c2c4  g8f6 -b1c3  b8c6 -c1g5  e7e6 -c4c5  f8e7 -f1b5  o-o -g1f3  f6e4 -! Caro-Kann Defence -e2e4  c7c6 -d2d4  d7d5 -e4e5  c8f5 -f1d3  f5d3 -d1d3  e7e6 -b1c3  d8b6 -b1d2  c6c5 -d4c5  f8c5 -! Caro-Kann Defence -e2e4  c7c6 -b1c3  d7d5 -g1f3  c8g4 -h2h3  g4f3 -d1f3  e7e6 -d2d4  g8f6 -f1d3  d5e4 -c3e4  d8d4 -c2c3  d4d8 -! French Defence -- Classical -e2e4  e7e6 -d2d4  d7d5 -b1c3  g8f6 -c1g5  f8e7 -e4e5  f6d7 -g5e7  d8e7 -d1d2  o-o -f2f4  c7c5 -g1f3  b8c6 -o-o-o c5c4 -! French Defence -- MacCutcheon -e2e4  e7e6 -d2d4  d7d5 -b1c3  g8f6 -c1g5  c8g4 -e4e5  h7h6 -g5d2  g4f3 -g2f3  f6e4 -d1g4  e8f8 -h2h4  c7c5 -! French Defence -- Rubenstein -e2e4  e7e6 -d2d4  d7d5 -b1c3  d5e4 -c3e4  b8d7 -g1f3  g8f6 -e4f6  d7f6 -f1d3  b7b6 -d1e2  c8b7 -c1g5  f8e7 -! French Defence -- Winawer -e2e4  e7e6 -d2d4  d7d5 -b1c3  f8b4 -e4e5  c7c5 -a2a3  b4c3 -b2c3  b8d7 -d1g4  o-o -g1f3  b8c6 -f1e3  f7f5 -! French Defence -- Tarrasch -e2e4  e7e6 -d2d4  d7d5 -b1d2  b8c6 -g1f3  g8f6 -e4e5  f6d7 -d2b3  f7f6 -f1b5  f8e7 -c1f4  o-o -! Sicilian Defence -- Dragon Variation -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -f1e2  g7g6 -c1e3  f8g7 -o-o   o-o -d4b3  c8e6 -f2f4  c6a5 -f4f5  e6c4 -! Sicilian Defence -- Dragon Variation -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g7g6 -b1c3  f8g7 -c1e3  g8f6 -f1c4  o-o -! Sicilian Defence -- Boleslavsky Variation -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -f1e2  e7e5 -d4b3  f8e7 -o-o   o-o -c1e3  c8e6 -! Sicilian Defence -- Najdorf -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -d1d2  f8e7 -o-o-o o-o -! Sicilian Defence -- Najdorf -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -f1e2  e7e5 -d4b3  f8e7 -o-o   o-o -f2f4  b7b5 -a2a3  c8b7 -! Sicilian Defence -- Najdorf -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -g2g3  e7e5 -d4e2  c8e6 -f1g2  b7b5 -o-o   b8d7 -! Sicilian Defence -- Closed -e2e4  c7c5 -b1c3  b8c6 -g2g3  g7g6 -f1g2  f8g7 -d2d3  e7e6 -c1e3  d7d6 -g1e2  c6d4 -d1d2  d8h4 -o-o   g8d7 -! Nimzowitsch Defence -e2e4  b8c6 -d2d4  d7d5 -e4e5  f7f6 -g1f3  c1g4 -f1e2  e7e6 -e5f6  g8f6 -c2c3  f8d6 -c1g5  d8d7 -! Queens Gambit Accepted -d2d4  d7d5 -c2c4  d5c4 -g1f3  g8f6 -e2e3  e7e6 -f1c4  c7c5 -o-o   a7a6 -d1e2  b7b5 -c4d3  c5d4 -e3d4  b8c6 -! Queens Gambit -- Catalan -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -g1f3  f8e7 -f1g2  o-o -o-o   f6d7 -d1c2  c7c6 -b1d2  b7b6 -e2e4  c8b7 -b2b3  a8c8 -! Queens Gambit Declined -- Orthodox -d2d4  d7d5 -c2c4  e7e6 -b1c3  g8f6 -c1g5  f8e7 -e2e3  o-o -g1f3  b8d7 -a1c1  c7c6 -f8d3  d5c4 -f1c4  f6d5 -! Queens Gambit Declined -- Cambridge Springs -d2d4  d7d5 -c2c4  e7e6 -b1c3  g8f6 -c1g5  b8d7 -e2e3  c7c6 -g1f3  d8a5 -f3d2  f8b4 -d1c2  o-o -g5h4  c6c5 -! Queens Gambit Declined -- Exchange Var. -d2d4  d7d5 -c2c4  e7e6 -b1c3  g8f6 -c1g5  b8d7 -c4d5  e6d5 -e2e3  c7c6 -f1d3  f8e7 -d1c2  o-o -g1e2  f8e8 -! Queens Gambit Declined -- Semi-Tarrasch -d2d4  d7d5 -c2c4  e7e6 -b1c3  g8f6 -g1f3  c7c5 -c4d5  c5d4 -d1d4  e6d5 -e2e4  b8c6 -f1b5  f6e4 -! Queens Gambit Declined -- Tarrasch -d2d4  d7d5 -c2c4  e7e6 -b1c3  c7c5 -c4d5  e6d5 -g1f3  b8c6 -g2g3  g8f6 -f1g2  f8e7 -o-o   o-o -! Queens Gambit Declined -- Vienna -d2d4  d7d5 -c2c4  e7e6 -g1f3  g8f6 -f1b5  f8b4 -b1c3  d5c4 -e2e4  c7c5 -e4e5  c5d4 -d1a4  b8c6 -o-o-o c1d2 -! Queens Gambit Declined -- Slav (Marshall Gambit) -d2d4  d7d5 -c2c4  c7c6 -b1c3  e7e6 -e2e4  d4e4 -c3e4  f8b4 -c1d2  d8d4 -d2b4  d4e4 -f1e2  b8a6 -b4d6  b7b6 -! Queens Gambit --Slav (Krause) -d2d4  d7d5 -c2c4  c7c6 -g1f3  g8f6 -b1c3  d5c4 -a2a4  c8f5 -f3e5  e7e6 -f2f3  f8b4 -c1g5  h7h6 -g5f6  d8f6 -e2e4  f5h7 -! Modern Benoni Counter Gambit -d2d4  g8f6 -c2c4  c7c5 -d4d5  e7e6 -b1c3  e6d5 -c4d5  d7d6 -e2e4  g7g6 -f1d3  f8g7 -g1e2  o-o -o-o   a7a6 -a2a4  d8c7 -! Queens Pawn Game -d2d4  d7d5 -g1f3  g8f6 -c1f4  c7c5 -e2e3  b8c6 -c2c3  d8b6 -d1c1  c8f5 -d4c5  b6c5 -b1d2  a8c8 -f3d4  c6d4 -e3d4  c5b6 -! Pirc-Robatsch Defence -d2d4  d7d6 -e2e4  g8f6 -b1c3  g7g6 -c1g5  f8g7 -d1d2  b8d7 -o-o-o e7e5 -d4e5  d6e5 -g1f3  h7h6 -g5h4  g6g5 -h4g3  d8e7 -! Pirc-Robatsch Defence -d2d4  d7d6 -e2e4  g8f6 -b1c3  g7g6 -f1c4  c7c6 -d1e2  f8g7 -g1f3  o-o -c1g5  b7b5 -c4d3  d8c7 -! Queens Indian Defence -d2d4  g8f6 -c2c4  e7e6 -g1f3  b7b6 -g2g3  c8b7 -f1g2  f8e7 -o-o   o-o -b1c3  f6e4 -d1c2  e4c3 -c2c3  d7d6 -c3c2  f7f5 -! Queens Indian Defence -d2d4  g8f6 -c2c4  e7e6 -g1f3  b7b6 -e2e3  c8b7 -f1d3  f8e7 -b1c3  d7d5 -o-o   o-o -d1e2  b8d7 -! Nimzo-Indian Defence -d2d4  g8f6 -c2c4  e7e6 -b1c3  f8b4 -d1c2  d7d5 -a2a3  b4c3 -c2c3  b8c6 -g1f3  f6e4 -c3b3  c6a5 -b3a4  c7c6 -! Nimzo-Indian Defence (Rubenstein) -d2d4  g8f6 -c2c4  e7e6 -b1c3  f8b4 -e2e3  o-o -f1d3  d7d5 -g1f3  c7c5 -o-o   b8c6 -a2a3  b4c3 -b2c3  d5c4 -d3c4  d8c7 -! Nimzo-Indian Defence -- Samisch  -d2d4  g8f6 -c2c4  e7e6 -b1c3  f8b4 -a2a3  b4c3 -b2c3  o-o -f2f3  d7d5 -c4d5  e6d5 -e2e3  c8f5 -g1e2  b8d7 -e2g3  f5g6 -! Nimzo-Indian Defence -d2d4  g8f6 -c2c4  e7e6 -b1c3  f8b4 -c1d2  o-o -e2e3  d7d5 -g1f3  c7c5 -a2a3  b4c3 -d2c3  f6e4 -a1c1  e4c3 -c1c3  c5d4 -! Grunfeld Defence -d2d4  g8f6 -c2c4  g7g6 -b1c3  d7d5 -c4d5  f6d5 -e2e4  d5c3 -b2c3  c7c5 -f1c4  f8g7 -g1e2  o-o -o-o   c5d4 -c3d4  b8c6 -! Grunfeld Defence -- Smyslov -d2d4  g8f6 -c2c4  g7g6 -b1c3  d7d5 -g1f3  f8g7 -d1b3  d5c4 -b3c4  o-o -e2e4  c8g4 -c1e3  f6d7 -o-o-o b8c6 -! Grunfeld Defence -d2d4  g8f6 -c2c4  g7g6 -b1c3  d7d5 -c1f4  f8g7 -d2d3  o-o -c4d5  f6d5 -c3d5  d8d5 -f4c7  b8c6 -! Kings Indian Defence -- Classical -d2d4  g8f6 -c2c4  g7g6 -b1c3  f8g7 -e2e4  d7d6 -g1f3  o-o -f1e2  e7e5 -o-o   b8c6 -c1e3  f8e8 -d4e5  d6e5 -! Kings Indian Defence -- 4 pawns attack -d2d4  g8f6 -c2c4  g7g6 -b1c3  f8g7 -e2e4  d7d6 -f2f4  c7c5 -g1f3  o-o -d4d5  e7e6 -f1d3  e6d5 -c4d5  d8b6 -! Kings Indian Defence -- Samisch -d2d4  g8f6 -c2c4  g7g6 -b1c3  f8g7 -e2e4  d7d6 -f2f3  o-o -c1e3  e7e5 -d4d5  c7c6 -g1e2  c6d5 -c3d5  f6d5 -! Kings Indian Defence -- Main Line -d2d4  g8f6 -c2c4  g7g6 -g2g3  f8g7 -f1g2  o-o -b1c3  d7d6 -g1f3  b8d7 -o-o   e7e5 -e2e4  c7c6 -h2h3  d8b6 -! Kings Indian Defence -d2d4  g8f6 -c2c4  g7g6 -b1c3  f8g7 -g1f3  o-o -c1f4  d7d6 -h2h3  b8d7 -e2e3  c7c6 -! Dutch Defence -d2d4  f7f5 -g2g3  e7e6 -f1g2  g8f6 -g1f3  f8e7 -o-o   o-o -c2c4  d7d6 -b1c3  d8e8 -d1c2  e8h5 -b2b3  b8c6 -c1a3  a7a5 -! English Opening -c2c4  e7e5 -b1c3  g8f6 -g1f3  b8c6 -e2e4  f8b4 -d2d3  d7d6 -f1e2  o-o -o-o   b4c3 -b2c3  d8e7 -! English Opening -c2c4  g8f6 -b1c3  d7d5 -c4d5  f6d5 -e2e4  d5f4 -f1c4  c8e6 -c4e6  f7e6 -! English Opening -c2c4  e7e5 -b1c3  g8f6 -g1f3  b8c6 -g2g3  d7d5 -c4d5  f6d5 -f1g2  d5b6 -o-o   f8e7 -d2d3  o-o -c1e3  f7f5 -! Reti -- Accepted -g1f3  d7d5 -c2c4  d5c4 -e2e3  c7c5 -f1c4  e7e6 -o-o   g8f6 -b2b3  b8c6 -c1b2  a7a6 -a2a4  f8e7 -! Reti -- Neo Catalan -g1f3  d7d5 -c2c4  e7e6 -g2g3  g8f6 -f1g2  f8e7 -o-o   o-o -b2b3  c7c5 -c4d5  f6d5 -c1b2  b8c6 -d2d4  b7b6 -b1c3  d5c3 -! Reti -- Barcza -g1f3  d7d5 -g2g3  g8f6 -f1g2  g7g6 -o-o   f8g7 -d2d3  o-o -b1d2  b8c6 -e2e4  e7e5 -c2c3  a7a5 -f1e1  d5e4 -d3e4  f6d7 -! Sicilian Najdorf -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  d8b6 -d1d2  b6b2 -a1b1  b2a3 -e4e5  d6e5 -f4e5  f6d7 -c3e4  h7h6 -g5h4  a3a2 -b1b3  b8c6 -d4c6  b7c6 -e4d6  f8d6 -e5d6  a6a5 -f1e2  a5a4 -b3c3  a2a1 -e2d1  a4a3 -o-o   a3a2  -d2e3  o-o -! #  Sicilian Defense col. 2f p. 176 MCO 12.  (Incomplete game) -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  d8b6 -d1d2  b6b2 -a1b1  b2a3 -e4e5  d6e5 -f4e5  f6d7 -f1c4  f8b4 -b1b3  a3a5 -o-o   o-o -g5f6  d7f6 -e5f6  f8d8 -b3b4  a5b4 -d2g5  g7g6 -f1f4  b7b6 -f4h4  b4f8 -g1f1  a8a7  -! #  Sicilian Defense col. 3g p. 176 MCO (Incomplete Game) -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  d8b6 -d1d2  b6b2 -a1b1  b2a3 -e4e5  d6e5 -f4e5  f6d7 -f1c4  a3a5 -c4e6  f7e6 -d4e6  d7e5 -c3d5  a5d2 -e1d2  e8d7 -e6c7  a8a7 -h1e1  e5c4 -! #  Parma vs. Fischer, Havana 1965.  Sicilian Defense col. 4j p. 176 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  d8b6 -d1d2  b6b2 -a1b1  b2a3 -g5f6  g7f6 -f1e2  f8g7 -o-o   f6f5 -f1d1  b8c6 -d4c6  g7c3 -d2e3  b7c6 -b1b3  a3c5 -e3c5  d6c5 -b3c3  f5e4 -c3c5  c8d7 -c5e5  f7f5 -g2g4  h8g8 -g1g2  f5g4 -e5e4  h7h5 -g2g3  e8e7 -! #  Matanovic, Sicilian Defense col. 5k p. 176 MCO (partial game) -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  d8b6 -d1d2  b6b2 -a1b1  b2a3 -g5f6  g7f6 -f1e2  b8c6 -d4c6  b7c6 -o-o   a3a5 -g1h1  f8e7 -f4f5  e6f5 -e4f5  c8f5 -e2a6  a5a6 -f1f5  d6d5 -b1e1  a6b7 -d2h6  o-o-o -h6h3  b7d7 -c3a4   -! #  col. 6a -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  d8b6 -d1d2  b6b2 -a1b1  b2a3 -f4f5  b8c6 -f5e6  f7e6 -d4c6  b7c6 -e4e5  d6e5 -g5f6  g7f6 -c3e4  f8e7 -f1e2  h7h6 -c2c4  f6f5 -b1b3  a3a4 -o-o   f5e4 -g1h1  c6c5 -d2c3  a4c6 -c3e5  h8f8 -! #  col. 7d -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  d8b6 -d1d2  b6b2 -a1b1  b2a3 -f4f5  b8c6 -f5e6  f7e6 -d4c6  b7c6 -e4e5  f6d5 -c3d5  c6d5 -f1e2  d6e5 -o-o   a8a7 -g1h1  a3c5 -c2c4  d5d4 -e2h5  g7g6 -h5d1  f8e7 -d1a4  e8d8 -f1f7  h7h6 -g5h6  e5e4 -! #  col. 8 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  d8b6 -d1d2  b6b2 -d4b3  b8d7 -g5f6  g7f6 -f1e2  h7h5 -o-o   b2a3 -a1d1  f8e7 -g1h1  d7c5 -e2f3  a8a7 -b3c5  a3c5 -! #  col. 9g; Minic-Barczay, Varna 1967 (partial game) -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  d8b6 -d1d2  b6b2 -d4b3  b8c6 -f1d3  d6d5 -g5f6  g7f6 -c3a4  b2a3 -a4b6  d5d4 -o-o   a8b8 -f4f5  a3b4 -d2b4  f8b4 -b6c8  b8c8 -f5e6  f7e6 -f1f6  e8e7 -a1f1  c6e5 -! #  col. 10i; Matulovic-Kavalek, Sousse 1967 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  d8b6 -d1d2  b6b2 -d4b3  b8c6 -a1b1  b2a3 -g5f6  g7f6 -f1d3  f8g7 -o-o   o-o -f1f3  g8h8 -f3h3  c6e7 -f4f5  e6f5 -e4f5  c8f5 -d3f5  e7f5 -c3d5 -! #  col. 11b; Joppen-Bronstein, Belgrade 1954 (partial game) -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  d8b6 -d4b3  b6e3 -d1e2  e3e2 -f1e2  b8d7 -a2a4  f8e7 -o-o-o h7h6 -g5h4  e6e5 -f4f5  b7b6 -e2f3  c8b7 -! #  col. 12e; Rajkovic-Udovcic, Yugoslav Chp. 1962 (partial game) -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  d8b6 -d4b3  b8d7 -d1f3  f8e7 -o-o-o b6c7 -f1d3  h7h6 -g5h4  g7g5 -f4g5  d7e5 -f3e2  f6g4 -b3d4  h6g5 -h4g3  c8d7 -d4f3  c7c5 -! #  col. 13i; Fischer-Vukovic (partial game) -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  f8e7 -d1f3  d8c7 -o-o-o b8d7 -g2g4  b7b5 -g5f6  d7f6 -g4g5  f6d7 -a2a3  a8b8 -h2h4  b5b4 -a3b4  b8b4 -f1h3  o-o -d4e6  f7e6 -h3e6  g8h8 -c3d5  c7c4 -e6f5  f8f5 -e4f5  c8b7 -h1e1  e7f8 -! #  col. 14m Parma-Tatai, Athens 1968 (partial game) -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  b7b5 -e4e5  d6e5 -f4e5  d8c7 -e5f6  c7e5 -f1e2  e5g5 -d1d3  a8a7 -c3e4  g5e5 -d4f3  e5b2 -o-o   a7d7 -d3e3  c8b7 -a1b1  b2c2 -f3g5  c2c6 -f6g7  f8g7 -! #  col. 15; slight advantage for white. -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -f2f4  h7h6 -g5h4  d8b6 -d1d3  b6b2 -a1b1  b2a3 -e4e5  f6d5 -c3d5  a3d3 -f1d3  e6d5 -e5e6 -! #  col. 16c; Fichtl-Dolezal, CSSR 1954 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -d1f3  b8d7 -o-o-o d8c7 -f3g3  b7b5 -f1b5  a6b5 -d4b5  c7b8 -b5d6  f8d6 -g3d6  b8d6 -d1d6  h7h6 -g5f6  d7f6 -h1d1  c8b7 -f2f3 -! #  col. 17e; Vasyukov-Zukharov, USSR 1960 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  e7e6 -d1d2  b8c6 -o-o-o h7h6 -g5h4  f6e4 -d2f4  e4g5 -d4c6  b7c6 -f4a4  d8b6 -f2f4  g5h7 -f4f5  a8b8 -f5e6  c8e6 -f1c4 -! #  col. 18g (somewhat questionable) -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1g5  b8d7 -f1c4  d8a5 -d1d2  e7e6 -o-o-o b7b5 -c4b3  c8b7 -h1e1  a8c8 -e4e5  d7e5 -d4e6  f7e6 -e1e5  d6e5 -g5f6 -! #  col. 19m; Yanofsky-Bolbochan, Stockholm 1962 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -f1e2  e7e5 -d4b3  f8e7 -o-o   o-o -f2f4  b7b5 -a2a3  c8b7 -e2f3  b8d7 -g2g3  a8c8 -d1e1  d7b6 -g1h1  b6c4 -b3d2  d8d7 -d2c4  c8c4 -c1d2  d6d5 -! #  col. 20p -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -f1e2  e7e5 -d4b3  f8e7 -o-o   o-o -c1e3  b8d7 -a2a4  b7b6 -d1d2  c8b7 -f2f3  d8c7 -f1d1  f8c8 -b3c1 -! #  col. 21b -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -g2g3  e7e5 -d4e2  f8e7 -f1g2  o-o -o-o   b7b5 -h2h3  c8b7 -c3d5  f6d5 -e4d5  b8d7 -a2a4  d7c5 -e2c3  d8d7 -a4b5  a6b5 -a1a8  f8a8 -! #  col. 22 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -f2f4  e7e6 -d1f3  d8b6 -d4b3  b8c6 -f1d3  f8e7 -c1e3  b6c7 -o-o   o-o -a1e1  c6b4 -! #  col. 23f -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -c1e3  e7e5 -d4b3  c8e6 -d1d2  b8d7 -f2f3  f8e7 -g2g4  b7b5 -g4g5  f6h5 -o-o-o o-o -h1g1  a8c8 -c3e2 -! #  col. 24k; Kotkov-Polugayevski, USSR 1959 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -f1c4  e7e6 -o-o   f8e7 -c4b3  o-o -f2f4  b7b5 -a2a3  c8b7 -f4f5  e6e5 -d4e2  b8d7 -e2g3  d7c5 -b3d5  b7d5 -e4d5  a8c8 -c1g5  c5d7 -g5f6  d7f6 -c3e4  c8c4 -! #  col. 25o; Ciocaltea-Minic, Bucharest 1966 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  a7a6 -f1c4  e7e6 -c4b3  b7b5 -f2f4  c8b7 -f4f5  e6e5 -d4e2  b8d7 -o-o   f8e7 -e2g3  a8c8 -c1g5  o-o -! #  col. 26e -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -c1e3  f8g7 -f2f3  o-o -d1d2  b8c6 -o-o-o d6d5 -e4d5  f6d5 -d4c6  b7c6 -c3d5  c6d5 -d2d5  d8c7 -d5a8  c8f5 -a8f8  g8f8 -d1d2  h7h5 -f1e2  f8g8 -a2a3  c7b8 -! #  col. 27i; Bikhovski-Gik, Moscow 1968 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -c1e3  f8g7 -f2f3  o-o -d1d2  b8c6 -f1c4  c8d7 -o-o-o d8a5 -c4b3  f8c8 -g2g4  c6e5 -h2h4  e5c4 -b3c4  c8c4 -d4b3  a5a6 -h4h5  c4c3 -b2c3  d7e6 -c1b1  a8c8 -e3d4  c8c4 -h5g6  h7g6 -! #  col. 28k -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -c1e3  f8g7 -f2f3  o-o -d1d2  b8c6 -f1c4  c8d7 -o-o-o d8a5 -c4b3  f8c8 -h2h4  c6e5 -h4h5  f6h5 -e3h6  e5d3 -c1b1  d3b2 -b1b2  g7h6 -d2h6  c8c3 -g2g4  h5f6 -g4g5  f6h5 -! #  col. 29m; Ostojic-Honfi, Monte Carlo 1968 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -c1e3  f8g7 -f2f3  o-o -d1d2  b8c6 -f1c4  c8d7 -o-o-o d8a5 -c4b3  f8c8 -c1b1  c6e5 -h2h4  e5c4 -b3c4  c8c4 -d4b3  a5c7 -h4h5  c4c3 -d2c3  c7c3 -b2c3  f6h5 -e3d4  d7e6 -h1e1  h5f6 -e4e5  d6e5 -d4e5  f6d5 -b1b2  a8c8 -! #  col. 30p; Karpov-Korchnoi, 2nd match game 1974. -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -c1e3  f8g7 -f2f3  o-o -d1d2  b8c6 -f1c4  c8d7 -h2h4  a8c8 -c4b3  c6e5 -h4h5  f6h5 -o-o-o e5c4 -b3c4  c8c4 -g2g4  h5f6 -d4e2  d8a5 -e3h6  g7h6 -d2h6  f8c8 -d1d3  c4c5 -g4g5  c5g5 -d3d5  g5d5 -c3d5  c8e8 -e2c3  d7c6 -e4e5  c6d5 -e5f6  e7f6 -h6h7  g8f8 -h7h8  f8e7 -c3d5 -! #  col. 31 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -g2g3  b8c6 -f1g2  c6d4 -d1d4  f8g7 -o-o   o-o -d4d3  c8e6 -c3d5  f6d5 -e4d5  e6f5 -! #  col. 32c; Pulsen-Cortlever, Buenos Aires 1939. -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -c1g5  f8g7 -d1d2  b8c6 -o-o-o o-o -d4b3  f8e8 -f2f3  a7a6 -c1b1  b7b5 -h2h4  c8e6 -g2g4  c6e5 -! #  col. 33h -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f2f4  b8c6 -d4c6  b7c6 -e4e5  d6e5 -d1d8  e8d8 -f4e5  f6g4 -c1f4  c8e6 -c3e4  f8g7 -e4g5  g7e5 -o-o-o d8c7 -g5e6  f7e6 -f4e5  g4e5 -d1e1  c7d6 -g2g3  e5g4 -f1c4  e6e5 -e1e2 -! #  col. 34j -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f2f4  b8c6 -f1b5  d8c7 -c3d5  f6d5 -e4d5  a7a6 -b5c6  b7c6 -d4c6  c8b7 -c1e3  f8g7 -e3d4  g7d4 -d1d4  o-o -o-o   b7c6 -! #  col. 35l -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f2f4  b8d7 -f1e2  f8g7 -c1e3  o-o -e2f3  d7b6 -d1e2  e7e5 -d4b3  f6g4 -f3g4  d8h4 -g2g3  h4g4 -e2g4  c8g4 -! #  col. 36a -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f1e2  f8g7 -c1e3  b8c6 -o-o   o-o -d4b3  c8e6 -f2f4  c6a5 -f4f5  e6c4 -b3a5  c4e2 -d1e2  d8a5 -g2g4  a8c8 -g4g5  c8c3 -g5f6  c3e3 -e2e3  g7f6 -c2c3  f8c8 -a2a3  c8c4 -a1e1  b7b5 -! #  col. 37c; Domnitz-Kraidman, Tel Aviv 1964 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f1e2  f8g7 -c1e3  b8c6 -o-o   o-o -d4b3  c8e6 -f2f4  d8c8 -d1e1  f6g4 -e2g4  e6g4 -f4f5  g6f5 -h2h3  g4h3 -g2h3  f5e4 -e1h4  f7f5 -g1h1  f8f7 -f1g1  c6e5 -c3d5  c8d7 -b3d4  e5g6 -g1g6  h7g6 -a1g1  e7e5 -g1g6  d7d8 -e3g5  d8a5 -d5f6  g8f8 -d4e6 -! #  col. 38f; Unzicker-Geller, W. Germany-USSR 1960 (drawn) -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f1e2  f8g7 -c1e3  b8c6 -o-o   o-o -d1d2  f6g4 -e2g4  c8g4 -f2f4  c6d4 -e3d4  e7e5 -d4e3  e5f4 -f1f4  g4e6 -f4f2  g7e5 -e3d4  a8c8 -a1d1  d8a5 -a2a3  c8c4 -c3e2  a5d2 -d1d2 -! #  col. 39 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f1e2  f8g7 -c1e3  b8c6 -o-o   o-o -f2f4  d8b6 -d1d3  f6g4 -c3d5  g7d4 -e2g4  d4e3 -d3e3  b6b2 -g4c8  a8c8 -a1b1  b2a2 -b1b7  e7e6 -! #  col. 40h -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f1e2  f8g7 -c1e3  b8c6 -o-o   o-o -f2f4  d8b6 -e4e5  d6e5 -f4e5  c6e5 -d4f5  b6b2 -f5e7  g8h8 -e3d4  b2b4 -d4e5  b4e7 -d1d4  f6e8 -e5g7  e8g7 -e2d3  c8e6 -! #  col. 41b; Smyslov-Botvinnik, match 1958 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f1e2  f8g7 -c1e3  b8c6 -h2h4  h7h5 -f2f3  o-o -d1d2  d6d5 -d4c6  b7c6 -e4e5  f6e8 -f3f4  f7f6 -o-o-o f6e5 -f4e5  g7e5 -g2g4  c8g4 -e2g4  h5g4 -h4h5  g6g5 -! #  col. 42d; Van den Burg-Rajkovic, Orebro 1966 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f1e2  f8g7 -c1e3  b8c6 -d4b3  o-o -f2f4  c6a5 -g2g4  b7b6 -g4g5  f6d7 -o-o   c8b7 -e2d3  a8c8 -b3a5  b6a5 -d1e1  d7c5 -f4f5  g7e5 -e1h4  e7e6 -f5f6  h7h5 -d3e2  g8h7 -e2h5  f8h8 -! #  col. 43f -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f1e2  f8g7 -c1e3  b8c6 -d4b3  o-o -f2f4  c6a5 -g2g4  c8e6 -g4g5  f6d7 -e3d4  f7f6 -h2h4  f6g5 -d4g7  g8g7 -b3d4  e6g8 -f4f5  d8b6 -! #  col. 44 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f1e2  f8g7 -o-o   b8c6 -d4b3  o-o -f2f4  b7b5 -e2f3  b5b4 -c3d5  f6d5 -e4d5  c6a5 -b3a5  d8a5 -f1e1  f8e8 -! #  col. 45i; Smyslov-Korchnoi, Moscow 1960 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  g7g6 -f1e2  f8g7 -d4b3  b8c6 -g2g4  b7b6 -f2f4  c8b7 -e2f3  o-o -h2h4  a7a5 -a2a4  c6b4 -h4h5  d6d5 -e4e5  f6g4 -b3d4  g4h6 -h5g6  f7g6 -d4e6  d8d7 -e6f8  a8f8 -c3b5  d5d4 -! #  col. 46 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -f3d4  g8f6 -f2f3  e7e5 -f1b5  c8d7 -b5d7  b8d7 -d4f5  d6d5 -e4d5  d8a5 -b1c3  d7b6 -! #  col. 47h; Schweber-Najdorf, Buenos Aires 1970 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -d1d4  b8c6 -f1b5  c8d7 -b5c6  d7c6 -c2c4  g8f6 -b1c3  e7e6 -c1g5  f8e7 -o-o   o-o -f1e1  h7h6 -g5h4  a7a6 -a1d1  d8a5 -d4d2  a5b6 -f3d4  a8c8 -e1e3  f8e8 -! #  col. 48i -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -d1d4  a7a6 -c1e3  g8f6 -b1c3  b8c6 -d4b6  d8b6 -e3b6  g7g6 -o-o-o f8h6 -c1b1  o-o -f3d4  c8d7 -f2f3  c6e5 -d4b3  f8c8 -b3a5  d7c6 -c3d5  c6d5 -e4d5  f6d7 -b6d4  b7b6 -! #  col. 49m; Fischer-Korchnoi, Buenos-Aires 1960 -e2e4  c7c5 -g1f3  d7d6 -d2d4  c5d4 -c2c3  d4c3 -b1c3  b8c6 -f1c4  e7e6 -o-o   a7a6 -d1e2  g8f6 -f1d1  d8c7 -c1g5  f8e7 -a1c1  o-o -c4b3  h7h6 -g5f4  e6e5 -f4e3  c7d8 -c3d5  f6d5 -b3d5  c8d7 -! #  col. 50 -e2e4  c7c5 -g1f3  d7d6 -d2d4  g8f6 -d4c5  f6e4 -c5d6  e7e6 -d1d3  e4d6 -b1c3  b8c6 -c1f4  f7f6 -o-o-o e6e5 -c3b5 -! #  col. 51c; Pfeiffer-Kottnauer, Helsinki 1952 -e2e4  c7c5 -g1f3  d7d6 -c2c3  g8f6 -f1d3  b8c6 -d3c2  c8g4 -h2h3  g4h5 -d2d3  d6d5 -d1e2  e7e6 -b1d2  f8e7 -d2f1  d8a5 -! #  col. 52d; Brasket-Evans, U.S. Open Chp. 1960 -e2e4  c7c5 -g1f3  d7d6 -c2c3  g8f6 -d2d3  g7g6 -g2g3  f8g7 -b1d2  o-o -f1g2  e7e5 -o-o   b8c6 -a2a4  h7h6 -d2b1  d8a5 -! #  col. 53h; Ciocaltea-Fischer, Varna 1962 -e2e4  c7c5 -g1f3  d7d6 -g2g3  g7g6 -f1g2  f8g7 -o-o   b8c6 -c2c3  e7e5 -d2d3  g8e7 -f3h4  o-o -f2f4  e5f4 -g3f4  f7f5 -b1d2  g8h8 -d2f3 -! #  col. 54k; Tarjan-Mednis, U.S. Chp. 1973 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  e7e6 -f1e2  g7g6 -d4b3 -! e2e4  c7c5 -g1f3  d7d6 -b1c3  g8f6 -e4e5  d6e5 -f3e5  a7a6 -f1e2  e7e6 -o-o   d8c7 -e5c4  b7b5 -c4e3  f8d6 -h2h3  b8c6 -a2a4  b5b4 -c3b1  c8b7 -d2d3  c6d4 -b1d2  o-o -d2f3  d4e2 -d1e2  f8e8 -e3c4  e6e5 -f3g5  e5e4 -c4d6  c7d6 -g5e4  f6e4 -d3e4  b7e4 -c1e3  d6c6 -! #  col. 55o; Medina-Pomar, Santander 1947 -e2e4  c7c5 -g1f3  d7d6 -b2b4  c5b4 -d2d4  g8f6 -f1d3  d6d5 -b1d2  d5e4 -d2e4  b8d7 -e4g5  d8c7 -c2c4  h7h6 -g5h3  g7g5 -h3g1  f8g7 -g1e2  e7e5 -e2g3  e5e4 -d1e2  o-o -! #  col. 56e; del Corral-Benko, Mallorca 1968 -e2e4  c7c5 -g1f3  d7d6 -f1b5  c8d7 -b5d7  d8d7 -o-o   b8c6 -f1e1  g8f6 -c2c3  e7e6 -d2d3  f8e7 -a2a4  o-o -b1d2  d7c7 -! #  col. 57g; Radovich-Lombardy, Leipzig 1960 -e2e4  c7c5 -g1f3  d7d6 -f1b5  b8c6 -o-o   a7a6 -b5c6  b7c6 -d2d4  c5d4 -d1d4  e7e5 -d4d3  f7f6 -c2c4  c8e6 -b1c3  d8c7 -! #  col. 58j; Gurgenidze-Osnos, Alma Ata 1969 -e2e4  c7c5 -g1f3  b8c6 -f1b5  e7e6 -b1c3  g8e7 -o-o   a7a6 -b5c6  e7c6 -d2d4  c5d4 -f3d4  d7d6 -d4c6  b7c6 -d1g4  g7g6 -e4e5  d6d5 -c1g5  f8e7 -! #  col. 59m -e2e4  c7c5 -g1f3  b8c6 -f1b5  g7g6 -o-o   f8g7 -c2c3  g8f6 -f1e1  o-o -d2d4  c5d4 -c3d4  d7d5 -e4e5  f6e4 -b1c3  e4c3 -b2c3  c6a5 -c1g5  c8f5 -f3d2  f8e8 -! #  col. 60o -e2e4  c7c5 -g1f3  b8c6 -f1b5  g7g6 -o-o   f8g7 -f1e1  e7e5 -f1e1  o-o -d2d4  c5d4 -c3d4  d7d5 -e4e5  f6e4 -b1c3  e4c3 -b2c3  c6a5 -c1g5  c8f5 -f3d2  f8e8 -! #  col. 61c; Barczay-Szilagyi, Hungarian Chp. 1969 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  c8d7 -g5f6  g7f6 -d4b3  h8g8 -g2g3  f6f5 -d1d2  f8g7 -e4f5  d7f5 -f1g2  d8d7 -o-o   g7c3 -b2c3  f5h3 -g2h3  d7h3 -! #  col. 62e -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  c8d7 -d4b3  h7h6 -g5h4  a8c8 -f1e2  g7g5 -h4g3  h6h5 -h2h4  g5g4 -g3f4  c6e5 -d1d4  e5g6 -f4g5  f8g7 -o-o -! #  col. 63g; Matulovic-Masic, Sombor 1968 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  c8d7 -f2f4  d8b6 -d4b3  f6g4 -d1e2  c6d4 -c3d5  d4e2 -d5b6  a7b6 -e1e2  h7h6 -g5h4  g7g5 -h4g3  g5f4 -g3f4  f8g7 -c2c3  d7c6 -! #  col. 64j; Liberzo-Stein, USSR Chp. 1969-70.  Complete game (draw). -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  c8d7 -d1d3  c6d4 -d3d4  d8a5 -f2f4  e7e5 -d4d3  f8e7 -o-o-o d7c6 -c1b1  e5f4 -g5f4  o-o -f1e2  f8e8 -e2f3  e7f8 -c3d5  f6d7 -d3d2  a5d2 -d1d2  a8c8 -h1d1  d7e5 -b2b3 -! #  col. 65m; Bronstein-Stein, USSR 1969 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  c8d7 -d1d3  c6d4 -d3d4  d8a5 -f1e2  e7e5 -d4d3  a5c7 -e2g4  f8e7 -g5f6  e7f6 -o-o-o f6e7 -c3b5  d7b5 -d3b5  c7c6 -b5d5  c6d5 -d1d5 -! #  col. 66b; Benko-R. Byrne, US Open Chp. 1968 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  c8d7 -d1d2  a8c8 -o-o-o c6d4 -d2d4  d8a5 -g5d2  a7a6 -f1c4  a5c5 -d4c5  c8c5 -c4b3  g7g6 -d2e3  c5c8 -e3d4  f8g7 -c3d5  f6h5 -d4g7  h5g7 -e4e5  c8c6 -d5b4  c6b6 -! #  col. 66b alternate; Polgar-Nagy, Hungarian Chp. 1972 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  c8d7 -d1d2  a8c8 -o-o-o c6d4 -d2d4  d8a5 -g5d2  e7e5 -d4d3  a7a6 -c1b1  h7h6 -f2f3  a5c7 -g2g3  f8e7 -h2h4  b7b5 -! #  col. 67c; Suetin-Gheorghiu, Hastings 1967/8.  Draw. -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  c8d7 -d1d2  a8c8 -o-o-o c6d4 -d2d4  d8a5 -g5e3  a7a6 -f2f3  e7e6 -d4b6  a5b6 -e3b6  d7c6 -f1c4  c6e4 -c4e6  f7e6 -c3e4  f6e4 -f3e4  f8e7 -h1f1  e7g5 -c1b1  e8e7 -c2c3  h8f8 -b1c2  f8f1 -d1f1  c8f8 -! #  col. 68d -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  c8d7 -d1d2  a8c8 -o-o-o c6d4 -d2d4  d8a5 -f2f4  e7e6 -e4e5  d6e5 -f4e5  c8c3 -g5d2  a5a2 -d2c3  g7g6 -! #  col. 69fA1; Janosevic-Larsen, Belgrade 1964 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  c8d7 -d1d2  a8c8 -o-o-o c6d4 -d2d4  d8a5 -f2f4  c8c3 -b2c3  e7e5 -d4b4  a5b4 -c3b4  f6e4 -f1c4  b7b5 -c4d5  e4c3 -f4e5  h7h6 -g5h4  g7g5 -h4g3  c3e2 -c1b2  e2g3 -h2g3  f8g7 -! #  col. 70g; Bednarski-Simagin, Polanica Zdroj 1968 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  c8d7 -d1d2  a8c8 -o-o-o c6d4 -d2d4  c8c3 -d4c3  f6e4 -c3e3  e4g5 -e3g5  d8b6 -f1c4  e7e6 -g5g3  g7g6 -c4b3  f8e7 -h2h4  h7h5 -h1e1  b6b4 -g3e3  a7a5 -e3d4 -! #  col. 71d -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  e7e6 -d1d2  f8e7 -o-o-o c6d4 -d2d4  o-o -f2f4  h7h6 -g5h4  d8a5 -f1c4  e6e5 -f4e5  d6e5 -d4d3  a5c5 -h4f6  e7f6 -! #  col. 72g -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  e7e6 -d1d2  f8e7 -o-o-o c6d4 -d2d4  o-o -f2f4  d8a5 -f1c4  c8d7 -c4b3  d7c6 -h1f1  b7b5 -g5f6  e7f6 -d4d6  f6c3 -d6c6  a8c8 -c6d7  c8d8 -d7e7  c3d2 -c1b1  d2f4 -d1d8  a5d8 -! #  col. 73i -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  e7e6 -d1d2  f8e7 -o-o-o o-o -d4b3  d8b6 -f2f3  a7a6 -g2g4  f8d8 -g5e3  b6c7 -h2h4  b7b5 -g4g5  f6d7 -g5g6  f7g6 -h4h5  g6h5 -h1h5  d7f6 -h5g5  c6e5 -d2g2  e7f8 -f3f4  e5c4 -f1c4  b5c4 -b3d4  a8b8 -d1g1  b8b7 -! #  col. 74; Tal-Larsen, match 1969 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  e7e6 -d1d2  f8e7 -o-o-o o-o -d4b3  a7a6 -g5f6  g7f6 -f1e2  g8h8 -e2h5  c8d7 -f2f4  b7b5 -c1b1 -! #  col. 75k -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  e7e6 -d1d2  f8e7 -o-o-o o-o -d4b5  d8a5 -g5f6  e7f6 -b5d6  f8d8 -f2f4  e6e5 -d2d5  a5c7 -f4f5  c6d4 -d6b5  c7a5 -d5c4  c8f5 -b2b4  a5a6 -! #  col. 76b; Spasski-Larsen, Santa Monica 1966 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  e7e6 -d1d2  f8e7 -o-o-o o-o -f2f4  h7h6 -g5h4  e6e5 -d4f5  c8f5 -e4f5  d8a5 -c1b1  a8d8 -h4f6  e7f6 -c3d5  a5d2 -d5f6  g7f6 -d1d2  e5f4 -! #  col. 77e; Kujpers-Minev, Halle 1967 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  e7e6 -d1d2  f8e7 -o-o-o o-o -f2f4  d6d5 -e4e5  f6d7 -h2h4  d7b6 -d2e3  c8d7 -g5e7  d8e7 -h4h5  c6a5 -d4b3  a5c4 -e3d4  f8c8 -c1b1  a7a5 -f4f5  a5a4 -f5f6  e7f8 -h1h3  c4b2 -b1b2  b6c4 -f1c4  c8c4 -d4d2 -! #  col. 78h -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  e7e6 -d1d2  a7a6 -o-o-o c8d7 -f2f4  h7h6 -g5h4  f6e4 -d2e1  e4f6 -d4f5  d8a5 -f5d6  f8d6 -d1d6  o-o-o  -d6d1  e6e5 -f1c4  e5f4 -c3e4  d7e6 -c4e6  f7e6 -e4d6  c8b8 -e1e6  h8f8 -! #  col. 79j; O'Kelly-Simagin corr. 1964 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  e7e6 -d1d2  a7a6 -o-o-o h7h6 -g5h4  f6e4 -d2f4  e4g5 -d4c6  b7c6 -f4a4  d8b6 -f2f4  g5h7 -f4f5  f8e7 -c3e4  a8b8 -a4a3  b6b5 -! #  col. 80k; Di Camillo-R. Byrne, US Open Chp. 1958 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  e7e6 -d1d2  h7h6 -g5f6  g7f6 -o-o-o a7a6 -f2f4  c8d7 -f1e2  h6h5 -c1b1  d8b6 -d4b3  o-o-o  -h1f1  f8e7 -c3a4  b6a7 -c2c4  c6d4 -! #  col. 81b -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  e7e6 -d4c6  b7c6 -e4e5  d6e5 -d1f3  f8e7 -f3c6  c8d7 -c6f3  e5e4 -c3e4  f6e4 -g5e7  d8a5 -! #  col. 82e -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1g5  e7e6 -d1d3  f8e7 -a1d1  o-o -f1e2  c8d7 -o-o   c6d4 -d3d4  d7c6 -g1h1  d8a5 -f2f4  f8e8 -! #  col. 83 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -h2h3  g7g6 -c1e3  f8g7 -d1d2  o-o -o-o-o c6d4 -e3d4  d8a5 -c1b1  e7e5 -d4e3  c8e6 -! #  BAD! -- col. 84i; Karaklajic-Taimanov, Yugoslavia-USSR, match 1956 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -c1e3  f6g4 -f1b5  g4e3 -f2e3  c8d7 -o-o   e7e6 -5c6   b7c6 -e4e5  f8e7 -d1h5  o-o -e5d6  e7d6 -c3e4  d6e7 -a1d1  d8c7 -d4b3  h7h6 -! #  col. 85 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -d4e2  e7e6 -g2g3  d6d5 -e4d5  f6d5 -f1g2  d5c3 -d1d8  e8d8 -e2c3  c8d7 -c1d2  f8e7 -! #  col. 86c; Carcia-Pomar, Havana 1969 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -f1c4  e7e5 -d4e2  c8e6 -c4e6  f7e6 -o-o   f8e7 -f2f4  o-o -e2g3  e5f4 -f1f4  d8b6 -g1h1  a8d8 -b2b3  d6d5 -e4d5  f6d5 -f4f8  e7f8 -c3d5  d8d5 -d1e1  c6d4 -c1e3  f8c5 -! #  col. 87 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -f1c4  d8b6 -d4b3  e7e6 -o-o   f8e7 -c1e3  b6c7 -f2f4  o-o -c4d3  a7a6 -d1f3 -! #  col. 88 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -f1c4  e7e6 -c1e3  d8c7 -d1e2  a7a6 -c4b3  c6a5 -g2g4  b7b5 -g4g5  f6d7 -o-o-o d7c5 -! #  col. 89mA; Spasjevic-Ostojic, Belgrade 1966 (draw) -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -f1c4  e7e6 -c1e3  f8e7 -d1e2  a7a6 -o-o-o o-o -c4b3  d8c7 -g2g4  c6d4 -d1d4  e6e5 -d4c4  c7d8 -g4g5  f6e8 -h1g1  c8d7 -c3d5  d7b5 -e3b6  d8d7 -e2g4  e7d8 -g4d7  b5d7 -c4c3  d7e6 -b6d8  a8d8 -d5e3  d8d7 -b3a4  d7c7 -! #  col. 90o; Bogdanovic-Shamkovich, Sarajevo 1963 -e2e4  c7c5 -g1f3  b8c6 -d2d4  c5d4 -f3d4  g8f6 -b1c3  d7d6 -f1c4  e7e6 -c1e3  f8e7 -d1e2  o-o -o-o-o c6d4 -e3d4  d8a5 -e4e5  d6e5 -d4e5  b7b6 -c3b5  c8a6 -e5c3  a5a4 -d1d4  a6b5 -c4b5  a4a2 -h1d1  f8d8 -d4a4  d8d1 -e2d1  a2d5 -d1d5  f6d5 -c3d4  e7g5 -c1b1  h7h5 -b5c6  a8d8 -a4a7  d5b4 -c6d7  b4c6 -! #  Queen's Catalan, col. 1c; Kramer-Fichtl, Varna Olympics 1962 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -g1f3  f8e7 -f1g2  o-o -o-o   b8d7 -b1c3  c7c6 -b2b3  b7b6 -c1b2  c8b7 -d1c2  a8c8 -a1d1  d8c7 -e2e4  d5e4 -c3e4  f6e4 -c2e4  c6c5 -d4d5  e7f6 -e4c2  e6d5 -c4d5  f6b2 -c2b2  c8d8 -! #  col. 2f -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -g1f3  f8e7 -f1g2  o-o -o-o   b8d7 -b1c3  d5c4 -e2e4  c7c6 -a2a4  a7a5 -d1e2  d7b6 -f1d1  e7b4 -f3e5  d8e7 -c1e3  c8d7 -e5c4  b6c4 -e2c4  e6e5 -d4e5  f6g4 -! #  col. 3i; Geller-Medina, Beverwijk 1965 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -g1f3  f8e7 -f1g2  o-o -o-o   b8d7 -d1c2  b7b6 -c4d5  f6d5 -b1c3  c8b7 -c3d5  b7d5 -e2e4  d5b7 -f1d1  c7c5 -d4d5  e6d5 -e4d5  e7f6 -h2h4  h7h6 -! #  col. 4k; Geller-Bisguier, Bled 1961 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -g1f3  f8e7 -f1g2  o-o -o-o   b8d7 -d1c2  c7c6 -b2b3  b7b6 -c1b2  c8b7 -b1c3  a8c8 -a1d1  b6b5 -c4c5  b5b4 -c3b1  f6e4 -f3e1  f7f5 -e1d3  a7a5 -d3f4  f8f6 -f2f3  e4g5 -! #  col. 5m; Benko-Pachman, Budapest 1948 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -g1f3  f8e7 -f1g2  o-o -o-o   b8d7 -d1c2  c7c6 -b1d2  b7b6 -e2e4  c8b7 -b2b3  a8c8 -f1d1  d8c7 -c1b2  f8d8 -a1c1  c7b8 -c2b1  a7a5 -f3e5  b8a8 -! #  col. 6 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -g1f3  f8e7 -f1g2  o-o -o-o   c7c6 -b1c3  b7b6 -f3e5  a7a5 -d1c2  c8a6 -f1d1  b6b5 -! #  col. 7d; Evans-Poschel, US Jr. Chp. 1947 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -g1f3  c7c5 -c4d5  f6d5 -f1g2  c5d4 -o-o   f8c5 -f3d4  o-o -a2a3  b8c6 -d4c6  b7c6 -b2b4  c5e7 -c1b2  e7f6 -d1c2  f6b2 -c2b2  a7a5 -! #  col. 8g; O'Kelly-Euwe, New York 1951 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -g1f3  d5c4 -f1g2  c7c5 -o-o   b8c6 -d1a4  f6d7 -d4c5  f8c5 -a4c4  o-o -b1c3  a7a6 -c3e4  c5e7 -c1e3  d7b6 -c4b3  b6d5 -f1d1  d8c7 -! #  col. 9 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -g1f3  d5c4 -f1g2  b7b5 -a2a4  c7c6 -o-o   c8b7 -f3e5  d8c8 -b2b3  c4b3 -d1b3  b5b4 -a4a5  f6d7 -! #  col. 10l; Keres-Korchnoi, Curacao 1962 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -g1f3  d5c4 -d1a4  b8d7 -f1g2  a7a6 -a4c4  c7c5 -d4c5  f8c5 -o-o   b7b5 -c4h4  c8b7 -b1d2  c5e7 -d2b3  a8c8 -h4d4  o-o -c1d2  d7c5 -! #  col. -- Accelerated Catalan -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -f1g2  d5c4 -d1a4  b8d7 -b1d2  c7c6 -a4c4  e6e5 -g1f3  d7b6 -c4d3  e5d4 -f3d4  f8e7 -o-o  o-o -! #  col. 12e; Muller-Ratzek, Vienna 1951 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -f1g2  d5c4 -d1a4  c8d7 -a4c4  d7c6 -g1f3  c6d5 -c4d3  c7c5 -b1c3  d5c6 -o-o   b8d7 -f1d1  d8b6 -e2e4  c5d4 -f3d4  f8c5 -d4c6  c5f2 -g1f1  b7c6 -c3a4  b6a5 -f1f2  a5a4 -d3d6 -! #  col. 13f; Smyslov-Kere, USSR Chp. 1948 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -f1g2  d5c4 -d1a4  c8d7 -a4c4  d7c6 -g1f3  b8d7 -b1c3  d7b6 -c4d3  f8b4 -o-o   o-o -f1d1  h7h6 -c1d2  d8e7 -a2a3  b4c3 -d3c3  f8d8 -! #  col. 14g -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -b1c3  d5c4 -d1a4  b8c6 -f1g2  c8d7 -a4c4  c6b4 -c4b3  c7c5 -g1f3  c5d4 -f3d4  e6e5 -d4f3  d7e6 -b3a4  e6d7 -! #  col. 15; Stoltz-Vidmar, Groningen 1946 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -b1c3  f8e7 -f1g2  o-o -g1f3  d5c4 -d1a4  a7a6 -a4c4  b7b5 -c4d3  c8b7 -! #  col. 16 -d2d4  d7d5 -c2c4  e7e6 -g2g3  g8f6 -b1d2  c7c5 -d4c5  f8c5 -f1g2  b8c6 -g1f3  o-o -o-o   a7a5 -c4d5  e6d5 -d2b3  c5b6 -! #  col. 17d; Mikenas-Aronin, USSR Chp. 1963 -d2d4  d7d5 -c2c4  e7e6 -g2g3  c7c5 -c4d5  e6d5 -g1f3  b8c6 -f1g2  g8f6 -o-o   f8e7 -d4c5  e7c5 -b1d2  o-o -d2b3  c5b6 -b3d4  f8e8 -b2b3  c6d4 -f3d4  b6d4 -d1d4  e8e2 -! #  col. 18e -d2d4  d7d5 -c2c4  e7e6 -g2g3  d5c4 -d1a4  c8d7 -a4c4  c7c5 -d4c5  d7c6 -g1f3  b8d7 -c1e3  g8f6 -f1g2  d8c7 -o-o   c6d5 -c4a4  f8c5 -e3c5  c7c5 -b1c3  d5c6 -! #  col. 19 -d2d4  d7d5 -c2c4  e7e6 -g2g3  f8b4 -c1d2  b4d2 -d1d2  g8f6 -g1f3  o-o -f1g2  d8e7 -o-o   b8c6 -f1c1 -! #  col. 20 -d2d4  d7d5 -c2c4  e7e6 -g2g3  f8b4 -c1d2  b4e7 -f1g2  g8f6 -g1f3  o-o -d1b3  b7b6 -c4d5  e6d5 -b1c3  c8b7 -o-o -! #  col. 21 -d2d4  g8f6 -c2c4  e7e6 -g2g3  e6e5 -g1f3  e5d4 -f3d4  d7d5 -f1g2  d5c4 -d1a4  c7c6 -a4c4  f8e7 -o-o   o-o -f1d1 -! #  col. 22 -d2d4  g8f6 -c2c4  e7e6 -g2g3  c7c5 -g1f3  c5d4 -f3d4  d7d5 -f1g2  e6e5 -d4f3  d5d4 -o-o   b8c6 -e2e3  f8e7 -e3d4  e5d4 -! #  col. 23g -d2d4  g8f6 -c2c4  e7e6 -g2g3  c7c5 -g1f3  c5d4 -f3d4  b8c6 -f1g2  d8b6 -d4c2  f8c5 -e2e3  o-o -b1c3  b6a6 -d1d2  f8d8 -a2a3  d7d5 -b2b4  d5d4 -c3e4 -! #  col. 24j; Smyslov-Petrosian, Moscow 1967 -d2d4  g8f6 -c2c4  e7e6 -g2g3  f8b4 -b1d2  c7c5 -d4c5  b4c5 -f1g2  b8c6 -g1f3  b7b6 -o-o   c8b7 -a2a3  o-o -b2b4  c5e7 -c1b2  a8c8 -d1b1 -! #  col. 25 -d2d4  g8f6 -c2c4  e7e6 -g2g3  f8b4 -c1d2  b4d2 -d1d2  f6e4 -d2c2  f7f5 -f2f3  e4f6 -e2e4  f5e4 -f3e4  e6e5 -! #  Alternate openings leading to the Catalan, line C -g1f3  d7d5 -c2c4  e7e6 -g2g3  g8f6 -d2d4 -! #  line D -c2c4  g8f6 -d2d4  e7e6 -g2g3  d7d5 -! #  line E -d2d4  g8f6 -c2c4  e7e6 -g2g3  d7d5 -! #  The Reti Opening, col. 1c; Muller-Lilenthal, Budapest 1933 -g1f3  d7d5 -c2c4  c7c6 -b2b3  g8f6 -g2g3  c8f5 -c1b2  e7e6 -f1g2  b8d7 -o-o   f8d6 -d2d3  o-o -b1c3  d8e7 -f1e1  e6e5 -c4d5  c6d5 -e2e4  d5e4 -d3e4  f5g6 -! #  col. 2g; Bilek-Geller, Sousse 1967 -g1f3  d7d5 -c2c4  c7c6 -b2b3  g8f6 -g2g3  c8g4 -f1g2  e7e6 -c1b2  b8d7 -o-o   f8e7 -d2d3  o-o -b1d2  a7a5 -a2a3  d8b6 -d1c2  h7h6 -b2c3  f8c8 -f1e1  b6d8 -e2e4  d8f8 -! #  col. 3k; Botvinnik-Fine, Nottingham 1936 -g1f3  d7d5 -c2c4  d5c4 -b1a3  c7c5 -a3c4  b8c6 -g2g3  e7e5 -f1g2  f7f6 -b2b3  g8e7 -c1b2  e7d5 -o-o   f8e7 -f3h4  o-o -d1b1  f8f7 -h4f5  c8e6 -f2f4  e5f4 -g3f4  d5b6 -g2e4  e6c4 -! #  col. 4n; Katetov-Alekhin, Prague 1943 -g1f3  d7d5 -c2c4  d5d4 -e2e3  b8c6 -e3d4  c6d4 -f3d4  d8d4 -b1c3  e7e5 -d2d3  f8c5 -c1e3  d4d6 -c3b5  d6e7 -e3c5  e7c5 -d3d4  e5d4 -d1d4  c5d4 -b5d4  c8g4 -! #  col. 5o -g1f3  d7d5 -c2c4  d5d4 -e2e3  c7c5 -e3d4  c5d4 -g2g3  b8c6 -f1g2  g7g6 -d2d3  f8g7 -o-o   e7e5 -f1e1  f7f6 -b2b4  c6b4 -d1a4  b4c6 -f3d4  d8d4 -g2c6  c8d7 -! #  col. 6 -g1f3  d7d5 -c2c4  e7e6 -g2g3  g8f6 -f1g2  f8e7 -o-o   o-o -b2b3  c7c5 -c4d5  f6d5 -c1b2  b8c6 -d2d4  d5b4 -a2a3  b4a6 -d4c5  d8d1 -! #  col. 7 -g1f3  d7d5 -c2c4  e7e6 -g2g3  g8f6 -f1g2  f8e7 -b1c3  o-o -b2b3  c7c5 -c1b2  b8c6 -c4d5  e6d5 -a1c1  c8e6 -o-o   a8c8 -d2d4  f8e8 -! #  col. 8g; Kashdan-Horowitz, New York 1931 -g1f3  d7d5 -c2c4  e7e6 -g2g3  g8f6 -f1g2  b8d7 -b2b3  c7c6 -o-o   f8d6 -c1b2  o-o -b1c3  b7b6 -d2d3  c8b7 -e2e4  d5e4 -d3e4  d8c7 -d1e2  f8d8 -f1d1 -! #  col. 9h; Abroshin-Krykov corr. 1960 -g1f3  d7d5 -c2c4  e7e6 -g2g3  g8f6 -f1g2  d5c4 -d1a4  c8d7 -a4c4  d7c6 -o-o   c6d5 -c4a4  d8d7 -a4c2  b8c6 -b1c3  d5f3 -g2f3  c6d4 -c2d3  c7c6 -! #  col. 10m; Teti-Tartakover, Semmering 1926 -g1f3  d7d5 -c2c4  e7e6 -g2g3  d5c4 -d1a4  c8d7 -a4c4  c7c5 -f3e5  b8c6 -e5d7  d8d7 -f1g2  g8f6 -d2d3  f8e7 -o-o   c6d4 -b1c3  a8d8 -a2a4  f6d5 -! #  Barcza System, col. 11 -g1f3  d7d5 -g2g3  g8f6 -f1g2  c8f5 -o-o   c7c6 -c2c4  d5c4 -b1a3  e7e5 -a3c4  e5e4 -f3e1  f8c5 -d2d3  o-o -c1e3  b8d7 -! #  col. 12d; Benko-Petrosian, Curacao 1962 -g1f3  d7d5 -g2g3  g8f6 -f1g2  c8f5 -o-o   c7c6 -d2d3  b8d7 -b1d2  h7h6 -d1e1  e7e6 -e2e4  f5h7 -e1e2  f8e7 -e4e5  f6g8 -d2b3  e7f8 -c2c4  g8e7 -b3d4  e7f5 -d4f5  h7f5 -c4d5  c6d5 -d3d4  a7a5 -c1e3  f8e7 -f1c1  o-o -! #  col. 13f; Bronstein-O'Kelly, Beverwijk 1963 -g1f3  d7d5 -g2g3  g8f6 -f1g2  c7c5 -o-o   e7e6 -d2d3  b8c6 -b1d2  f8e7 -e2e4  o-o -f1e1  d8c7 -e4e5  f6d7 -d1e2  b7b5 -h2h4  a7a5 -d2f1  c8a6 -f1h2  c6b4 -h4h5 -! #  col. 14i; Evans-Olafsson, Dallas 1957 -g1f3  d7d5 -g2g3  g8f6 -f1g2  g7g6 -o-o   f8g7 -d2d3  o-o -b1d2  b8c6 -e2e4  e7e5 -c2c3  a7a5 -f1e1  d5e4 -d3e4  f6d7 -d1e2  b7b6 -d2c4  c8a6 -g2f1  d8f6 -! #  col. 15 -g1f3  d7d5 -g2g3  g8f6 -f1g2  g7g6 -d2d4  f8g7 -o-o   c7c6 -b2b3  b8d7 -c1b2  e7e5 -d4e5  f6g4 -b1d2  d7e5 -f3e5  g4e5 -! #  col. 16d; Larsen-Mecking, Mallorca 1969 -g1f3  d7d5 -g2g3  c7c5 -f1g2  b8c6 -o-o   e7e6 -d2d3  g7g6 -b1c3  f8g7 -a2a3  g8e7 -a1b1  o-o -c1d2  a8b8 -b2b4  c5b4 -a3b4  b7b5 -e2e4  a7a5 -! #  col. 17h; Benko-Bisguier, US Chp. 1963 -g1f3  d7d5 -g2g3  c8g4 -f1g2  b8d7 -c2c4  c7c6 -c4d5  c6d5 -b1c3  e7e6 -d1b3  d8b6 -b3b6  d7b6 -d2d3  a8c8 -c1e3  f8d6 -c3b5  d6b8 -o-o   g8e7 -f1c1  c8c1 -a1c1  e7c6 -f3d4  e8d7 -! #  col. 18j; Keene-Basman, Hastings 1966-7 -g1f3  d7d5 -g2g3  c8g4 -f1g2  g8f6 -c2c4  c7c6 -c4d5  g4f3 -g2f3  c6d5 -d1b3  d8d7 -b1c3  e7e6 -o-o   b8c6 -f3g2  f8e7 -d2d3  o-o -! #  col. 19k -g1f3  d7d5 -g2g3  c8g4 -f1g2  g8f6 -c2c4  c7c6 -d1c2  e7e6 -o-o   f8e7 -b2b3  b8d7 -c1b2  o-o -d2d3  a7a5 -b1d2  a5a4 -b2c3  a4b3 -a2b3  d8b6 -! #  col. 20m -g1f3  d7d5 -g2g3  c8g4 -f1g2  g8f6 -o-o   c7c6 -c2c4  e7e6 -c4d5  g4f3 -g2f3  c6d5 -b1c3  b8c6 -d2d3  f8e7 -f3g2 -! #  col. 21b; Savon-Aronin, USSR 1963 -g1f3  d7d5 -g2g3  b8c6 -d2d4  c8f5 -f1g2  c6b4 -b1a3  e7e6 -o-o   g8f6 -f3h4  f5g4 -c2c4  c7c6 -a3c2  b4c2 -d1c2  f8e7 -h2h3  g4h5 -f2f3  h5g6 -h4g6  h7g6 -! #  col. 22d; Fischer-Ivkov, Santa Monica 1966 -g1f3  d7d5 -g2g3  e7e6 -f1g2  c7c5 -o-o   b8c6 -d2d3  f8d6 -e2e4  g8e7 -b1d2  o-o -f3h4  b7b6 -f2f4  d5e4 -d3e4  c8a6 -f1e1  c5c4 -c2c3 -! #  col. 23 -g1f3  d7d5 -g2g3  b8d7 -c2c4  e7e6 -f1g2  g8f6 -b1c3  f8e7 -o-o   o-o -d2d3  c7c5 -c4d5  e6d5 -c1g5  b7b6 -! #  col. 24g; Benko-Bisguier, US Chp. 1976-7 -g1f3  d7d5 -g2g3  g8f6 -f1g2  b7b6 -c2c4  e7e6 -c4d5  e6d5 -o-o   f8d6 -d2d4  o-o -b1c3  c7c6 -f3e5  c8b7 -c1g5  h7h6 -g5f6  d8f6 -f2f4  f8d8 -e2e4 -! #  col. 25; Rabinovich-Rauser, Moscow 1934 -g1f3  d7d5 -b2b3  c8g4 -c1b2  b8d7 -c2c4  e7e6 -e2e3  g8f6 -f1e2  c7c6 -f3d4  g4e2 -d1e2  f8d6 -f2f4  o-o -! #  col. 26e; Evans-Najdorf, Dallas 1967 -g1f3  c7c5 -g2g3  b8c6 -f1g2  g7g6 -o-o   f8g7 -e2e4  d7d6 -c2c3  e7e5 -d2d3  g8h6 -f3e1  o-o -f2f4  e5f4 -c1f4  h6g4 -b1a3  g4e5 -g1h1  d8b6 -d1d2  c8e6 -! #  col. 27h; Van den Pol-Barden, Holland v. England 1960 -g1f3  f7f5 -g2g3  g8f6 -f1g2  g7g6 -d2d3  f8g7 -b1d2  d7d6 -e2e4  e7e5 -d2c4  o-o -e4f5  g6f5 -c1e3  b8c6 -d3d4  e5e4 -! #  col. 28m; Gufeld-Bokuchava, USSR Chp. prelims 1968 -g1f3  f7f5 -g2g3  g8f6 -f1g2  e7e6 -c2c4  f8e7 -o-o   o-o -d2d3  d7d6 -b1c3  b8c6 -a1b1  a7a5 -a2a3  d8e8 -b2b4  a5b4 -a3b4  e6e5 -! #  col. 29p; Lundin-Tartakover, Groningen 1946 -g1f3  f7f5 -g2g3  g8f6 -f1g2  e7e6 -c2c4  f8e7 -o-o   o-o -b2b3  c7c5 -c1b2  b8c6 -b1c3  e6e5 -e2e3  d7d6 -d2d4 -! #  col. 30 -g1f3  g7g6 -g2g3  f8g7 -f1g2  e7e5 -d2d3  b8c6 -e2e4  d7d6 -b1c3  g8e7 -c1e3  o-o -d1d2  c6d4 -o-o -! #  King's Indian attack, col. 31a -g1f3  g8f6 -g2g3  b7b5 -h2h4  b5b4 -d2d3  c8b7 -e2e4  d7d6 -f1g2  b8d7 -o-o   e7e6 -h4h5  a8b8 -b1d2  f8e7 -d2c4  o-o -! #  col. 32d -g1f3  g8f6 -g2g3  g7g6 -b2b4  f8g7 -c1b2  o-o -f1g2  d7d5 -o-o   c8g4 -c2c4  c7c6 -b1a3  b8d7 -a1c1  a7a5 -b4b5  a5a4 -d2d3  e7e5 -! #  col. 33e; Olafsson-Kavalek, Wijik aan Zee 1969 -g1f3  g8f6 -g2g3  g7g6 -b2b3  f8g7 -c1b2  o-o -f1g2  d7d6 -d2d4  f6d7 -b1c3  e7e5 -d1d2  f8e8 -d4e5  d7e5 -f3e5  g7e5 -! #  col. 34h -g1f3  g8f6 -g2g3  g7g6 -c2c4  d7d6 -f1g2  f8g7 -o-o   o-o -b1c3  b8d7 -d2d3  e7e5 -c1d2  d7c5 -b2b4  c5e6 -a1b1  f6e8 -a2a4  c7c6 -a4a5  e8c7 -! #  col. 35 -g1f3  g8f6 -c2c4  g7g6 -b2b3  f8g7 -c1b2  o-o -e2e3  d7d6 -f1e2  e7e5 -o-o   f8e8 -b1c3  b8d7 -d2d3  c7c6 -! #  col. 36d -g1f3  g8f6 -c2c4  g7g6 -b1c3  d7d5 -c4d5  f6d5 -d1a4  c8d7 -a4b3  d5b6 -d2d4  f8g7 -c1f4  d7e6 -b3c2  b8c6 -a1d1 -! #  col. 37f -g1f3  g8f6 -c2c4  b7b6 -g2g3  c8b7 -f1g2  c7c5 -o-o   g7g6 -b2b3  f8g7 -c1b2  o-o -b1c3  d7d5 -c3d5  f6d5 -b2g7  g8g7 -c4d5  d8d5 -d2d4  b8a6 -! #  col. 38h; Geller-Kholmov, Moscow 1969 -g1f3  g8f6 -c2c4  b7b6 -g2g3  c8b7 -f1g2  e7e6 -o-o   f8e7 -b2b3  o-o -c1b2  d7d5 -e2e3  b8d7 -b1c3  f6e4 -c4d5  e4c3 -b2c3  e6d5 -! #  col. 39 -g1f3  g8f6 -b2b3  g7g6 -c2c4  f8g7 -c1b2  o-o -g2g3  c7c5 -f1g2  b7b6 -o-o   c8b7 -b1c3  e7e6 -a1b1  d8e7 -! #  col. 40o; Lombardy-Burger, US Chp. 1969-70 -g1f3  g8f6 -b2b3  d7d5 -c1b2  e7e6 -e2e3  f8e7 -c2c4  o-o -d2d4  b7b6 -f1d3  c8b7 -o-o   b8d7 -b1d2  c7c5 -d1e2  f6e4 -a1c1  a8c8 -! diff --git a/gnu/games/chess/gnuchess.c b/gnu/games/chess/gnuchess.c deleted file mode 100644 index 20b32c4d7499..000000000000 --- a/gnu/games/chess/gnuchess.c +++ /dev/null @@ -1,2307 +0,0 @@ -/* -  C source for CHESS - -  Revision: 4-25-88 - -  Copyright (C) 1986, 1987, 1988 Free Software Foundation, Inc. -  Copyright (c) 1988   John Stanback - -  This file is part of CHESS. - -  CHESS is distributed in the hope that it will be useful, -  but WITHOUT ANY WARRANTY.  No author or distributor -  accepts responsibility to anyone for the consequences of using it -  or for whether it serves any particular purpose or works at all, -  unless he says so in writing.  Refer to the CHESS General Public -  License for full details. - -  Everyone is granted permission to copy, modify and redistribute -  CHESS, but only under the conditions described in the -  CHESS General Public License.   A copy of this license is -  supposed to have been given to you along with CHESS so you -  can know your rights and responsibilities.  It should be in a -  file named COPYING.  Among other things, the copyright notice -  and this notice must be preserved on all copies. -*/ - - -#include <stdio.h> -#include <ctype.h> - -#ifdef MSDOS -#include <stdlib.h> -#include <time.h> -#include <alloc.h> -#define ttblsz 4096 -#else -#include <sys/param.h> -#include <sys/times.h> -#define ttblsz 16384 -#define huge -#endif MSDOS - -#include "move.h" - -#define neutral 2 -#define white 0 -#define black 1 -#define no_piece 0 -#define pawn 1 -#define knight 2 -#define bishop 3 -#define rook 4 -#define queen 5 -#define king 6 -#define valueP 100 -#define valueN 350 -#define valueB 355 -#define valueR 550 -#define valueQ 1100 -#define valueK 1200 -#define ctlP 0x4000 -#define ctlN 0x2800 -#define ctlB 0x1800 -#define ctlR 0x0400 -#define ctlQ 0x0200 -#define ctlK 0x0100 -#define ctlBQ 0x1200 -#define ctlRQ 0x0600 -#define ctlNN 0x2000 -#define pxx " PNBRQK" -#define qxx " pnbrqk" -#define rxx "12345678" -#define cxx "abcdefgh" -#define check 0x0001 -#define capture 0x0002 -#define draw 0x0004 -#define promote 0x0008 -#define cstlmask 0x0010 -#define epmask 0x0020 -#define exact 0x0040 -#define pwnthrt 0x0080 -#define truescore 0x0001 -#define lowerbound 0x0002 -#define upperbound 0x0004 -#define maxdepth 30 -#define true 1 -#define false 0 -#define absv(x) ((x) < 0 ? -(x) : (x)) -#if (NEWMOVE < 1) -#define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b])) -#endif -struct leaf -  { -    short f,t,score,reply; -    unsigned short flags; -  }; -struct GameRec -  { -    unsigned short gmove; -    short score,depth,time,piece,color; -    long nodes; -  }; -struct TimeControlRec -  { -    short moves[2]; -    long clock[2]; -  }; -struct BookEntry -  { -    struct BookEntry *next; -    unsigned short *mv; -  }; -struct hashval -  { -    unsigned long bd; -    unsigned short key; -  }; -struct hashentry -  { -    unsigned long hashbd; -    unsigned short mv,flags; -    short score,depth; -  }; - -char mvstr1[5],mvstr2[5]; -struct leaf Tree[2000],*root; -short TrPnt[maxdepth],board[64],color[64]; -short row[64],column[64],locn[8][8],Pindex[64],svalue[64]; -short PieceList[2][16],PieceCnt[2],atak[2][64],PawnCnt[2][8]; -short castld[2],kingmoved[2],mtl[2],pmtl[2],emtl[2],hung[2]; -short c1,c2,*atk1,*atk2,*PC1,*PC2,EnemyKing; -short mate,post,opponent,computer,Sdepth,Awindow,Bwindow,dither; -long ResponseTime,ExtraTime,Level,et,et0,time0,cputimer,ft; -long NodeCnt,evrate,ETnodes,EvalNodes,HashCnt; -short quit,reverse,bothsides,hashflag,InChk,player,force,easy,beep; -short wking,bking,FROMsquare,TOsquare,timeout,Zscore,zwndw,xwndw,slk; -short INCscore; -short HasPawn[2],HasKnight[2],HasBishop[2],HasRook[2],HasQueen[2]; -short ChkFlag[maxdepth],CptrFlag[maxdepth],PawnThreat[maxdepth]; -short Pscore[maxdepth],Tscore[maxdepth],Threat[maxdepth]; -struct GameRec GameList[240]; -short GameCnt,Game50,epsquare,lpost,rcptr,contempt; -short MaxSearchDepth; -struct BookEntry *Book; -struct TimeControlRec TimeControl; -short TCflag,TCmoves,TCminutes,OperatorTime; -short otherside[3]={1,0,2}; -short rank7[3]={6,1,0}; -short map[64]= -   {0,1,2,3,4,5,6,7, -    0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, -    0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, -    0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, -    0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47, -    0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57, -    0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67, -    0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77}; -short unmap[120]= -   {0,1,2,3,4,5,6,7,-1,-1,-1,-1,-1,-1,-1,-1, -    8,9,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1, -    16,17,18,19,20,21,22,23,-1,-1,-1,-1,-1,-1,-1,-1, -    24,25,26,27,28,29,30,31,-1,-1,-1,-1,-1,-1,-1,-1, -    32,33,34,35,36,37,38,39,-1,-1,-1,-1,-1,-1,-1,-1, -    40,41,42,43,44,45,46,47,-1,-1,-1,-1,-1,-1,-1,-1, -    48,49,50,51,52,53,54,55,-1,-1,-1,-1,-1,-1,-1,-1, -    56,57,58,59,60,61,62,63}; -short Dcode[120]= -   {0,1,1,1,1,1,1,1,0,0,0,0,0,0,0x0E,0x0F, -    0x10,0x11,0x12,0,0,0,0,0,0,0,0,0,0,0,0x0F,0x1F, -    0x10,0x21,0x11,0,0,0,0,0,0,0,0,0,0,0x0F,0,0, -    0x10,0,0,0x11,0,0,0,0,0,0,0,0,0x0F,0,0,0, -    0x10,0,0,0,0x11,0,0,0,0,0,0,0x0F,0,0,0,0, -    0x10,0,0,0,0,0x11,0,0,0,0,0x0F,0,0,0,0,0, -    0x10,0,0,0,0,0,0x11,0,0,0x0F,0,0,0,0,0,0, -    0x10,0,0,0,0,0,0,0x11}; -short Stboard[64]= -   {rook,knight,bishop,queen,king,bishop,knight,rook, -    pawn,pawn,pawn,pawn,pawn,pawn,pawn,pawn, -    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -    pawn,pawn,pawn,pawn,pawn,pawn,pawn,pawn, -    rook,knight,bishop,queen,king,bishop,knight,rook}; -short Stcolor[64]= -   {white,white,white,white,white,white,white,white, -    white,white,white,white,white,white,white,white, -    2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, -    black,black,black,black,black,black,black,black, -    black,black,black,black,black,black,black,black}; -short sweep[7]= {false,false,false,true,true,true,false}; -short Dpwn[3]={4,6,0}; -short Dstart[7]={6,4,8,4,0,0,0}; -short Dstop[7]={7,5,15,7,3,7,7}; -short Dir[16]={1,0x10,-1,-0x10,0x0F,0x11,-0x0F,-0x11, -               0x0E,-0x0E,0x12,-0x12,0x1F,-0x1F,0x21,-0x21}; -short Pdir[34]={0,0x38,0,0,0,0,0,0,0,0,0,0,0,0,0x02,0x35, -                0x38,0x35,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0x02, -                0,0x02}; -short pbit[7]={0,0x01,0x02,0x04,0x08,0x10,0x20}; -unsigned short killr0[maxdepth],killr1[maxdepth],killr2[maxdepth]; -unsigned short killr3[maxdepth],PrVar[maxdepth]; -unsigned short PV,hint,Swag0,Swag1,Swag2,Swag3,Swag4; -unsigned short hashkey; -unsigned long hashbd; -struct hashval hashcode[2][7][64]; -struct hashentry huge *ttable,*ptbl; -unsigned char history[8192]; - -short Mwpawn[64],Mbpawn[64],Mknight[2][64],Mbishop[2][64]; -short Mking[2][64],Kfield[2][64]; -short value[7]={0,valueP,valueN,valueB,valueR,valueQ,valueK}; -short control[7]={0,ctlP,ctlN,ctlB,ctlR,ctlQ,ctlK}; -short PassedPawn0[8]={0,60,80,120,200,360,600,800}; -short PassedPawn1[8]={0,30,40,60,100,180,300,800}; -short PassedPawn2[8]={0,15,25,35,50,90,140,800}; -short PassedPawn3[8]={0,5,10,15,20,30,140,800}; -short ISOLANI[8] = {-12,-16,-20,-24,-24,-20,-16,-12}; -short BACKWARD[8] = {-6,-10,-15,-21,-28,-28,-28,-28}; -short BMBLTY[14] = {-2,0,2,4,6,8,10,12,13,14,15,16,16,16}; -short RMBLTY[14] = {0,2,4,6,8,10,11,12,13,14,14,14,14,14}; -short Kthreat[16] = {0,-8,-20,-36,-52,-68,-80,-80,-80,-80,-80,-80, -                     -80,-80,-80,-80}; -short KNIGHTPOST,KNIGHTSTRONG,BISHOPSTRONG,KATAK,KBNKsq; -short PEDRNK2B,PWEAKH,PADVNCM,PADVNCI,PAWNSHIELD,PDOUBLED,PBLOK; -short RHOPN,RHOPNX,KHOPN,KHOPNX,KSFTY; -short ATAKD,HUNGP,HUNGX,KCASTLD,KMOVD,XRAY,PINVAL; -short stage,stage2,Zwmtl,Zbmtl,Developed[2],PawnStorm; -short PawnBonus,BishopBonus,RookBonus; -short KingOpening[64]= -   {  0,  0, -4,-10,-10, -4,  0,  0, -     -4, -4, -8,-12,-12, -8, -4, -4, -    -12,-16,-20,-20,-20,-20,-16,-12, -    -16,-20,-24,-24,-24,-24,-20,-16, -    -16,-20,-24,-24,-24,-24,-20,-16, -    -12,-16,-20,-20,-20,-20,-16,-12, -     -4, -4, -8,-12,-12, -8, -4, -4, -      0,  0, -4,-10,-10, -4,  0,  0}; -short KingEnding[64]= -   { 0, 6,12,18,18,12, 6, 0, -     6,12,18,24,24,18,12, 6, -    12,18,24,30,30,24,18,12, -    18,24,30,36,36,30,24,18, -    18,24,30,36,36,30,24,18, -    12,18,24,30,30,24,18,12, -     6,12,18,24,24,18,12, 6, -     0, 6,12,18,18,12, 6, 0}; -short DyingKing[64]= -   { 0, 8,16,24,24,16, 8, 0, -     8,32,40,48,48,40,32, 8, -    16,40,56,64,64,56,40,16, -    24,48,64,72,72,64,48,24, -    24,48,64,72,72,64,48,24, -    16,40,56,64,64,56,40,16, -     8,32,40,48,48,40,32, 8, -     0, 8,16,24,24,16, 8, 0}; -short KBNK[64]= -   {99,90,80,70,60,50,40,40, -    90,80,60,50,40,30,20,40, -    80,60,40,30,20,10,30,50, -    70,50,30,10, 0,20,40,60, -    60,40,20, 0,10,30,50,70, -    50,30,10,20,30,40,60,80, -    40,20,30,40,50,60,80,90, -    40,40,50,60,70,80,90,99}; -short pknight[64]= -   { 0, 4, 8,10,10, 8, 4, 0, -     4, 8,16,20,20,16, 8, 4, -     8,16,24,28,28,24,16, 8, -    10,20,28,32,32,28,20,10, -    10,20,28,32,32,28,20,10, -     8,16,24,28,28,24,16, 8, -     4, 8,16,20,20,16, 8, 4, -     0, 4, 8,10,10, 8, 4, 0}; -short pbishop[64]= -   {14,14,14,14,14,14,14,14, -    14,22,18,18,18,18,22,14, -    14,18,22,22,22,22,18,14, -    14,18,22,22,22,22,18,14, -    14,18,22,22,22,22,18,14, -    14,18,22,22,22,22,18,14, -    14,22,18,18,18,18,22,14, -    14,14,14,14,14,14,14,14}; -short PawnAdvance[64]= -   { 0, 0, 0, 0, 0, 0, 0, 0, -     4, 4, 4, 0, 0, 4, 4, 4, -     6, 8, 2,10,10, 2, 8, 6, -     6, 8,12,16,16,12, 8, 6, -     8,12,16,24,24,16,12, 8, -    12,16,24,32,32,24,16,12, -    12,16,24,32,32,24,16,12, -     0, 0, 0, 0, 0, 0, 0, 0}; - - -main(argc,argv) -int argc; char *argv[]; -{ -#ifdef MSDOS -  ttable = (struct hashentry huge *)farmalloc(ttblsz * -           (unsigned long)sizeof(struct hashentry)); -#else -  ttable = (struct hashentry *)malloc(ttblsz * -           (unsigned long)sizeof(struct hashentry)); -#endif -  Level = 0; TCflag = false; OperatorTime = 0; -  if (argc == 2) Level = atoi(argv[1]); -  if (argc == 3) -    { -      TCmoves = atoi(argv[1]); TCminutes = atoi(argv[2]); TCflag = true; -    } -  Initialize(); -  NewGame(); -#if (NEWMOVE > 0) -  Initialize_dist(); -#if (NEWMOVE > 1) -  Initialize_moves(); -#endif -#endif -  while (!(quit)) -    { -      if (bothsides && !mate) SelectMove(opponent,1); else InputCommand(); -      if (!(quit || mate || force)) SelectMove(computer,1); -    } -  ExitChess(); -} - - - -/* ............    INTERFACE ROUTINES    ........................... */ - -int VerifyMove(s,iop,mv) -char s[]; -short iop; -unsigned short *mv; - -/* -   Compare the string 's' to the list of legal moves available for the -   opponent. If a match is found, make the move on the board. -*/ - -{ -static short pnt,tempb,tempc,tempsf,tempst,cnt; -static struct leaf xnode; -struct leaf *node; - -  *mv = 0; -  if (iop == 2) -    { -      UnmakeMove(opponent,&xnode,&tempb,&tempc,&tempsf,&tempst); -      return(false); -    } -  cnt = 0; -  MoveList(opponent,2); -  pnt = TrPnt[2]; -  while (pnt < TrPnt[3]) -    { -      node = &Tree[pnt++]; -      algbr(node->f,node->t,(short) node->flags & cstlmask); -      if (strcmp(s,mvstr1) == 0 || strcmp(s,mvstr2) == 0) -        { -          cnt++; xnode = *node; -        } -    } -  if (cnt == 1) -    { -      MakeMove(opponent,&xnode,&tempb,&tempc,&tempsf,&tempst); -      if (SqAtakd(PieceList[opponent][0],computer)) -        { -          UnmakeMove(opponent,&xnode,&tempb,&tempc,&tempsf,&tempst); -          ShowMessage("Illegal Move!!"); -          return(false); -        } -      else -        { -          if (iop == 1) return(true); -          if (xnode.flags & epmask) UpdateDisplay(0,0,1,0); -          else UpdateDisplay(xnode.f,xnode.t,0,xnode.flags & cstlmask); -          if (xnode.flags & cstlmask) Game50 = GameCnt; -          else if (board[xnode.t] == pawn || (xnode.flags & capture)) -            Game50 = GameCnt; -          GameList[GameCnt].depth = GameList[GameCnt].score = 0; -          GameList[GameCnt].nodes = 0; -          ElapsedTime(1); -          GameList[GameCnt].time = (short)et; -          TimeControl.clock[opponent] -= et; -          --TimeControl.moves[opponent]; -          *mv = (xnode.f << 8) + xnode.t; -          algbr(xnode.f,xnode.t,false); -          return(true); -        } -    } -  if (cnt > 1) ShowMessage("Ambiguous Move!"); -  return(false); -} - - -NewGame() - -/* -   Reset the board and other variables to start a new game. -*/ - -{ -short l,r,c,p; - -  mate = quit = reverse = bothsides = post = false; -  hashflag = force = PawnStorm = false; -  beep = rcptr = easy = true; -  lpost =  NodeCnt = epsquare = et0 = 0; -  dither = 0; -  Awindow = 90; -  Bwindow = 90; -  xwndw = 90; -  MaxSearchDepth = 29; -  contempt = 0; -  GameCnt = -1; Game50 = 0; -  Zwmtl = Zbmtl = 0; -  Developed[white] = Developed[black] = false; -  castld[white] = castld[black] = false; -  kingmoved[white] = kingmoved[black] = 0; -  PawnThreat[0] = CptrFlag[0] = Threat[0] = false; -  Pscore[0] = 12000; Tscore[0] = 12000; -  opponent = white; computer = black; -  for (r = 0; r < 8; r++) -    for (c = 0; c < 8; c++) -      { -        l = 8*r+c; locn[r][c] = l; -        row[l] = r; column[l] = c; -        board[l] = Stboard[l]; color[l] = Stcolor[l]; -      } -  for (c = white; c <= black; c++) -    for (p = pawn; p <= king; p++) -      for (l = 0; l < 64; l++) -        { -          hashcode[c][p][l].key = (unsigned short)rand(); -          hashcode[c][p][l].bd = ((unsigned long)rand() << 16) + -                                 (unsigned long)rand(); -        } -  ClrScreen(); -  if (TCflag) SetTimeControl(); -  else if (Level == 0) SelectLevel(); -  UpdateDisplay(0,0,1,0); -  InitializeStats(); -  time0 = time((long *)0); -  ElapsedTime(1); -  GetOpenings(); -} - - -algbr(f,t,iscastle) -short f,t,iscastle; -{ -  mvstr1[0] = cxx[column[f]]; mvstr1[1] = rxx[row[f]]; -  mvstr1[2] = cxx[column[t]]; mvstr1[3] = rxx[row[t]]; -  mvstr2[0] = qxx[board[f]]; -  mvstr2[1] = mvstr1[2]; mvstr2[2] = mvstr1[3]; -  mvstr1[4] = '\0'; mvstr2[3] = '\0'; -  if (iscastle) -    if (t > f) strcpy(mvstr2,"o-o"); -    else strcpy(mvstr2,"o-o-o"); -} - - -/* ............    MOVE GENERATION & SEARCH ROUTINES    .............. */ - -SelectMove(side,iop) -short side,iop; - -/* -   Select a move by calling function search() at progressively deeper -   ply until time is up or a mate or draw is reached. An alpha-beta -   window of -90 to +90 points is set around the score returned from the -   previous iteration. If Sdepth != 0 then the program has correctly -   predicted the opponents move and the search will start at a depth of -   Sdepth+1 rather than a depth of 1. -*/ - -{ -static short i,alpha,beta,score,tempb,tempc,tempsf,tempst,xside,rpt; - -  timeout = false; -  xside = otherside[side]; -  if (iop != 2) player = side; -  if (TCflag) -    { -      if (((TimeControl.moves[side] + 3) - OperatorTime) != 0) -	ResponseTime = (TimeControl.clock[side]) / -  	               (TimeControl.moves[side] + 3) - -                       OperatorTime; -      else ResponseTime = 0; -      ResponseTime += (ResponseTime*TimeControl.moves[side])/(2*TCmoves+1); -    } -  else ResponseTime = Level; -  if (iop == 2) ResponseTime = 999; -  if (Sdepth > 0 && root->score > Zscore-zwndw) ResponseTime -= ft; -  else if (ResponseTime < 1) ResponseTime = 1; -  ExtraTime = 0; -  ExaminePosition(); -  ScorePosition(side,&score); -  ShowSidetomove(); - -  if (Sdepth == 0) -  { -    ZeroTTable(); -    SearchStartStuff(side); -    for (i = 0; i < 8192; i++) history[i] = 0; -    FROMsquare = TOsquare = -1; -    PV = 0; -    if (iop != 2) hint = 0; -    for (i = 0; i < maxdepth; i++) -     PrVar[i] = killr0[i] = killr1[i] = killr2[i] = killr3[i] = 0; -    alpha = score-90; beta = score+90; -    rpt = 0; -    TrPnt[1] = 0; root = &Tree[0]; -    MoveList(side,1); -    for (i = TrPnt[1]; i < TrPnt[2]; i++) pick(i,TrPnt[2]-1); -    if (Book != NULL) OpeningBook(); -    if (Book != NULL) timeout = true; -    NodeCnt = ETnodes = EvalNodes = HashCnt = 0; -    Zscore = 0; zwndw = 20; -  } - -  while (!timeout && Sdepth < MaxSearchDepth) -    { -      Sdepth++; -      ShowDepth(' '); -      score = search(side,1,Sdepth,alpha,beta,PrVar,&rpt); -      for (i = 1; i <= Sdepth; i++) killr0[i] = PrVar[i]; -      if (score < alpha) -        { -          ShowDepth('-'); -          ExtraTime = 10*ResponseTime; -          ZeroTTable(); -          score = search(side,1,Sdepth,-9000,beta,PrVar,&rpt); -        } -      if (score > beta && !(root->flags & exact)) -        { -          ShowDepth('+'); -          ExtraTime = 0; -          ZeroTTable(); -          score = search(side,1,Sdepth,alpha,9000,PrVar,&rpt); -        } -      score = root->score; -      if (!timeout) -        for (i = TrPnt[1]+1; i < TrPnt[2]; i++) pick(i,TrPnt[2]-1); -      ShowResults(score,PrVar,'.'); -      for (i = 1; i <= Sdepth; i++) killr0[i] = PrVar[i]; -      if (score > Zscore-zwndw && score > Tree[1].score+250) ExtraTime = 0; -      else if (score > Zscore-3*zwndw) ExtraTime = ResponseTime; -      else ExtraTime = 3*ResponseTime; -      if (root->flags & exact) timeout = true; -      if (Tree[1].score < -9000) timeout = true; -      if (4*et > 2*ResponseTime + ExtraTime) timeout = true; -      if (!timeout) -        { -          Tscore[0] = score; -          if (Zscore == 0) Zscore = score; -          else Zscore = (Zscore+score)/2; -        } -      zwndw = 20+abs(Zscore/12); -      beta = score + Bwindow; -      if (Zscore < score) alpha = Zscore - Awindow - zwndw; -      else alpha = score - Awindow - zwndw; -    } - -  score = root->score; -  if (rpt >= 2 || score < -12000) root->flags |= draw; -  if (iop == 2) return(0); -  if (Book == NULL) hint = PrVar[2]; -  ElapsedTime(1); - -  if (score > -9999 && rpt <= 2) -    { -      MakeMove(side,root,&tempb,&tempc,&tempsf,&tempst); -      algbr(root->f,root->t,(short) root->flags & cstlmask); -    } -  else mvstr1[0] = '\0'; -  OutputMove(); -  if (score == -9999 || score == 9998) mate = true; -  if (mate) hint = 0; -  if (root->flags & cstlmask) Game50 = GameCnt; -  else if (board[root->t] == pawn || (root->flags & capture)) -    Game50 = GameCnt; -  GameList[GameCnt].score = score; -  GameList[GameCnt].nodes = NodeCnt; -  GameList[GameCnt].time = (short)et; -  GameList[GameCnt].depth = Sdepth; -  if (TCflag) -    { -      TimeControl.clock[side] -= (et + OperatorTime); -      if (--TimeControl.moves[side] == 0) SetTimeControl(); -    } -  if ((root->flags & draw) && bothsides) quit = true; -  if (GameCnt > 238) quit = true; -  player = xside; -  Sdepth = 0; -  fflush(stdin); -  return(0); -} - - -OpeningBook() - -/* -   Go thru each of the opening lines of play and check for a match with -   the current game listing. If a match occurs, generate a random number. -   If this number is the largest generated so far then the next move in -   this line becomes the current "candidate". After all lines are -   checked, the candidate move is put at the top of the Tree[] array and -   will be played by the program. Note that the program does not handle -   book transpositions. -*/ - -{ -short j,pnt; -unsigned short m,*mp; -unsigned r,r0; -struct BookEntry *p; - -  srand((unsigned)time0); -  r0 = m = 0; -  p = Book; -  while (p != NULL) -    { -      mp = p->mv; -      for (j = 0; j <= GameCnt; j++) -        if (GameList[j].gmove != *(mp++)) break; -      if (j > GameCnt) -        if ((r=rand()) > r0) -          { -            r0 = r; m = *mp; -            hint = *(++mp); -          } -      p = p->next; -    } - -  for (pnt = TrPnt[1]; pnt < TrPnt[2]; pnt++) -    if ((Tree[pnt].f<<8) + Tree[pnt].t == m) Tree[pnt].score = 0; -  pick(TrPnt[1],TrPnt[2]-1); -  if (Tree[TrPnt[1]].score < 0) Book = NULL; -} - - -#define UpdateSearchStatus \ -{\ -  if (post) ShowCurrentMove(pnt,node->f,node->t);\ -  if (pnt > TrPnt[1])\ -    {\ -      d = best-Zscore; e = best-node->score;\ -      if (best < alpha) ExtraTime = 10*ResponseTime;\ -      else if (d > -zwndw && e > 4*zwndw) ExtraTime = -ResponseTime/3;\ -      else if (d > -zwndw) ExtraTime = 0;\ -      else if (d > -3*zwndw) ExtraTime = ResponseTime;\ -      else if (d > -9*zwndw) ExtraTime = 3*ResponseTime;\ -      else ExtraTime = 5*ResponseTime;\ -    }\ -} - -int search(side,ply,depth,alpha,beta,bstline,rpt) -short side,ply,depth,alpha,beta,*rpt; -unsigned short bstline[]; - -/* -   Perform an alpha-beta search to determine the score for the current -   board position. If depth <= 0 only capturing moves, pawn promotions -   and responses to check are generated and searched, otherwise all -   moves are processed. The search depth is modified for check evasions, -   certain re-captures and threats. Extensions may continue for up to 11 -   ply beyond the nominal search depth. -*/ - -#define prune (cf && score+node->score < alpha) -#define ReCapture (rcptr && score > alpha && score < beta &&\ -                   ply > 2 && CptrFlag[ply-1] && CptrFlag[ply-2]) -#define MateThreat (ply < Sdepth+4 && ply > 4 &&\ -                    ChkFlag[ply-2] && ChkFlag[ply-4] &&\ -                    ChkFlag[ply-2] != ChkFlag[ply-4]) - -{ -register short j,pnt; -short best,tempb,tempc,tempsf,tempst; -short xside,pbst,d,e,cf,score,rcnt; -unsigned short mv,nxtline[maxdepth]; -struct leaf *node,tmp; - -  NodeCnt++; -  xside = otherside[side]; -  if (depth < 0) depth = 0; - -  if (ply <= Sdepth+3) repetition(rpt); else *rpt = 0; -  if (*rpt >= 2) return(0); - -  score = evaluate(side,xside,ply,alpha,beta); -  if (score > 9000) -    { -      bstline[ply] = 0; -      return(score); -    } - -  if (depth > 0) -    { -      if (InChk || PawnThreat[ply-1] || ReCapture) ++depth; -    } -  else -    { -      if (score >= alpha && -         (InChk || PawnThreat[ply-1] || Threat[ply-1])) ++depth; -      else if (score <= beta && MateThreat) ++depth; -    } - -  if (depth > 0 && hashflag && ply > 1) -    { -      ProbeTTable(side,depth,&alpha,&beta,&score); -      bstline[ply] = PV; -      bstline[ply+1] = 0; -      if (beta == -20000) return(score); -      if (alpha > beta) return(alpha); -    } - -  if (Sdepth == 1) d = 7; else d = 11; -  if (ply > Sdepth+d || (depth < 1 && score > beta)) return(score); - -  if (ply > 1) -    if (depth > 0) MoveList(side,ply); -    else CaptureList(side,xside,ply); - -  if (TrPnt[ply] == TrPnt[ply+1]) return(score); - -  cf = (depth < 1 && ply > Sdepth+1 && !ChkFlag[ply-2] && !slk); - -  if (depth > 0) best = -12000; else best = score; -  if (best > alpha) alpha = best; - -  for (pnt = pbst = TrPnt[ply]; -       pnt < TrPnt[ply+1] && best <= beta; -       pnt++) -    { -      if (ply > 1) pick(pnt,TrPnt[ply+1]-1); -      node = &Tree[pnt]; -      mv = (node->f << 8) + node->t; -      nxtline[ply+1] = 0; - -      if (prune) break; -      if (ply == 1) UpdateSearchStatus; - -      if (!(node->flags & exact)) -        { -          MakeMove(side,node,&tempb,&tempc,&tempsf,&tempst); -          CptrFlag[ply] = (node->flags & capture); -          PawnThreat[ply] = (node->flags & pwnthrt); -          Tscore[ply] = node->score; -          PV = node->reply; -          node->score = -search(xside,ply+1,depth-1,-beta,-alpha, -                                nxtline,&rcnt); -          if (abs(node->score) > 9000) node->flags |= exact; -          else if (rcnt == 1) node->score /= 2; -          if (rcnt >= 2 || GameCnt-Game50 > 99 || -             (node->score == 9999-ply && !ChkFlag[ply])) -            { -              node->flags |= draw; node->flags |= exact; -              if (side == computer) node->score = contempt; -              else node->score = -contempt; -            } -          node->reply = nxtline[ply+1]; -          UnmakeMove(side,node,&tempb,&tempc,&tempsf,&tempst); -        } -      if (node->score > best && !timeout) -        { -          if (depth > 0) -            if (node->score > alpha && !(node->flags & exact)) -              node->score += depth; -          best = node->score; pbst = pnt; -          if (best > alpha) alpha = best; -          for (j = ply+1; nxtline[j] > 0; j++) bstline[j] = nxtline[j]; -          bstline[j] = 0; -          bstline[ply] = mv; -          if (ply == 1) -            { -              if (best == alpha) -                { -                  tmp = Tree[pnt]; -                  for (j = pnt-1; j >= 0; j--) Tree[j+1] = Tree[j]; -                  Tree[0] = tmp; -                  pbst = 0; -                } -              if (Sdepth > 2) -                if (best > beta) ShowResults(best,bstline,'+'); -                else if (best < alpha) ShowResults(best,bstline,'-'); -                else ShowResults(best,bstline,'&'); -            } -        } -      if (NodeCnt > ETnodes) ElapsedTime(0); -      if (timeout) return(-Tscore[ply-1]); -    } - -  node = &Tree[pbst]; -  mv = (node->f<<8) + node->t; -  if (hashflag && ply <= Sdepth && *rpt == 0 && best == alpha) -    PutInTTable(side,best,depth,alpha,beta,mv); -  if (depth > 0) -    { -      j = (node->f<<6) + node->t; if (side == black) j |= 0x1000; -      if (history[j] < 150) history[j] += 2*depth; -      if (node->t != (GameList[GameCnt].gmove & 0xFF)) -        if (best <= beta) killr3[ply] = mv; -        else if (mv != killr1[ply]) -          { -            killr2[ply] = killr1[ply]; -            killr1[ply] = mv; -          } -      if (best > 9000) killr0[ply] = mv; else killr0[ply] = 0; -    } -  return(best); -} - - -evaluate(side,xside,ply,alpha,beta) -short side,xside,ply,alpha,beta; - -/* -   Compute an estimate of the score by adding the positional score from -   the previous ply to the material difference. If this score falls -   inside a window which is 180 points wider than the alpha-beta window -   (or within a 50 point window during quiescence search) call -   ScorePosition() to determine a score, otherwise return the estimated -   score. If one side has only a king and the other either has no pawns -   or no pieces then the function ScoreLoneKing() is called. -*/ - -{ -short s,evflag; - -  hung[white] = hung[black] = 0; -  slk = ((mtl[white] == valueK && (pmtl[black] == 0 || emtl[black] == 0)) || -         (mtl[black] == valueK && (pmtl[white] == 0 || emtl[white] == 0))); -  s = -Pscore[ply-1] + mtl[side] - mtl[xside]; -  s -= INCscore; - -  if (slk) evflag = false; -  else evflag = -     (ply == 1 || ply < Sdepth || -     ((ply == Sdepth+1 || ply == Sdepth+2) && -      (s > alpha-xwndw && s < beta+xwndw)) || -     (ply > Sdepth+2 && s >= alpha-25 && s <= beta+25)); - -  if (evflag) -    { -      EvalNodes++; -      ataks(side,atak[side]); -      if (atak[side][PieceList[xside][0]] > 0) return(10001-ply); -      ataks(xside,atak[xside]); -      InChk = (atak[xside][PieceList[side][0]] > 0); -      ScorePosition(side,&s); -    } -  else -    { -      if (SqAtakd(PieceList[xside][0],side)) return(10001-ply); -      InChk = SqAtakd(PieceList[side][0],xside); -      if (slk) ScoreLoneKing(side,&s); -    } - -  Pscore[ply] = s - mtl[side] + mtl[xside]; -  if (InChk) ChkFlag[ply-1] = Pindex[TOsquare]; -  else ChkFlag[ply-1] = 0; -  Threat[ply-1] = (hung[side] > 1 && ply == Sdepth+1); -  return(s); -} - - -ProbeTTable(side,depth,alpha,beta,score) -short side,depth,*alpha,*beta,*score; - -/* -   Look for the current board position in the transposition table. -*/ - -{ -short hindx; -  if (side == white) hashkey |= 1; else hashkey &= 0xFFFE; -  hindx = (hashkey & (ttblsz-1)); -  ptbl = (ttable + hindx); -  if (ptbl->depth >= depth && ptbl->hashbd == hashbd) -    { -      HashCnt++; -      PV = ptbl->mv; -      if (ptbl->flags & truescore) -        { -          *score = ptbl->score; -          *beta = -20000; -          return(true); -        } -/* -      else if (ptbl->flags & upperbound) -        { -          if (ptbl->score < *beta) *beta = ptbl->score+1; -        } -*/ -      else if (ptbl->flags & lowerbound) -        { -          if (ptbl->score > *alpha) *alpha = ptbl->score-1; -        } -    } -  return(false); -} - - -PutInTTable(side,score,depth,alpha,beta,mv) -short side,score,depth,alpha,beta; -unsigned short mv; - -/* -   Store the current board position in the transposition table. -*/ - -{ -short hindx; -  if (side == white) hashkey |= 1; else hashkey &= 0xFFFE; -  hindx = (hashkey & (ttblsz-1)); -  ptbl = (ttable + hindx); -  ptbl->hashbd = hashbd; -  ptbl->depth = depth; -  ptbl->score = score; -  ptbl->mv = mv; -  ptbl->flags = 0; -  if (score < alpha) ptbl->flags |= upperbound; -  else if (score > beta) ptbl->flags |= lowerbound; -  else ptbl->flags |= truescore; -} - - -ZeroTTable() -{ -int i; -  if (hashflag) -    for (i = 0; i < ttblsz; i++) -      { -        ptbl = (ttable + i); -        ptbl->depth = 0; -      } -} - - -MoveList(side,ply) -short side,ply; - -/* -   Fill the array Tree[] with all available moves for side to play. Array -   TrPnt[ply] contains the index into Tree[] of the first move at a ply. -*/ - -{ -register short i; -short xside,f; - -  xside = otherside[side]; -  if (PV == 0) Swag0 = killr0[ply]; else Swag0 = PV; -  Swag1 = killr1[ply]; Swag2 = killr2[ply]; -  Swag3 = killr3[ply]; Swag4 = 0; -  if (ply > 2) Swag4 = killr1[ply-2]; -  TrPnt[ply+1] = TrPnt[ply]; -  Dstart[pawn] = Dpwn[side]; Dstop[pawn] = Dstart[pawn] + 1; -  for (i = PieceCnt[side]; i >= 0; i--) -    GenMoves(ply,PieceList[side][i],side,xside); -  if (kingmoved[side] == 0 && !castld[side]) -    { -      f = PieceList[side][0]; -      if (castle(side,f,f+2,0)) -        { -          LinkMove(ply,f,f+2,xside); -          Tree[TrPnt[ply+1]-1].flags |= cstlmask; -        } -      if (castle(side,f,f-2,0)) -        { -          LinkMove(ply,f,f-2,xside); -          Tree[TrPnt[ply+1]-1].flags |= cstlmask; -        } -    } -} - -#if (NEWMOVE < 11) -GenMoves(ply,sq,side,xside) -short ply,sq,side,xside; - -/* -   Generate moves for a piece. The from square is mapped onto a special -   board and offsets (taken from array Dir[]) are added to the mapped -   location. The newly generated square is tested to see if it falls off -   the board by ANDing the square with 88 HEX. Legal moves are linked -   into the tree. -*/ - -{ -register short m,u,d; -short i,m0,piece; - -  piece = board[sq]; m0 = map[sq]; -  if (sweep[piece]) -    for (i = Dstart[piece]; i <= Dstop[piece]; i++) -      { -        d = Dir[i]; m = m0+d; -        while (!(m & 0x88)) -          { -            u = unmap[m]; -            if (color[u] == neutral) -              { -                LinkMove(ply,sq,u,xside); -                m += d; -              } -            else if (color[u] == xside) -              { -                LinkMove(ply,sq,u,xside); -                break; -              } -            else break; -          } -      } -  else if (piece == pawn) -    { -      if (side == white && color[sq+8] == neutral) -        { -          LinkMove(ply,sq,sq+8,xside); -          if (row[sq] == 1) -            if (color[sq+16] == neutral) -              LinkMove(ply,sq,sq+16,xside); -        } -      else if (side == black && color[sq-8] == neutral) -        { -          LinkMove(ply,sq,sq-8,xside); -          if (row[sq] == 6) -            if (color[sq-16] == neutral) -              LinkMove(ply,sq,sq-16,xside); -        } -      for (i = Dstart[piece]; i <= Dstop[piece]; i++) -        if (!((m = m0+Dir[i]) & 0x88)) -          { -            u = unmap[m]; -            if (color[u] == xside || u == epsquare) -              LinkMove(ply,sq,u,xside); -          } -    } -  else -    { -      for (i = Dstart[piece]; i <= Dstop[piece]; i++) -        if (!((m = m0+Dir[i]) & 0x88)) -          { -            u = unmap[m]; -            if (color[u] != side) LinkMove(ply,sq,u,xside); -          } -    } -} -#endif - -LinkMove(ply,f,t,xside) -short ply,f,t,xside; - -/* -   Add a move to the tree.  Assign a bonus to order the moves -   as follows: -     1. Principle variation -     2. Capture of last moved piece -     3. Other captures (major pieces first) -     4. Killer moves -     5. "history" killers -*/ - -{ -register short s,z; -unsigned short mv; -struct leaf *node; - -  node = &Tree[TrPnt[ply+1]]; -  ++TrPnt[ply+1]; -  node->flags = node->reply = 0; -  node->f = f; node->t = t; -  mv = (f<<8) + t; -  s = 0; -  if (mv == Swag0) s = 2000; -  else if (mv == Swag1) s = 60; -  else if (mv == Swag2) s = 50; -  else if (mv == Swag3) s = 40; -  else if (mv == Swag4) s = 30; -  if (color[t] != neutral) -    { -      node->flags |= capture; -      if (t == TOsquare) s += 500; -      s += value[board[t]] - board[f]; -    } -  if (board[f] == pawn) -    if (row[t] == 0 || row[t] == 7) -      { -        node->flags |= promote; -        s += 800; -      } -    else if (row[t] == 1 || row[t] == 6) -      { -        node->flags |= pwnthrt; -        s += 600; -      } -    else if (t == epsquare) node->flags |= epmask; -  z = (f<<6) + t; if (xside == white) z |= 0x1000; -  s += history[z]; -  node->score = s - 20000; -} - -#if (NEWMOVE < 10) -CaptureList(side,xside,ply) -short side,xside,ply; - -/* -    Generate captures and Pawn promotions only. -*/ - -#define LinkCapture\ -{\ -  node->f = sq; node->t = u;\ -  node->reply = 0;\ -  node->flags = capture;\ -  node->score = value[board[u]] + svalue[board[u]] - piece;\ -  if (piece == pawn && (u < 8 || u > 55))\ -    {\ -      node->flags |= promote;\ -      node->score = valueQ;\ -    }\ -  ++node;\ -  ++TrPnt[ply+1];\ -} - -{ -register short m,u; -short d,sq,i,j,j1,j2,m0,r7,d0,piece,*PL; -struct leaf *node; - -  TrPnt[ply+1] = TrPnt[ply]; -  node = &Tree[TrPnt[ply]]; -  Dstart[pawn] = Dpwn[side]; Dstop[pawn] = Dstart[pawn] + 1; -  if (side == white) -    { -      r7 = 6; d0 = 8; -    } -  else -    { -      r7 = 1; d0 = -8; -    } -  PL = PieceList[side]; -  for (i = 0; i <= PieceCnt[side]; i++) -    { -      sq = PL[i]; -      m0 = map[sq]; piece = board[sq]; -      j1 = Dstart[piece]; j2 = Dstop[piece]; -      if (sweep[piece]) -        for (j = j1; j <= j2; j++) -          { -            d = Dir[j]; m = m0+d; -            while (!(m & 0x88)) -              { -                u = unmap[m]; -                if (color[u] == neutral) m += d; -                else -                  { -                    if (color[u] == xside) LinkCapture; -                    break; -                  } -              } -          } -      else -        { -          for (j = j1; j <= j2; j++) -            if (!((m = m0+Dir[j]) & 0x88)) -              { -                u = unmap[m]; -                if (color[u] == xside) LinkCapture; -              } -          if (piece == pawn && row[sq] == r7) -            { -              u = sq+d0; -              if (color[u] == neutral) LinkCapture; -            } -        } -    } -} -#endif - -int castle(side,kf,kt,iop) -short side,kf,kt,iop; - -/* -   Make or Unmake a castling move. -*/ - -{ -short rf,rt,d,t0,xside; - -  xside = otherside[side]; -  if (kt > kf) -    { -      rf = kf+3; rt = kt-1; d = 1; -    } -  else -    { -      rf = kf-4; rt = kt+1; d = -1; -    } -  if (iop == 0) -    { -      if (board[kf] != king || board[rf] != rook || color[rf] != side) -        return(false); -      if (color[kt] != neutral || color[rt] != neutral) return(false); -      if (d == -1 && color[kt+d] != neutral) return(false); -      if (SqAtakd(kf,xside)) return(false); -      if (SqAtakd(kt,xside)) return(false); -      if (SqAtakd(kf+d,xside)) return(false); -    } -  else -    { -      if (iop == 1) castld[side] = true; else castld[side] = false; -      if (iop == 2) -        { -          t0 = kt; kt = kf; kf = t0; -          t0 = rt; rt = rf; rf = t0; -        } -      board[kt] = king; color[kt] = side; Pindex[kt] = 0; -      board[kf] = no_piece; color[kf] = neutral; -      board[rt] = rook; color[rt] = side; Pindex[rt] = Pindex[rf]; -      board[rf] = no_piece; color[rf] = neutral; -      PieceList[side][Pindex[kt]] = kt; -      PieceList[side][Pindex[rt]] = rt; -      if (hashflag) -        { -          UpdateHashbd(side,king,kf,kt); -          UpdateHashbd(side,rook,rf,rt); -        } -    } -  return(true); -} - - -EnPassant(xside,f,t,iop) -short xside,f,t,iop; - -/* -   Make or unmake an en passant move. -*/ - -{ -short l; -  if (t > f) l = t-8; else l = t+8; -  if (iop == 1) -    { -      board[l] = no_piece; color[l] = neutral; -    } -  else -    { -      board[l] = pawn; color[l] = xside; -    } -  InitializeStats(); -} - - -MakeMove(side,node,tempb,tempc,tempsf,tempst) -short side,*tempc,*tempb,*tempsf,*tempst; -struct leaf *node; - -/* -   Update Arrays board[], color[], and Pindex[] to reflect the new board -   position obtained after making the move pointed to by node. Also -   update miscellaneous stuff that changes when a move is made. -*/ - -{ -register short f,t; -short xside,ct,cf; - -  xside = otherside[side]; -  f = node->f; t = node->t; epsquare = -1; -  FROMsquare = f; TOsquare = t; -  INCscore = 0; -  GameList[++GameCnt].gmove = (f<<8) + t; -  if (node->flags & cstlmask) -    { -      GameList[GameCnt].piece = no_piece; -      GameList[GameCnt].color = side; -      castle(side,f,t,1); -    } -  else -    { -      *tempc = color[t]; *tempb = board[t]; -      *tempsf = svalue[f]; *tempst = svalue[t]; -      GameList[GameCnt].piece = *tempb; -      GameList[GameCnt].color = *tempc; -      if (*tempc != neutral) -        { -          UpdatePieceList(*tempc,t,1); -          if (*tempb == pawn) --PawnCnt[*tempc][column[t]]; -          if (board[f] == pawn) -            { -              --PawnCnt[side][column[f]]; -              ++PawnCnt[side][column[t]]; -              cf = column[f]; ct = column[t]; -              if (PawnCnt[side][ct] > 1+PawnCnt[side][cf]) -                INCscore -= 15; -              else if (PawnCnt[side][ct] < 1+PawnCnt[side][cf]) -                INCscore += 15; -              else if (ct == 0 || ct == 7 || PawnCnt[side][ct+ct-cf] == 0) -                INCscore -= 15; -            } -          mtl[xside] -= value[*tempb]; -          if (*tempb == pawn) pmtl[xside] -= valueP; -          if (hashflag) UpdateHashbd(xside,*tempb,-1,t); -          INCscore += *tempst; -        } -      color[t] = color[f]; board[t] = board[f]; svalue[t] = svalue[f]; -      Pindex[t] = Pindex[f]; PieceList[side][Pindex[t]] = t; -      color[f] = neutral; board[f] = no_piece; -      if (board[t] == pawn) -        if (t-f == 16) epsquare = f+8; -        else if (f-t == 16) epsquare = f-8; -      if (node->flags & promote) -        { -          board[t] = queen; -          --PawnCnt[side][column[t]]; -          mtl[side] += valueQ - valueP; -          pmtl[side] -= valueP; -          HasQueen[side] = true; -          if (hashflag) -            { -              UpdateHashbd(side,pawn,f,-1); -              UpdateHashbd(side,queen,f,-1); -            } -          INCscore -= *tempsf; -        } -      if (board[t] == king) ++kingmoved[side]; -      if (node->flags & epmask) EnPassant(xside,f,t,1); -      else if (hashflag) UpdateHashbd(side,board[t],f,t); -    } -} - - -UnmakeMove(side,node,tempb,tempc,tempsf,tempst) -short side,*tempc,*tempb,*tempsf,*tempst; -struct leaf *node; - -/* -   Take back a move. -*/ - -{ -register short f,t; -short xside; - -  xside = otherside[side]; -  f = node->f; t = node->t; epsquare = -1; -  GameCnt--; -  if (node->flags & cstlmask) castle(side,f,t,2); -  else -    { -      color[f] = color[t]; board[f] = board[t]; svalue[f] = *tempsf; -      Pindex[f] = Pindex[t]; PieceList[side][Pindex[f]] = f; -      color[t] = *tempc; board[t] = *tempb; svalue[t] = *tempst; -      if (node->flags & promote) -        { -          board[f] = pawn; -          ++PawnCnt[side][column[t]]; -          mtl[side] += valueP - valueQ; -          pmtl[side] += valueP; -          if (hashflag) -            { -              UpdateHashbd(side,queen,-1,t); -              UpdateHashbd(side,pawn,-1,t); -            } -        } -      if (*tempc != neutral) -        { -          UpdatePieceList(*tempc,t,2); -          if (*tempb == pawn) ++PawnCnt[*tempc][column[t]]; -          if (board[f] == pawn) -            { -              --PawnCnt[side][column[t]]; -              ++PawnCnt[side][column[f]]; -            } -          mtl[xside] += value[*tempb]; -          if (*tempb == pawn) pmtl[xside] += valueP; -          if (hashflag) UpdateHashbd(xside,*tempb,-1,t); -        } -      if (board[f] == king) --kingmoved[side]; -      if (node->flags & epmask) EnPassant(xside,f,t,2); -      else if (hashflag) UpdateHashbd(side,board[f],f,t); -    } -} - - -UpdateHashbd(side,piece,f,t) -short side,piece,f,t; - -/* -   hashbd contains a 32 bit "signature" of the board position. hashkey -   contains a 16 bit code used to address the hash table. When a move is -   made, XOR'ing the hashcode of moved piece on the from and to squares -   with the hashbd and hashkey values keeps things current. -*/ - -{ -  if (f >= 0) -    { -      hashbd ^= hashcode[side][piece][f].bd; -      hashkey ^= hashcode[side][piece][f].key; -    } -  if (t >= 0) -    { -      hashbd ^= hashcode[side][piece][t].bd; -      hashkey ^= hashcode[side][piece][t].key; -    } -} - - -UpdatePieceList(side,sq,iop) -short side,sq,iop; - -/* -   Update the PieceList and Pindex arrays when a piece is captured or -   when a capture is unmade. -*/ - -{ -register short i; -  if (iop == 1) -    { -      PieceCnt[side]--; -      for (i = Pindex[sq]; i <= PieceCnt[side]; i++) -        { -          PieceList[side][i] = PieceList[side][i+1]; -          Pindex[PieceList[side][i]] = i; -        } -    } -  else -    { -      PieceCnt[side]++; -      PieceList[side][PieceCnt[side]] = sq; -      Pindex[sq] = PieceCnt[side]; -    } -} - - -InitializeStats() - -/* -   Scan thru the board seeing what's on each square. If a piece is found, -   update the variables PieceCnt, PawnCnt, Pindex and PieceList. Also -   determine the material for each side and set the hashkey and hashbd -   variables to represent the current board position. Array -   PieceList[side][indx] contains the location of all the pieces of -   either side. Array Pindex[sq] contains the indx into PieceList for a -   given square. -*/ - -{ -register short i,sq; -  epsquare = -1; -  for (i = 0; i < 8; i++) -    PawnCnt[white][i] = PawnCnt[black][i] = 0; -  mtl[white] = mtl[black] = pmtl[white] = pmtl[black] = 0; -  PieceCnt[white] = PieceCnt[black] = 0; -  hashbd = hashkey = 0; -  for (sq = 0; sq < 64; sq++) -    if (color[sq] != neutral) -      { -        mtl[color[sq]] += value[board[sq]]; -        if (board[sq] == pawn) -          { -            pmtl[color[sq]] += valueP; -            ++PawnCnt[color[sq]][column[sq]]; -          } -        if (board[sq] == king) Pindex[sq] = 0; -          else Pindex[sq] = ++PieceCnt[color[sq]]; -        PieceList[color[sq]][Pindex[sq]] = sq; -        hashbd ^= hashcode[color[sq]][board[sq]][sq].bd; -        hashkey ^= hashcode[color[sq]][board[sq]][sq].key; -      } -} - - -pick(p1,p2) -short p1,p2; - -/* -   Find the best move in the tree between indexes p1 and p2. Swap the -   best move into the p1 element. -*/ - -{ -register short p,s; -short p0,s0; -struct leaf temp; - -  s0 = Tree[p1].score; p0 = p1; -  for (p = p1+1; p <= p2; p++) -    if ((s = Tree[p].score) > s0) -      { -        s0 = s; p0 = p; -      } -  if (p0 != p1) -    { -      temp = Tree[p1]; Tree[p1] = Tree[p0]; Tree[p0] = temp; -    } -} - - -repetition(cnt) -short *cnt; - -/* -    Check for draw by threefold repetition. -*/ - -{ -register short i,c; -short f,t,b[64]; -unsigned short m; -  *cnt = c = 0; -  if (GameCnt > Game50+3) -    { -/* -      memset((char *)b,0,64*sizeof(short)); -*/ -      for (i = 0; i < 64; b[i++] = 0); -      for (i = GameCnt; i > Game50; i--) -        { -          m = GameList[i].gmove; f = m>>8; t = m & 0xFF; -          if (++b[f] == 0) c--; else c++; -          if (--b[t] == 0) c--; else c++; -          if (c == 0) (*cnt)++; -        } -    } -} - -#if (NEWMOVE < 3) -int SqAtakd(sq,side) -short sq,side; - -/* -  See if any piece with color 'side' ataks sq.  First check for pawns -  or king, then try other pieces. Array Dcode is used to check for -  knight attacks or R,B,Q co-linearity. -*/ - -{ -register short m,d; -short i,m0,m1,loc,piece,*PL; - -  m1 = map[sq]; -  if (side == white) m = m1-0x0F; else m = m1+0x0F; -  if (!(m & 0x88)) -    if (board[unmap[m]] == pawn && color[unmap[m]] == side) return(true); -  if (side == white) m = m1-0x11; else m = m1+0x11; -  if (!(m & 0x88)) -    if (board[unmap[m]] == pawn && color[unmap[m]] == side) return(true); -  if (distance(sq,PieceList[side][0]) == 1) return(true); - -  PL = PieceList[side]; -  for (i = 1; i <= PieceCnt[side]; i++) -    { -      loc = PL[i]; piece = board[loc]; -      if (piece == pawn) continue; -      m0 = map[loc]; d = Dcode[abs(m1-m0)]; -      if (d == 0 || (Pdir[d] & pbit[piece]) == 0) continue; -      if (piece == knight) return(true); -      else -        { -          if (m1 < m0) d = -d; -          for (m = m0+d; m != m1; m += d) -            if (color[unmap[m]] != neutral) break; -          if (m == m1) return(true); -        } -    } -  return(false); -} -#endif - -#if (NEWMOVE < 2) -ataks(side,a) -short side,*a; - -/* -    Fill array atak[][] with info about ataks to a square.  Bits 8-15 -    are set if the piece (king..pawn) ataks the square. Bits 0-7 -    contain a count of total ataks to the square. -*/ - -{ -register short u,m; -short d,c,j,j1,j2,piece,i,m0,sq,*PL; - -/* -  memset((char *)a,0,64*sizeof(short)); -*/ -  for (u = 0; u < 64; a[u++] = 0); -  Dstart[pawn] = Dpwn[side]; Dstop[pawn] = Dstart[pawn] + 1; -  PL = PieceList[side]; -  for (i = 0; i <= PieceCnt[side]; i++) -    { -      sq = PL[i]; -      m0 = map[sq]; -      piece = board[sq]; -      c = control[piece]; j1 = Dstart[piece]; j2 = Dstop[piece]; -      if (sweep[piece]) -        for (j = j1; j <= j2; j++) -          { -            d = Dir[j]; m = m0+d; -            while (!(m & 0x88)) -              { -                u = unmap[m]; -                a[u] = ++a[u] | c; -                if (color[u] == neutral) m += d; -                else break; -              } -          } -      else -        for (j = j1; j <= j2; j++) -          if (!((m = m0+Dir[j]) & 0x88)) -            { -              u = unmap[m]; -              a[u] = ++a[u] | c; -            } -    } -} -#endif - -/* ............    POSITIONAL EVALUATION ROUTINES    ............ */ - -ScorePosition(side,score) -short side,*score; - -/* -   Perform normal static evaluation of board position. A score is -   generated for each piece and these are summed to get a score for each -   side. -*/ - -{ -register short sq,s; -short i,xside,pscore[3]; - -  wking = PieceList[white][0]; bking = PieceList[black][0]; -  UpdateWeights(); -  xside = otherside[side]; -  pscore[white] = pscore[black] = 0; - -  for (c1 = white; c1 <= black; c1++) -    { -      c2 = otherside[c1]; -      if (c1 == white) EnemyKing = bking; else EnemyKing = wking; -      atk1 = atak[c1]; atk2 = atak[c2]; -      PC1 = PawnCnt[c1]; PC2 = PawnCnt[c2]; -      for (i = 0; i <= PieceCnt[c1]; i++) -        { -          sq = PieceList[c1][i]; -          s = SqValue(sq,side); -          pscore[c1] += s; -          svalue[sq] = s; -        } -    } -  if (hung[side] > 1) pscore[side] += HUNGX; -  if (hung[xside] > 1) pscore[xside] += HUNGX; - -  *score = mtl[side] - mtl[xside] + pscore[side] - pscore[xside] + 10; -  if (dither) *score += rand() % dither; - -  if (*score > 0 && pmtl[side] == 0) -    if (emtl[side] < valueR) *score = 0; -    else if (*score < valueR) *score /= 2; -  if (*score < 0 && pmtl[xside] == 0) -    if (emtl[xside] < valueR) *score = 0; -    else if (-*score < valueR) *score /= 2; - -  if (mtl[xside] == valueK && emtl[side] > valueB) *score += 200; -  if (mtl[side] == valueK && emtl[xside] > valueB) *score -= 200; -} - - -ScoreLoneKing(side,score) -short side,*score; - -/* -   Static evaluation when loser has only a king and winner has no pawns -   or no pieces. -*/ - -{ -short winner,loser,king1,king2,s,i; - -  UpdateWeights(); -  if (mtl[white] > mtl[black]) winner = white; else winner = black; -  loser = otherside[winner]; -  king1 = PieceList[winner][0]; king2 = PieceList[loser][0]; - -  s = 0; - -  if (pmtl[winner] > 0) -    for (i = 1; i <= PieceCnt[winner]; i++) -      s += ScoreKPK(side,winner,loser,king1,king2,PieceList[winner][i]); - -  else if (emtl[winner] == valueB+valueN) -    s = ScoreKBNK(winner,king1,king2); - -  else if (emtl[winner] > valueB) -    s = 500 + emtl[winner] - DyingKing[king2] - 2*distance(king1,king2); - -  if (side == winner) *score = s; else *score = -s; -} - - -int ScoreKPK(side,winner,loser,king1,king2,sq) -short side,winner,loser,king1,king2,sq; - -/* -   Score King and Pawns versus King endings. -*/ - -{ -short s,r; - -  if (PieceCnt[winner] == 1) s = 50; else s = 120; -  if (winner == white) -    { -      if (side == loser) r = row[sq]-1; else r = row[sq]; -      if (row[king2] >= r && distance(sq,king2) < 8-r) s += 10*row[sq]; -      else s = 500+50*row[sq]; -      if (row[sq] < 6) sq += 16; else sq += 8; -    } -  else -    { -      if (side == loser) r = row[sq]+1; else r = row[sq]; -      if (row[king2] <= r && distance(sq,king2) < r+1) s += 10*(7-row[sq]); -      else s = 500+50*(7-row[sq]); -      if (row[sq] > 1) sq -= 16; else sq -= 8; -    } -  s += 8*(taxicab(king2,sq) - taxicab(king1,sq)); -  return(s); -} - - -int ScoreKBNK(winner,king1,king2) -short winner,king1,king2; - -/* -   Score King+Bishop+Knight versus King endings. -   This doesn't work all that well but it's better than nothing. -*/ - -{ -short s; -  s = emtl[winner] - 300; -  if (KBNKsq == 0) s += KBNK[king2]; -  else s += KBNK[locn[row[king2]][7-column[king2]]]; -  s -= taxicab(king1,king2); -  s -= distance(PieceList[winner][1],king2); -  s -= distance(PieceList[winner][2],king2); -  return(s); -} - - -SqValue(sq,side) -short sq,side; - -/* -   Calculate the positional value for the piece on 'sq'. -*/ - -{ -register short j,fyle,rank; -short s,piece,a1,a2,in_square,r,mob,e,c; - -  piece = board[sq]; -  a1 = (atk1[sq] & 0x4FFF); a2 = (atk2[sq] & 0x4FFF); -  rank = row[sq]; fyle = column[sq]; -  s = 0; -  if (piece == pawn && c1 == white) -    { -      s = Mwpawn[sq]; -      if (sq == 11 || sq == 12) -        if (color[sq+8] != neutral) s += PEDRNK2B; -      if ((fyle == 0 || PC1[fyle-1] == 0) && -          (fyle == 7 || PC1[fyle+1] == 0)) -        s += ISOLANI[fyle]; -      else if (PC1[fyle] > 1) s += PDOUBLED; -      if (a1 < ctlP && atk1[sq+8] < ctlP) -        { -          s += BACKWARD[a2 & 0xFF]; -          if (PC2[fyle] == 0) s += PWEAKH; -          if (color[sq+8] != neutral) s += PBLOK; -        } -      if (PC2[fyle] == 0) -        { -          if (side == black) r = rank-1; else r = rank; -          in_square = (row[bking] >= r && distance(sq,bking) < 8-r); -          if (a2 == 0 || side == white) e = 0; else e = 1; -          for (j = sq+8; j < 64; j += 8) -            if (atk2[j] >= ctlP) { e = 2; break; } -            else if (atk2[j] > 0 || color[j] != neutral) e = 1; -          if (e == 2) s += (stage*PassedPawn3[rank]) / 10; -          else if (in_square || e == 1) s += (stage*PassedPawn2[rank]) / 10; -          else if (emtl[black] > 0) s += (stage*PassedPawn1[rank]) / 10; -          else s += PassedPawn0[rank]; -        } -    } -  else if (piece == pawn && c1 == black) -    { -      s = Mbpawn[sq]; -      if (sq == 51 || sq == 52) -        if (color[sq-8] != neutral) s += PEDRNK2B; -      if ((fyle == 0 || PC1[fyle-1] == 0) && -          (fyle == 7 || PC1[fyle+1] == 0)) -        s += ISOLANI[fyle]; -      else if (PC1[fyle] > 1) s += PDOUBLED; -      if (a1 < ctlP && atk1[sq-8] < ctlP) -        { -          s += BACKWARD[a2 & 0xFF]; -          if (PC2[fyle] == 0) s += PWEAKH; -          if (color[sq-8] != neutral) s += PBLOK; -        } -      if (PC2[fyle] == 0) -        { -          if (side == white) r = rank+1; else r = rank; -          in_square = (row[wking] <= r && distance(sq,wking) < r+1); -          if (a2 == 0 || side == black) e = 0; else e = 1; -          for (j = sq-8; j >= 0; j -= 8) -            if (atk2[j] >= ctlP) { e = 2; break; } -            else if (atk2[j] > 0 || color[j] != neutral) e = 1; -          if (e == 2) s += (stage*PassedPawn3[7-rank]) / 10; -          else if (in_square || e == 1) s += (stage*PassedPawn2[7-rank]) / 10; -          else if (emtl[white] > 0) s += (stage*PassedPawn1[7-rank]) / 10; -          else s += PassedPawn0[7-rank]; -        } -    } -  else if (piece == knight) -    { -      s = Mknight[c1][sq]; -    } -  else if (piece == bishop) -    { -      s = Mbishop[c1][sq]; -      BRscan(sq,&s,&mob); -      s += BMBLTY[mob]; -    } -  else if (piece == rook) -    { -      s += RookBonus; -      BRscan(sq,&s,&mob); -      s += RMBLTY[mob]; -      if (PC1[fyle] == 0) s += RHOPN; -      if (PC2[fyle] == 0) s += RHOPNX; -      if (rank == rank7[c1] && pmtl[c2] > 100) s += 10; -      if (stage > 2) s += 14 - taxicab(sq,EnemyKing); -    } -  else if (piece == queen) -    { -      if (stage > 2) s += 14 - taxicab(sq,EnemyKing); -      if (distance(sq,EnemyKing) < 3) s += 12; -    } -  else if (piece == king) -    { -      s = Mking[c1][sq]; -      if (KSFTY > 0) -        if (Developed[c2] || stage > 0) KingScan(sq,&s); -      if (castld[c1]) s += KCASTLD; -      else if (kingmoved[c1]) s += KMOVD; - -      if (PC1[fyle] == 0) s += KHOPN; -      if (PC2[fyle] == 0) s += KHOPNX; -      if (fyle == 1 || fyle == 2 || fyle == 3 || fyle == 7) -        { -          if (PC1[fyle-1] == 0) s += KHOPN; -          if (PC2[fyle-1] == 0) s += KHOPNX; -        } -      if (fyle == 4 || fyle == 5 || fyle == 6 || fyle == 0) -        { -          if (PC1[fyle+1] == 0) s += KHOPN; -          if (PC2[fyle+1] == 0) s += KHOPNX; -        } -      if (fyle == 2) -        { -          if (PC1[0] == 0) s += KHOPN; -          if (PC2[0] == 0) s += KHOPNX; -        } -      if (fyle == 5) -        { -          if (PC1[7] == 0) s += KHOPN; -          if (PC2[7] == 0) s += KHOPNX; -        } -    } - -  if (a2 > 0) -    { -      c = (control[piece] & 0x4FFF); -      if (a1 == 0 || a2 > c+1) -        { -          s += HUNGP; -          ++hung[c1]; -          if (piece != king && trapped(sq,piece)) ++hung[c1]; -        } -      else if (piece != pawn || a2 > a1) -        if (a2 >= c || a1 < ctlP) s += ATAKD; -    } -  return(s); -} - -#if (NEWMOVE > 6) -KingScan(sq,s) -short sq,*s; - -/* -   Assign penalties if king can be threatened by checks, if squares -   near the king are controlled by the enemy (especially the queen), -   or if there are no pawns near the king. -*/ - -#define ScoreThreat\ -  if (color[u] != c2)\ -    if (atk1[u] == 0 || (atk2[u] & 0xFF) > 1) ++cnt;\ -    else *s -= 3 - -{ -register short m,u; -short d,i,m0,cnt,ok; - -  cnt = 0; -  m0 = map[sq]; -  if (HasBishop[c2] || HasQueen[c2]) -    for (i = Dstart[bishop]; i <= Dstop[bishop]; i++) -      { -        d = Dir[i]; m = m0+d; -        while (!(m & 0x88)) -          { -            u = unmap[m]; -            if (atk2[u] & ctlBQ) ScoreThreat; -            if (color[u] != neutral) break; -            m += d; -          } -      } -  if (HasRook[c2] || HasQueen[c2]) -    for (i = Dstart[rook]; i <= Dstop[rook]; i++) -      { -        d = Dir[i]; m = m0+d; -        while (!(m & 0x88)) -          { -            u = unmap[m]; -            if (atk2[u] & ctlRQ) ScoreThreat; -            if (color[u] != neutral) break; -            m += d; -          } -      } -  if (HasKnight[c2]) -    for (i = Dstart[knight]; i <= Dstop[knight]; i++) -      if (!((m = m0+Dir[i]) & 0x88)) -        { -          u = unmap[m]; -          if (atk2[u] & ctlNN) ScoreThreat; -        } -  *s += (KSFTY*Kthreat[cnt]) / 16; - -  cnt = 0; ok = false; -  m0 = map[sq]; -  for (i = Dstart[king]; i <= Dstop[king]; i++) -    if (!((m = m0+Dir[i]) & 0x88)) -      { -        u = unmap[m]; -        if (board[u] == pawn) ok = true; -        if (atk2[u] > atk1[u]) -          { -            ++cnt; -            if (atk2[u] & ctlQ) -              if (atk2[u] > ctlQ+1 && atk1[u] < ctlQ) *s -= 4*KSFTY; -          } -      } -  if (!ok) *s -= KSFTY; -  if (cnt > 1) *s -= KSFTY; -} -#endif - -#if (NEWMOVE < 4) -BRscan(sq,s,mob) -short sq,*s,*mob; - -/* -   Find Bishop and Rook mobility, XRAY attacks, and pins. Increment the -   hung[] array if a pin is found. -*/ - -{ -register short m,u; -short d,j,m0,piece,pin,*Kf; - -  Kf = Kfield[c1]; -  *mob = 0; -  m0 = map[sq]; piece = board[sq]; -  for (j = Dstart[piece]; j <= Dstop[piece]; j++) -    { -      pin = -1; -      d = Dir[j]; m = m0+d; -      while (!(m & 0x88)) -        { -          u = unmap[m]; *s += Kf[u]; -          if (color[u] == neutral) -            { -              (*mob)++; -              m += d; -            } -          else if (pin < 0) -            { -              if (board[u] == pawn || board[u] == king) break; -              pin = u; -              m += d; -            } -          else if (color[u] == c2 && (board[u] > piece || atk2[u] == 0)) -            { -              if (color[pin] == c2) -                { -                  *s += PINVAL; -                  if (atk2[pin] == 0 || -                      atk1[pin] > control[board[pin]]+1) -                    ++hung[c2]; -                } -              else *s += XRAY; -              break; -            } -          else break; -        } -    } -} -#endif - -#if (NEWMOVE > 5) -int trapped(sq,piece) -short sq,piece; - -/* -   See if the attacked piece has unattacked squares to move to. -*/ - -{ -register short u,m,d; -short i,m0; - -  m0 = map[sq]; -  if (sweep[piece]) -    for (i = Dstart[piece]; i <= Dstop[piece]; i++) -      { -        d = Dir[i]; m = m0+d; -        while (!(m & 0x88)) -          { -            u = unmap[m]; -            if (color[u] == c1) break; -            if (atk2[u] == 0 || board[u] >= piece) return(false); -            if (color[u] == c2) break; -            m += d; -          } -      } -  else if (piece == pawn) -    { -      if (c1 == white) u = sq+8; else u = sq-8; -      if (color[u] == neutral && atk1[u] >= atk2[u]) -        return(false); -      if (!((m = m0+Dir[Dpwn[c1]]) & 0x88)) -        if (color[unmap[m]] == c2) return(false); -      if (!((m = m0+Dir[Dpwn[c1]+1]) & 0x88)) -        if (color[unmap[m]] == c2) return(false); -    } -  else -    { -      for (i = Dstart[piece]; i <= Dstop[piece]; i++) -        if (!((m = m0+Dir[i]) & 0x88)) -          { -            u = unmap[m]; -            if (color[u] != c1) -              if (atk2[u] == 0 || board[u] >= piece) return(false); -          } -    } -  return(true); -} -#endif - -ExaminePosition() - -/* -   This is done one time before the search is started. Set up arrays -   Mwpawn, Mbpawn, Mknight, Mbishop, Mking which are used in the -   SqValue() function to determine the positional value of each piece. -*/ - -{ -register short i,sq; -short wpadv,bpadv,wstrong,bstrong,z,side,pp,j,val,Pd,fyle,rank; - -  wking = PieceList[white][0]; bking = PieceList[black][0]; -  ataks(white,atak[white]); ataks(black,atak[black]); -  Zwmtl = Zbmtl = 0; -  UpdateWeights(); -  HasPawn[white] = HasPawn[black] = 0; -  HasKnight[white] = HasKnight[black] = 0; -  HasBishop[white] = HasBishop[black] = 0; -  HasRook[white] = HasRook[black] = 0; -  HasQueen[white] = HasQueen[black] = 0; -  for (side = white; side <= black; side++) -    for (i = 0; i <= PieceCnt[side]; i++) -      switch (board[PieceList[side][i]]) -        { -          case pawn : ++HasPawn[side]; break; -          case knight : ++HasKnight[side]; break; -          case bishop : ++HasBishop[side]; break; -          case rook : ++HasRook[side]; break; -          case queen : ++HasQueen[side]; break; -        } -  if (!Developed[white]) -    Developed[white] = (board[1] != knight && board[2] != bishop && -                        board[5] != bishop && board[6] != knight); -  if (!Developed[black]) -    Developed[black] = (board[57] != knight && board[58] != bishop && -                        board[61] != bishop && board[62] != knight); -  if (!PawnStorm && stage < 5) -    PawnStorm = ((column[wking] < 3 && column[bking] > 4) || -                 (column[wking] > 4 && column[bking] < 3)); - -  CopyBoard(pknight,Mknight[white]); -  CopyBoard(pknight,Mknight[black]); -  CopyBoard(pbishop,Mbishop[white]); -  CopyBoard(pbishop,Mbishop[black]); -  BlendBoard(KingOpening,KingEnding,Mking[white]); -  BlendBoard(KingOpening,KingEnding,Mking[black]); - -  for (sq = 0; sq < 64; sq++) -    { -      fyle = column[sq]; rank = row[sq]; -      wstrong = bstrong = true; -      for (i = sq; i < 64; i += 8) -        if (atak[black][i] >= ctlP) wstrong = false; -      for (i = sq; i >= 0; i -= 8) -        if (atak[white][i] >= ctlP) bstrong = false; -      wpadv = bpadv = PADVNCM; -      if ((fyle == 0 || PawnCnt[white][fyle-1] == 0) && -          (fyle == 7 || PawnCnt[white][fyle+1] == 0)) wpadv = PADVNCI; -      if ((fyle == 0 || PawnCnt[black][fyle-1] == 0) && -          (fyle == 7 || PawnCnt[black][fyle+1] == 0)) bpadv = PADVNCI; -      Mwpawn[sq] = (wpadv*PawnAdvance[sq]) / 10; -      Mbpawn[sq] = (bpadv*PawnAdvance[63-sq]) / 10; -      Mwpawn[sq] += PawnBonus; Mbpawn[sq] += PawnBonus; -      if (castld[white] || kingmoved[white]) -        { -          if ((fyle < 3 || fyle > 4) && distance(sq,wking) < 3) -            Mwpawn[sq] += PAWNSHIELD; -        } -      else if (rank < 3 && (fyle < 2 || fyle > 5)) -        Mwpawn[sq] += PAWNSHIELD / 2; -      if (castld[black] || kingmoved[black]) -        { -          if ((fyle < 3 || fyle > 4) && distance(sq,bking) < 3) -            Mbpawn[sq] += PAWNSHIELD; -        } -      else if (rank > 4 && (fyle < 2 || fyle > 5)) -        Mbpawn[sq] += PAWNSHIELD / 2; -      if (PawnStorm) -        { -          if ((column[wking] < 4 && fyle > 4) || -              (column[wking] > 3 && fyle < 3)) Mwpawn[sq] += 3*rank - 21; -          if ((column[bking] < 4 && fyle > 4) || -              (column[bking] > 3 && fyle < 3)) Mbpawn[sq] -= 3*rank; -        } - -      Mknight[white][sq] += 5 - distance(sq,bking); -      Mknight[white][sq] += 5 - distance(sq,wking); -      Mknight[black][sq] += 5 - distance(sq,wking); -      Mknight[black][sq] += 5 - distance(sq,bking); -      Mbishop[white][sq] += BishopBonus; -      Mbishop[black][sq] += BishopBonus; -      for (i = 0; i <= PieceCnt[black]; i++) -        if (distance(sq,PieceList[black][i]) < 3) -          Mknight[white][sq] += KNIGHTPOST; -      for (i = 0; i <= PieceCnt[white]; i++) -        if (distance(sq,PieceList[white][i]) < 3) -          Mknight[black][sq] += KNIGHTPOST; -      if (wstrong) Mknight[white][sq] += KNIGHTSTRONG; -      if (bstrong) Mknight[black][sq] += KNIGHTSTRONG; -      if (wstrong) Mbishop[white][sq] += BISHOPSTRONG; -      if (bstrong) Mbishop[black][sq] += BISHOPSTRONG; - -      if (HasBishop[white] == 2) Mbishop[white][sq] += 8; -      if (HasBishop[black] == 2) Mbishop[black][sq] += 8; -      if (HasKnight[white] == 2) Mknight[white][sq] += 5; -      if (HasKnight[black] == 2) Mknight[black][sq] += 5; - -      if (board[sq] == bishop) -        if (rank % 2 == fyle % 2) KBNKsq = 0; else KBNKsq = 7; - -      Kfield[white][sq] = Kfield[black][sq] = 0; -      if (distance(sq,wking) == 1) Kfield[black][sq] = KATAK; -      if (distance(sq,bking) == 1) Kfield[white][sq] = KATAK; - -      Pd = 0; -      for (i = 0; i < 64; i++) -        if (board[i] == pawn) -          { -            if (color[i] == white) -              { -                pp = true; -                if (row[i] == 6) z = i+8; else z = i+16; -                for (j = i+8; j < 64; j += 8) -                  if (atak[black][j] > ctlP || board[j] == pawn) pp = false; -              } -            else -              { -                pp = true; -                if (row[i] == 1) z = i-8; else z = i-16; -                for (j = i-8; j >= 0; j -= 8) -                  if (atak[white][j] > ctlP || board[j] == pawn) pp = false; -              } -            if (pp) Pd += 5*taxicab(sq,z); else Pd += taxicab(sq,z); -          } -      if (Pd != 0) -        { -          val = (Pd*stage2) / 10; -          Mking[white][sq] -= val; -          Mking[black][sq] -= val; -        } -    } -} - - -UpdateWeights() - -/* -   If material balance has changed, determine the values for the -   positional evaluation terms. -*/ - -{ -short tmtl; - -  if (mtl[white] != Zwmtl || mtl[black] != Zbmtl) -    { -      Zwmtl = mtl[white]; Zbmtl = mtl[black]; -      emtl[white] = Zwmtl - pmtl[white] - valueK; -      emtl[black] = Zbmtl - pmtl[black] - valueK; -      tmtl = emtl[white] + emtl[black]; -      if (tmtl > 6600) stage = 0; -      else if (tmtl < 1400) stage = 10; -      else stage = (6600-tmtl) / 520; -      if (tmtl > 3600) stage2 = 0; -      else if (tmtl < 1400) stage2 = 10; -      else stage2 = (3600-tmtl) / 220; - -      PEDRNK2B = -15;         /* centre pawn on 2nd rank & blocked */ -      PBLOK = -4;             /* blocked backward pawn */ -      PDOUBLED = -14;         /* doubled pawn */ -      PWEAKH  = -4;           /* weak pawn on half open file */ -      PAWNSHIELD = 10-stage;  /* pawn near friendly king */ -      PADVNCM =  10;          /* advanced pawn multiplier */ -      PADVNCI = 7;            /* muliplier for isolated pawn */ -      PawnBonus = stage; - -      KNIGHTPOST = (stage+2)/3;   /* knight near enemy pieces */ -      KNIGHTSTRONG = (stage+6)/2; /* occupies pawn hole */ - -      BISHOPSTRONG = (stage+6)/2; /* occupies pawn hole */ -      BishopBonus = 2*stage; - -      RHOPN    = 10;          /* rook on half open file */ -      RHOPNX   = 4; -      RookBonus = 6*stage; - -      XRAY     = 8;           /* Xray attack on piece */ -      PINVAL   = 10;          /* Pin */ - -      KHOPN    = (3*stage-30) / 2; /* king on half open file */ -      KHOPNX   = KHOPN / 2; -      KCASTLD  = 10 - stage; -      KMOVD    = -40 / (stage+1);  /* king moved before castling */ -      KATAK    = (10-stage) / 2;   /* B,R attacks near enemy king */ -      if (stage < 8) KSFTY = 16-2*stage; else KSFTY = 0; - -      ATAKD    = -6;          /* defender > attacker */ -      HUNGP    = -8;          /* each hung piece */ -      HUNGX    = -12;         /* extra for >1 hung piece */ -    } -} - -#if (NEWMOVE < 1) -int distance(a,b) -short a,b; -{ -register short d1,d2; - -  d1 = abs(column[a]-column[b]); -  d2 = abs(row[a]-row[b]); -  return(d1 > d2 ? d1 : d2); -} -#endif - -BlendBoard(a,b,c) -short a[64],b[64],c[64]; -{ -register int sq; -  for (sq = 0; sq < 64; sq++) -    c[sq] = (a[sq]*(10-stage) + b[sq]*stage) / 10; -} - - -CopyBoard(a,b) -short a[64],b[64]; -{ -register int sq; -  for (sq = 0; sq < 64; sq++) -    b[sq] = a[sq]; -} diff --git a/gnu/games/chess/gnuchess.h b/gnu/games/chess/gnuchess.h deleted file mode 100644 index ee6442eefd8b..000000000000 --- a/gnu/games/chess/gnuchess.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -  This file contains code for CHESS. -  Copyright (C) 1986, 1987, 1988 Free Software Foundation, Inc. - -  This file is part of CHESS. - -  CHESS is distributed in the hope that it will be useful, -  but WITHOUT ANY WARRANTY.  No author or distributor -  accepts responsibility to anyone for the consequences of using it -  or for whether it serves any particular purpose or works at all, -  unless he says so in writing.  Refer to the CHESS General Public -  License for full details. - -  Everyone is granted permission to copy, modify and redistribute -  CHESS, but only under the conditions described in the -  CHESS General Public License.   A copy of this license is -  supposed to have been given to you along with CHESS so you -  can know your rights and responsibilities.  It should be in a -  file named COPYING.  Among other things, the copyright notice -  and this notice must be preserved on all copies. -*/ - - -/* Header file for GNU CHESS */ - -#define neutral 2 -#define white 0 -#define black 1 -#define no_piece 0 -#define pawn 1 -#define knight 2 -#define bishop 3 -#define rook 4 -#define queen 5 -#define king 6 -#define pxx " PNBRQK" -#define qxx " pnbrqk" -#define rxx "12345678" -#define cxx "abcdefgh" -#define check 0x0001 -#define capture 0x0002 -#define draw 0x0004 -#define promote 0x0008 -#define cstlmask 0x0010 -#define epmask 0x0020 -#define exact 0x0040 -#define pwnthrt 0x0080 -#define maxdepth 30 -#define true 1 -#define false 0 - -struct leaf -  { -    short f,t,score,reply; -    unsigned short flags; -  }; -struct GameRec -  { -    unsigned short gmove; -    short score,depth,time,piece,color; -    long nodes; -  }; -struct TimeControlRec -  { -    short moves[2]; -    long clock[2]; -  }; -struct BookEntry -  { -    struct BookEntry *next; -    unsigned short *mv; -  }; - -extern char mvstr1[5],mvstr2[5]; -extern struct leaf Tree[2000],*root; -extern short TrPnt[maxdepth],board[64],color[64]; -extern short row[64],column[64],locn[8][8]; -extern short atak[2][64],PawnCnt[2][8]; -extern short castld[2],kingmoved[2]; -extern short c1,c2,*atk1,*atk2,*PC1,*PC2; -extern short mate,post,opponent,computer,Sdepth,Awindow,Bwindow,dither; -extern long ResponseTime,ExtraTime,Level,et,et0,time0,cputimer,ft; -extern long NodeCnt,evrate,ETnodes,EvalNodes,HashCnt; -extern short quit,reverse,bothsides,hashflag,InChk,player,force,easy,beep,meter; -extern short timeout,xwndw; -extern struct GameRec GameList[240]; -extern short GameCnt,Game50,epsquare,lpost,rcptr,contempt; -extern short MaxSearchDepth; -extern struct BookEntry *Book; -extern struct TimeControlRec TimeControl; -extern short TCflag,TCmoves,TCminutes,OperatorTime; -extern short otherside[3]; -extern short Stboard[64]; -extern short Stcolor[64]; -extern unsigned short hint,PrVar[maxdepth]; - -#define HZ 60 diff --git a/gnu/games/chess/move.c b/gnu/games/chess/move.c deleted file mode 100644 index b4b0d4267e9c..000000000000 --- a/gnu/games/chess/move.c +++ /dev/null @@ -1,357 +0,0 @@ -/* move generator hes@log-sv.se 890318 -   Modified: 890606 NEWMOVE Levels 1-6 for easier debugging */ -#include "move.h" -#include "gnuchess.h" - -short distdata[64][64]; -short taxidata[64][64]; - -void Initialize_dist() { -register short a,b,d,di; - -  /* init taxi and dist data */ -  for(a=0;a<64;a++) -    for(b=0;b<64;b++) { -      d = abs(column[a]-column[b]); -      di = abs(row[a]-row[b]); -      taxidata[a][b] = d + di; -      distdata[a][b] = (d > di ? d : di); -    }; -} - -#if (NEWMOVE > 1) -struct sqdata posdata[3][8][64][64]; - -static short direc[8][8] = { -    0,  0,  0,  0,  0,  0,  0,  0, /* no_piece = 0 */ -  -10,-11, -9,  0,  0,  0,  0,  0, /* wpawn    = 1 */ -  -21,-19,-12, -8, 21, 19, 12,  8, /* knight   = 2 */ -  -11, -9, 11,  9,  0,  0,  0,  0, /* bishop   = 3 */ -  -10, -1, 10,  1,  0,  0,  0,  0, /* rook     = 4 */ -  -11, -9,-10, -1, 11,  9, 10,  1, /* queen    = 5 */ -  -11, -9,-10, -1, 11,  9, 10,  1, /* king     = 6 */ -    0,  0,  0,  0,  0,  0,  0,  0};/* no_piece = 7 */ - -static short dc[3] = {-1,1,0}; - -static short max_steps [8] = {0,2,1,7,7,7,1,0}; - -static short unmap[120] = { -  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -  -1, 0, 1, 2, 3, 4, 5, 6, 7,-1, -  -1, 8, 9,10,11,12,13,14,15,-1, -  -1,16,17,18,19,20,21,22,23,-1, -  -1,24,25,26,27,28,29,30,31,-1, -  -1,32,33,34,35,36,37,38,39,-1, -  -1,40,41,42,43,44,45,46,47,-1, -  -1,48,49,50,51,52,53,54,55,-1, -  -1,56,57,58,59,60,61,62,63,-1, -  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; - -void Initialize_moves() { -  short c,ptyp,po,p0,d,di,s; -  struct sqdata *p; -  short dest[8][8]; -  short steps[8]; -  short sorted[8]; - -  /* init posdata */ -  for(c=0;c<3;c++) -    for(ptyp=0;ptyp<8;ptyp++) -      for(po=0;po<64;po++) -	for(p0=0;p0<64;p0++) { -	  posdata[c][ptyp][po][p0].nextpos = po; -	  posdata[c][ptyp][po][p0].nextdir = po; -	}; -  /* dest is a function of dir and step */ -  for(c=0;c<2;c++) -    for(ptyp=1;ptyp<7;ptyp++) -      for(po=21;po<99;po++) -	if (unmap[po] >= 0) { -          p = posdata[c][ptyp][unmap[po]]; -	  for(d=0;d<8;d++) { -	    dest[d][0] = unmap[po]; -	    if (dc[c]*direc[ptyp][d] != 0) { -	      p0=po; -	      for(s=0;s<max_steps[ptyp];s++) { -		p0 = p0 + dc[c]*direc[ptyp][d]; -		/* break if (off board) or -		   (pawns move two steps from home square) */ -		if (unmap[p0] < 0 || -		    (ptyp == pawn && s>0 && (d>0 || Stboard[unmap[po]] != ptyp))) -		  break; -		else -		  dest[d][s] = unmap[p0]; -	      } -	    } -	    else s=0; -	    /* sort dest in number of steps order */ -	    steps[d] = s; -	    for(di=d;di>0;di--) -	      if (steps[sorted[di-1]] < s) -		sorted[di] = sorted[di-1]; -	      else -		break; -	    sorted[di] = d; -	  } -	  /* update posdata, pawns have two threads (capture and no capture) */ -	  p0=unmap[po]; -	  if (ptyp == pawn) { -	    for(s=0;s<steps[0];s++) { -	      p[p0].nextpos = dest[0][s]; -	      p0 = dest[0][s]; -	    } -	    p0=unmap[po]; -	    for(d=1;d<3;d++) { -	      p[p0].nextdir = dest[d][0]; -	      p0 = dest[d][0]; -	    } -	  } -	  else { -	    p[p0].nextdir = dest[sorted[0]][0]; -	    for(d=0;d<8;d++) -	      for(s=0;s<steps[sorted[d]];s++) { -		p[p0].nextpos = dest[sorted[d]][s]; -		p0 = dest[sorted[d]][s]; -		if (d < 7) -		  p[p0].nextdir = dest[sorted[d+1]][0]; -		/* else is already initialised */ -	      } -	  } -#ifdef DEBUG -	  printf("Ptyp:%d Position:%d\n{",ptyp,unmap[po]); -	  for(p0=0;p0<63;p0++) printf("%d,",p[p0].nextpos); -	  printf("%d};\n",p[63].nextpos); -	  for(p0=0;p0<63;p0++) printf("%d,",p[p0].nextdir); -	  printf("%d};\n",p[63].nextdir); -#endif DEBUG -	} -} -#endif - - -#if (NEWMOVE > 2) -int SqAtakd(sq,side) -short sq,side; - -/* -  See if any piece with color 'side' ataks sq. First check pawns -  Then Queen, Bishop, Rook and King and last Knight. -*/ - -{ -  register short u; -  register struct sqdata *p; - -  p = posdata[1-side][pawn][sq]; -  u = p[sq].nextdir; /* follow captures thread */ -  while (u != sq) { -    if (board[u] == pawn && color[u] == side) return(true); -    u = p[u].nextdir; -  } -  /* king capture */ -  if (distance(sq,PieceList[side][0]) == 1) return(true); -  /* try a queen bishop capture */ -  p = posdata[side][bishop][sq]; -  u = p[sq].nextpos; -  while (u != sq) { -    if (color[u] == neutral) { -      u = p[u].nextpos; -    } -    else { -      if (color[u] == side && -	  (board[u] == queen || board[u] == bishop)) -	return(true); -      u = p[u].nextdir; -    } -  } -  /* try a queen rook capture */ -  p = posdata[side][rook][sq]; -  u = p[sq].nextpos; -  while (u != sq) { -    if (color[u] == neutral) { -      u = p[u].nextpos; -    } -    else { -      if (color[u] == side && -	  (board[u] == queen || board[u] == rook)) -	return(true); -      u = p[u].nextdir; -    } -  } -  /* try a knight capture */ -  p = posdata[side][knight][sq]; -  u = p[sq].nextpos; -  while (u != sq) { -    if (color[u] == neutral) { -      u = p[u].nextpos; -    } -    else { -      if (color[u] == side && board[u] == knight) return(true); -      u = p[u].nextdir; -    } -  } -  return(false); -} -#endif - -#if (NEWMOVE > 3) -BRscan(sq,s,mob) -short sq,*s,*mob; -/* -   Find Bishop and Rook mobility, XRAY attacks, and pins. Increment the -   hung[] array if a pin is found. -*/ -{ -  register short u,piece,pin; -  register struct sqdata *p; -  short *Kf; - -  Kf = Kfield[c1]; -  *mob = 0; -  piece = board[sq]; -  p = posdata[color[sq]][piece][sq]; -  u = p[sq].nextpos; -  pin = -1; /* start new direction */ -  while (u != sq) { -    *s += Kf[u]; -    if (color[u] == neutral) { -      (*mob)++; -      if (p[u].nextpos == p[u].nextdir) pin = -1; /* oops new direction */ -      u = p[u].nextpos; -    } -    else if (pin < 0) { -      if (board[u] == pawn || board[u] == king) -	u = p[u].nextdir; -      else { -	if (p[u].nextpos != p[u].nextdir) -	  pin = u; /* not on the edge and on to find a pin */ -	u = p[u].nextpos; -      } -    } -    else if (color[u] == c2 && (board[u] > piece || atk2[u] == 0)) -      { -	if (color[pin] == c2) -	  { -	    *s += PINVAL; -	    if (atk2[pin] == 0 || -		atk1[pin] > control[board[pin]]+1) -	      ++hung[c2]; -	  } -	else *s += XRAY; -	pin = -1; /* new direction */ -	u = p[u].nextdir; -      } -    else { -      pin = -1; /* new direction */ -      u = p[u].nextdir; -    } -  } -} -#endif - -#if (NEWMOVE >= 5) -CaptureList(side,xside,ply) -short side,xside,ply; -{ -  register short u,sq; -  register struct sqdata *p; -  short i,piece,*PL; -  struct leaf *node; - -  TrPnt[ply+1] = TrPnt[ply]; -  node = &Tree[TrPnt[ply]]; -  PL = PieceList[side]; -  for (i = 0; i <= PieceCnt[side]; i++) -    { -      sq = PL[i]; -      piece = board[sq]; -      p = posdata[side][piece][sq]; -      if (piece == pawn) { -	u = p[sq].nextdir; /* follow captures thread */ -	while (u != sq) { -	  if (color[u] == xside) { -            node->f = sq; node->t = u; -            node->flags = capture; -            if (u < 8 || u > 55) -              { -                node->flags |= promote; -                node->score = valueQ; -              } -	    else -              node->score = value[board[u]] + svalue[board[u]] - piece; -            ++node; -            ++TrPnt[ply+1]; -           } -	  u = p[u].nextdir; -	} -      } -      else { -	u = p[sq].nextpos; -	while (u != sq) { -          if (color[u] == neutral) -          u = p[u].nextpos; -          else { -          if (color[u] == xside) { -              node->f = sq; node->t = u; -              node->flags = capture; -              node->score = value[board[u]] + svalue[board[u]] - piece; -              ++node; -              ++TrPnt[ply+1]; -             } -	   u = p[u].nextdir; -	 } -       } -     } -   } -} -#endif - -#if (NEWMOVE > 5) -GenMoves(ply,sq,side,xside) -     short ply,sq,side,xside; - -/* -  Generate moves for a piece. The moves are taken from the -  precalulated array posdata. If the board is free, next move -  is choosen from nextpos else from nextdir. -*/ - -{ -  register short u,piece; -  register struct sqdata *p; - -  piece = board[sq]; -  p = posdata[side][piece][sq]; -  if (piece == pawn) { -    u = p[sq].nextdir; /* follow captures thread */ -    while (u != sq) { -      if (color[u] == xside) LinkMove(ply,sq,u,xside); -      u = p[u].nextdir; -    } -    u = p[sq].nextpos; /* and follow no captures thread */ -    while (u != sq) { -      if (color[u] == neutral && (u != sq+16 || color[u-8] == neutral) -          && (u != sq-16 || color[u+8] == neutral)) { -        LinkMove(ply,sq,u,xside); -      } -      u = p[u].nextpos; -    } -  } -  else { -    u = p[sq].nextpos; -    while (u != sq) { -      if (color[u] == neutral) { -        LinkMove(ply,sq,u,xside); -        u = p[u].nextpos; -      } -      else { -        if (color[u] == xside) LinkMove(ply,sq,u,xside); -	u = p[u].nextdir; -      } -    } -  } -} -#endif diff --git a/gnu/games/chess/move.h b/gnu/games/chess/move.h deleted file mode 100644 index 3294e4a6015d..000000000000 --- a/gnu/games/chess/move.h +++ /dev/null @@ -1,81 +0,0 @@ -/* header file for move generator hes 890318 -   Modified: 890510 minor bug fixed in Newataks -             890606 NEWMOVE levels 1-6 */ - -#if (NEWMOVE >= 1) -extern short distdata[64][64]; -extern short taxidata[64][64]; - -#define taxicab(a,b) taxidata[a][b] -#define distance(a,b) distdata[a][b] - -extern void Initialize_dist(); -#endif - -#if (NEWMOVE >= 2) -struct sqdata { -  short nextpos; -  short nextdir; -}; -extern struct sqdata posdata[3][8][64][64]; - -extern void Initialize_moves(); - -#define ataks(side,a)\ -{\ -  register short u,c,sq;\ -  register struct sqdata *p;\ -  short i,piece,*PL;\ -  \ -  for (u = 64; u; a[--u] = 0); \ -  PL = PieceList[side];\ -  for (i = 0; i <= PieceCnt[side]; i++)\ -    {\ -      sq = PL[i];\ -      piece = board[sq];\ -      c = control[piece];\ -      p = posdata[side][piece][sq];\ -      if (piece == pawn) {\ -	u = p[sq].nextdir; /* follow captures thread */\ -	while (u != sq) {\ -	  a[u] = ++a[u] | c;\ -	  u = p[u].nextdir;\ -	}\ -      }\ -      else {\ -	u = p[sq].nextpos;\ -	while (u != sq) {\ -          a[u] = ++a[u] | c;\ -	  if (color[u] == neutral)\ -	    u = p[u].nextpos;\ -	  else\ -	    u = p[u].nextdir;\ -	}\ -      }\ -    }\ -} -#endif - -#if (NEWMOVE >= 3) -extern short PieceList[2][16]; - -extern int Sqatakd(); -#endif - -#if (NEWMOVE > 3) -extern short Kfield[2][64],PINVAL,control[7],hung[2],XRAY; - -extern BRscan(); -#endif - -#if (NEWMOVE > 4) -#define valueQ 1100 - -extern short PieceCnt[2],value[7],svalue[64]; - -extern CaptureList(); -#endif - -#if (NEWMOVE > 5) -extern GenMoves(); -#endif diff --git a/gnu/games/chess/nondsp.c b/gnu/games/chess/nondsp.c deleted file mode 100644 index bec36d3800f9..000000000000 --- a/gnu/games/chess/nondsp.c +++ /dev/null @@ -1,791 +0,0 @@ -/* -  UNIX & MSDOS NON-DISPLAY, AND CHESSTOOL interface for Chess - -  Revision: 4-25-88 - -  Copyright (C) 1986, 1987, 1988 Free Software Foundation, Inc. -  Copyright (c) 1988  John Stanback - -  This file is part of CHESS. - -  CHESS is distributed in the hope that it will be useful, -  but WITHOUT ANY WARRANTY.  No author or distributor -  accepts responsibility to anyone for the consequences of using it -  or for whether it serves any particular purpose or works at all, -  unless he says so in writing.  Refer to the CHESS General Public -  License for full details. - -  Everyone is granted permission to copy, modify and redistribute -  CHESS, but only under the conditions described in the -  CHESS General Public License.   A copy of this license is -  supposed to have been given to you along with CHESS so you -  can know your rights and responsibilities.  It should be in a -  file named COPYING.  Among other things, the copyright notice -  and this notice must be preserved on all copies. -*/ - - -#include <stdio.h> -#include <ctype.h> -#ifdef MSDOS -#include <dos.h> -#include <stdlib.h> -#include <time.h> -#else -#include <sys/param.h> -#include <sys/times.h> -#include <sys/file.h> -struct tms tmbuf1,tmbuf2; -int TerminateSearch(),Die(); -#endif MSDOS - -#include "gnuchess.h" -#ifdef NEWMOVE -#include "move.h" -#endif - -#define printz printf -#define scanz scanf -int mycnt1,mycnt2; - - -Initialize() -{ -  mycnt1 = mycnt2 = 0; -#ifndef MSDOS -#endif -#ifdef CHESSTOOL -  setlinebuf(stdout); -/* -  setvbuf(stdout,NULL,_IOLBF,BUFSIZ); -*/ -  printf("Chess\n"); -  if (Level == 0 && !TCflag) Level = 15; -#endif CHESSTOOL -} - -ExitChess() -{ -  ListGame(); -  exit(0); -} - -#ifndef MSDOS -Die() -{ -char s[80]; -  printz("Abort? "); -  scanz("%s",s); -  if (strcmp(s,"yes") == 0) ExitChess(); -} - -TerminateSearch() -{ -  timeout = true; -  bothsides = false; -} -#endif MSDOS - - -InputCommand() - -/* -   Process the users command. If easy mode is OFF (the computer is -   thinking on opponents time) and the program is out of book, then make -   the 'hint' move on the board and call SelectMove() to find a response. -   The user terminates the search by entering ^C (quit siqnal) before -   entering a command. If the opponent does not make the hint move, then -   set Sdepth to zero. -*/ - -{ -int i; -short ok,tmp; -long cnt,rate,t1,t2; -unsigned short mv; -char s[80]; - -  ok = quit = false; -  player = opponent; -  ft = 0; -  if (hint > 0 && !easy && Book == NULL) -    { -      fflush(stdout); -      time0 = time((long *)0); -      algbr(hint>>8,hint & 0xFF,false); -      strcpy(s,mvstr1); -      tmp = epsquare; -      if (VerifyMove(s,1,&mv)) -        { -          SelectMove(computer,2); -          VerifyMove(mvstr1,2,&mv); -          if (Sdepth > 0) Sdepth--; -        } -      ft = time((long *)0) - time0; -      epsquare = tmp; -    } - -#ifndef MSDOS -#endif -  while (!(ok || quit)) -    { -      PromptForMove(); -      i = scanz("%s",s); -      if (i == EOF || s[0] == 0) ExitChess(); -      player = opponent; -      ok = VerifyMove(s,0,&mv); -      if (ok && mv != hint) -        { -          Sdepth = 0; -          ft = 0; -        } - -      if (strcmp(s,"bd") == 0) -        { -          ClrScreen(); -          UpdateDisplay(0,0,1,0); -        } -      if (strcmp(s,"quit") == 0) quit = true; -      if (strcmp(s,"post") == 0) post = !post; -      if (strcmp(s,"set") == 0) EditBoard(); -      if (strcmp(s,"go") == 0) ok = true; -      if (strcmp(s,"help") == 0) help(); -      if (strcmp(s,"force") == 0) force = !force; -      if (strcmp(s,"book") == 0) Book = NULL; -      if (strcmp(s,"new") == 0) NewGame(); -      if (strcmp(s,"list") == 0) ListGame(); -      if (strcmp(s,"level") == 0) SelectLevel(); -      if (strcmp(s,"hash") == 0) hashflag = !hashflag; -      if (strcmp(s,"beep") == 0) beep = !beep; -      if (strcmp(s,"Awindow") == 0) ChangeAlphaWindow(); -      if (strcmp(s,"Bwindow") == 0) ChangeBetaWindow(); -      if (strcmp(s,"rcptr") == 0) rcptr = !rcptr; -      if (strcmp(s,"hint") == 0) GiveHint(); -      if (strcmp(s,"zero") == 0) ZeroTTable(); -      if (strcmp(s,"both") == 0) -        { -          bothsides = !bothsides; -          Sdepth = 0; -          SelectMove(opponent,1); -          ok = true; -        } -      if (strcmp(s,"reverse") == 0) -        { -          reverse = !reverse; -          ClrScreen(); -          UpdateDisplay(0,0,1,0); -        } -      if (strcmp(s,"switch") == 0) -        { -          computer = otherside[computer]; -          opponent = otherside[opponent]; -          force = false; -          Sdepth = 0; -          ok = true; -        } -      if (strcmp(s,"white") == 0) -        { -          computer = white; opponent = black; -          ok = true; force = false; -          Sdepth = 0; -        } -      if (strcmp(s,"black") == 0) -        { -          computer = black; opponent = white; -          ok = true; force = false; -          Sdepth = 0; -        } -      if (strcmp(s,"undo") == 0 && GameCnt >= 0) Undo(); -      if (strcmp(s,"remove") == 0 && GameCnt >= 1) -        { -          Undo(); Undo(); -        } -      if (strcmp(s,"get") == 0) GetGame(); -      if (strcmp(s,"save") == 0) SaveGame(); -      if (strcmp(s,"depth") == 0) ChangeSearchDepth(); -      if (strcmp(s,"random") == 0) dither = 6; -      if (strcmp(s,"easy") == 0) easy = !easy; -      if (strcmp(s,"contempt") == 0) SetContempt(); -      if (strcmp(s,"xwndw") == 0) ChangeXwindow(); -      if (strcmp(s,"test") == 0) -        { -          t1 = time(0); -          cnt = 0; -          for (i = 0; i < 10000; i++) -            { -              MoveList(opponent,2); -              cnt += TrPnt[3] - TrPnt[2]; -            } -          t2 = time(0); -          rate = cnt / (t2-t1); -          printz("cnt= %ld  rate= %ld\n",cnt,rate); -        } -    } - -  ElapsedTime(1); -  if (force) -    { -      computer = opponent; opponent = otherside[computer]; -    } -#ifndef MSDOS -  (void) times(&tmbuf1); -#ifdef CHESSTOOL -  printf("%d. %s\n",++mycnt2,s); -#endif CHESSTOOL -#endif MSDOS -} - - -help() -{ -  ClrScreen(); -  printz("CHESS command summary\n"); -  printz("g1f3      move from g1 to f3\n"); -  printz("nf3       move knight to f3\n"); -  printz("o-o       castle king side\n"); -  printz("o-o-o     castle queen side\n"); -  printz("set       edit board\n"); -  printz("switch    sides with computer\n"); -  printz("white     computer plays white\n"); -  printz("black     computer plays black\n"); -  printz("reverse   board display\n"); -  printz("both      computer match\n"); -  printz("random    randomize play\n"); -  printz("undo      undo last move\n"); -  printz("time      change level\n"); -  printz("depth     set search depth\n"); -  printz("post      principle variation\n"); -  printz("hint      suggest a move\n"); -  printz("bd        redraw board\n"); -  printz("clock     set time control\n"); -  printz("force     enter game moves\n"); -  printz("list      game to chess.lst\n"); -  printz("save      game to file\n"); -  printz("get       game from file\n"); -  printz("new       start new game\n"); -  printz("quit      exit CHESS\n"); -  printz("Computer: "); -  if (computer == white) printz("WHITE\n"); else printz("BLACK\n"); -  printz("Opponent: "); -  if (opponent == white) printz("WHITE\n"); else printz("BLACK\n"); -  printz("Response time: %ld",Level," sec.\n"); -  printz("Easy mode: "); -  if (easy) printz("ON\n"); else printz("OFF\n"); -  printz("Depth: %d\n",MaxSearchDepth); -  printz("Random: "); -  if (dither) printz("ON\n"); else printz("OFF\n"); -  printz("Transposition table: "); -  if (hashflag) printz("ON\n"); else printz("OFF\n"); -  UpdateDisplay(0,0,1,0); -} - - -EditBoard() - -/* -   Set up a board position. Pieces are entered by typing the piece -   followed by the location. For example, Nf3 will place a knight on -   square f3. -*/ - -{ -short a,r,c,sq; -char s[80]; - -  ClrScreen(); -  UpdateDisplay(0,0,1,0); -  printz(".   exit to main\n"); -  printz("#   clear board\n"); -  printz("enter piece & location: \n"); - -  a = white; -  do -  { -    scanz("%s",s); -    if (s[0] == '#') -      { -        for (sq = 0; sq < 64; sq++) -          { -            board[sq] = no_piece; color[sq] = neutral; -          } -        UpdateDisplay(0,0,1,0); -      } -    if (s[0] == 'c' || s[0] == 'C') a = otherside[a]; -    c = s[1]-'a'; r = s[2]-'1'; -    if ((c >= 0) && (c < 8) && (r >= 0) && (r < 8)) -      { -        sq = locn[r][c]; -        color[sq] = a; -        if (s[0] == 'p') board[sq] = pawn; -        else if (s[0] == 'n') board[sq] = knight; -        else if (s[0] == 'b') board[sq] = bishop; -        else if (s[0] == 'r') board[sq] = rook; -        else if (s[0] == 'q') board[sq] = queen; -        else if (s[0] == 'k') board[sq] = king; -        else { board[sq] = no_piece; color[sq] = neutral; } -      } -  } -  while (s[0] != '.'); -  if (board[4] != king) kingmoved[white] = 10; -  if (board[60] != king) kingmoved[black] = 10; -  GameCnt = -1; Game50 = 0; Sdepth = 0; -  InitializeStats(); -  ClrScreen(); -  UpdateDisplay(0,0,1,0); -} - - -ShowDepth(ch) -char ch; -{ -} - -ShowResults(score,bstline,ch) -short score; -unsigned short bstline[]; -char ch; -{ -#ifndef CHESSTOOL -register int i; -  printz("%2d%c  %5d %4ld %7ld   ",Sdepth,ch,score,et,NodeCnt); -  for (i = 1; bstline[i] > 0; i++) -    { -      algbr((short)(bstline[i] >> 8),(short)(bstline[i] & 0xFF),false); -      if (i == 9 || i == 17) printz("\n                          "); -      printz("%5s ",mvstr1); -    } -  printz("\n"); -#endif -} - - -SearchStartStuff(side) -short side; -{ -#ifndef MSDOS -#endif -#ifndef CHESSTOOL -  printz("\nMove# %d    Target= %ld    Clock: %ld\n", -          TCmoves-TimeControl.moves[side]+1, -          ResponseTime,TimeControl.clock[side]); -#endif -} - - -OutputMove() -{ -#ifdef CHESSTOOL -  printz("%d. ... %s\n",++mycnt1,mvstr1); -  if (root->flags & draw) -    { -      printz("Draw\n"); -      ListGame(); -      exit(0); -    } -  if (root->score == -9999) -    { -      if (opponent == white) printz("White\n"); else printz("Black\n"); -      ListGame(); -      exit(0); -    } -  if (root->score == 9998) -    { -      if (computer == white) printz("White\n"); else printz("Black\n"); -      ListGame(); -      exit(0); -    } -#else -  printz("Nodes= %ld  Eval= %ld  Hash= %ld  Rate= %ld  ", -          NodeCnt,EvalNodes,HashCnt,evrate); -  printz("CPU= %.2ld:%.2ld.%.2ld\n\n", -          cputimer/6000,(cputimer % 6000)/100,cputimer % 100); - -  if (root->flags & epmask) UpdateDisplay(0,0,1,0); -  else UpdateDisplay(root->f,root->t,0,root->flags & cstlmask); -  printz("My move is: %s\n\n",mvstr1); -  if (beep) printz("%c",7); - -  if (root->flags & draw) printz("Draw game!\n"); -  else if (root->score == -9999) printz("opponent mates!\n"); -  else if (root->score == 9998) printz("computer mates!\n"); -  else if (root->score < -9000) printz("opponent will soon mate!\n"); -  else if (root->score > 9000)  printz("computer will soon mate!\n"); -#endif CHESSTOOL -} - - -ElapsedTime(iop) -short iop; - -/* -   Determine the time that has passed since the search was started. If -   the elapsed time exceeds the target (ResponseTime+ExtraTime) then set -   timeout to true which will terminate the search. -*/ - -{ -  et = time((long *)0) - time0; -  if (et < 0) et = 0; -  ETnodes += 50; -  if (et > et0 || iop == 1) -    { -      if (et > ResponseTime+ExtraTime && Sdepth > 1) timeout = true; -      et0 = et; -      if (iop == 1) -        { -          time0 = time((long *)0); et0 = 0; -        } -#ifdef MSDOS -      cputimer = 100*et; -      if (et > 0) evrate = NodeCnt/(et+ft); else evrate = 0; -      if (kbhit() && Sdepth > 1) -        { -          timeout = true; -          bothsides = false; -        } -#else -      (void) times(&tmbuf2); -      cputimer = 100*(tmbuf2.tms_utime - tmbuf1.tms_utime) / HZ; -      if (cputimer > 0) evrate = (100*NodeCnt)/(cputimer+100*ft); -      else evrate = 0; -#endif MSDOS -      ETnodes = NodeCnt + 50; -    } -} - - -SetTimeControl() -{ -  if (TCflag) -    { -      TimeControl.moves[white] = TimeControl.moves[black] = TCmoves; -      TimeControl.clock[white] = TimeControl.clock[black] = 60*(long)TCminutes; -    } -  else -    { -      TimeControl.moves[white] = TimeControl.moves[black] = 0; -      TimeControl.clock[white] = TimeControl.clock[black] = 0; -      Level = 60*(long)TCminutes; -    } -  et = 0; -  ElapsedTime(1); -} - - -ClrScreen() -{ -#ifndef CHESSTOOL -  printz("\n"); -#endif -} - - -UpdateDisplay(f,t,flag,iscastle) -short f,t,flag,iscastle; -{ -#ifndef CHESSTOOL -short r,c,l; -  if (flag) -    { -      printz("\n"); -      for (r = 7; r >= 0; r--) -        { -          for (c = 0; c <= 7; c++) -            { -              if (reverse) l = locn[7-r][7-c]; else l = locn[r][c]; -              if (color[l] == neutral) printz(" -"); -              else if (color[l] == white) printz(" %c",qxx[board[l]]); -              else printz(" %c",pxx[board[l]]); -            } -          printz("\n"); -        } -      printz("\n"); -    } -#endif CHESSTOOL -} - - -GetOpenings() - -/* -   Read in the Opening Book file and parse the algebraic notation for a -   move into an unsigned integer format indicating the from and to -   square. Create a linked list of opening lines of play, with -   entry->next pointing to the next line and entry->move pointing to a -   chunk of memory containing the moves. More Opening lines of up to 256 -   half moves may be added to gnuchess.book. -*/ - -{ -FILE *fd; -int c,i,j,side; -char buffr[2048]; -struct BookEntry *entry; -unsigned short mv,*mp,tmp[100]; - -  if ((fd = fopen("gnuchess.book","r")) != NULL) -    { -/* -      setvbuf(fd,buffr,_IOFBF,2048); -*/ -      Book = NULL; -      i = 0; side = white; -      while ((c = parse(fd,&mv,side)) >= 0) -        if (c == 1) -          { -            tmp[++i] = mv; -            side = otherside[side]; -          } -        else if (c == 0 && i > 0) -          { -            entry = (struct BookEntry *)malloc(sizeof(struct BookEntry)); -            mp = (unsigned short *)malloc((i+1)*sizeof(unsigned short)); -            entry->mv = mp; -            entry->next = Book; -            Book = entry; -            for (j = 1; j <= i; j++) *(mp++) = tmp[j]; -            *mp = 0; -            i = 0; side = white; -          } -      fclose(fd); -    } -} - - -int parse(fd,mv,side) -FILE *fd; -unsigned short *mv; -short side; -{ -int c,i,r1,r2,c1,c2; -char s[100]; -  while ((c = getc(fd)) == ' '); -  i = 0; s[0] = c; -  while (c != ' ' && c != '\n' && c != EOF) s[++i] = c = getc(fd); -  s[++i] = '\0'; -  if (c == EOF) return(-1); -  if (s[0] == '!' || i < 3) -    { -      while (c != '\n' && c != EOF) c = getc(fd); -      return(0); -    } -  if (s[4] == 'o') -    if (side == black) *mv = 0x3C3A; else *mv = 0x0402; -  else if (s[0] == 'o') -    if (side == black) *mv = 0x3C3E; else *mv = 0x0406; -  else -    { -      c1 = s[0] - 'a'; r1 = s[1] - '1'; -      c2 = s[2] - 'a'; r2 = s[3] - '1'; -      *mv = (locn[r1][c1]<<8) + locn[r2][c2]; -    } -  return(1); -} - - -GetGame() -{ -FILE *fd; -char fname[40]; -int c; -short sq; -unsigned short m; - -  printz("Enter file name: "); -  scanz("%s",fname); -  if (fname[0] == '\0') strcpy(fname,"chess.000"); -  if ((fd = fopen(fname,"r")) != NULL) -    { -      fscanf(fd,"%hd%hd%hd",&computer,&opponent,&Game50); -      fscanf(fd,"%hd%hd%hd%hd", -             &castld[white],&castld[black], -             &kingmoved[white],&kingmoved[black]); -      fscanf(fd,"%hd%hd",&TCflag,&OperatorTime); -      fscanf(fd,"%ld%ld%hd%hd", -             &TimeControl.clock[white],&TimeControl.clock[black], -             &TimeControl.moves[white],&TimeControl.moves[black]); -      for (sq = 0; sq < 64; sq++) -        { -          fscanf(fd,"%hd",&m); -          board[sq] = (m >> 8); color[sq] = (m & 0xFF); -          if (color[sq] == 0) color[sq] = neutral; else --color[sq]; -        } -      GameCnt = -1; c = '?'; -      while (c != EOF) -        { -          ++GameCnt; -          c = fscanf(fd,"%hd%hd%hd%ld%hd%hd%hd",&GameList[GameCnt].gmove, -                     &GameList[GameCnt].score,&GameList[GameCnt].depth, -                     &GameList[GameCnt].nodes,&GameList[GameCnt].time, -                     &GameList[GameCnt].piece,&GameList[GameCnt].color); -          if (GameList[GameCnt].color == 0) GameList[GameCnt].color = neutral; -          else --GameList[GameCnt].color; -        } -      GameCnt--; -      if (TimeControl.clock[white] > 0) TCflag = true; -      computer--; opponent--; -    } -  fclose(fd); -  InitializeStats(); -  UpdateDisplay(0,0,1,0); -  Sdepth = 0; -} - - -SaveGame() -{ -FILE *fd; -char fname[40]; -short sq,i,c; - -  printz("Enter file name: "); -  scanz("%s",fname); - -  if (fname[0] == '\0' || access(fname,W_OK) == -1) strcpy(fname,"chess.000"); -  fd = fopen(fname,"w"); -  fprintf(fd,"%d %d %d\n",computer+1,opponent+1,Game50); -  fprintf(fd,"%d %d %d %d\n", -          castld[white],castld[black],kingmoved[white],kingmoved[black]); -  fprintf(fd,"%d %d\n",TCflag,OperatorTime); -  fprintf(fd,"%ld %ld %d %d\n", -          TimeControl.clock[white],TimeControl.clock[black], -          TimeControl.moves[white],TimeControl.moves[black]); -  for (sq = 0; sq < 64; sq++) -    { -      if (color[sq] == neutral) c = 0; else c = color[sq]+1; -      fprintf(fd,"%d\n",256*board[sq] + c); -    } -  for (i = 0; i <= GameCnt; i++) -    { -      if (GameList[i].color == neutral) c = 0; -      else c = GameList[i].color + 1; -      fprintf(fd,"%d %d %d %ld %d %d %d\n", -              GameList[i].gmove,GameList[i].score,GameList[i].depth, -              GameList[i].nodes,GameList[i].time, -              GameList[i].piece,c); -    } -  fclose(fd); -} - - -ListGame() -{ -FILE *fd; -short i,f,t; -  fd = fopen("chess.lst","w"); -  fprintf(fd,"\n"); -  fprintf(fd,"       score  depth  nodes  time         "); -  fprintf(fd,"       score  depth  nodes  time\n"); -  for (i = 0; i <= GameCnt; i++) -    { -      f = GameList[i].gmove>>8; t = (GameList[i].gmove & 0xFF); -      algbr(f,t,false); -      if ((i % 2) == 0) fprintf(fd,"\n"); else fprintf(fd,"         "); -      fprintf(fd,"%5s  %5d     %2d %6ld %5d",mvstr1, -              GameList[i].score,GameList[i].depth, -              GameList[i].nodes,GameList[i].time); -    } -  fprintf(fd,"\n\n"); -  fclose(fd); -} - - -Undo() - -/* -   Undo the most recent half-move. -*/ - -{ -short f,t; -  f = GameList[GameCnt].gmove>>8; -  t = GameList[GameCnt].gmove & 0xFF; -  if (board[t] == king && distance(t,f) > 1) -    castle(GameList[GameCnt].color,f,t,2); -  else -    { -      board[f] = board[t]; color[f] = color[t]; -      board[t] = GameList[GameCnt].piece; -      color[t] = GameList[GameCnt].color; -      if (board[f] == king) --kingmoved[color[f]]; -    } -  if (TCflag) ++TimeControl.moves[color[f]]; -  GameCnt--; mate = false; Sdepth = 0; -  UpdateDisplay(0,0,1,0); -  InitializeStats(); -} - - -ShowMessage(s) -char *s; -{ -#ifndef CHESSTOOL -  printz("%s\n"); -#endif CHESSTOOL -} - -ShowSidetomove() -{ -} - -PromptForMove() -{ -#ifndef CHESSTOOL -  printz("\nYour move is? "); -#endif CHESSTOOL -} - - -ShowCurrentMove(pnt,f,t) -short pnt,f,t; -{ -} - -ChangeAlphaWindow() -{ -  printz("window: "); -  scanz("%hd",&Awindow); -} - -ChangeBetaWindow() -{ -  printz("window: "); -  scanz("%hd",&Bwindow); -} - -GiveHint() -{ -  algbr((short)(hint>>8),(short)(hint & 0xFF),false); -  printz("try %s\n",mvstr1); -} - - -SelectLevel() -{ -  OperatorTime = 30000; -  printz("Enter #moves #minutes: "); -  scanz("%hd %hd",&TCmoves,&TCminutes); -  printz("Operator time= "); -  scanz("%hd",&OperatorTime); -  TCflag = (TCmoves > 1); -  SetTimeControl(); -} - - -ChangeSearchDepth() -{ -  printz("depth= "); -  scanz("%hd",&MaxSearchDepth); -} - -SetContempt() -{ -  printz("contempt= "); -  scanz("%hd",&contempt); -} - -ChangeXwindow() -{ -  printz("xwndw= "); -  scanz("%hd",&xwndw); -} diff --git a/gnu/games/chess/pathnames.h b/gnu/games/chess/pathnames.h deleted file mode 100644 index b70a0f0d417d..000000000000 --- a/gnu/games/chess/pathnames.h +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - *    notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - *    notice, this list of conditions and the following disclaimer in the - *    documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - *    must display the following acknowledgement: - *	This product includes software developed by the University of - *	California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - *    may be used to endorse or promote products derived from this software - *    without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *	@(#)pathnames.h	5.1 (Berkeley) 5/2/90 - */ - -#define	_PATH_CHESSBOOK	"/usr/share/games/gnuchess.book" diff --git a/gnu/games/chess/uxdsp.c b/gnu/games/chess/uxdsp.c deleted file mode 100644 index 84034bc930ca..000000000000 --- a/gnu/games/chess/uxdsp.c +++ /dev/null @@ -1,933 +0,0 @@ -/* -  ALPHA interface for CHESS - -  Revision: 4-25-88 - -  Copyright (C) 1986, 1987, 1988 Free Software Foundation, Inc. -  Copyright (c) 1988  John Stanback - -  This file is part of CHESS. - -  CHESS is distributed in the hope that it will be useful, -  but WITHOUT ANY WARRANTY.  No author or distributor -  accepts responsibility to anyone for the consequences of using it -  or for whether it serves any particular purpose or works at all, -  unless he says so in writing.  Refer to the CHESS General Public -  License for full details. - -  Everyone is granted permission to copy, modify and redistribute -  CHESS, but only under the conditions described in the -  CHESS General Public License.   A copy of this license is -  supposed to have been given to you along with CHESS so you -  can know your rights and responsibilities.  It should be in a -  file named COPYING.  Among other things, the copyright notice -  and this notice must be preserved on all copies. -*/ - - -#include <stdio.h> -#include <ctype.h> -#include <sys/param.h> -#include <sys/times.h> -#include <sys/file.h> -#include <curses.h> -#include <signal.h> -#include "gnuchess.h" -#ifdef NEWMOVE -#include "move.h" -#endif -#include "pathnames.h" - -struct tms tmbuf1,tmbuf2; -void TerminateSearch(),Die(); - -#define scanz fflush(stdout),scanw -#define printz printw - - -Initialize() -{ -  signal(SIGINT,Die); signal(SIGQUIT,Die); -  initscr(); -  crmode(); -} - - -ExitChess() -{ -  nocrmode(); -  endwin(); -  exit(0); -} - - -void -Die() -{ -char s[80]; -  signal(SIGINT,SIG_IGN); -  signal(SIGQUIT,SIG_IGN); -  ShowMessage("Abort? "); -  scanz("%s",s); -  if (strcmp(s,"yes") == 0) ExitChess(); -  signal(SIGINT,Die); signal(SIGQUIT,Die); -} - - -void -TerminateSearch() -{ -  signal(SIGINT,SIG_IGN); -  signal(SIGQUIT,SIG_IGN); -  timeout = true; -  bothsides = false; -  signal(SIGINT,Die); signal(SIGQUIT,Die); -} - - -InputCommand() - -/* -   Process the users command. If easy mode is OFF (the computer is -   thinking on opponents time) and the program is out of book, then make -   the 'hint' move on the board and call SelectMove() to find a response. -   The user terminates the search by entering ^C (quit siqnal) before -   entering a command. If the opponent does not make the hint move, then -   set Sdepth to zero. -*/ - -{ -short ok,i,tmp; -long cnt,rate,t1,t2; -unsigned short mv; -char s[80]; - -  ok = quit = false; -  player = opponent; -  ShowSidetomove(); -  ft = 0; -  if (hint > 0 && !easy && Book == NULL) -    { -      fflush(stdout); -      time0 = time((long *)0); -      algbr(hint>>8,hint & 0xFF,false); -      strcpy(s,mvstr1); -      tmp = epsquare; -      if (VerifyMove(s,1,&mv)) -        { -          PromptForMove(); -          SelectMove(computer,2); -          VerifyMove(mvstr1,2,&mv); -          if (Sdepth > 0) Sdepth--; -        } -      ft = time((time_t *)0) - time0; -      epsquare = tmp; -    } - -  signal(SIGINT,Die); signal(SIGQUIT,Die); -  while (!(ok || quit)) -    { -      PromptForMove(); -      scanz("%s",s); -      player = opponent; -      ok = VerifyMove(s,0,&mv); -      if (ok && mv != hint) -        { -          Sdepth = 0; -          ft = 0; -        } - -      if (strcmp(s,"bd") == 0) -        { -          ClrScreen(); -          UpdateDisplay(0,0,1,0); -        } -      if (strcmp(s,"quit") == 0) quit = true; -      if (strcmp(s,"post") == 0) post = !post; -      if (strcmp(s,"edit") == 0) EditBoard(); -      if (strcmp(s,"go") == 0) ok = true; -      if (strcmp(s,"help") == 0) help(); -      if (strcmp(s,"force") == 0) force = !force; -      if (strcmp(s,"book") == 0) Book = NULL; -      if (strcmp(s,"undo") == 0 && GameCnt >= 0) Undo(); -      if (strcmp(s,"new") == 0) NewGame(); -      if (strcmp(s,"list") == 0) ListGame(); -      if (strcmp(s,"level") == 0) SelectLevel(); -      if (strcmp(s,"hash") == 0) hashflag = !hashflag; -      if (strcmp(s,"beep") == 0) beep = !beep; -      if (strcmp(s,"Awindow") == 0) ChangeAlphaWindow(); -      if (strcmp(s,"Bwindow") == 0) ChangeBetaWindow(); -      if (strcmp(s,"hint") == 0) GiveHint(); -      if (strcmp(s,"both") == 0) -        { -          bothsides = !bothsides; -          Sdepth = 0; -          SelectMove(opponent,1); -          ok = true; -        } -      if (strcmp(s,"reverse") == 0) -        { -          reverse = !reverse; -          ClrScreen(); -          UpdateDisplay(0,0,1,0); -        } -      if (strcmp(s,"switch") == 0) -        { -          computer = otherside[computer]; -          opponent = otherside[opponent]; -          force = false; -          Sdepth = 0; -          ok = true; -        } -      if (strcmp(s,"white") == 0) -        { -          computer = white; opponent = black; -          ok = true; force = false; -          Sdepth = 0; -        } -      if (strcmp(s,"black") == 0) -        { -          computer = black; opponent = white; -          ok = true; force = false; -          Sdepth = 0; -        } -      if (strcmp(s,"remove") == 0 && GameCnt >= 1) -        { -          Undo(); Undo(); -        } -      if (strcmp(s,"get") == 0) GetGame(); -      if (strcmp(s,"save") == 0) SaveGame(); -      if (strcmp(s,"depth") == 0) ChangeSearchDepth(); -      if (strcmp(s,"random") == 0) dither = 6; -      if (strcmp(s,"easy") == 0) easy = !easy; -      if (strcmp(s,"contempt") == 0) SetContempt(); -      if (strcmp(s,"xwndw") == 0) ChangeXwindow(); -      if (strcmp(s,"test") == 0) -        { -          t1 = time(0); -          cnt = 0; -          for (i = 0; i < 10000; i++) -            { -              MoveList(opponent,2); -              cnt += TrPnt[3] - TrPnt[2]; -            } -          t2 = time(0); -          rate = cnt / (t2-t1); -          gotoXY(50,24); -          printz("cnt= %ld  rate= %ld",cnt,rate); -          ClrEoln(); -        } -      if (strcmp(s,"p") == 0) ShowPostnValues(); -      if (strcmp(s,"debug") == 0) DoDebug(); -    } - -  ClearMessage(); -  ElapsedTime(1); -  if (force) -    { -      computer = opponent; opponent = otherside[computer]; -    } -  (void) times(&tmbuf1); -  signal(SIGINT,TerminateSearch); signal(SIGQUIT,TerminateSearch); -} - - -EditBoard() - -/* -   Set up a board position. Pieces are entered by typing the piece -   followed by the location. For example, Nf3 will place a knight on -   square f3. -*/ - -{ -short a,r,c,sq; -char s[80]; - -  ClrScreen(); -  UpdateDisplay(0,0,1,0); -  gotoXY(50,2); printz(".   Exit to main"); -  gotoXY(50,3); printz("#   Clear board"); -  gotoXY(49,5); printz("Enter piece & location: "); -  a = white; -  do -  { -    gotoXY(73,5); ClrEoln(); scanz("%s",s); -    if (s[0] == '#') -      { -        for (sq = 0; sq < 64; sq++) -          { -            board[sq] = no_piece; color[sq] = neutral; -          } -        UpdateDisplay(0,0,1,0); -      } -    if (s[0] == 'c' || s[0] == 'C') a = otherside[a]; -    c = s[1]-'a'; r = s[2]-'1'; -    if ((c >= 0) && (c < 8) && (r >= 0) && (r < 8)) -      { -        sq = locn[r][c]; -        color[sq] = a; -        if (s[0] == 'p') board[sq] = pawn; -        else if (s[0] == 'n') board[sq] = knight; -        else if (s[0] == 'b') board[sq] = bishop; -        else if (s[0] == 'r') board[sq] = rook; -        else if (s[0] == 'q') board[sq] = queen; -        else if (s[0] == 'k') board[sq] = king; -        else { board[sq] = no_piece; color[sq] = neutral; } -        DrawPiece(sq); -      } -  } -  while (s[0] != '.'); -  if (board[4] != king) kingmoved[white] = 10; -  if (board[60] != king) kingmoved[black] = 10; -  GameCnt = -1; Game50 = 0; Sdepth = 0; -  InitializeStats(); -  ClrScreen(); -  UpdateDisplay(0,0,1,0); -} - - -help() -{ -  ClrScreen(); -  gotoXY(28,1); printz("CHESS command summary"); -  gotoXY(1,3); printz("g1f3      move from g1 to f3"); -  gotoXY(1,4); printz("nf3       move knight to f3"); -  gotoXY(1,5); printz("o-o       castle king side"); -  gotoXY(1,6); printz("o-o-o     castle queen side"); -  gotoXY(1,7); printz("edit      edit board"); -  gotoXY(1,8); printz("switch    sides with computer"); -  gotoXY(1,9); printz("white     computer plays white"); -  gotoXY(1,10); printz("black     computer plays black"); -  gotoXY(1,11); printz("reverse   board display"); -  gotoXY(1,12); printz("both      computer match"); -  gotoXY(1,13); printz("random    randomize play"); -  gotoXY(1,14); printz("undo      undo last move"); -  gotoXY(42,3); printz("level     change level"); -  gotoXY(42,4); printz("depth     set search depth"); -  gotoXY(42,5); printz("post      principle variation"); -  gotoXY(42,6); printz("hint      suggest a move"); -  gotoXY(42,7); printz("bd        redraw board"); -  gotoXY(42,8); printz("force     enter game moves"); -  gotoXY(42,9); printz("list      game to chess.lst"); -  gotoXY(42,10); printz("save      game to file"); -  gotoXY(42,11); printz("get       game from file"); -  gotoXY(42,12); printz("new       start new game"); -  gotoXY(42,13); printz("quit      exit CHESS"); -  gotoXY(10,21); printz("Computer: "); -  if (computer == white) printz("WHITE"); else printz("BLACK"); -  gotoXY(10,22); printz("Opponent: "); -  if (opponent == white) printz("WHITE"); else printz("BLACK"); -  gotoXY(10,23); printz("Level: %ld",Level," sec."); -  gotoXY(10,24); printz("Easy mode: "); -  if (easy) printz("ON"); else printz("OFF"); -  gotoXY(40,21); printz("Depth: %d",MaxSearchDepth); -  gotoXY(40,22); printz("Random: "); -  if (dither) printz("ON"); else printz("OFF"); -  gotoXY(40,23); printz("Transposition table: "); -  if (hashflag) printz("ON"); else printz("OFF"); -  refresh(); -  while (getchar() != 27); -  ClrScreen(); -  UpdateDisplay(0,0,1,0); -} - - -ShowDepth(ch) -char ch; -{ -  gotoXY(50,4); printz("Depth= %d%c ",Sdepth,ch); ClrEoln(); -} - - -ShowResults(score,bstline,ch) -short score; -unsigned short bstline[]; -char ch; -{ -short d,e,ply; -  if (post && player == computer) -    { -      e = lpost; -      gotoXY(50,5); printz("Score= %d",score); ClrEoln(); -      d = 8; gotoXY(50,d); ClrEoln(); -      for (ply = 1; bstline[ply] > 0; ply++) -        { -          algbr(bstline[ply] >> 8,bstline[ply] & 0xFF,false); -          if (ply == 5 || ply == 9 || ply == 13 || ply == 17) -            { -              gotoXY(50,++d); ClrEoln(); -            } -          printz("%5s ",mvstr1); -        } -      ClrEoln(); -      lpost = d; -      while (++d <= e) -        { -          gotoXY(50,d); ClrEoln(); -        } -    } -} - - -SearchStartStuff(side) -short side; -{ -short i; -  signal(SIGINT,TerminateSearch); signal(SIGQUIT,TerminateSearch); -  if (player == computer) -    for (i = 5; i < 14; i++) -      { -        gotoXY(50,i); ClrEoln(); -      } -} - - -OutputMove() -{ -  if (root->flags & epmask) UpdateDisplay(0,0,1,0); -  else UpdateDisplay(root->f,root->t,0,root->flags & cstlmask); -  gotoXY(50,17); printz("My move is: %s",mvstr1); -  if (beep) putchar(7); -  ClrEoln(); - -  gotoXY(50,24); -  if (root->flags & draw) printz("Draw game!"); -  else if (root->score == -9999) printz("opponent mates!"); -  else if (root->score == 9998) printz("computer mates!"); -  else if (root->score < -9000) printz("opponent will soon mate!"); -  else if (root->score > 9000)  printz("computer will soon mate!"); -  ClrEoln(); - -  if (post) -    { -      gotoXY(50,22); printz("Nodes=   %6ld",NodeCnt); ClrEoln(); -      gotoXY(50,23); printz("Nodes/Sec= %4ld",evrate); ClrEoln(); -    } -} - - -ElapsedTime(iop) - -/* -   Determine the time that has passed since the search was started. If -   the elapsed time exceeds the target (ResponseTime+ExtraTime) then set -   timeout to true which will terminate the search. -*/ - -short iop; -{ -  et = time((time_t *)0) - time0; -  if (et < 0) et = 0; -  ETnodes += 50; -  if (et > et0 || iop == 1) -    { -      if (et > ResponseTime+ExtraTime && Sdepth > 1) timeout = true; -      et0 = et; -      if (iop == 1) -        { -          time0 = time((time_t *)0); et0 = 0; -        } -      (void) times(&tmbuf2); -      cputimer = 100*(tmbuf2.tms_utime - tmbuf1.tms_utime) / HZ; -      if (cputimer > 0) evrate = (100*NodeCnt)/(cputimer+100*ft); -      else evrate = 0; -      ETnodes = NodeCnt + 50; -      UpdateClocks(); -    } -} - - -UpdateClocks() -{ -short m,s; -  m = et/60; s = (et - 60*m); -  if (TCflag) -    { -      m = (TimeControl.clock[player] - et) / 60; -      s = TimeControl.clock[player] - et - 60*m; -    } -  if (m < 0) m = 0; -  if (s < 0) s = 0; -  if (player == white) -    if (reverse) gotoXY(20,2); else gotoXY(20,23); -  else -    if (reverse) gotoXY(20,23); else gotoXY(20,2); -  printz("%d:%2d   ",m,s); -  if (post) -    { -      gotoXY(50,22); printz("Nodes=   %6ld",NodeCnt); -      gotoXY(50,23); printz("Nodes/Sec= %4ld",evrate); -    } -  refresh(); -} - - - -SetTimeControl() -{ -  if (TCflag) -    { -      TimeControl.moves[white] = TimeControl.moves[black] = TCmoves; -      TimeControl.clock[white] = TimeControl.clock[black] = 60*(long)TCminutes; -    } -  else -    { -      TimeControl.moves[white] = TimeControl.moves[black] = 0; -      TimeControl.clock[white] = TimeControl.clock[black] = 0; -      Level = 60*(long)TCminutes; -    } -  et = 0; -  ElapsedTime(1); -} - - -gotoXY(x,y) -short x,y; -{ -  move(y-1,x-1); -} - - -ClrScreen() -{ -  clear(); refresh(); -} - - -ClrEoln() -{ -  clrtoeol(); refresh(); -} - - -DrawPiece(sq) -short sq; -{ -short r,c; char x; -  if (reverse) r = 7-row[sq]; else r = row[sq]; -  if (reverse) c = 7-column[sq]; else c = column[sq]; -  if (color[sq] == black) x = '*'; else x = ' '; -  gotoXY(5+5*c,5+2*(7-r)); printz("%c%c ",x,pxx[board[sq]]); -} - - -UpdateDisplay(f,t,flag,iscastle) -short f,t,flag,iscastle; -{ -short i,l,z; -  if (flag) -    { -      gotoXY(56,2); printz("CHESS"); -      i = 3; -      gotoXY(3,++i); -      printz("|----|----|----|----|----|----|----|----|"); -      while (i<19) -        { -          gotoXY(1,++i); -          if (reverse) z = (i/2)-1; else z = 10-(i/2); -          printz("%d |    |    |    |    |    |    |    |    |",z); -          gotoXY(3,++i); -          if (i < 19) -            printz("+----+----+----+----+----+----+----+----+"); -        } -      printz("|----|----|----|----|----|----|----|----|"); -      gotoXY(3,21); -      if (reverse) printz("  h    g    f    e    d    c    b    a"); -              else printz("  a    b    c    d    e    f    g    h"); -      if (reverse) gotoXY(5,23); else gotoXY(5,2); -      if (computer == black) printz("Computer"); else printz("Human   "); -      if (reverse) gotoXY(5,2); else gotoXY(5,23); -      if (computer == white) printz("Computer"); else printz("Human   "); -      for (l = 0; l < 64; l++) DrawPiece(l); -    } -  else -    { -      DrawPiece(f); DrawPiece(t); -      if (iscastle) -        if (t > f) -          { DrawPiece(f+3); DrawPiece(t-1); } -        else -          { DrawPiece(f-4); DrawPiece(t+1); } -    } -  refresh(); -} - - -GetOpenings() - -/* -   Read in the Opening Book file and parse the algebraic notation for a -   move into an unsigned integer format indicating the from and to -   square. Create a linked list of opening lines of play, with -   entry->next pointing to the next line and entry->move pointing to a -   chunk of memory containing the moves. More Opening lines of up to 256 -   half moves may be added to gnuchess.book. -*/ - -{ -FILE *fd; -int c,i,j,side; -struct BookEntry *entry; -unsigned short mv,*mp,tmp[100]; - -  if ((fd = fopen(_PATH_CHESSBOOK,"r")) != NULL) -    { -      Book = NULL; -      i = 0; side = white; -      while ((c = parse(fd,&mv,side)) >= 0) -        if (c == 1) -          { -            tmp[++i] = mv; -            side = otherside[side]; -          } -        else if (c == 0 && i > 0) -          { -            entry = (struct BookEntry *)malloc(sizeof(struct BookEntry)); -            mp = (unsigned short *)malloc((i+1)*sizeof(unsigned short)); -            entry->mv = mp; -            entry->next = Book; -            Book = entry; -            for (j = 1; j <= i; j++) *(mp++) = tmp[j]; -            *mp = 0; -            i = 0; side = white; -          } -      fclose(fd); -    } -    else -      { -	fprintf(stderr, "\nchess: can't read %s.\n", _PATH_CHESSBOOK); -	exit(1); -      } -} - - -int parse(fd,mv,side) -FILE *fd; -unsigned short *mv; -short side; -{ -int c,i,r1,r2,c1,c2; -char s[100]; -  while ((c = getc(fd)) == ' '); -  i = 0; s[0] = c; -  while (c != ' ' && c != '\n' && c != EOF) s[++i] = c = getc(fd); -  s[++i] = '\0'; -  if (c == EOF) return(-1); -  if (s[0] == '!' || i < 3) -    { -      while (c != '\n' && c != EOF) c = getc(fd); -      return(0); -    } -  if (s[4] == 'o') -    if (side == black) *mv = 0x3C3A; else *mv = 0x0402; -  else if (s[0] == 'o') -    if (side == black) *mv = 0x3C3E; else *mv = 0x0406; -  else -    { -      c1 = s[0] - 'a'; r1 = s[1] - '1'; -      c2 = s[2] - 'a'; r2 = s[3] - '1'; -      *mv = (locn[r1][c1]<<8) + locn[r2][c2]; -    } -  return(1); -} - - -GetGame() -{ -FILE *fd; -char fname[40]; -int c; -short sq; -unsigned short m; - -  ShowMessage("File name: "); -  scanz("%s",fname); -  if (fname[0] == '\0') strcpy(fname,"chess.000"); -  if ((fd = fopen(fname,"r")) != NULL) -    { -      fscanf(fd,"%hd%hd%hd",&computer,&opponent,&Game50); -      fscanf(fd,"%hd%hd%hd%hd", -             &castld[white],&castld[black], -             &kingmoved[white],&kingmoved[black]); -      fscanf(fd,"%hd%hd",&TCflag,&OperatorTime); -      fscanf(fd,"%ld%ld%hd%hd", -             &TimeControl.clock[white],&TimeControl.clock[black], -             &TimeControl.moves[white],&TimeControl.moves[black]); -      for (sq = 0; sq < 64; sq++) -        { -          fscanf(fd,"%hd",&m); -          board[sq] = (m >> 8); color[sq] = (m & 0xFF); -          if (color[sq] == 0) color[sq] = neutral; else --color[sq]; -        } -      GameCnt = -1; c = '?'; -      while (c != EOF) -        { -          ++GameCnt; -          c = fscanf(fd,"%hd%hd%hd%ld%hd%hd%hd",&GameList[GameCnt].gmove, -                     &GameList[GameCnt].score,&GameList[GameCnt].depth, -                     &GameList[GameCnt].nodes,&GameList[GameCnt].time, -                     &GameList[GameCnt].piece,&GameList[GameCnt].color); -          if (GameList[GameCnt].color == 0) GameList[GameCnt].color = neutral; -          else --GameList[GameCnt].color; -        } -      GameCnt--; -      if (TimeControl.clock[white] > 0) TCflag = true; -      computer--; opponent--; -    } -  fclose(fd); -  InitializeStats(); -  UpdateDisplay(0,0,1,0); -  Sdepth = 0; -} - - -SaveGame() -{ -FILE *fd; -char fname[40]; -short sq,i,c; - -  ShowMessage("File name: "); -  scanz("%s",fname); - -  if (fname[0] == '\0' || access(fname,W_OK) == -1) strcpy(fname,"chess.000"); -  fd = fopen(fname,"w"); -  fprintf(fd,"%d %d %d\n",computer+1,opponent+1,Game50); -  fprintf(fd,"%d %d %d %d\n", -          castld[white],castld[black],kingmoved[white],kingmoved[black]); -  fprintf(fd,"%d %d\n",TCflag,OperatorTime); -  fprintf(fd,"%ld %ld %d %d\n", -          TimeControl.clock[white],TimeControl.clock[black], -          TimeControl.moves[white],TimeControl.moves[black]); -  for (sq = 0; sq < 64; sq++) -    { -      if (color[sq] == neutral) c = 0; else c = color[sq]+1; -      fprintf(fd,"%d\n",256*board[sq] + c); -    } -  for (i = 0; i <= GameCnt; i++) -    { -      if (GameList[i].color == neutral) c = 0; -      else c = GameList[i].color + 1; -      fprintf(fd,"%d %d %d %ld %d %d %d\n", -              GameList[i].gmove,GameList[i].score,GameList[i].depth, -              GameList[i].nodes,GameList[i].time, -              GameList[i].piece,c); -    } -  fclose(fd); -} - - -ListGame() -{ -FILE *fd; -short i,f,t; -  fd = fopen("chess.lst","w"); -  fprintf(fd,"\n"); -  fprintf(fd,"       score  depth  nodes  time         "); -  fprintf(fd,"       score  depth  nodes  time\n"); -  for (i = 0; i <= GameCnt; i++) -    { -      f = GameList[i].gmove>>8; t = (GameList[i].gmove & 0xFF); -      algbr(f,t,false); -      if ((i % 2) == 0) fprintf(fd,"\n"); else fprintf(fd,"         "); -      fprintf(fd,"%5s  %5d     %2d %6ld %5d",mvstr1, -              GameList[i].score,GameList[i].depth, -              GameList[i].nodes,GameList[i].time); -    } -  fprintf(fd,"\n\n"); -  fclose(fd); -} - - -Undo() - -/* -   Undo the most recent half-move. -*/ - -{ -short f,t; -  f = GameList[GameCnt].gmove>>8; -  t = GameList[GameCnt].gmove & 0xFF; -  if (board[t] == king && distance(t,f) > 1) -    castle(GameList[GameCnt].color,f,t,2); -  else -    { -      board[f] = board[t]; color[f] = color[t]; -      board[t] = GameList[GameCnt].piece; -      color[t] = GameList[GameCnt].color; -      if (board[f] == king) --kingmoved[color[f]]; -    } -  if (TCflag) ++TimeControl.moves[color[f]]; -  GameCnt--; mate = false; Sdepth = 0; -  UpdateDisplay(0,0,1,0); -  InitializeStats(); -} - - -ShowMessage(s) -char *s; -{ -  gotoXY(50,24); printz("%s",s); ClrEoln(); -} - -ClearMessage() -{ -  gotoXY(50,24); ClrEoln(); -} - -ShowSidetomove() -{ -  gotoXY(50,14); -  if (player == white) printz("%2d:   WHITE",1+(GameCnt+1)/2); -  else printz("%2d:   BLACK",1+(GameCnt+1)/2); -  ClrEoln(); -} - -PromptForMove() -{ -  gotoXY(50,19); printz("Your move is? "); ClrEoln(); -} - -ShowCurrentMove(pnt,f,t) -short pnt,f,t; -{ -  algbr(f,t,false); -  gotoXY(50,7); printz("(%2d) %4s",pnt,mvstr1); -} - -ChangeAlphaWindow() -{ -  ShowMessage("window: "); -  scanz("%hd",&Awindow); -} - -ChangeBetaWindow() -{ -  ShowMessage("window: "); -  scanz("%hd",&Bwindow); -} - -GiveHint() -{ -char s[40]; -  algbr((short)(hint>>8),(short)(hint & 0xFF),false); -  strcpy(s,"try "); -  strcat(s,mvstr1); -  ShowMessage(s); -} - -ChangeSearchDepth() -{ -  ShowMessage("depth= "); -  scanz("%hd",&MaxSearchDepth); -} - -SetContempt() -{ -  ShowMessage("contempt= "); -  scanz("%hd",&contempt); -} - -ChangeXwindow() -{ -  ShowMessage("xwndw= "); -  scanz("%hd",&xwndw); -} - - -SelectLevel() -{ -  ClrScreen(); -  gotoXY(32,2); printz("CHESS"); -  gotoXY(20,4); printz(" 1.   60 moves in   5 minutes"); -  gotoXY(20,5); printz(" 2.   60 moves in  15 minutes"); -  gotoXY(20,6); printz(" 3.   60 moves in  30 minutes"); -  gotoXY(20,7); printz(" 4.   40 moves in  30 minutes"); -  gotoXY(20,8); printz(" 5.   40 moves in  60 minutes"); -  gotoXY(20,9); printz(" 6.   40 moves in 120 minutes"); -  gotoXY(20,10); printz(" 7.   40 moves in 240 minutes"); -  gotoXY(20,11); printz(" 8.    1 move  in  15 minutes"); -  gotoXY(20,12); printz(" 9.    1 move  in  60 minutes"); -  gotoXY(20,13); printz("10.    1 move  in 600 minutes"); - -  OperatorTime = 0; TCmoves = 60; TCminutes = 5; - -  gotoXY(20,17); printz("Enter Level: "); -  refresh(); -  scanz("%ld",&Level); -  switch (Level) -    { -      case 1 : TCmoves = 60; TCminutes = 5; break; -      case 2 : TCmoves = 60; TCminutes = 15; break; -      case 3 : TCmoves = 60; TCminutes = 30; break; -      case 4 : TCmoves = 40; TCminutes = 30; break; -      case 5 : TCmoves = 40; TCminutes = 60; break; -      case 6 : TCmoves = 40; TCminutes = 120; break; -      case 7 : TCmoves = 40; TCminutes = 240; break; -      case 8 : TCmoves = 1; TCminutes = 15; break; -      case 9 : TCmoves = 1; TCminutes = 60; break; -      case 10 : TCmoves = 1; TCminutes = 600; break; -    } - -  TCflag = (TCmoves > 1); -  SetTimeControl(); -  ClrScreen(); -  UpdateDisplay(0,0,1,0); -} - - -ShowPostnValues() -{ -short i,r,c; -  ExaminePosition(); -  for (i = 0; i < 64; i++) -    { -      if (reverse) r = 7-row[i]; else r = row[i]; -      if (reverse) c = 7-column[i]; else c = column[i]; -      gotoXY(4+5*c,5+2*(7-r)); -      c1 = color[i]; c2 = otherside[c1]; -      PC1 = PawnCnt[c1]; PC2 = PawnCnt[c2]; -      atk1 = atak[c1]; atk2 = atak[c2]; -      if (color[i] == neutral) printz("   "); -      else printz("%3d ",SqValue(i,opponent)); -    } -  ScorePosition(opponent,&i); -  gotoXY(50,24); -  printz("Score= %d",i); ClrEoln(); -} - - -DoDebug() -{ -short k,p,i,r,c,tp,tc; -char s[40]; -  ExaminePosition(); -  ShowMessage("Enter piece: "); -  scanz("%s",s); -  if (s[0] == 'w') k = white; else k = black; -  if (s[1] == 'p') p = pawn; -  else if (s[1] == 'n') p = knight; -  else if (s[1] == 'b') p = bishop; -  else if (s[1] == 'r') p = rook; -  else if (s[1] == 'q') p = queen; -  else if (s[1] == 'k') p = king; -  else p = no_piece; -  for (i = 0; i < 64; i++) -    { -      if (reverse) r = 7-row[i]; else r = row[i]; -      if (reverse) c = 7-column[i]; else c = column[i]; -      gotoXY(4+5*c,5+2*(7-r)); -      tp = board[i]; tc = color[i]; -      board[i] = p; color[i] = k; -      c1 = k; c2 = otherside[c1]; -      PC1 = PawnCnt[c1]; PC2 = PawnCnt[c2]; -      atk1 = atak[c1]; atk2 = atak[c2]; -      printz("%3d ",SqValue(i,opponent)); -      board[i] = tp; color[i] = tc; -    } -  ScorePosition(opponent,&i); -  gotoXY(50,24); -  printz("Score= %d",i); ClrEoln(); -} diff --git a/gnu/include/Makefile b/gnu/include/Makefile index e05dbf801302..aa06524cf445 100644 --- a/gnu/include/Makefile +++ b/gnu/include/Makefile @@ -1,4 +1,4 @@ -#	$Id: Makefile,v 1.19 1994/11/01 09:19:50 pst Exp $ +#	$Id: Makefile,v 1.1 1994/11/08 00:47:02 ache Exp $  #  all depend lint tags: @@ -9,7 +9,7 @@ beforeinstall:  	@${ECHO} installing ${FILES}  	@-for i in ${FILES}; do \  		cmp -s $$i ${DESTDIR}/usr/include/$$i || \ -		    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \ +		    ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \  		    ${DESTDIR}/usr/include/$$i; \  	done diff --git a/gnu/lib/libgmp/Makefile b/gnu/lib/libgmp/Makefile index 11ebb87ce364..d59fc244f5aa 100644 --- a/gnu/lib/libgmp/Makefile +++ b/gnu/lib/libgmp/Makefile @@ -1,5 +1,5 @@  # Makefile for libgmp -# $Id: Makefile,v 1.2 1995/11/25 00:14:03 peter Exp $ +# $Id: Makefile,v 1.3 1995/11/26 09:51:42 bde Exp $  LIB=    gmp  SRCS=	$(GMP_SRCS) @@ -53,10 +53,10 @@ cre-conv-tab: gmp-mparam.h  gmp-mparam.h: cre-mparam  	./cre-mparam > tmp-${.TARGET} -	mv tmp-${.TARGET} ${.TARGET} +	mv -f tmp-${.TARGET} ${.TARGET}  mp_bases.c: cre-conv-tab  	./cre-conv-tab > tmp-${.TARGET} -	mv tmp-${.TARGET} ${.TARGET} +	mv -f tmp-${.TARGET} ${.TARGET}  .include <bsd.lib.mk> diff --git a/gnu/lib/libgmp/tests/Makefile b/gnu/lib/libgmp/tests/Makefile index 3d746685beb3..9d62bf6fe3d0 100644 --- a/gnu/lib/libgmp/tests/Makefile +++ b/gnu/lib/libgmp/tests/Makefile @@ -24,7 +24,7 @@ CC = gcc  TEST_LIBS = -lgmp  OPT = -O -g -CFLAGS = -I${.CURDIR} -I${.CURDIR}/.. -I${.CURDIR}/../obj -I${.CURDIR}/../libgmp/obj $(OPT) +CFLAGS = -I${.CURDIR} -I${.CURDIR}/.. -I${.CURDIR}/../obj -I${.CURDIR}/../libgmp -I${.CURDIR}/../libgmp/obj $(OPT)  TEST_SRCS = tst-mul.c tst-dm.c tst-dm_ui.c tst-mdm.c tst-mdm_ui.c tst-gcd.c \   tst-sqrtrem.c tst-convert.c @@ -56,11 +56,11 @@ tst-convert: tst-convert.o $(TEST_LIBS)  $(TEST_PREFIX)clean:  	rm -f $(TESTS) $(TEST_OBJS) core -tst-convert.o : tst-convert.c ../gmp.h urandom.h  -tst-dm.o : tst-dm.c ../gmp.h urandom.h  -tst-dm_ui.o : tst-dm_ui.c ../gmp.h urandom.h  -tst-gcd.o : tst-gcd.c ../gmp.h urandom.h  -tst-mdm.o : tst-mdm.c ../gmp.h urandom.h  -tst-mdm_ui.o : tst-mdm_ui.c ../gmp.h urandom.h  -tst-mul.o : tst-mul.c ../gmp.h ../gmp-impl.h ../gmp-mparam.h ../longlong.h urandom.h  -tst-sqrtrem.o : tst-sqrtrem.c ../gmp.h urandom.h  +tst-convert.o : tst-convert.c gmp.h urandom.h  +tst-dm.o : tst-dm.c gmp.h urandom.h  +tst-dm_ui.o : tst-dm_ui.c gmp.h urandom.h  +tst-gcd.o : tst-gcd.c gmp.h urandom.h  +tst-mdm.o : tst-mdm.c gmp.h urandom.h  +tst-mdm_ui.o : tst-mdm_ui.c gmp.h urandom.h  +tst-mul.o : tst-mul.c gmp.h gmp-impl.h gmp-mparam.h longlong.h urandom.h  +tst-sqrtrem.o : tst-sqrtrem.c gmp.h urandom.h  diff --git a/gnu/lib/libreadline/Makefile b/gnu/lib/libreadline/Makefile index 37b3e96fadca..437464ab1d4d 100644 --- a/gnu/lib/libreadline/Makefile +++ b/gnu/lib/libreadline/Makefile @@ -1,4 +1,4 @@ -#       $Id: Makefile,v 1.19 1995/02/15 20:59:13 ache Exp $ +#       $Id: Makefile,v 1.20 1995/05/08 08:43:06 ache Exp $  CFLAGS+= -I${.CURDIR} -DVOID_SIGHANDLER -DHAVE_CONFIG_H @@ -20,7 +20,7 @@ beforeinstall:  	cd ${.CURDIR}; \  	for m in ${HEADERS} ; do \  	  cmp -s $$m ${DESTDIR}/usr/include/readline/$$m || \ -	  install -c -o ${BINOWN} -g ${BINGRP} -m 444 \ +	  ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \  		$$m ${DESTDIR}/usr/include/readline ; \  	done diff --git a/gnu/lib/libreadline/complete.c b/gnu/lib/libreadline/complete.c index 2ef001cf8479..f219877a3aa2 100644 --- a/gnu/lib/libreadline/complete.c +++ b/gnu/lib/libreadline/complete.c @@ -334,14 +334,14 @@ print_filename (to_print, full_pathname)        PUTX (*s);      }    return 0; -#else +#else      char *s, c, *new_full_pathname;    int extension_char = 0, slen, tlen;    for (s = to_print; *s; s++)      {        PUTX (*s); -    } +    }      if (rl_filename_completion_desired && rl_visible_stats)      { @@ -468,7 +468,7 @@ rl_complete_internal (what_to_do)  	    }  	} -      if (rl_point == end && found_quote == 0) +      if (rl_point == end && quote_char == '\0')  	{  	  int quoted = 0;  	  /* We didn't find an unclosed quoted substring upon which to do @@ -633,7 +633,16 @@ rl_complete_internal (what_to_do)  	     munge the array, deleting matches as it desires. */  	  if (rl_ignore_some_completions_function &&  	      our_func == (Function *)filename_completion_function) -	    (void)(*rl_ignore_some_completions_function)(matches); +	    { +	      (void)(*rl_ignore_some_completions_function)(matches); +	      if (matches == 0 || matches[0] == 0) +		{ +		  if (matches) +		    free (matches); +		  ding (); +		  return; +		} +	    }  	  /* If we are doing completion on quoted substrings, and any matches  	     contain any of the completer_word_break_characters, then auto- diff --git a/gnu/lib/libreadline/display.c b/gnu/lib/libreadline/display.c index 762b5052f770..daf736ca1cd9 100644 --- a/gnu/lib/libreadline/display.c +++ b/gnu/lib/libreadline/display.c @@ -166,7 +166,7 @@ static int visible_first_line_len = 0;  	\002 (^B) end non-visible characters     all characters except \001 and \002 (following a \001) are copied to     the returned string; all characters except those between \001 and -   \002 are assumed to be `visible'. */ +   \002 are assumed to be `visible'. */	  static char *  expand_prompt (pmt, lp) @@ -187,7 +187,7 @@ expand_prompt (pmt, lp)    l = pmt ? strlen (pmt) : 0;    r = ret = xmalloc (l + 1); - +      for (rl = ignoring = 0, p = pmt; p && *p; p++)      {        /* This code strips the invisible character string markers @@ -377,7 +377,7 @@ rl_redisplay ()  	      out += 4;  	    }  	  else -	    line[out++] = c; +	    line[out++] = c;	    	}  #if defined (DISPLAY_TABS)        else if (c == '\t') @@ -693,7 +693,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)        if (old[0] && new[0])          old[0] = new[0];      } - +          /* Find first difference. */    for (ofd = old, nfd = new;         (ofd - old < omax) && *ofd && (*ofd == *nfd); diff --git a/gnu/lib/libreadline/examples/fileman.c b/gnu/lib/libreadline/examples/fileman.c index 3256bf371e31..3ecb9f184861 100644 --- a/gnu/lib/libreadline/examples/fileman.c +++ b/gnu/lib/libreadline/examples/fileman.c @@ -161,7 +161,7 @@ stripwhite (string)    for (s = string; whitespace (*s); s++)      ; - +        if (*s == 0)      return (s); diff --git a/gnu/lib/libreadline/examples/manexamp.c b/gnu/lib/libreadline/examples/manexamp.c index 051dcbc10a02..3496efa00e76 100644 --- a/gnu/lib/libreadline/examples/manexamp.c +++ b/gnu/lib/libreadline/examples/manexamp.c @@ -56,7 +56,7 @@ invert_case_line (count, key)      }    else      direction = 1; - +          /* Find the end of the range to modify. */    end = start + (count * direction); diff --git a/gnu/lib/libreadline/funmap.c b/gnu/lib/libreadline/funmap.c index c37cf39ea276..9255974c9ce6 100644 --- a/gnu/lib/libreadline/funmap.c +++ b/gnu/lib/libreadline/funmap.c @@ -170,7 +170,7 @@ rl_add_funmap_entry (name, function)      else        funmap =  	(FUNMAP **)xrealloc (funmap, (funmap_size += 80) * sizeof (FUNMAP *)); - +      funmap[funmap_entry] = (FUNMAP *)xmalloc (sizeof (FUNMAP));    funmap[funmap_entry]->name = name;    funmap[funmap_entry]->function = function; diff --git a/gnu/lib/libreadline/history.c b/gnu/lib/libreadline/history.c index a0a25603f419..94c0ad51a3ee 100644 --- a/gnu/lib/libreadline/history.c +++ b/gnu/lib/libreadline/history.c @@ -332,6 +332,8 @@ history_search_internal (string, direction, anchored)    reverse = (direction < 0);    /* Take care of trivial cases first. */ +  if (string == 0 || *string == '\0') +    return (-1);    if (!history_length || ((i == history_length) && !reverse))      return (-1); @@ -862,7 +864,7 @@ history_set_pos (pos)    history_offset = pos;    return (1);  } - +   /* **************************************************************** */  /*								    */ @@ -996,7 +998,7 @@ get_history_event (string, caller_index, delimiting_quote)  	{  	  entry = current_history ();  	  history_offset = history_length; - +	  	  /* If this was a substring search, then remember the  	     string that we matched for word substitution. */  	  if (substring_okay) @@ -1259,7 +1261,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)  	quoted_search_delimiter = string[i - 1];        event = get_history_event (string, &i, quoted_search_delimiter);      } - +	      if (!event)      {        *ret_string = hist_error (string, start, i, EVENT_NOT_FOUND); @@ -1581,7 +1583,7 @@ history_expand (hstring, output)        *output = savestring (hstring);        return (0);      } - +        /* Prepare the buffer for printing error messages. */    result = xmalloc (result_len = 256);    result[0] = '\0'; @@ -1650,7 +1652,7 @@ history_expand (hstring, output)  	    }  #endif /* SHELL */  	} - +	          if (string[i] != history_expansion_char)  	{  	  free (result); @@ -1968,7 +1970,7 @@ history_tokenize_internal (string, wind, indp)  	return (result);        start = i; - +              if (member (string[i], "()\n"))  	{  	  i++; @@ -2149,7 +2151,7 @@ main ()    while (!done)      {        fprintf (stdout, "history%% "); -      t = gets (line); +      t = fgets (line, 1024, stdin);        if (!t)  	strcpy (line, "quit"); diff --git a/gnu/lib/libreadline/history.h b/gnu/lib/libreadline/history.h index d9d41315e9fa..6935efd20d13 100644 --- a/gnu/lib/libreadline/history.h +++ b/gnu/lib/libreadline/history.h @@ -67,7 +67,7 @@ extern HIST_ENTRY **history_list ();  /* Returns the number which says what history element we are now     looking at.  */  extern int where_history (); - +    /* Return the history entry at the current position, as determined by     history_offset.  If there is no entry there, return a NULL pointer. */  HIST_ENTRY *current_history (); diff --git a/gnu/lib/libreadline/posixstat.h b/gnu/lib/libreadline/posixstat.h index ce123f8c3b83..7d1cece35257 100644 --- a/gnu/lib/libreadline/posixstat.h +++ b/gnu/lib/libreadline/posixstat.h @@ -114,7 +114,7 @@  /*   * POSIX 1003.1 5.6.1.2 <sys/stat.h> File Modes   */ - +   #if !defined (S_IRWXU)  #  if !defined (S_IREAD)  #    define S_IREAD	00400 diff --git a/gnu/lib/libreadline/readline.3 b/gnu/lib/libreadline/readline.3 index bbe9d9139542..7f8c2c3820c5 100644 --- a/gnu/lib/libreadline/readline.3 +++ b/gnu/lib/libreadline/readline.3 @@ -22,8 +22,8 @@ readline \- get a line from a user with editing  .LP  .nf  .ft B -#include <readline.h> -#include <history.h> +#include <readline/readline.h> +#include <readline/history.h>  .ft  .fi  .LP diff --git a/gnu/lib/libreadline/readline.c b/gnu/lib/libreadline/readline.c index 577f53661e99..59fbc3274ec8 100644 --- a/gnu/lib/libreadline/readline.c +++ b/gnu/lib/libreadline/readline.c @@ -216,12 +216,12 @@ int _rl_horizontal_scroll_mode = 0;  /* Non-zero means to display an asterisk at the starts of history lines     which have been modified. */ -int _rl_mark_modified_lines = 0; +int _rl_mark_modified_lines = 0;    /* The style of `bell' notification preferred.  This can be set to NO_BELL,     AUDIBLE_BELL, or VISIBLE_BELL. */  int _rl_bell_preference = AUDIBLE_BELL; - +       /* Line buffer and maintenence. */  char *rl_line_buffer = (char *)NULL;  int rl_line_buffer_len = 0; @@ -995,15 +995,15 @@ readline_initialize_everything ()    t = getenv ("LC_CTYPE");    t1 = getenv ("LANG");    if (t && (strstr (t, "8859-1") != NULL || strstr (t, "8859_1") != NULL || -	    strstr (t, "KOI8-R") != NULL || strstr (t, "koi8-r") != NULL) || +	  strstr (t, "KOI8-R") != NULL || strstr (t, "koi8-r") != NULL) ||        t1 && (strstr (t1, "8859-1") != NULL || strstr (t1, "8859_1") != NULL || -	     strstr (t1, "KOI8-R") != NULL || strstr (t1, "koi8-r") != NULL)) +	   strstr (t1, "KOI8-R") != NULL || strstr (t1, "koi8-r") != NULL))      {        _rl_meta_flag = 1;        _rl_convert_meta_chars_to_ascii = 0;        _rl_output_meta_chars = 1;      } - +          /* Read in the init file. */    rl_read_init_file ((char *)NULL); @@ -2110,7 +2110,7 @@ rl_quoted_insert (count, key)    int c;    c = rl_read_key (); -  return (rl_insert (count, c)); +  return (rl_insert (count, c));    }  /* Insert a tab character. */ @@ -2224,7 +2224,7 @@ rl_delete (count, invoking_key)      }    else      return (rl_delete_text (rl_point, rl_point + 1)); - +    }  /* Delete all spaces and tabs around point. */ diff --git a/gnu/lib/libreadline/readline.h b/gnu/lib/libreadline/readline.h index 81328430a5e2..652d8ca80a94 100644 --- a/gnu/lib/libreadline/readline.h +++ b/gnu/lib/libreadline/readline.h @@ -162,7 +162,7 @@ extern char *rl_basic_word_break_characters;  extern char *rl_completer_word_break_characters;  /* List of characters which can be used to quote a substring of the line. -   Completion occurs on the entire substring, and within the substring +   Completion occurs on the entire substring, and within the substring        rl_completer_word_break_characters are treated as any other character,     unless they also appear within this list. */  extern char *rl_completer_quote_characters; diff --git a/gnu/lib/libreadline/tilde.c b/gnu/lib/libreadline/tilde.c index a2693514e5de..736f1e6b413e 100644 --- a/gnu/lib/libreadline/tilde.c +++ b/gnu/lib/libreadline/tilde.c @@ -23,7 +23,7 @@  #  include <string.h>  #else /* !HAVE_STRING_H */  #  include <strings.h> -#endif /* !HAVE_STRING_H */ +#endif /* !HAVE_STRING_H */    #if defined (HAVE_STDLIB_H)  #  include <stdlib.h> @@ -316,7 +316,7 @@ main (argc, argv)        printf ("~expand: ");        fflush (stdout); -      if (!gets (line)) +      if (!fgets(line, 512, stdin))  	strcpy (line, "done");        if ((strcmp (line, "done") == 0) || diff --git a/gnu/lib/libreadline/vi_mode.c b/gnu/lib/libreadline/vi_mode.c index 8ace8922da68..d0b931079c59 100644 --- a/gnu/lib/libreadline/vi_mode.c +++ b/gnu/lib/libreadline/vi_mode.c @@ -174,7 +174,7 @@ rl_vi_redo (count, c)    return (0);  } - +      /* Yank the nth arg from the previous line into this line at point. */  rl_vi_yank_arg (count, key)       int count, key; @@ -886,7 +886,7 @@ rl_vi_delete (count, key)      end = rl_end;    rl_kill_text (rl_point, end); - +      if (rl_point > 0 && rl_point == rl_end)      rl_backward (1);    return (0); diff --git a/gnu/lib/libregex/Makefile b/gnu/lib/libregex/Makefile index b102119c69b5..a88856be998e 100644 --- a/gnu/lib/libregex/Makefile +++ b/gnu/lib/libregex/Makefile @@ -1,4 +1,4 @@ -# $Header: /home/ncvs/src/gnu/lib/libregex/Makefile,v 1.13 1995/03/06 05:51:32 nate Exp $ +# $Header: /home/ncvs/src/gnu/lib/libregex/Makefile,v 1.14 1995/03/12 23:21:29 ache Exp $  LIB=	gnuregex @@ -10,7 +10,7 @@ SUBDIR+= doc  beforeinstall:  	cmp -s ${.CURDIR}/regex.h ${DESTDIR}/usr/include/gnuregex.h || \ -	install -c -o ${BINOWN} -g ${BINGRP} -m 444 \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \  		${.CURDIR}/regex.h ${DESTDIR}/usr/include/gnuregex.h  .include <bsd.lib.mk> diff --git a/gnu/lib/libregex/test/Makefile b/gnu/lib/libregex/test/Makefile index 84ebfcb2211a..977c5d291851 100644 --- a/gnu/lib/libregex/test/Makefile +++ b/gnu/lib/libregex/test/Makefile @@ -1,3 +1,5 @@ +#	$Id$ +  # Generated automatically from Makefile.in by configure.  # Makefile for regex testing.  # @@ -65,7 +67,7 @@ regex: $(regex_o) $(common_o) $(test_o) main.o  dregex.o: ../regex.c ../regex.h  	rm -f $@  	$(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c ../$(srcdir)/regex.c -	mv regex.o $@ +	mv -f regex.o $@  # iregex is the interactive regex.  iregex: $(common_o) $(regex_o) iregex.o diff --git a/gnu/lib/libregex/test/Makefile.in b/gnu/lib/libregex/test/Makefile.in index fea1f10e1753..7b56b32c1ba8 100644 --- a/gnu/lib/libregex/test/Makefile.in +++ b/gnu/lib/libregex/test/Makefile.in @@ -1,3 +1,5 @@ +#	$Id$ +  # Makefile for regex testing.  #  # Copyright (C) 1992 Free Software Foundation, Inc. @@ -64,7 +66,7 @@ regex: $(regex_o) $(common_o) $(test_o) main.o  dregex.o: ../regex.c ../regex.h  	rm -f $@  	$(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c ../$(srcdir)/regex.c -	mv regex.o $@ +	mv -f regex.o $@  # iregex is the interactive regex.  iregex: $(common_o) $(regex_o) iregex.o diff --git a/gnu/libexec/Makefile b/gnu/libexec/Makefile index 61efa8972e15..1744c529be51 100644 --- a/gnu/libexec/Makefile +++ b/gnu/libexec/Makefile @@ -1,5 +1,5 @@ -#	$Id: Makefile,v 1.1 1994/01/30 01:08:18 rgrimes Exp $ +#	$Id: Makefile,v 1.2 1995/01/31 09:29:38 wpaul Exp $ -SUBDIR=	uucp ypxfr +SUBDIR=	uucp  .include <bsd.subdir.mk> diff --git a/gnu/libexec/uucp/contrib/uupoll.shar b/gnu/libexec/uucp/contrib/uupoll.shar index ec9464086b4e..5505ad11d7e5 100644 --- a/gnu/libexec/uucp/contrib/uupoll.shar +++ b/gnu/libexec/uucp/contrib/uupoll.shar @@ -493,10 +493,15 @@ X                  not scan the uucico log.  X  X  #if !defined(lint) -static char rcsid[] = "$Id: uupoll.shar,v 1.2 1995/08/19 21:24:34 ache Exp $"; +static char rcsid[] = "$Id: uupoll.shar,v 1.1.6.1 1995/09/01 06:01:57 davidg Exp $";  #endif /* not lint */  X  /* $Log: uupoll.shar,v $ +# Revision 1.1.6.1  1995/09/01  06:01:57  davidg +# Brought in changes from main branch: updated to UUCP 1.06.1 +# +# Reviewed by:	ache +#  # Revision 1.2  1995/08/19  21:24:34  ache  # Commit delta: current -> 1.06 + FreeBSD configuration  # @@ -1631,8 +1636,13 @@ sed 's/^X//' << 'SHAR_EOF' > 'uupoll/conf.h' &&  #ifndef CONF  X  #define CONF  X -/* $Id: uupoll.shar,v 1.2 1995/08/19 21:24:34 ache Exp $ */ +/* $Id: uupoll.shar,v 1.1.6.1 1995/09/01 06:01:57 davidg Exp $ */  /* $Log: uupoll.shar,v $ +# Revision 1.1.6.1  1995/09/01  06:01:57  davidg +# Brought in changes from main branch: updated to UUCP 1.06.1 +# +# Reviewed by:	ache +#  # Revision 1.2  1995/08/19  21:24:34  ache  # Commit delta: current -> 1.06 + FreeBSD configuration  # @@ -1992,10 +2002,15 @@ X                - No alias expansion is done on the given names.  */  X  #if !defined(lint) -static char rcsid[] = "$Id: uupoll.shar,v 1.2 1995/08/19 21:24:34 ache Exp $"; +static char rcsid[] = "$Id: uupoll.shar,v 1.1.6.1 1995/09/01 06:01:57 davidg Exp $";  #endif /* not lint */  X  /* $Log: uupoll.shar,v $ +# Revision 1.1.6.1  1995/09/01  06:01:57  davidg +# Brought in changes from main branch: updated to UUCP 1.06.1 +# +# Reviewed by:	ache +#  # Revision 1.2  1995/08/19  21:24:34  ache  # Commit delta: current -> 1.06 + FreeBSD configuration  # diff --git a/gnu/libexec/uucp/contrib/uurate.c b/gnu/libexec/uucp/contrib/uurate.c index e3b3ece91f28..3a57c20bc30a 100644 --- a/gnu/libexec/uucp/contrib/uurate.c +++ b/gnu/libexec/uucp/contrib/uurate.c @@ -84,6 +84,11 @@   *        get knowledge of   */  /* $Log: uurate.c,v $ + * Revision 1.3.4.1  1995/09/01  06:01:59  davidg + * Brought in changes from main branch: updated to UUCP 1.06.1 + * + * Reviewed by:	ache + *   * Revision 1.4  1995/08/19  21:24:38  ache   * Commit delta: current -> 1.06 + FreeBSD configuration   * @@ -142,7 +147,7 @@   * */  char version[] = "@(#) Taylor UUCP Log File Summary Filter, Version 1.2.2"; -static char rcsid[] = "$Id: uurate.c,v 1.4 1995/08/19 21:24:38 ache Exp $"; +static char rcsid[] = "$Id: uurate.c,v 1.3.4.1 1995/09/01 06:01:59 davidg Exp $";  #include <ctype.h>            /* Character Classification      */  #include <math.h>  #include "uucp.h" diff --git a/gnu/libexec/uucp/cu/Makefile b/gnu/libexec/uucp/cu/Makefile index 393b2a327361..de8599ca7d32 100644 --- a/gnu/libexec/uucp/cu/Makefile +++ b/gnu/libexec/uucp/cu/Makefile @@ -1,9 +1,10 @@  # Makefile for cu -# $Id: Makefile,v 1.4 1995/08/19 21:24:49 ache Exp $ +# $Id: Makefile,v 1.3.6.1 1995/09/01 06:02:08 davidg Exp $  BINDIR=		$(bindir)  BINOWN=		$(owner) -BINMODE=        4555 +BINGRP=         dialer +BINMODE=        6555  PROG=		cu  SRCS=           cu.c prot.c log.c chat.c conn.c copy.c diff --git a/gnu/libexec/uucp/uucico/Makefile b/gnu/libexec/uucp/uucico/Makefile index ac67f23dae34..82349dc27b7d 100644 --- a/gnu/libexec/uucp/uucico/Makefile +++ b/gnu/libexec/uucp/uucico/Makefile @@ -1,9 +1,10 @@  # Makefile for uucico -# $Id: Makefile,v 1.8 1995/08/19 21:29:34 ache Exp $ +# $Id: Makefile,v 1.7.4.1 1995/09/01 06:05:10 davidg Exp $  BINDIR=         $(libxdir)  BINOWN=		$(owner) -BINMODE=        4555 +BINGRP=         dialer +BINMODE=        6555  PROG=		uucico  SRCS=		uucico.c trans.c send.c rec.c xcmd.c prot.c protg.c protf.c \ diff --git a/gnu/libexec/uucp/uustat/Makefile b/gnu/libexec/uucp/uustat/Makefile index 7451292ceaa4..f45e6a108403 100644 --- a/gnu/libexec/uucp/uustat/Makefile +++ b/gnu/libexec/uucp/uustat/Makefile @@ -1,9 +1,10 @@  # Makefile for uustat -# $Id: Makefile,v 1.2 1993/08/05 16:15:22 jtc Exp $ +# $Id: Makefile,v 1.1 1993/08/05 18:28:01 conklin Exp $  BINDIR=		$(bindir)  BINOWN=		$(owner) -BINMODE=	4555 +BINGRP=         dialer +BINMODE=        6555  PROG=		uustat  SRCS=		uustat.c util.c log.c copy.c diff --git a/gnu/libexec/uucp/uustat/uustat.1 b/gnu/libexec/uucp/uustat/uustat.1 index 3524edd35af2..f3e2cbaaa879 100644 --- a/gnu/libexec/uucp/uustat/uustat.1 +++ b/gnu/libexec/uucp/uustat/uustat.1 @@ -1,4 +1,4 @@ -''' $Id: uustat.1,v 1.5 1995/08/19 21:30:18 ache Exp $ +''' $Id: uustat.1,v 1.4.4.1 1995/09/01 06:05:42 davidg Exp $  .TH uustat 1 "Taylor UUCP 1.06"  .SH NAME  uustat \- UUCP status inquiry and control @@ -545,7 +545,7 @@ configuration file, so these are only approximations.  /var/spool/uucp -  UUCP spool directory.  .SH SEE ALSO -ps(1), rmail(1), uucp(1), uux(1), uucico(8), uuxqt(8) +ps(1), rmail(8), uucp(1), uux(1), uucico(8), uuxqt(8)  .SH AUTHOR  Ian Lance Taylor  (ian@airs.com) diff --git a/gnu/usr.bin/Makefile b/gnu/usr.bin/Makefile index 55e804730b6b..da9e62d3696b 100644 --- a/gnu/usr.bin/Makefile +++ b/gnu/usr.bin/Makefile @@ -1,7 +1,7 @@ -#	$Id: Makefile,v 1.26 1995/03/31 08:00:06 nate Exp $ +#	$Id: Makefile,v 1.27 1995/04/11 17:28:26 nate Exp $  SUBDIR= as awk bc cc cpio cvs dc dialog diff diff3 gdb \  	grep groff gzip ld man mkisofs patch perl ptx rcs sdiff send-pr \ -	sort tar texinfo yppush +	sort tar texinfo  .include <bsd.subdir.mk> diff --git a/gnu/usr.bin/as/Makefile b/gnu/usr.bin/as/Makefile index c8d73c3af44e..50e4ac8cad08 100644 --- a/gnu/usr.bin/as/Makefile +++ b/gnu/usr.bin/as/Makefile @@ -1,5 +1,5 @@  #	from: @(#)Makefile	6.1 (Berkeley) 3/3/91 -#	$Id: Makefile,v 1.7 1995/01/16 17:40:57 ache Exp $ +#	$Id: Makefile,v 1.8 1995/05/30 04:45:55 rgrimes Exp $  .include "config/Makefile.$(MACHINE)" @@ -27,8 +27,6 @@ SRCS+=		app.c as.c atof-generic.c bignum-copy.c \  CFLAGS+=	-I$(.CURDIR) ${ADDINCLUDE} -I$(.CURDIR)/config \  		-DOLD_GAS -DSIGTY=void -Derror=as_fatal \  		-DSUB_SEGMENT_ALIGN=4 -DFREEBSD_AOUT -DPADD+=		${LIBGNUMALLOC} -LDADD+=		-lgnumalloc  CONF_HEADERS=	targ-cpu.h obj-format.h host.h targ-env.h diff --git a/gnu/usr.bin/as/Makefile.in b/gnu/usr.bin/as/Makefile.in index 9e7645856d4b..b91bb3322bbf 100644 --- a/gnu/usr.bin/as/Makefile.in +++ b/gnu/usr.bin/as/Makefile.in @@ -1,3 +1,5 @@ +#	$Id$ +  # Makefile for GNU Assembler  #   Copyright (C) 1987-1992 Free Software Foundation, Inc. @@ -306,7 +308,7 @@ targ-cpu.o : targ-cpu.c targ-env.h obj-format.h \  doc: $(srcdir)/as.info  $(srcdir)/as.info: $(srcdir)/doc/as.texinfo -	(cd doc; make as.info; mv as.info $srcdir) +	(cd doc; make as.info; mv -f as.info $srcdir)  clean:  	(cd doc ; $(MAKE) clean) @@ -369,17 +371,17 @@ bootstrap3: force  # Copy the object files from a particular stage into a subdirectory.  stage1: force  	-mkdir stage1 -	-mv $(STAGESTUFF) stage1 +	-mv -f $(STAGESTUFF) stage1  	if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi  stage2: force  	-mkdir stage2 -	-mv $(STAGESTUFF) stage2 +	-mv -f $(STAGESTUFF) stage2  	if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi  stage3: force  	-mkdir stage3 -	-mv $(STAGESTUFF) stage3 +	-mv -f $(STAGESTUFF) stage3  	if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi  against=stage2 @@ -388,15 +390,15 @@ comparison: force  	for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done  de-stage1: force -	- (cd stage1 ; rm as ; mv -f * ..) +	- (cd stage1 ; rm -f as ; mv -f * ..)  	- rmdir stage1  de-stage2: force -	- (cd stage2 ; rm as ; mv -f * ..) +	- (cd stage2 ; rm -f as ; mv -f * ..)  	- rmdir stage2  de-stage3: force -	- (cd stage3 ; rm as ; mv -f * ..) +	- (cd stage3 ; rm -f as ; mv -f * ..)  	- rmdir stage3  #In GNU Make, ignore whether `stage*' exists. diff --git a/gnu/usr.bin/as/as.1 b/gnu/usr.bin/as/as.1 index 57e2dc1f9b9e..66f7ee5004b0 100644 --- a/gnu/usr.bin/as/as.1 +++ b/gnu/usr.bin/as/as.1 @@ -3,7 +3,7 @@  .TH as 1 "21 January 1992" "cygnus support" "GNU Development Tools"  .SH NAME -GNU as \- the portable GNU assembler. +as \- the portable GNU assembler.  .SH SYNOPSIS  .na diff --git a/gnu/usr.bin/as/hash.c b/gnu/usr.bin/as/hash.c index b9cc1bcdd512..70068ea81ab9 100644 --- a/gnu/usr.bin/as/hash.c +++ b/gnu/usr.bin/as/hash.c @@ -123,7 +123,7 @@   */  #ifndef lint -static char rcsid[] = "$Id: hash.c,v 1.2 1993/11/03 00:51:44 paul Exp $"; +static char rcsid[] = "$Id: hash.c,v 1.3 1995/05/30 04:46:18 rgrimes Exp $";  #endif  #include <stdio.h> @@ -837,7 +837,7 @@ main()  	for (;;)  	    {  		    printf("hash_test command: "); -		    gets(answer); +		    fgets(answer, 100, stdin);  		    command = answer[0];  		    if (isupper(command)) command = tolower(command);	/* ecch! */  		    switch (command) @@ -929,7 +929,7 @@ char * description;  	char * malloc();  	printf("   %s : ",description); -	gets(answer); +	fgets(answer, 100, stdin);  	/* will one day clean up answer here */  	retval = malloc(strlen(answer)+1);  	if (!retval) @@ -967,7 +967,7 @@ whattable()			/* determine number: what hash table to use */  	for (;;)  	    {  		    printf("   what hash table (%d:%d) ?  ",0,TABLES-1); -		    gets(answer); +		    fgets(answer, 100, stdin);  		    sscanf(answer,"%d",&number);  		    if (number >= 0 && number<TABLES)  			{ diff --git a/gnu/usr.bin/awk/Makefile b/gnu/usr.bin/awk/Makefile index 690eacf1c286..1fa87cc9c8ce 100644 --- a/gnu/usr.bin/awk/Makefile +++ b/gnu/usr.bin/awk/Makefile @@ -11,4 +11,3 @@ DPADD+= ${LIBGNUREGEX} ${LIBM}  LDADD+= -lgnuregex -lm  .include <bsd.prog.mk> -#.include "../../usr.bin/Makefile.inc" diff --git a/gnu/usr.bin/awk/awk.1 b/gnu/usr.bin/awk/awk.1 index a98c99d1608b..1b58bec9acbe 100644 --- a/gnu/usr.bin/awk/awk.1 +++ b/gnu/usr.bin/awk/awk.1 @@ -1,11 +1,11 @@  .ds PX \s-1POSIX\s+1  .ds UX \s-1UNIX\s+1  .ds AN \s-1ANSI\s+1 -.TH GAWK 1 "Apr 18 1994" "Free Software Foundation" "Utility Commands" +.TH AWK 1 "Apr 18 1994" "Free Software Foundation" "Utility Commands"  .SH NAME -gawk \- pattern scanning and processing language +awk \- GNU awk pattern scanning and processing language  .SH SYNOPSIS -.B gawk +.B awk  [ POSIX or GNU style options ]  .B \-f  .I program-file @@ -13,7 +13,7 @@ gawk \- pattern scanning and processing language  .B \-\^\-  ] file .\^.\^.  .br -.B gawk +.B awk  [ POSIX or GNU style options ]  [  .B \-\^\- @@ -35,7 +35,7 @@ of \*(UX  also provides some GNU-specific extensions.  .PP  The command line consists of options to -.I gawk +.I awk  itself, the AWK program text (if not supplied via the  .B \-f  or @@ -57,7 +57,7 @@ for \*(PX mandated features.  Other implementations of the AWK language  are likely to only accept the traditional one letter options.  .PP  Following the \*(PX standard, -.IR gawk -specific +.IR awk -specific  options are supplied via arguments to the  .B \-W  option.  Multiple @@ -135,9 +135,9 @@ flag sets the maximum record size.  These two flags and the  option are from the AT&T Bell Labs research version of \*(UX  .IR awk .  They are ignored by -.IR gawk , +.IR awk ,  since -.I gawk +.I awk  has no pre-defined limits.  .TP \w'\fB\-\^\-copyright\fR'u+1n  .PD 0 @@ -148,7 +148,7 @@ has no pre-defined limits.  Run in  .I compatibility  mode.  In compatibility mode, -.I gawk +.I awk  behaves identically to \*(UX  .IR awk ;  none of the GNU-specific extensions are recognized. @@ -268,10 +268,10 @@ will be recognized in the same argument.  .PD  .B \-\^\-version  Print version information for this particular copy of -.I gawk +.I awk  on the error output.  This is useful mainly for knowing if the current copy of -.I gawk +.I awk  on your system  is up to date with respect to whatever the Free Software Foundation  is distributing. @@ -341,10 +341,10 @@ all variable assignments specified via the  .B \-v  option are performed.  Next, -.I gawk +.I awk  compiles the program into an internal form.  Then, -.I gawk +.I awk  executes the code in the  .B BEGIN  block(s) (if any), @@ -353,7 +353,7 @@ each file named in the  .B ARGV  array.  If there are no files named on the command line, -.I gawk +.I awk  reads the standard input.  .PP  If a filename on the command line has the form @@ -374,11 +374,11 @@ a single data file.  If the value of a particular element of  .B ARGV  is empty (\fB""\fR), -.I gawk +.I awk  skips over it.  .PP  For each line in the input, -.I gawk +.I awk  tests to see if it matches any  .I pattern  in the AWK program. @@ -388,7 +388,7 @@ is executed.  The patterns are tested in the order they occur in the program.  .PP  Finally, after all the input is exhausted, -.I gawk +.I awk  executes the code in the  .B END  block(s) (if any). @@ -403,7 +403,7 @@ runs; these will be described as needed and summarized below.  .SS Fields  .PP  As each input line is read, -.I gawk +.I awk  splits the line into  .IR fields ,  using the value of the @@ -429,7 +429,7 @@ If the  .B FIELDWIDTHS  variable is set to a space separated list of numbers, each field is  expected to have fixed width, and -.I gawk +.I awk  will split up the record using the specified widths.  The value of  .B FS  is ignored. @@ -480,7 +480,7 @@ AWK's built-in variables are:  .TP \w'\fBFIELDWIDTHS\fR'u+1n  .B ARGC  The number of command line arguments (does not include options to -.IR gawk , +.IR awk ,  or the program source).  .TP  .B ARGIND @@ -506,12 +506,12 @@ The array is indexed by the environment variables, each element being  the value of that variable (e.g., \fBENVIRON["HOME"]\fP might be  .BR /u/arnold ).  Changing this array does not affect the environment seen by programs which -.I gawk +.I awk  spawns via redirection or the  .B system()  function.  (This may change in a future version of -.IR gawk .) +.IR awk .)  .\" but don't hold your breath...  .TP  .B ERRNO @@ -528,14 +528,14 @@ a string describing the error.  .TP  .B FIELDWIDTHS  A white-space separated list of fieldwidths.  When set, -.I gawk +.I awk  parses the input into fields of fixed width, instead of using the  value of the  .B FS  variable as the field separator.  The fixed field width facility is still experimental; expect the  semantics to change as -.I gawk +.I awk  evolves over time.  .TP  .B FILENAME @@ -605,7 +605,7 @@ The input record separator, by default a newline.  is exceptional in that only the first character of its string  value is used for separating records.  (This will probably change in a future release of -.IR gawk .) +.IR awk .)  If  .B RS  is set to the null string, then records are separated by @@ -739,7 +739,7 @@ Two strings are compared, of course, as strings.  According to the \*(PX standard, even if two strings are  numeric strings, a numeric comparison is performed.  However, this is  clearly incorrect, and -.I gawk +.I awk  does not do this.  .PP  Uninitialized variables have the numeric value 0 and the string value "" @@ -1246,13 +1246,13 @@ into a file,  or via  .B getline  from a file, -.I gawk +.I awk  recognizes certain special filenames internally.  These filenames  allow access to open file descriptors inherited from -.IR gawk 's +.IR awk 's  parent process (usually the shell).  Other special filenames provide access information about the running -.B gawk +.B awk  process.  The filenames are:  .TP \w'\fB/dev/stdout\fR'u+1n @@ -1468,7 +1468,7 @@ Non-alphabetic characters are left unchanged.  .PP  Since one of the primary uses of AWK programs is processing log files  that contain time stamp information, -.I gawk +.I awk  provides the following two functions for obtaining time stamps and  formatting them.  .PP @@ -1496,11 +1496,11 @@ guaranteed to be available.  A public-domain version of  .IR strftime (3)  and a man page for it are shipped with -.IR gawk ; +.IR awk ;  if that version was used to build -.IR gawk , +.IR awk ,  then all of the conversions described in that man page are available to -.IR gawk. +.IR awk.  .SS String Constants  .PP  String constants in AWK are sequences of characters enclosed @@ -1643,12 +1643,12 @@ Addison-Wesley, 1988. ISBN 0-201-07981-X.  Edition 0.15, published by the Free Software Foundation, 1993.  .SH POSIX COMPATIBILITY  A primary goal for -.I gawk +.I awk  is compatibility with the \*(PX standard, as well as with the  latest version of \*(UX  .IR awk .  To this end, -.I gawk +.I awk  incorporates the following user visible  features which are not described in the AWK book,  but are part of @@ -1679,7 +1679,7 @@ The  option for implementation specific features is from the \*(PX standard.  .PP  When processing arguments, -.I gawk +.I awk  uses the special option ``\fB\-\^\-\fP'' to signal the end of  arguments.  In compatibility mode, it will warn about, but otherwise ignore, @@ -1696,7 +1696,7 @@ has it return the seed it was using, to allow keeping track  of random number sequences. Therefore  .B srand()  in -.I gawk +.I awk  also returns its current seed.  .PP  Other new features are: @@ -1711,7 +1711,7 @@ array; the  and  .BR \ev  escape sequences (done originally in -.I gawk +.I awk  and fed back into AT&T's); the  .B tolower()  and @@ -1726,13 +1726,13 @@ has some extensions to \*(PX  They are described in this section.  All the extensions described here  can be disabled by  invoking -.I gawk +.I awk  with the  .B "\-W compat"  option.  .PP  The following features of -.I gawk +.I awk  are not available in  \*(PX  .IR awk . @@ -1800,7 +1800,7 @@ or  when closing a file or pipe, respectively.  .PP  When -.I gawk +.I awk  is invoked with the  .B "\-W compat"  option, @@ -1818,7 +1818,7 @@ has been specified.  .ig  .PP  If -.I gawk +.I awk  was compiled for debugging, it will  accept the following additional options:  .TP @@ -1833,13 +1833,13 @@ or  .IR bison (1)  debugging output during program parsing.  This option should only be of interest to the -.I gawk +.I awk  maintainers, and may not even be compiled into -.IR gawk . +.IR awk .  ..  .SH HISTORICAL FEATURES  There are two features of historical AWK implementations that -.I gawk +.I awk  supports.  First, it is possible to call the  .B length() @@ -1863,7 +1863,7 @@ a = length($0)  .RE  .PP  This feature is marked as ``deprecated'' in the \*(PX standard, and -.I gawk +.I awk  will issue a warning about its use if  .B "\-W lint"  is specified on the command line. @@ -1887,14 +1887,14 @@ has not been specified.  If  .B POSIXLY_CORRECT  exists in the environment, then -.I gawk +.I awk  behaves exactly as if  .B \-\-posix  had been specified on the command line.  If  .B \-\-lint  has been specified, -.I gawk +.I awk  will issue a warning message to this effect.  .SH BUGS  The @@ -1910,9 +1910,9 @@ and the associated  and  .B /dev/stderr  files, you may get different output from -.I gawk +.I awk  than you would get on a system without those files.  When -.I gawk +.I awk  interprets these files internally, it synchronizes output to the standard  output with output to  .BR /dev/stdout , @@ -1921,11 +1921,11 @@ open files.  Caveat Emptor.  .SH VERSION INFORMATION  This man page documents -.IR gawk , +.IR awk ,  version 2.15.  .PP  Starting with the 2.15 version of -.IR gawk , +.IR awk ,  the  .BR \-c ,  .BR \-V , diff --git a/gnu/usr.bin/awk/main.c b/gnu/usr.bin/awk/main.c index ff9426e501fb..1f483bcd6bc5 100644 --- a/gnu/usr.bin/awk/main.c +++ b/gnu/usr.bin/awk/main.c @@ -23,6 +23,9 @@   * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.   */ +#ifdef __FreeBSD__ +#include <locale.h> +#endif  #include "getopt.h"  #include "awk.h"  #include "patchlevel.h" @@ -142,6 +145,9 @@ char **argv;  	extern int opterr;  	extern char *optarg; +#ifdef __FreeBSD__ +	(void) setlocale(LC_CTYPE, ""); +#endif  #ifdef __EMX__  	_response(&argc, &argv);  	_wildcard(&argc, &argv); diff --git a/gnu/usr.bin/cc/cc/Makefile b/gnu/usr.bin/cc/cc/Makefile index ce9e1fe60fca..6ac463f8cbc7 100644 --- a/gnu/usr.bin/cc/cc/Makefile +++ b/gnu/usr.bin/cc/cc/Makefile @@ -1,5 +1,5 @@  # -# $Id: Makefile,v 1.7 1994/11/15 04:51:27 phk Exp $ +# $Id: Makefile,v 1.8 1994/12/26 19:15:19 ats Exp $  #  PROG =	cc @@ -8,6 +8,6 @@ BINDIR=	/usr/bin  .PATH: ${.CURDIR}/../cc_int  SRCS+=	obstack.c version.c  LINKS=	${BINDIR}/cc ${BINDIR}/gcc -MLINKS= cc.1 gcc.1 +MLINKS= cc.1 gcc.1 cc.1 c++.1 cc.1 g++.1  .include <bsd.prog.mk> diff --git a/gnu/usr.bin/cc/cc/cc.1 b/gnu/usr.bin/cc/cc/cc.1 index 223115c43801..88d1d58b5715 100644 --- a/gnu/usr.bin/cc/cc/cc.1 +++ b/gnu/usr.bin/cc/cc/cc.1 @@ -20,7 +20,7 @@  .if n .sp  .if t .sp 0.4  .. -.Id $Id: gcc.1,v 1.4 1993/10/13 23:19:12 pesch Exp $ +.Id $Id: cc.1,v 1.2 1994/11/15 04:51:29 phk Exp $  .TH GCC 1 "\*(Dt" "GNU Tools" "GNU Tools"  .SH NAME  gcc, g++ \- GNU project C and C++ Compiler (v2.6) @@ -438,7 +438,17 @@ in the following sections.  \-m486  \-mno\-486  \-msoft\-float +\-mrtd +\-mregparm +\-msvr3\-shlib +\-mno\-ieee\-fp  \-mno\-fp\-ret\-in\-387 +\-mfancy\-math\-387 +\-mno\-wide\-multiply +\-mdebug\-addr +\-mno\-move +\-mprofiler\-epilogue +\-reg\-alloc=LIST  .Sp  .I HPPA Options  .br @@ -3490,6 +3500,7 @@ assembler files (with a `\|\c  These `\|\c  .B \-m\c  \&\|' options are defined for the Intel 80386 family of computers: +.TP  .B \-m486  .TP  .B \-mno\-486 @@ -3526,6 +3537,11 @@ The option `\|\c  .B \-mno-fp-ret-in-387\c  \&\|' causes such values to be returned  in ordinary CPU registers instead. +.TP +.B \-mprofiler-epilogue +.TP +.B \-mno-profiler-epilogue +Generate extra code to write profile information for function exits.  .PP  These `\|\c  .B \-m\c @@ -4061,7 +4077,7 @@ if available, else  .B /tmp\c  \&).  .SH "SEE ALSO" -cpp(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1). +cpp(1), as(1), ld(1), gdb(1).  .br  .RB "`\|" gcc "\|', `\|" cpp \|',  .RB "`\|" as "\|', `\|" ld \|', diff --git a/gnu/usr.bin/cc/cc/gcc.c b/gnu/usr.bin/cc/cc/gcc.c index 152c579d9a44..43ea4a7ade2d 100644 --- a/gnu/usr.bin/cc/cc/gcc.c +++ b/gnu/usr.bin/cc/cc/gcc.c @@ -720,7 +720,7 @@ static struct compiler default_compilers[] =    {"@f2c",     "f2c %{checksubscripts:-C} %{I2} %{onetrip} %{honorcase:-U} %{u} %{w}\          %{ANSIC:-A} %{a} %{C++}\ -        %{c} %{E} %{ec} %{ext} %{f} %{72} %{g} %{h} %{i2} %{kr}\ +        %{c} %{E} %{ec} %{ext} %{f} %{72} %{g} %{h} %{i2} %{kr} %{krd}\          %{P} %{p} %{r} %{r8} %{s} %{w8} %{z} %{N*}\          %i %{!pipe: -o %g.c} %{pipe:-o -}|\n",     "cpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\ diff --git a/gnu/usr.bin/cc/doc/invoke.texi b/gnu/usr.bin/cc/doc/invoke.texi index d3fc4f382589..54534a031a75 100644 --- a/gnu/usr.bin/cc/doc/invoke.texi +++ b/gnu/usr.bin/cc/doc/invoke.texi @@ -274,9 +274,10 @@ in addition to the above:  -mstats  -G  @var{num}  -nocpp  @emph{i386 Options} --m486  -mieee-fp  -mno-486  -mno-fancy-math-387 --mno-fp-ret-in-387  -msoft-float  -msvr3-shlib   --mno-wide-multiply -mreg-alloc=@var{list} +-m486  -mno-486  -mno-fancy-math-387 +-mno-fp-ret-in-387  -mno-ieee-fp  -mno-wide-multiply +-mprofiler-epilogue  -msoft-float  -msvr3-shlib +-mreg-alloc=@var{list}  @emph{HPPA Options}  -mdisable-fpregs  -mdisable-indexing  -mjump-in-delay  @@ -3481,8 +3482,8 @@ These @samp{-m} options are defined for the i386 family of computers:  Control whether or not code is optimized for a 486 instead of an  386.  Code generated for an 486 will run on a 386 and vice versa. -@item -mieee-fp -@itemx -m-no-ieee-fp +@item -mno-ieee-fp +@itemx -mieee-fp  Control whether or not the compiler uses IEEE floating point  comparisons.  These handle correctly the case where the result of a  comparison is unordered. @@ -3529,6 +3530,12 @@ Control whether GNU CC uses the @code{mul} and @code{imul} that produce  64 bit results in @code{eax:edx} from 32 bit operands to do @code{long  long} multiplies and 32-bit division by constants. +@item -mprofiler-epilogue +@itemx -mno-profiler-epilogue +Generate extra code to write profile information for function exits. +This option has no effect except in combination with @samp{-g} or +@samp{-pg}. +  @item -mreg-alloc=@var{regs}  Control the default allocation order of integer registers.  The  string @var{regs} is a series of letters specifing a register.  The diff --git a/gnu/usr.bin/cc/f77/Makefile b/gnu/usr.bin/cc/f77/Makefile index 4af4448ad0f7..e7ed05100edb 100644 --- a/gnu/usr.bin/cc/f77/Makefile +++ b/gnu/usr.bin/cc/f77/Makefile @@ -1,10 +1,9 @@  # -# $Id: Makefile,v 1.3 1994/09/18 22:35:43 wollman Exp $ +# $Id: Makefile,v 1.1 1994/10/25 14:36:49 ljo Exp $  #  PROG =	f77  SRCS =	f77.c  BINDIR=	/usr/bin -NOMAN=	1  .include <bsd.prog.mk> diff --git a/gnu/usr.bin/cc/include/tm.h b/gnu/usr.bin/cc/include/tm.h index 440d509cefae..14aa504879b5 100644 --- a/gnu/usr.bin/cc/include/tm.h +++ b/gnu/usr.bin/cc/include/tm.h @@ -27,9 +27,21 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */  /* Get perform_* macros to build libgcc.a.  */  #include "i386/perform.h" +#define MASK_PROFILER_EPILOGUE	010000000000 + +#define TARGET_PROFILER_EPILOGUE (target_flags & MASK_PROFILER_EPILOGUE) + +#undef	SUBTARGET_SWITCHES +#define SUBTARGET_SWITCHES						\ +     { "profiler-epilogue",	 MASK_PROFILER_EPILOGUE},		\ +     { "no-profiler-epilogue",	-MASK_PROFILER_EPILOGUE}, +  #undef CPP_PREDEFINES  #define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__=2 -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)" +#define STARTFILE_SPEC  \ +  "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:%{static:scrt0.o%s}%{!static:crt0.o%s}}}" +  #define INCLUDE_DEFAULTS { \  	{ "/usr/include", 0 }, \  	{ "/usr/include/g++", 1 }, \ @@ -80,15 +92,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */      fprintf (FILE, "\tcall mcount\n");					\  } -#if 0 /* not ready for this; it should be decided at compile time */  #define FUNCTION_PROFILER_EPILOGUE(FILE)  \  {									\ -  if (flag_pic)								\ -    fprintf (FILE, "\tcall *mexitcount@GOT(%%ebx)\n");			\ -  else									\ -    fprintf (FILE, "\tcall mexitcount\n");				\ +  if (TARGET_PROFILER_EPILOGUE)						\ +    {									\ +      if (flag_pic)							\ +	fprintf (FILE, "\tcall *mexitcount@GOT(%%ebx)\n");		\ +      else								\ +	fprintf (FILE, "\tcall mexitcount\n");				\ +    }									\  } -#endif  /* Override the default comment-starter of "/".  */ diff --git a/gnu/usr.bin/cc/libgcc/Makefile b/gnu/usr.bin/cc/libgcc/Makefile index e18fcde89189..e6024eb06e5d 100644 --- a/gnu/usr.bin/cc/libgcc/Makefile +++ b/gnu/usr.bin/cc/libgcc/Makefile @@ -1,5 +1,5 @@  # -# $Id: Makefile,v 1.7 1995/03/12 09:37:26 phk Exp $ +# $Id: Makefile,v 1.8 1995/03/12 20:17:07 phk Exp $  #  LIB=	gcc @@ -17,12 +17,12 @@ P2OBJS=${LIB2OBJS:.o=.po}  ${LIB1OBJS}: libgcc1.c  	${CC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc1.c  	@${LD} -x -r ${.TARGET} -	@mv a.out ${.TARGET} +	@mv -f a.out ${.TARGET}  ${LIB2OBJS}: libgcc2.c  	${CC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.CURDIR}/libgcc2.c  	@${LD} -x -r ${.TARGET} -	@mv a.out ${.TARGET} +	@mv -f a.out ${.TARGET}  .if !defined(NOPIC)  ${LIB1SOBJS}: libgcc1.c diff --git a/gnu/usr.bin/cpio/main.c b/gnu/usr.bin/cpio/main.c index 78b5fc53145f..9346b780bed1 100644 --- a/gnu/usr.bin/cpio/main.c +++ b/gnu/usr.bin/cpio/main.c @@ -23,6 +23,9 @@  #include <getopt.h>  #include <sys/types.h>  #include <sys/stat.h> +#ifdef __FreeBSD__ +#include <locale.h> +#endif  #include "filetypes.h"  #include "system.h"  #include "cpiohdr.h" @@ -458,6 +461,9 @@ main (argc, argv)    program_name = argv[0];    umask (0); +#ifdef __FreeBSD__ +  (void) setlocale (LC_ALL, ""); +#endif  #ifdef __TURBOC__    _fmode = O_BINARY;		/* Put stdin and stdout in binary mode.  */  #endif diff --git a/gnu/usr.bin/cpio/util.c b/gnu/usr.bin/cpio/util.c index e2e1c1e86697..7204af7d37da 100644 --- a/gnu/usr.bin/cpio/util.c +++ b/gnu/usr.bin/cpio/util.c @@ -784,9 +784,9 @@ get_next_reel (tape_des)      fprintf (tty_out, "%s%d%s", new_media_message_with_number, reel_number,  	     new_media_message_after_number);    else if (archive_name) -    fprintf (tty_out, "Found end of tape.  Load next tape and press RETURN. "); +    fprintf (tty_out, "Found end of volume.  Load next volume and press RETURN. ");    else -    fprintf (tty_out, "Found end of tape.  To continue, type device/file name when ready.\n"); +    fprintf (tty_out, "Found end of volume.  To continue, type device/file name when ready.\n");    fflush (tty_out); diff --git a/gnu/usr.bin/cvs/contrib/easy-import.pl b/gnu/usr.bin/cvs/contrib/easy-import.pl index 7bcfc398895a..3c0b7b5e75a1 100644 --- a/gnu/usr.bin/cvs/contrib/easy-import.pl +++ b/gnu/usr.bin/cvs/contrib/easy-import.pl @@ -8,7 +8,7 @@  #  # Written by Jörg Wunsch, 95/03/07, and placed in the public domain.  # -# $Id: easy-import.pl,v 1.4 1995/12/11 00:45:43 peter Exp $ +# $Id: easy-import.pl,v 1.5 1996/01/02 07:39:03 joerg Exp $  require "complete.pl";  require "getopts.pl"; @@ -22,7 +22,7 @@ sub scan_opts      $dont_do_it = "-n" if $opt_n;      if($opt_v) { -	print STDERR '$Source: /home/ncvs/src/gnu/usr.bin/cvs/contrib/easy-import.pl,v $ $Revision: 1.4 $' . "\n"; # 'emacs kludge +	print STDERR '$Source: /home/ncvs/src/gnu/usr.bin/cvs/contrib/easy-import.pl,v $ $Revision: 1.5 $' . "\n"; # 'emacs kludge  	exit 0;      }      die "usage: $0 [-v] [-n] [moduledir]\n" . @@ -162,20 +162,20 @@ sub cvs_init  sub lsmodules  {      # list all known CVS modules -    local(@rv, $mname, $_); +    local(%rv, $mname, $mpath, $_); -    @rv = (); +    %rv = ();      open(CVS, "cvs co -c|");      while($_ = <CVS>) {  	chop; -	($mname) = split; +	($mname,$mpath) = split;  	next if $mname eq ""; -	@rv = (@rv, $mname); +	$rv{$mname} = $mpath;      }      close(CVS); -    return @rv; +    return %rv;  } @@ -259,56 +259,65 @@ $area = "$rep/$selected";  print "\n${so}[Working on:${se} ${us}$area${ue}${so}]${se}\n"; +%cvsmods = &lsmodules(); +  for(;;) {      $| = 1; -    print "${so}Enter the module path:${se} $area/"; +    print "${so}Gimme the module name:${se} ";      $| = 0; -    $modpath = <>; -    chop $modpath; -    if ($modpath eq "") { -	print "\a${us}You cannot use an empty module path.${ue}\n"; +    $modname = <>; +    chop $modname; +    if ($modname eq "") { +	print "\a${us}You cannot use an empty module name.${ue}\n";  	next;      } -    last if ! -d "$cvsroot/$area/$modpath"; -    print "\a${us}This module path does already exist; " . -	"choose another one.${ue}\n"; +    last if !$cvsmods{$modname}; +    print "\a${us}This module name does already exist;\n" . +	"do you intend to create a vendor-branch import?${ue}: "; +    $rep = <>; +    if ($rep =~ /\s*[yY]/) { +	($area,$modpath) = split(/\//,$cvsmods{$modname},2); +	$branchimport = 1; +	last; +    } +    print "${us}Choose another name.${ue}\n";  } -@newdirs = (); -$dir1 = "$cvsroot/$area"; -$dir2 = "$area"; +if(!$branchimport) { +    for(;;) { +	$| = 1; +	print "${so}Enter the module path:${se} $area/"; +	$| = 0; +	$modpath = <>; +	chop $modpath; +	if ($modpath eq "") { +	    print "\a${us}You cannot use an empty module path.${ue}\n"; +	    next; +	} +	last if ! -d "$cvsroot/$area/$modpath"; +	print "\a${us}This module path does already exist; " . +	    "choose another one.${ue}\n"; +    } -@newdirs = (@newdirs, "$dir2") if ! -d $dir1; -foreach $ele (split(/\//, $modpath)) { -    $dir1 = "$dir1/$ele"; -    $dir2 = "$dir2/$ele"; -    @newdirs = (@newdirs, "$dir2") if ! -d $dir1; -} +    @newdirs = (); +    $dir1 = "$cvsroot/$area"; +    $dir2 = "$area"; -print "${so}You're going to create the following new directories:${se}\n"; +    @newdirs = (@newdirs, "$dir2") if ! -d $dir1; -&list(@newdirs); +    foreach $ele (split(/\//, $modpath)) { +	$dir1 = "$dir1/$ele"; +	$dir2 = "$dir2/$ele"; +	@newdirs = (@newdirs, "$dir2") if ! -d $dir1; +    } -@cvsmods = &lsmodules(); +    print "${so}You're going to create the following new directories:${se}\n"; -for(;;) { -    $| = 1; -    print "${so}Gimme the module name:${se} "; -    $| = 0; -    $modname = <>; -    chop $modname; -    if ($modname eq "") { -	print "\a${us}You cannot use an empty module name.${ue}\n"; -	next; -    } -    last if !&contains($modname, @cvsmods); -    print "\a${us}This module name does already exist; " . -	"choose another one.${ue}\n"; +    &list(@newdirs);  } -  for(;;) {      $| = 1;      print "${so}Enter a \`vendor\' tag (e. g. the authors ID):${se} "; @@ -334,37 +343,38 @@ print "${so}This is your last chance to interrupt, " .  $| = 0;  <>; -$mod = ""; -foreach $tmp (@cvsmods) { -    if($tmp gt $modname) { -	$mod = $tmp; -	last; +if (!$branchimport) { +    $mod = ""; +    foreach $tmp (sort(keys(%cvsmods))) { +	if($tmp gt $modname) { +	    $mod = $tmp; +	    last; +	} +    } +    if($mod eq "") { +	# we are going to append our module +	$cmd = "\$\na\n"; +    } else { +	# we can insert it +	$cmd = "/^${mod}[ \t]/\ni\n";      } -} - -if($mod eq "") { -    # we are going to append our module -    $cmd = "\$\na\n"; -} else { -    # we can insert it -    $cmd = "/^${mod}[ \t]/\ni\n"; -} -print "${so}Checking out the modules database...${se}\n"; -system("cvs co modules") && die "${us}failed.\n${ue}"; +    print "${so}Checking out the modules database...${se}\n"; +    system("cvs co modules") && die "${us}failed.\n${ue}"; -print "${so}Inserting new module...${se}\n"; -open(ED, "|ed modules/modules") || die "${us}Cannot start ed${ue}\n"; -print(ED "${cmd}${modname}" . ' ' x (16 - length($modname)) . -      "$area/${modpath}\n.\nw\nq\n"); -close(ED); +    print "${so}Inserting new module...${se}\n"; +    open(ED, "|ed modules/modules") || die "${us}Cannot start ed${ue}\n"; +    print(ED "${cmd}${modname}" . ' ' x (16 - length($modname)) . +	  "$area/${modpath}\n.\nw\nq\n"); +    close(ED); -print "${so}Commiting new modules database...${se}\n"; -system("cvs $dont_do_it commit -m \"  " . -       "${modname} --> $area/${modpath}\" modules") -    && die "Commit failed\n"; +    print "${so}Commiting new modules database...${se}\n"; +    system("cvs $dont_do_it commit -m \"  " . +	   "${modname} --> $area/${modpath}\" modules") +	&& die "Commit failed\n"; -system("cvs $dont_do_it -Q release -d modules"); +    system("cvs $dont_do_it -Q release -d modules"); +}  print "${so}Importing source.  Enter a commit message in the editor.${se}\n"; diff --git a/gnu/usr.bin/cvs/doc/cvs.texinfo b/gnu/usr.bin/cvs/doc/cvs.texinfo index b3404d5825aa..ef125f524b6e 100644 --- a/gnu/usr.bin/cvs/doc/cvs.texinfo +++ b/gnu/usr.bin/cvs/doc/cvs.texinfo @@ -1647,7 +1647,11 @@ int main(int argc,          gencode();      else          fprintf(stderr, "No code generated.\n"); +<<<<<<< driver.c +    exit(nerr == 0 ? EXIT_SUCCESS : EXIT_FAILURE); +=======      exit(!!nerr); +>>>>>>> 1.6  @}  @end example diff --git a/gnu/usr.bin/cvs/examples/loginfo b/gnu/usr.bin/cvs/examples/loginfo index e9c25e064612..0c338249ce63 100644 --- a/gnu/usr.bin/cvs/examples/loginfo +++ b/gnu/usr.bin/cvs/examples/loginfo @@ -1,5 +1,5 @@  # -# $CVSid: @(#)loginfo 1.5 92/03/31 $ +#ident	"@(#)cvs/examples:$Name$:$Id$"  #  # The "loginfo" file is used to control where "cvs commit" log information  # is sent.  The first entry on a line is a regular expression which is tested diff --git a/gnu/usr.bin/diff/diff.1 b/gnu/usr.bin/diff/diff.1 index e16f6d98dcfa..4acd3c9ac44d 100644 --- a/gnu/usr.bin/diff/diff.1 +++ b/gnu/usr.bin/diff/diff.1 @@ -309,9 +309,6 @@ Use  to output a line taken from just the first file in  if-then-else format.  .TP -.B \-p -Show which C function each change is in. -.TP  .B \-P  When comparing directories, if a file appears only in the second  directory of the two, treat it as present but empty in the other. @@ -325,25 +322,25 @@ to paginate it.  Report only whether the files differ, not the details of the  differences.  .TP -.B \-r -When comparing directories, recursively compare any subdirectories -found. -.TP  .B \-\-rcs  Output RCS-format diffs; like  .B \-f  except that each command  specifies the number of lines affected.  .TP +.B \-r +.br +.ns +.TP  .B \-\-recursive  When comparing directories, recursively compare any subdirectories  found.  .TP -.B \-\-report\-identical\-files +.B \-s  .br  .ns  .TP -.B \-s +.B \-\-report\-identical\-files  Report when two files are the same.  .TP  .BI "\-S " file diff --git a/gnu/usr.bin/gdb/bfd/sysdep.h b/gnu/usr.bin/gdb/bfd/sysdep.h index f57363b66aba..5e989eb230f7 100644 --- a/gnu/usr.bin/gdb/bfd/sysdep.h +++ b/gnu/usr.bin/gdb/bfd/sysdep.h @@ -19,7 +19,7 @@  #define SEEK_SET 0  #define SEEK_CUR 1 -#define	HOST_PAGE_SIZE		NBPG +#define	HOST_PAGE_SIZE		PAGE_SIZE  #define	HOST_MACHINE_ARCH	bfd_arch_i386  #define	HOST_TEXT_START_ADDR		USRTEXT diff --git a/gnu/usr.bin/gdb/bfd/trad-core.c b/gnu/usr.bin/gdb/bfd/trad-core.c index dc3d84380f17..78a70a737416 100644 --- a/gnu/usr.bin/gdb/bfd/trad-core.c +++ b/gnu/usr.bin/gdb/bfd/trad-core.c @@ -117,7 +117,7 @@ trad_unix_core_file_p (abfd)  	bfd_set_error (bfd_error_system_call);  	return 0;        } -    if (NBPG * (UPAGES + u.u_dsize +    if (PAGE_SIZE * (UPAGES + u.u_dsize  #ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE  		- u.u_tsize  #endif @@ -127,7 +127,7 @@ trad_unix_core_file_p (abfd)  	return 0;        }  #ifndef TRAD_CORE_ALLOW_ANY_EXTRA_SIZE -    if (NBPG * (UPAGES + u.u_dsize + u.u_ssize) +    if (PAGE_SIZE * (UPAGES + u.u_dsize + u.u_ssize)  #ifdef TRAD_CORE_EXTRA_SIZE_ALLOWED  	/* Some systems write the file too big.  */  	+ TRAD_CORE_EXTRA_SIZE_ALLOWED @@ -187,26 +187,26 @@ trad_unix_core_file_p (abfd)    core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;    core_regsec (abfd)->flags = SEC_HAS_CONTENTS; -  core_datasec (abfd)->_raw_size =  NBPG * u.u_dsize +  core_datasec (abfd)->_raw_size =  PAGE_SIZE * u.u_dsize  #ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE -    - NBPG * u.u_tsize +    - PAGE_SIZE * u.u_tsize  #endif        ; -  core_stacksec (abfd)->_raw_size = NBPG * u.u_ssize; -  core_regsec (abfd)->_raw_size = NBPG * UPAGES; /* Larger than sizeof struct u */ +  core_stacksec (abfd)->_raw_size = PAGE_SIZE * u.u_ssize; +  core_regsec (abfd)->_raw_size = PAGE_SIZE * UPAGES; /* Larger than sizeof struct u */    /* What a hack... we'd like to steal it from the exec file,       since the upage does not seem to provide it.  FIXME.  */  #ifdef HOST_DATA_START_ADDR    core_datasec (abfd)->vma = HOST_DATA_START_ADDR;  #else -  core_datasec (abfd)->vma = HOST_TEXT_START_ADDR + (NBPG * u.u_tsize); +  core_datasec (abfd)->vma = HOST_TEXT_START_ADDR + (PAGE_SIZE * u.u_tsize);  #endif  #ifdef HOST_STACK_START_ADDR    core_stacksec (abfd)->vma = HOST_STACK_START_ADDR;  #else -  core_stacksec (abfd)->vma = HOST_STACK_END_ADDR - (NBPG * u.u_ssize); +  core_stacksec (abfd)->vma = HOST_STACK_END_ADDR - (PAGE_SIZE * u.u_ssize);  #endif    /* This is tricky.  As the "register section", we give them the entire @@ -225,10 +225,10 @@ trad_unix_core_file_p (abfd)       using minor trickery to get around the offset-or-absolute-addr problem. */    core_regsec (abfd)->vma = 0 - (int) u.u_ar0; -  core_datasec (abfd)->filepos = NBPG * UPAGES; -  core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize +  core_datasec (abfd)->filepos = PAGE_SIZE * UPAGES; +  core_stacksec (abfd)->filepos = (PAGE_SIZE * UPAGES) + PAGE_SIZE * u.u_dsize  #ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE -    - NBPG * u.u_tsize +    - PAGE_SIZE * u.u_tsize  #endif        ;    core_regsec (abfd)->filepos = 0; /* Register segment is the upage */ diff --git a/gnu/usr.bin/gdb/gdb/Makefile b/gnu/usr.bin/gdb/gdb/Makefile index 68a86ae5395b..d1513bb6fb62 100644 --- a/gnu/usr.bin/gdb/gdb/Makefile +++ b/gnu/usr.bin/gdb/gdb/Makefile @@ -1,3 +1,5 @@ +#	$Id$ +  PROG = gdb  BINDIR= /usr/bin  CLEANFILES+= y.tab.h c-exp.tab.c ch-exp.tab.c m2-exp.tab.c @@ -24,24 +26,24 @@ c-exp.tab.c: $(.CURDIR)/c-exp.y  	sed -e '/extern.*malloc/d'  -e '/extern.*realloc/d'  -e '/extern.*free/d' \           -e '/include.*malloc.h/d'  -e 's/malloc/xmalloc/g'  \           -e 's/realloc/xrealloc/g'  < y.tab.c > c-exp.new -	rm y.tab.c -	mv c-exp.new ./c-exp.tab.c +	rm -f y.tab.c +	mv -f c-exp.new ./c-exp.tab.c  ch-exp.tab.c: $(.CURDIR)/ch-exp.y  	yacc -d -p ch_ $(.CURDIR)/ch-exp.y  	sed -e '/extern.*malloc/d'  -e '/extern.*realloc/d'  -e '/extern.*free/d' \           -e '/include.*malloc.h/d'  -e 's/malloc/xmalloc/g'  \           -e 's/realloc/xrealloc/g'  < y.tab.c > ch-exp.new -	rm y.tab.c -	mv ch-exp.new ./ch-exp.tab.c +	rm -f y.tab.c +	mv -f ch-exp.new ./ch-exp.tab.c  m2-exp.tab.c: $(.CURDIR)/m2-exp.y  	yacc -d -p m2_ $(.CURDIR)/m2-exp.y  	sed -e '/extern.*malloc/d'  -e '/extern.*realloc/d'  -e '/extern.*free/d' \           -e '/include.*malloc.h/d'  -e 's/malloc/xmalloc/g'  \           -e 's/realloc/xrealloc/g'  < y.tab.c > m2-exp.new -	rm y.tab.c -	mv m2-exp.new ./m2-exp.tab.c +	rm -f y.tab.c +	mv -f m2-exp.new ./m2-exp.tab.c  CFLAGS+= -I$(.CURDIR)/. -I${DESTDIR}/usr/include/readline -I$(.CURDIR)/../bfd diff --git a/gnu/usr.bin/gdb/gdb/freebsd-nat.c b/gnu/usr.bin/gdb/gdb/freebsd-nat.c index 90b323674489..ebf7db75d261 100644 --- a/gnu/usr.bin/gdb/gdb/freebsd-nat.c +++ b/gnu/usr.bin/gdb/gdb/freebsd-nat.c @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License  along with this program; if not, write to the Free Software  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -	$Id: freebsd-nat.c,v 1.6 1995/05/09 13:59:22 rgrimes Exp $ +	$Id: freebsd-nat.c,v 1.7 1995/05/30 04:57:05 rgrimes Exp $  */  #include <sys/types.h> @@ -480,7 +480,7 @@ kvtophys (fd, addr)  CORE_ADDR addr;  {  	CORE_ADDR v; -	struct pte pte; +	unsigned int pte;  	static CORE_ADDR PTD = -1;  	CORE_ADDR current_ptd; @@ -526,18 +526,18 @@ CORE_ADDR addr;  	/*  	 * Read the first-level page table (ptd).  	 */ -	v = current_ptd + ((unsigned)addr >> PD_SHIFT) * sizeof pte; -	if (physrd(fd, v, (char *)&pte, sizeof pte) < 0 || pte.pg_v == 0) +	v = current_ptd + ((unsigned)addr >> PDRSHIFT) * sizeof pte; +	if (physrd(fd, v, (char *)&pte, sizeof pte) < 0 || (pte&PG_V) == 0)  		return (~0);  	/*  	 * Read the second-level page table.  	 */ -	v = i386_ptob(pte.pg_pfnum) + ((addr&PT_MASK) >> PG_SHIFT) * sizeof pte; -	if (physrd(fd, v, (char *) &pte, sizeof(pte)) < 0 || pte.pg_v == 0) +	v = (pte&PG_FRAME) + ((addr >> PAGE_SHIFT)&(NPTEPG-1)) * sizeof pte; +	if (physrd(fd, v, (char *) &pte, sizeof(pte)) < 0 || (pte&PG_V) == 0)  		return (~0); -	addr = i386_ptob(pte.pg_pfnum) + (addr & PGOFSET); +	addr = (pte & PG_FRAME) + (addr & PAGE_MASK);  #if 0  	printf("vtophys(%x) -> %x\n", oldaddr, addr);  #endif @@ -605,7 +605,7 @@ kernel_core_file_hook(fd, addr, buf, len)  			break;  		}  		/* we can't read across a page boundary */ -		i = min(len, NBPG - (addr & PGOFSET)); +		i = min(len, PAGE_SIZE - (addr & PAGE_MASK));  		if ((cc = physrd(fd, paddr, cp, i)) <= 0) {  			bzero(cp, len);  			return (cp - buf); diff --git a/gnu/usr.bin/gdb/gdb/gdb.1 b/gnu/usr.bin/gdb/gdb/gdb.1 index ee14f7073451..0245ec81cc8c 100644 --- a/gnu/usr.bin/gdb/gdb/gdb.1 +++ b/gnu/usr.bin/gdb/gdb/gdb.1 @@ -1,6 +1,6 @@  .\" Copyright (c) 1991 Free Software Foundation  .\" See section COPYING for conditions for redistribution -.\" $Id: gdb.1,v 1.1 1994/01/28 12:39:43 pk Exp $ +.\" $Id: gdb.1,v 1.2 1994/12/30 23:25:45 jkh Exp $  .TH gdb 1 "4nov1991" "GNU Tools" "GNU Tools"  .SH NAME  gdb \- The GNU Debugger @@ -11,6 +11,8 @@ gdb \- The GNU Debugger  .RB "[\|" \-help "\|]"  .RB "[\|" \-nx "\|]"  .RB "[\|" \-q "\|]" +.RB "[\|" \-k "\|]" +.RB "[\|" \-w "\|]"  .RB "[\|" \-batch "\|]"  .RB "[\|" \-cd=\c  .I dir\c @@ -281,6 +283,23 @@ command options and arguments have been processed.  messages are also suppressed in batch mode.  .TP +.B \-kernel +.TP +.B \-k +Puts GDB into kernel debugging mode. If no executable file is specified then +/kernel is used. If no core file is specified then /dev/mem is +used. Crash dumps can be examined by specifying both an executable and +a core file. + +.TP +.B \-wcore +.TP +.B \-w +This flag is only effective when debugging a "live" kernel. It makes the +core file (/dev/mem) writable so that kernel variables can be changed +during a debugging session. Use this with caution ! + +.TP  .B \-batch  Run in batch mode.  Exit with status \c  .B 0\c diff --git a/gnu/usr.bin/gdb/libiberty/Makefile b/gnu/usr.bin/gdb/libiberty/Makefile index 2bc6abfab4a7..838781295e82 100644 --- a/gnu/usr.bin/gdb/libiberty/Makefile +++ b/gnu/usr.bin/gdb/libiberty/Makefile @@ -1,7 +1,7 @@  LIB= iberty  SRCS= argv.c basename.c concat.c cplus-dem.c fdmatch.c getopt.c \        getopt1.c ieee-float.c obstack.c spaces.c strerror.c strsignal.c \ -      vasprintf.c xmalloc.c +      xmalloc.c  CFLAGS+= -I$(.CURDIR)/../gdb/.  NOPROFILE=no diff --git a/gnu/usr.bin/grep/Makefile b/gnu/usr.bin/grep/Makefile index a7811a3c656c..0cfcf6b2d44c 100644 --- a/gnu/usr.bin/grep/Makefile +++ b/gnu/usr.bin/grep/Makefile @@ -2,7 +2,7 @@ PROG=	grep  SRCS=   dfa.c grep.c getopt.c kwset.c obstack.c search.c  CFLAGS+=-DGREP -DHAVE_STRING_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_UNISTD_H=1 \  	-DHAVE_GETPAGESIZE=1 -DHAVE_MEMCHR=1 -DHAVE_STRERROR=1 \ -	-DHAVE_VALLOC=1 +	-DHAVE_VALLOC=1 -DHAVE_MMAP=1 -DHAVE_FTS=1  LINKS+= ${BINDIR}/grep ${BINDIR}/egrep \  	${BINDIR}/grep ${BINDIR}/fgrep diff --git a/gnu/usr.bin/grep/grep.1 b/gnu/usr.bin/grep/grep.1 index 27c6b0e419d2..22e96e8b7cdd 100644 --- a/gnu/usr.bin/grep/grep.1 +++ b/gnu/usr.bin/grep/grep.1 @@ -3,22 +3,13 @@  grep, egrep, fgrep \- print lines matching a pattern  .SH SYNOPOSIS  .B grep -[ -.BR \- [[ AB "] ]\c" -.I "num" -] -[ -.BR \- [ CEFGVBchilnsvwx ] -] -[ -.B \-e -] -.I pattern -| -.BI \-f file -] [ -.I files... -] +[\-[AB] num] +[\-HRPS] +[\-CEFGLVabchilnqsvwx] +[\-e expr] +[\-f file] +files... +  .SH DESCRIPTION  .PP  .B Grep @@ -102,6 +93,9 @@ Print the version number of  to standard error.  This version number should  be included in all bug reports (see below).  .TP +.B \-a +Don't search in binary files. +.TP  .B \-b  Print the byte offset within the input file before  each line of output. @@ -165,6 +159,36 @@ characters are letters, digits, and the underscore.  .TP  .B \-x  Select only those matches that exactly match the whole line. + +.PP +Following options only avaible if compiled with FTS library: +.PD 0 +.TP +.BI \-H +If the  +.I \-R +option is specified, symbolic links on the command line +are followed.  (Symbolic links encountered in the tree traversal +are not followed.) +.TP + +.BI \-L +If the  +.I \-R +option is specified, all symbolic links are followed. +.TP + +.BI \-P +If the  +.I \-R +option is specified, no symbolic links are followed. +.TP + +.BI \-R +Search in the file hierarchies +rooted in the files instead of just the files themselves. +.TP +  .PD  .SH "REGULAR EXPRESSIONS"  .PP diff --git a/gnu/usr.bin/grep/grep.c b/gnu/usr.bin/grep/grep.c index dc3329853307..2576e3dab758 100644 --- a/gnu/usr.bin/grep/grep.c +++ b/gnu/usr.bin/grep/grep.c @@ -19,6 +19,9 @@  #include <errno.h>  #include <stdio.h> +#ifdef __FreeBSD__ +#include <locale.h> +#endif  #ifndef errno  extern int errno; @@ -53,6 +56,7 @@ extern char *memchr();  #include <unistd.h>  #else  #define O_RDONLY 0 +#define STDIN_FILENO 0  extern int open(), read(), close();  #endif @@ -91,6 +95,16 @@ memchr(vp, c, n)  }  #endif +/* traverse a file hierarchy library */ +#ifdef HAVE_FTS +#include <sys/types.h> +#include <sys/stat.h> +#include <fts.h> +#endif + +/* don't search in binary files */ +int aflag; +  /* Define flags declared in grep.h. */  char *matcher;  int match_icase; @@ -496,6 +510,40 @@ grepbuf(beg, lim)    return nlines;  } + +/* + * try to guess if fd belong to a binary file  + */ + +int isBinaryFile(fd) +     int fd; +{ +#define BINARY_BUF_LEN 32 +  static unsigned char buf[BINARY_BUF_LEN]; +  int i, n; + +  /* pipe, socket, fifo */ +  if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) +    return(0); + + if ((n =(int) read(fd, buf, (size_t)BINARY_BUF_LEN)) == -1) +   return(0); + +  /* look for non-printable chars */ +  for(i = 0; i < n; i++) +    if (!isprint(buf[i]) && !isspace(buf[i])) +      return(1); + +  /* reset fd to begin of file */ +  if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) +    return(0); + +   +  return(0); +} + + +  /* Search a given file.  Return a count of lines printed. */  static int  grep(fd) @@ -505,6 +553,10 @@ grep(fd)    size_t residue, save;    char *beg, *lim; +  /* skip binary files */ +  if (aflag && isBinaryFile(fd)) +    return(0); +    reset(fd);    totalcc = 0; @@ -565,8 +617,15 @@ grep(fd)  static char version[] = "GNU grep version 2.0"; +#ifdef HAVE_FTS +#define USAGE \ +"usage: %s [-[AB] <num>] [-HRPS] [-CEFGLVabchilnqsvwx]\n\ +            [-e <expr>] [-f file] [files ...]\n" +#else  #define USAGE \ -  "usage: %s [-[[AB] ]<num>] [-[CEFGVchilnqsvwx]] [-[ef]] <expr> [<files...>]\n" +"usage: %s [-[AB] <num>] [-CEFGLVabchilnqsvwx]\n\ +            [-e <expr>] [-f file] [files ...]\n" +#endif  static void  usage() @@ -605,7 +664,16 @@ main(argc, argv)    FILE *fp;    extern char *optarg;    extern int optind; +#ifdef HAVE_FTS +  int Rflag, Hflag, Pflag, Lflag; +  FTS *ftsp; +  FTSENT *ftsent; +  int fts_options; +#endif +#ifdef __FreeBSD__ +  (void) setlocale(LC_CTYPE, ""); +#endif    prog = argv[0];    if (prog && strrchr(prog, '/'))      prog = strrchr(prog, '/') + 1; @@ -618,9 +686,20 @@ main(argc, argv)    list_files = 0;    suppress_errors = 0;    matcher = NULL; +  aflag = 0; +#ifdef HAVE_FTS +  Rflag = Hflag = Pflag = Lflag = 0; +#endif + +  while ((opt = getopt(argc, argv,  + +#ifndef HAVE_FTS +"0123456789A:B:CEFGVX:abce:f:hiLlnqsvwxy" +#else +"0123456789A:B:CEFGHLPRSVX:abce:f:hiLlnqsvwxy?" +#endif  -  while ((opt = getopt(argc, argv, "0123456789A:B:CEFGVX:bce:f:hiLlnqsvwxy")) -	 != EOF) +)) != EOF)      switch (opt)        {        case '0': @@ -672,6 +751,34 @@ main(argc, argv)  	  fatal("matcher already specified", 0);  	matcher = optarg;  	break; + +#ifdef HAVE_FTS +	/* symbolic links on the command line are followed */ +      case 'H':  +	Hflag = 1; +	Lflag = Pflag = 0; +	break; + +	/* no symbolic links are followed */ +      case 'P': +	Pflag = 1; +	Hflag = Lflag = 0; +	break; + +	/* traverse file hierarchies */ +      case 'R': +	Rflag = 1; +	break; + +	/* all symbolic links are followed */ +      case 'S': +	Lflag = 1; +	Hflag = Pflag = 0; +	break; +#endif +      case 'a': +	aflag = 1; +	break;        case 'b':  	out_byte = 1;  	break; @@ -769,12 +876,126 @@ main(argc, argv)    (*compile)(keys, keycc); +#ifndef HAVE_FTS    if (argc - optind > 1 && !no_filenames) +#else +  if ((argc - optind > 1 || Rflag) && !no_filenames) +#endif      out_file = 1;    status = 1; +#if HAVE_FTS +  if (Rflag) { +    fts_options = FTS_PHYSICAL | FTS_NOCHDIR; + +    if (Hflag) +      fts_options |= FTS_COMFOLLOW; + +    if (Lflag) { +      fts_options |= FTS_LOGICAL; +      fts_options &= ~FTS_PHYSICAL; +    } + +    if (Pflag) { +      fts_options &= ~FTS_LOGICAL & ~FTS_COMFOLLOW; +      fts_options |= FTS_PHYSICAL; +    }       +  } + +  if (Rflag && optind < argc) { +    int i; + +    /* replace "-" with "/dev/stdin" */ +    for (i = optind; i < argc; i++) +      if (strcmp(argv[i], "-") == 0) +	*(argv + i) = "/dev/stdin"; + +    if ((ftsp = fts_open(argv + optind, fts_options,   +			 (int(*)())NULL)) == NULL) { +      if (!suppress_errors) +	error("", errno); +    } else { + +      while((ftsent = fts_read(ftsp)) != NULL) { +	filename = ftsent->fts_accpath; + +	switch(ftsent->fts_info) { + +	  /* regular file */ +	case FTS_F: +	  break; + +	  /* directory */ +	case FTS_D: +	case FTS_DC: +	case FTS_DP: +	  continue; break; + +	  /* errors */ +	case FTS_DNR: +	  error(filename, errno); +	  continue; break; + +	case FTS_ERR: +	case FTS_NS: +	  error(filename, ftsent->fts_errno); +	  continue; break; + +	  /* dead symlink */ +	case FTS_SLNONE: +	  continue; break; + +	  /* symlink, don't skip */ +	case FTS_SL: +	  break; + +	default: +	  /*  +	  if (!suppress_errors) +	    fprintf(stderr, "%s: ignored\n", filename); +	  continue; break; +	  */ + +	} + +	if ((desc = open(filename, O_RDONLY)) == -1) { +	  error(filename, errno); +	  continue; +	} + +	count = grep(desc); +	if (count_matches) +	  { +	    if (out_file) +	      printf("%s:", filename); +	    printf("%d\n", count); +	  } +	if (count) +	  { +	    status = 0; +	    if (list_files == 1) +	      printf("%s\n", filename); +	  } +	else if (list_files == -1) +	  printf("%s\n", filename); + +	if (desc != STDIN_FILENO) +	  close(desc); +      } + +      if (fts_close(ftsp) == -1) +	error("fts_close", errno); +    } + +  /* ! Rflag */ +  } else + +#endif /* HAVE_FTS */ + +  /* search in file names from arguments, not from stdin */    if (optind < argc) +      while (optind < argc)        {  	desc = strcmp(argv[optind], "-") ? open(argv[optind], O_RDONLY) : 0; @@ -806,6 +1027,8 @@ main(argc, argv)  	  close(desc);  	++optind;        } + +  /* read input from stdin */    else      {        filename = "(standard input)"; diff --git a/gnu/usr.bin/grep/search.c b/gnu/usr.bin/grep/search.c index 2b8933805c9a..5e17d034abbe 100644 --- a/gnu/usr.bin/grep/search.c +++ b/gnu/usr.bin/grep/search.c @@ -46,7 +46,7 @@ extern char *memchr();  #define bcopy(s, d, n) memcpy((d), (s), (n))  #endif -#ifdef isascii +#if defined(isascii) && !defined(__FreeBSD__)  #define ISALNUM(C) (isascii(C) && isalnum(C))  #define ISUPPER(C) (isascii(C) && isupper(C))  #else diff --git a/gnu/usr.bin/groff/Makefile.cfg b/gnu/usr.bin/groff/Makefile.cfg index 406e24ee2813..0c7adc565ddd 100644 --- a/gnu/usr.bin/groff/Makefile.cfg +++ b/gnu/usr.bin/groff/Makefile.cfg @@ -1,5 +1,6 @@ +#	$Id$ +  BINDIR?=	/usr/bin -SHAREDIR?=	/usr/share  SHELL=		/bin/sh  # Define `page' to be letter if your PostScript printer uses 8.5x11 @@ -89,13 +90,13 @@ CFLAGS+=$(DEFINES)  .y.o:  	$(YACC) $(YFLAGS) $(.IMPSRC) -	mv y.tab.c $(.PREFIX).cc -	mv y.tab.h $(.PREFIX).tab.h +	mv -f y.tab.c $(.PREFIX).cc +	mv -f y.tab.h $(.PREFIX).tab.h  	${CXX} ${CXXFLAGS} -c $(.PREFIX).cc -o ${.TARGET}  .y.cc:  	$(YACC) $(YFLAGS) $(.IMPSRC) -	mv y.tab.c $(.PREFIX).cc -	mv y.tab.h $(.PREFIX).tab.h +	mv -f y.tab.c $(.PREFIX).cc +	mv -f y.tab.h $(.PREFIX).tab.h  .SUFFIXES: .man .1 .2 .3 .4 .5 .6 .7 .8 diff --git a/gnu/usr.bin/groff/Makefile.comm b/gnu/usr.bin/groff/Makefile.comm index b3d24af39c54..9e6f15ee5937 100644 --- a/gnu/usr.bin/groff/Makefile.comm +++ b/gnu/usr.bin/groff/Makefile.comm @@ -1,3 +1,5 @@ +#	$Id$ +  # Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.  #      Written by James Clark (jjc@jclark.com)  # @@ -93,14 +95,14 @@ extraclean:  	else \  	  $(YACC) $(YACCFLAGS) $<; \  	fi -	mv y.tab.c $@ +	mv -f y.tab.c $@  # Avoid ending up with two versions of $(YTABH).  	if test -n "$(YTABH)"; then \  	  if test -f $(srcdir)/$(YTABH); then \  	    rm -f $(YTABH); \ -	    mv y.tab.h $(srcdir)/$(YTABH); \ +	    mv -f y.tab.h $(srcdir)/$(YTABH); \  	  else \ -	    mv y.tab.h $(YTABH); \ +	    mv -f y.tab.h $(YTABH); \  	  fi; \  	fi @@ -217,7 +219,7 @@ uninstall_dev:  .PHONY: depend_src  depend_src: depend.temp -	mv depend.temp Makefile.dep +	mv -f depend.temp Makefile.dep  depend.temp: FORCE  	> depend.temp; @@ -227,7 +229,7 @@ depend.temp: FORCE  	  || $(CC) $(ALL_CFLAGS) -MM $(CSRCS) >>depend.temp  	if test -n "$(YTABH)"; then \  	  sed -e 's|$(YTABH)|$(YTABC)|g' depend.temp >depend.temp1; \ -	  mv depend.temp1 depend.temp; \ +	  mv -f depend.temp1 depend.temp; \  	fi  .PHONY: TAGS_src diff --git a/gnu/usr.bin/groff/Makefile.dev b/gnu/usr.bin/groff/Makefile.dev index 4f6948fb19d6..2aa71f87e116 100644 --- a/gnu/usr.bin/groff/Makefile.dev +++ b/gnu/usr.bin/groff/Makefile.dev @@ -13,18 +13,15 @@ FONTMODE?=	444  all:	$(FONTFILES) -.if !target(maninstall) -maninstall: -	@echo -n -.endif - -.if !target(install) -install: -	for f in $(FONTFILES); do \ -		ff=$$f; test -f $$f || ff=${.CURDIR}/$$f || true; \ -		install -c -o $(FONTOWN) -g $(FONTGRP) -m $(FONTMODE) $$ff \ -			$(DESTDIR)$(DEVICEDIR)/$$f; \ -	done +.for f in $(FONTFILES) +.if exists($f) +beforeinstall: $f +.else +beforeinstall: $(.CURDIR)/$f  .endif +.endfor +beforeinstall: +	$(INSTALL) -c -o $(FONTOWN) -g $(FONTGRP) -m $(FONTMODE) \ +		${.ALLSRC} $(DESTDIR)$(DEVICEDIR)  .include <bsd.prog.mk> diff --git a/gnu/usr.bin/groff/Makefile.in b/gnu/usr.bin/groff/Makefile.in index 321fc2ef19d6..723798716348 100644 --- a/gnu/usr.bin/groff/Makefile.in +++ b/gnu/usr.bin/groff/Makefile.in @@ -1,3 +1,5 @@ +#	$Id$ +  # Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.  #      Written by James Clark (jjc@jclark.com)  # @@ -338,7 +340,7 @@ dist:  	done; \  	rm -f Makefile; \  	$(LN_S) $$srcdir/Makefile.init Makefile -	mv tmp groff-$(version) +	mv -f tmp groff-$(version)  	tar cfh - groff-$(version) | gzip -c >groff-$(version).tar.gz  	rm -fr groff-$(version) diff --git a/gnu/usr.bin/groff/addftinfo/addftinfo.man b/gnu/usr.bin/groff/addftinfo/addftinfo.man index 4c92477c7b8b..0b6b796a7497 100644 --- a/gnu/usr.bin/groff/addftinfo/addftinfo.man +++ b/gnu/usr.bin/groff/addftinfo/addftinfo.man @@ -79,7 +79,6 @@ If a parameter is not specified the default will be used.  The defaults are chosen to have the reasonable values for  a Times font.  .SH "SEE ALSO" -.BR font (5)  .BR groff_font (@MAN5EXT@),  .BR groff (@MAN1EXT@),  .BR groff_char (@MAN7EXT@) diff --git a/gnu/usr.bin/groff/grodvi/Makefile b/gnu/usr.bin/groff/grodvi/Makefile index 9dafc47937bf..de4a71258fc3 100644 --- a/gnu/usr.bin/groff/grodvi/Makefile +++ b/gnu/usr.bin/groff/grodvi/Makefile @@ -4,7 +4,7 @@ PROG=		grodvi  SRCS=		dvi.cc  CFLAGS+=	-I${.CURDIR}/../include  LDADD+=		${LIBDRIVER} ${LIBGROFF} -lm -DPADD+=		${LIBDRIVER} ${LIBGROFF} ${LIBMATH} +DPADD+=		${LIBDRIVER} ${LIBGROFF} ${LIBM}  MANDEPEND=	grodvi.1  CLEANFILES+=	${MANDEPEND} diff --git a/gnu/usr.bin/groff/groff/Makefile b/gnu/usr.bin/groff/groff/Makefile index 6499244622c6..9539f700d560 100644 --- a/gnu/usr.bin/groff/groff/Makefile +++ b/gnu/usr.bin/groff/groff/Makefile @@ -4,7 +4,7 @@ PROG=		groff  SRCS=		groff.cc pipeline.c  CFLAGS+=	-I${.CURDIR}/../include  LDADD+=		${LIBGROFF} -lm -DPADD+=		${LIBGROFF} ${LIBMATH} +DPADD+=		${LIBGROFF} ${LIBM}  MANDEPEND=	groff.1  CLEANFILES+=	${MANDEPEND} diff --git a/gnu/usr.bin/groff/groff/groff.man b/gnu/usr.bin/groff/groff/groff.man index a1a337ac05f6..40961ccc256f 100644 --- a/gnu/usr.bin/groff/groff/groff.man +++ b/gnu/usr.bin/groff/groff/groff.man @@ -83,6 +83,9 @@ For typewriter-like devices  .TP  .B latin1  For typewriter-like devices using the ISO Latin-1 character set. +.TP +.B koi8-r +For typewriter-like devices using the russian KOI8-R character set.  .LP  The postprocessor to be used for a device is specified by the  .B postpro @@ -344,7 +347,7 @@ The most recent released version of groff is always available for  anonymous ftp from prep.ai.mit.edu (18.71.0.38) in the directory  pub/gnu.  .SH "SEE ALSO" -.BR grog (@MAN1EXT@), +.\" .BR grog (@MAN1EXT@),  .BR @g@troff (@MAN1EXT@),  .BR @g@tbl (@MAN1EXT@),  .BR @g@pic (@MAN1EXT@), @@ -354,7 +357,7 @@ pub/gnu.  .BR grops (@MAN1EXT@),  .BR grodvi (@MAN1EXT@),  .BR grotty (@MAN1EXT@), -.BR gxditview (@MAN1EXT@), +.\" .BR gxditview (@MAN1EXT@),  .BR groff_font (@MAN5EXT@),  .BR groff_out (@MAN5EXT@),  .BR groff_ms (@MAN7EXT@), diff --git a/gnu/usr.bin/groff/grops/Makefile b/gnu/usr.bin/groff/grops/Makefile index 3716f18484c7..7b68bc18d22c 100644 --- a/gnu/usr.bin/groff/grops/Makefile +++ b/gnu/usr.bin/groff/grops/Makefile @@ -4,7 +4,7 @@ PROG=		grops  SRCS=		ps.cc psrm.cc  CFLAGS+=	-I${.CURDIR}/../include  LDADD+=		${LIBDRIVER} ${LIBGROFF} -lm -DPADD+=		${LIBDRIVER} ${LIBGROFF} ${LIBMATH} +DPADD+=		${LIBDRIVER} ${LIBGROFF} ${LIBM}  MANDEPEND=	grops.1  CLEANFILES+=	${MANDEPEND} diff --git a/gnu/usr.bin/groff/grops/grops.man b/gnu/usr.bin/groff/grops/grops.man index 7a2d0bd90fb8..1f4947ebf863 100644 --- a/gnu/usr.bin/groff/grops/grops.man +++ b/gnu/usr.bin/groff/grops/grops.man @@ -609,7 +609,7 @@ The input to  must be in the format output by  .BR @g@troff (@MAN1EXT@).  This is described in -.BR groff_out (@MAN1EXT@). +.BR groff_out (@MAN5EXT@).  In addition the device and font description files for the device used  must meet certain requirements.  The device and font description files supplied for @@ -808,7 +808,7 @@ Macros to undo the effect of  .BI /tmp/grops XXXXXX  Temporary file.  .SH "SEE ALSO" -.BR afmtodit (@MAN1EXT@), +.\" .BR afmtodit (@MAN1EXT@),  .BR groff (@MAN1EXT@),  .BR @g@troff (@MAN1EXT@),  .BR psbb (@MAN1EXT@), diff --git a/gnu/usr.bin/groff/grotty/Makefile b/gnu/usr.bin/groff/grotty/Makefile index d9d1ab287127..18bd9ba18bab 100644 --- a/gnu/usr.bin/groff/grotty/Makefile +++ b/gnu/usr.bin/groff/grotty/Makefile @@ -4,7 +4,7 @@ PROG=		grotty  SRCS=		tty.cc  CFLAGS+=	-I${.CURDIR}/../include  LDADD+=		${LIBDRIVER} ${LIBGROFF} -lm -DPADD+=		${LIBDRIVER} ${LIBGROFF} ${LIBMATH} +DPADD+=		${LIBDRIVER} ${LIBGROFF} ${LIBM}  MANDEPEND=	grotty.1  CLEANFILES+=	${MANDEPEND} diff --git a/gnu/usr.bin/groff/grotty/grotty.man b/gnu/usr.bin/groff/grotty/grotty.man index 6b7e7471dbd3..9e7d31c90544 100644 --- a/gnu/usr.bin/groff/grotty/grotty.man +++ b/gnu/usr.bin/groff/grotty/grotty.man @@ -22,7 +22,8 @@ should invoked by using the  .B groff  command  with a -.B \-Tascii +.BR \-Tascii , +.B \-Tkoi8-r  or  .B \-Tlatin1  option. @@ -101,7 +102,8 @@ Search the directory  for font and device description files;  .I name  is the name of the device, usually -.B ascii +.BR ascii , +.B koi8-r  or  .BR latin1 .  .TP @@ -150,28 +152,18 @@ characters.  Print the version number.  .SH FILES  .TP -.B @FONTDIR@/devascii/DESC +.B @FONTDIR@/dev\fIname\fB/DESC  Device description file for -.B ascii +.I name  device.  .TP -.B @FONTDIR@/devascii/ F +.BI @FONTDIR@/dev\fIname\fB/ F  Font description file for font  .I F  of -.B ascii device. -.TP -.B @FONTDIR@/devlatin1/DESC -Device description file for -.B latin1 +.I name  device.  .TP -.B @FONTDIR@/devlatin1/ F -Font description file for font -.I F -of -.B latin1 device. -.TP  .B @MACRODIR@/tmac.tty  Macros for use with  .BR grotty . @@ -200,5 +192,4 @@ cannot be printed.  .BR groff_font (@MAN5EXT@),  .BR groff_char (@MAN7EXT@),  .BR ul (1), -.BR more (1), -.BR less (1) +.BR more (1) diff --git a/gnu/usr.bin/groff/indxbib/Makefile b/gnu/usr.bin/groff/indxbib/Makefile index be2bb8f2b30a..0508c6675a4a 100644 --- a/gnu/usr.bin/groff/indxbib/Makefile +++ b/gnu/usr.bin/groff/indxbib/Makefile @@ -4,7 +4,7 @@ PROG=		indxbib  SRCS=		indxbib.cc dirnamemax.c signal.c  CFLAGS+=	-I${.CURDIR}/../include  LDADD+= 	${LIBBIB} ${LIBGROFF} -lm -DPADD+= 	${LIBBIB} ${LIBGROFF} ${LIBMATH} +DPADD+= 	${LIBBIB} ${LIBGROFF} ${LIBM}  MANDEPEND=	indxbib.1  CLEANFILES+=	${MANDEPEND} @@ -14,7 +14,7 @@ CLEANFILES+=	${MANDEPEND}  # Sigh... Hardcode it.  	- jkh  #  afterinstall: -	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/eign \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/eign \  		${DESTDIR}${SHAREDIR}/dict  .include "../Makefile.cfg" diff --git a/gnu/usr.bin/groff/libgroff/cmap.cc b/gnu/usr.bin/groff/libgroff/cmap.cc index 640f4bfecb05..7c35253a483c 100644 --- a/gnu/usr.bin/groff/libgroff/cmap.cc +++ b/gnu/usr.bin/groff/libgroff/cmap.cc @@ -19,6 +19,9 @@ with groff; see the file COPYING.  If not, write to the Free Software  Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */  #include <ctype.h> +#ifdef __FreeBSD__ +#include <locale.h> +#endif  #include "cmap.h"  cmap cmlower(CMAP_BUILTIN); @@ -49,6 +52,9 @@ cmap_init::cmap_init()    if (initialised)      return;    initialised = 1; +#ifdef __FreeBSD__ +  (void) setlocale(LC_CTYPE, ""); +#endif    for (int i = 0; i <= UCHAR_MAX; i++) {      cmupper.v[i] = ISASCII(i) && islower(i) ? toupper(i) : i;      cmlower.v[i] = ISASCII(i) && isupper(i) ? tolower(i) : i; diff --git a/gnu/usr.bin/groff/libgroff/cset.cc b/gnu/usr.bin/groff/libgroff/cset.cc index 1319aa77edbe..c720d1b9eed8 100644 --- a/gnu/usr.bin/groff/libgroff/cset.cc +++ b/gnu/usr.bin/groff/libgroff/cset.cc @@ -19,6 +19,9 @@ with groff; see the file COPYING.  If not, write to the Free Software  Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */  #include <ctype.h> +#ifdef __FreeBSD__ +#include <locale.h> +#endif  #include "cset.h"  cset csalpha(CSET_BUILTIN); @@ -86,6 +89,9 @@ cset_init::cset_init()    if (initialised)      return;    initialised = 1; +#ifdef __FreeBSD__ +  (void) setlocale(LC_CTYPE, ""); +#endif    for (int i = 0; i <= UCHAR_MAX; i++) {      csalpha.v[i] = ISASCII(i) && isalpha(i);      csupper.v[i] = ISASCII(i) && isupper(i); diff --git a/gnu/usr.bin/groff/lkbib/Makefile b/gnu/usr.bin/groff/lkbib/Makefile index c7e8d2a506ee..d00f0f688975 100644 --- a/gnu/usr.bin/groff/lkbib/Makefile +++ b/gnu/usr.bin/groff/lkbib/Makefile @@ -4,7 +4,7 @@ PROG=		lkbib  SRCS=		lkbib.cc  CFLAGS+=	-I${.CURDIR}/../include  LDADD+=		${LIBBIB} ${LIBGROFF} -lm -DPADD+=		${LIBBIB} ${LIBGROFF} ${LIBMATH} +DPADD+=		${LIBBIB} ${LIBGROFF} ${LIBM}  MANDEPEND=	lkbib.1  CLEANFILES+=	${MANDEPEND} diff --git a/gnu/usr.bin/groff/lookbib/Makefile b/gnu/usr.bin/groff/lookbib/Makefile index dde1c71e2a2b..fb1a65c87f66 100644 --- a/gnu/usr.bin/groff/lookbib/Makefile +++ b/gnu/usr.bin/groff/lookbib/Makefile @@ -4,7 +4,7 @@ PROG=		lookbib  SRCS=		lookbib.cc  CFLAGS+=	-I$(.CURDIR)/../include  LDADD+=		$(LIBBIB) $(LIBGROFF) -lm -DPADD+=		$(LIBBIB) $(LIBGROFF) $(LIBMATH) +DPADD+=		$(LIBBIB) $(LIBGROFF) $(LIBM)  MANDEPEND=	lookbib.1  CLEANFILES+=	${MANDEPEND} diff --git a/gnu/usr.bin/groff/mm/Makefile b/gnu/usr.bin/groff/mm/Makefile index f2ea0b35639e..9023bb85ba21 100644 --- a/gnu/usr.bin/groff/mm/Makefile +++ b/gnu/usr.bin/groff/mm/Makefile @@ -13,9 +13,9 @@ MANDEPEND=	${MAN7}  CLEANFILES+=	${MANDEPEND}  afterinstall: -	install -c -o $(TMACOWN) -g $(TMACGRP) -m $(TMACMODE) \ +	${INSTALL} -c -o $(TMACOWN) -g $(TMACGRP) -m $(TMACMODE) \  		$(.CURDIR)/tmac.m $(DESTDIR)$(TMACDIR)/tmac.m -	install -c -o $(TMACOWN) -g $(TMACGRP) -m $(TMACMODE) \ +	${INSTALL} -c -o $(TMACOWN) -g $(TMACGRP) -m $(TMACMODE) \  		$(.CURDIR)/tmac.m $(DESTDIR)$(TMACDIR)/tmac.mse  	test -d $(DESTDIR)$(TMACDIR)/mm || mkdir $(DESTDIR)$(TMACDIR)/mm @@ -23,8 +23,7 @@ afterinstall:  	chmod 755 $(DESTDIR)$(TMACDIR)/mm  	for f in $(FILES); do \ -		rm -f $(DESTDIR)$(TMACDIR)/mm/$$f; \ -		install -c -o $(TMACOWN) -g $(TMACGRP) -m $(TMACMODE) \ +		$(INSTALL) -c -o $(TMACOWN) -g $(TMACGRP) -m $(TMACMODE) \  			$(.CURDIR)/mm/$$f $(DESTDIR)$(TMACDIR)/mm/$$f; \  	done  	for f in $(LOCALE); do \ diff --git a/gnu/usr.bin/groff/nroff/Makefile b/gnu/usr.bin/groff/nroff/Makefile index 8998b2daf8ca..6758dd4b9c57 100644 --- a/gnu/usr.bin/groff/nroff/Makefile +++ b/gnu/usr.bin/groff/nroff/Makefile @@ -4,9 +4,9 @@ MANDEPEND=	nroff.1  CLEANFILES+=	${MANDEPEND}  afterinstall: -	install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \  		$(.CURDIR)/nroff.sh $(DESTDIR)$(BINDIR)/nroff -	install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \  		$(.CURDIR)/psroff.sh $(DESTDIR)$(BINDIR)/psroff  .include <../Makefile.cfg> diff --git a/gnu/usr.bin/groff/pic/Makefile b/gnu/usr.bin/groff/pic/Makefile index 90ef8d7bf3eb..5a0e171050e9 100644 --- a/gnu/usr.bin/groff/pic/Makefile +++ b/gnu/usr.bin/groff/pic/Makefile @@ -5,7 +5,7 @@ SRCS=		lex.cc main.cc object.cc common.cc troff.cc tex.cc  OBJS=		pic.o  CFLAGS+=	-I. -I${.CURDIR}/../include  LDADD+=		${LIBGROFF} -lm -DPADD+=		${LIBGROFF} ${LIBMATH} +DPADD+=		${LIBGROFF} ${LIBM}  MANDEPEND=	pic.1  CLEANFILES+=	pic.cc pic.tab.h ${MANDEPEND} diff --git a/gnu/usr.bin/groff/refer/Makefile b/gnu/usr.bin/groff/refer/Makefile index c82327adf424..ac8d5f059e53 100644 --- a/gnu/usr.bin/groff/refer/Makefile +++ b/gnu/usr.bin/groff/refer/Makefile @@ -5,7 +5,7 @@ SRCS=		command.cc ref.cc refer.cc token.cc  OBJS=		label.o  CFLAGS+=	-I. -I${.CURDIR}/../include  LDADD+=		${LIBBIB} ${LIBGROFF} -lm -DPADD+=		${LIBBIB} ${LIBGROFF} ${LIBMATH} +DPADD+=		${LIBBIB} ${LIBGROFF} ${LIBM}  MANDEPEND=	refer.1  CLEANFILES+=	label.cc label.tab.h ${MANDEPEND} diff --git a/gnu/usr.bin/groff/tbl/Makefile b/gnu/usr.bin/groff/tbl/Makefile index c58e90e3f7d1..bdf9431dc914 100644 --- a/gnu/usr.bin/groff/tbl/Makefile +++ b/gnu/usr.bin/groff/tbl/Makefile @@ -4,7 +4,7 @@ PROG=		tbl  SRCS=		main.cc table.cc  CFLAGS+=	-I${.CURDIR}/../include  LDADD+=		${LIBGROFF} -lm -DPADD+=		${LIBGROFF} ${LIBMATH} +DPADD+=		${LIBGROFF} ${LIBM}  MANDEPEND=	tbl.1  CLEANFILES+=	${MANDEPEND} diff --git a/gnu/usr.bin/groff/tfmtodit/Makefile b/gnu/usr.bin/groff/tfmtodit/Makefile index d75c12f6ea33..541398642ab4 100644 --- a/gnu/usr.bin/groff/tfmtodit/Makefile +++ b/gnu/usr.bin/groff/tfmtodit/Makefile @@ -4,7 +4,7 @@ PROG=		tfmtodit  SRCS=		tfmtodit.cc  CFLAGS+=	-I${.CURDIR}/../include  LDADD+=		${LIBGROFF} -lm -DPADD+=		${LIBGROFF} ${LIBMATH} +DPADD+=		${LIBGROFF} ${LIBM}  MANDEPEND=	tfmtodit.1  CLEANFILES+=	${MANDEPEND} diff --git a/gnu/usr.bin/groff/tmac/Makefile b/gnu/usr.bin/groff/tmac/Makefile index 2c88f3b856cb..c4b310ea3f0e 100644 --- a/gnu/usr.bin/groff/tmac/Makefile +++ b/gnu/usr.bin/groff/tmac/Makefile @@ -6,8 +6,8 @@ TMACMODE?=	444  TMACDIR?=	/usr/share/tmac  MDOCDIR?=	${TMACDIR}/mdoc -MAN7=		groff_ms.7 me.7 -MLINKS=		groff_ms.7 ms.7 +MAN7=		groff_ms.7 me.7  +MLINKS=		groff_ms.7 ms.7 me.7 groff_me.7  LINKS=          ${TMACDIR}/tmac.andoc ${TMACDIR}/tmac.an  MANDEPEND=	${MAN7} @@ -22,26 +22,26 @@ MDOCFILES=	doc-common doc-ditroff doc-nroff doc-syms  beforeinstall:  	for f in ${FILES}; do \ -		install -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ +		${INSTALL} -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \  			${.CURDIR}/$$f ${DESTDIR}${TMACDIR}; \  	done  	sed -f ${.CURDIR}/strip.sed ${.CURDIR}/tmac.an >tmac.groff_an -	install -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ +	${INSTALL} -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \  		tmac.groff_an ${DESTDIR}${TMACDIR}  	for f in ${STRIPFILES}; do \  		rm -f temp; \  	  	sed -f ${.CURDIR}/strip.sed ${.CURDIR}/$$f >temp; \ -		install -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ +		${INSTALL} -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \  			temp ${DESTDIR}${TMACDIR}/$$f; \  	done  	for f in ${MDOCFILES}; do \  		rm -f temp; \  		sed -f ${.CURDIR}/strip.sed ${.CURDIR}/$$f >temp; \ -		install -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ +		${INSTALL} -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \  			temp ${DESTDIR}${MDOCDIR}/$$f; \  	done  	test -f ${DESTDIR}${TMACDIR}/man.local || \ -		install -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ +		${INSTALL} -c -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \  			${.CURDIR}/man.local ${DESTDIR}${TMACDIR}  .include "../Makefile.cfg" diff --git a/gnu/usr.bin/groff/tmac/tmac.doc.old b/gnu/usr.bin/groff/tmac/tmac.doc.old index 51a0ec0053a5..df44cc3c8fcd 100644 --- a/gnu/usr.bin/groff/tmac/tmac.doc.old +++ b/gnu/usr.bin/groff/tmac/tmac.doc.old @@ -315,9 +315,9 @@  .	if "\\$3"" \{\  .		\" Volume Title if none given  .		if \\$2>=1 .if \\$2<=8 \{\ -.			ds vT UNIX Reference Manual -.			if \\$2>1 .if \\$2<6 .ds vT UNIX Programmer's Manual -.			if "\\$2"8" .ds vT UNIX System Manager's Manual +.			ds vT FreeBSD Reference Manual +.			if \\$2>1 .if \\$2<6 .ds vT FreeBSD Programmer's Manual +.			if "\\$2"8" .ds vT FreeBSD System Manager's Manual  .		\}  .		if "\\$2"unass"  .ds vT DRAFT  .		if "\\$2"draft"  .ds vT DRAFT diff --git a/gnu/usr.bin/groff/troff/Makefile b/gnu/usr.bin/groff/troff/Makefile index 61a237c8eccc..f51d93afc23e 100644 --- a/gnu/usr.bin/groff/troff/Makefile +++ b/gnu/usr.bin/groff/troff/Makefile @@ -3,7 +3,7 @@ SRCS=		env.cc node.cc input.cc div.cc symbol.cc dictionary.cc reg.cc \  		number.cc majorminor.cc  CFLAGS+=	-I${.CURDIR}/../include  LDADD+=		${LIBGROFF} -lm -DPADD+=		${LIBGROFF} ${LIBMATH} +DPADD+=		${LIBGROFF} ${LIBM}  MANDEPEND=	troff.1  CLEANFILES+=	majorminor.cc ${MANDEPEND} @@ -17,9 +17,9 @@ majorminor.cc: ${.CURDIR}/../VERSION  	\"`sed -e 's/^[^.]*\.\([0-9]*\).*$$/\1/' ${.CURDIR}/../VERSION`\"\; >>$@  afterinstall: -	install -c -o bin -g bin -m 444 ${.CURDIR}/hyphen.us \ +	${INSTALL} -c -o bin -g bin -m 444 ${.CURDIR}/hyphen.us \  		${DESTDIR}${tmacdir}/hyphen.us -	install -c -o bin -g bin -m 444 ${.CURDIR}/hyphen.us-ru \ +	${INSTALL} -c -o bin -g bin -m 444 ${.CURDIR}/hyphen.us-ru \  		${DESTDIR}${tmacdir}/hyphen.us-ru  .include "../Makefile.cfg" diff --git a/gnu/usr.bin/groff/xditview/Makefile b/gnu/usr.bin/groff/xditview/Makefile index 66d93178b668..b3453e5603d6 100644 --- a/gnu/usr.bin/groff/xditview/Makefile +++ b/gnu/usr.bin/groff/xditview/Makefile @@ -15,13 +15,14 @@ CFLAGS+=	-I${X11BASE}/include -DFONTPATH=\"$(fontpath)\"  SRCS+=		xditview.c Dvi.c draw.c font.c lex.c page.c parse.c \  		XFontName.c DviChar.c device.c  LDDESTDIR+=	-L${X11BASE}/lib -LDADD+=		-lXaw -lXmu -lXt -lXext -lX11 -lm +LDADD+=		-lXaw -lXmu -lXt -lSM -lICE -lXext -lX11 -lm  DPADD+=		${X11BASE}/lib/libXaw.a ${X11BASE}/lib/libXmu.a \ -		${X11BASE}/lib/libXt.a ${X11BASE}/lib/libXext.a \ +		${X11BASE}/lib/libXt.a ${X11BASE}/lib/libSM.a \ +		${X11BASE}/lib/libICE.a ${X11BASE}/lib/libXext.a \  		${X11BASE}/lib/libX11.a  afterinstall: -		install -c -o ${BINOWN} -g ${BINGRP} -m 444 \ +		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \  		${.CURDIR}/GXditview.ad \  		${DESTDIR}${X11BASE}/lib/X11/app-defaults/GXditview  .endif diff --git a/gnu/usr.bin/gzip/Makefile b/gnu/usr.bin/gzip/Makefile index e6f86523e47e..a646372be7a3 100644 --- a/gnu/usr.bin/gzip/Makefile +++ b/gnu/usr.bin/gzip/Makefile @@ -1,18 +1,24 @@  #       @(#)Makefile    5.3 (Berkeley) 5/12/90 +#	$Id$  PROG=	gzip  SRCS=	gzip.c zip.c deflate.c trees.c bits.c unzip.c inflate.c util.c \  	crypt.c lzw.c unlzw.c unlzh.c unpack.c getopt.c match.S -MAN1=	gzexe.1 gzip.1 zdiff.1 zforce.1 zmore.1 znew.1 +MAN1=	gzexe.1 gzip.1 zdiff.1 zforce.1 zmore.1 znew.1 zgrep.1  CFLAGS+=-DASMV -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DDIRENT=1  MLINKS= gzip.1 gunzip.1  gzip.1 zcat.1  gzip.1 gzcat.1 +MLINKS+= zgrep.1 zfgrep.1 zgrep.1 zegrep.1 +MLINKS+= zdiff.1 zcmp.1  LINKS+= ${BINDIR}/gzip ${BINDIR}/gunzip  LINKS+= ${BINDIR}/gzip ${BINDIR}/gzcat  LINKS+= ${BINDIR}/gzip ${BINDIR}/zcat +LINKS+= ${BINDIR}/zgrep ${BINDIR}/zegrep +LINKS+= ${BINDIR}/zgrep ${BINDIR}/zfgrep +LINKS+= ${BINDIR}/zdiff ${BINDIR}/zcmp  NOSHARED=yes -afterinstall: -	install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ +beforeinstall: +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \  	   ${.CURDIR}/zforce ${.CURDIR}/gzexe ${.CURDIR}/znew \  	   ${.CURDIR}/zmore ${.CURDIR}/zdiff ${.CURDIR}/zgrep \  	   ${DESTDIR}${BINDIR} @@ -20,7 +26,7 @@ afterinstall:  match.o: ${.CURDIR}/match.S  	$(CPP) ${.CURDIR}/match.S >_match.s  	$(CC) -c _match.s -	mv _match.o match.o +	mv -f _match.o match.o  	rm -f _match.s  .include <bsd.prog.mk> diff --git a/gnu/usr.bin/gzip/gzip.1 b/gnu/usr.bin/gzip/gzip.1 index 084dffd5e123..5304d30b44ea 100644 --- a/gnu/usr.bin/gzip/gzip.1 +++ b/gnu/usr.bin/gzip/gzip.1 @@ -367,8 +367,7 @@ explicit command line parameters. For example:  On Vax/VMS, the name of the environment variable is GZIP_OPT, to  avoid a conflict with the symbol set for invocation of the program.  .SH "SEE ALSO" -znew(1), zcmp(1), zmore(1), zforce(1), gzexe(1), zip(1), unzip(1), compress(1), -pack(1), compact(1) +znew(1), zcmp(1), zmore(1), zforce(1), gzexe(1), compress(1)  .SH "DIAGNOSTICS"  Exit status is normally 0;  if an error occurs, exit status is 1. If a warning occurs, exit status is 2. diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c index 6333f6cb7c67..2500143c3d34 100644 --- a/gnu/usr.bin/ld/ld.c +++ b/gnu/usr.bin/ld/ld.c @@ -32,7 +32,7 @@ static char sccsid[] = "@(#)ld.c	6.10 (Berkeley) 5/22/91";     Set, indirect, and warning symbol features added by Randy Smith. */  /* - *	$Id: ld.c,v 1.27.4.2 1995/08/25 04:39:51 davidg Exp $ + *	$Id: ld.c,v 1.27.4.3 1996/05/02 16:07:24 jdp Exp $   */  /* Define how to initialize system-dependent header fields.  */ @@ -3593,6 +3593,17 @@ write_file_syms(entry, syms_written_addr)  		if (!(lsp->flags & LS_WRITE))  			continue; +		if (discard_locals == DISCARD_ALL || +		    discard_locals == DISCARD_L && lsp->flags & LS_L_SYMBOL) { +			/* +			 * The user wants to discard this symbol, but it +			 * is referenced by a relocation.  We can still +			 * save some file space by suppressing the unique +			 * renaming of the symbol. +			 */ +			lsp->flags &= ~LS_RENAME; +		} +  		if (p->n_un.n_strx == 0)  			name = NULL;  		else if (!(lsp->flags & LS_RENAME)) diff --git a/gnu/usr.bin/ld/rtld/Makefile b/gnu/usr.bin/ld/rtld/Makefile index 12581d31712a..5a0d03c4fe72 100644 --- a/gnu/usr.bin/ld/rtld/Makefile +++ b/gnu/usr.bin/ld/rtld/Makefile @@ -1,4 +1,4 @@ -#	$Id: Makefile,v 1.14.4.1 1995/08/30 07:05:48 davidg Exp $ +#	$Id: Makefile,v 1.14.4.2 1996/05/02 16:14:02 jdp Exp $  PROG=	ld.so  SRCS=	mdprologue.S rtld.c malloc.c shlib.c etc.c md.c @@ -26,8 +26,8 @@ realinstall:  		:  	-chflags noschg ${DESTDIR}${BINDIR}/${PROG}  	-ln -f ${DESTDIR}${BINDIR}/${PROG} ${DESTDIR}${BINDIR}/${PROG}.old -	mv ${DESTDIR}${BINDIR}/${PROG}.new ${DESTDIR}${BINDIR}/${PROG} +	mv -f ${DESTDIR}${BINDIR}/${PROG}.new ${DESTDIR}${BINDIR}/${PROG}  	chflags schg ${DESTDIR}${BINDIR}/${PROG} -	-rm ${DESTDIR}${BINDIR}/${PROG}.old +	-rm -f ${DESTDIR}${BINDIR}/${PROG}.old  .include <bsd.prog.mk> diff --git a/gnu/usr.bin/ld/rtld/rtld.c b/gnu/usr.bin/ld/rtld/rtld.c index 839f7cd6ca6c..666c10a3772b 100644 --- a/gnu/usr.bin/ld/rtld/rtld.c +++ b/gnu/usr.bin/ld/rtld/rtld.c @@ -27,7 +27,7 @@   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.   * - *	$Id: rtld.c,v 1.24.4.2 1995/09/28 13:26:25 davidg Exp $ + *	$Id: rtld.c,v 1.24.4.3 1996/05/02 16:14:05 jdp Exp $   */  #include <sys/param.h> @@ -88,6 +88,8 @@ struct somap_private {  	struct so_map	*spd_parent;  	struct so_list	*spd_children;  	struct so_map	*spd_prev; +	dev_t		spd_dev; +	ino_t		spd_ino;  	int		spd_refcount;  	int		spd_flags;  #define RTLD_MAIN	0x01 @@ -491,17 +493,41 @@ map_object(path, sodp, parent)  	struct so_map	*parent;  {  	struct so_map	*smp; +	struct stat	statbuf;  	if(path == NULL)	/* Special case for the main program itself */  		smp = link_map_head;  	else { -		/* Check whether the shared object is already mapped */ +		/* +		 * Check whether the shared object is already mapped. +		 * We check first for an exact match by pathname.  That +		 * will detect the usual case.  If no match is found by +		 * pathname, then stat the file, and check for a match by +		 * device and inode.  That will detect the less common case +		 * involving multiple links to the same library. +		 */  		for(smp = link_map_head;  smp != NULL;  smp = smp->som_next) {  			if(!(LM_PRIVATE(smp)->spd_flags & (RTLD_MAIN|RTLD_RTLD))  			&& smp->som_path != NULL  			&& strcmp(smp->som_path, path) == 0)  				break;  		} +		if(smp == NULL) {  /* Check for a match by device and inode */ +			if (stat(path, &statbuf) == -1) { +				generror ("cannot stat \"%s\" : %s", +					path, strerror(errno)); +				return NULL; +			} +			for (smp = link_map_head;  smp != NULL; +			     smp = smp->som_next) { +				struct somap_private *smpp = LM_PRIVATE(smp); + +				if (!(smpp->spd_flags & (RTLD_MAIN | RTLD_RTLD)) +				&& smpp->spd_ino == statbuf.st_ino +				&& smpp->spd_dev == statbuf.st_dev) +					break; +			} +		}  	}  	if (smp == NULL) {	/* We must map the object */ @@ -589,6 +615,14 @@ map_object(path, sodp, parent)  		smpp->a_text = hdr.a_text;  		smpp->a_data = hdr.a_data;  		smpp->a_bss = hdr.a_bss; + +		/* +		 * Save the device and inode, so we can detect multiple links +		 * to the same library.  Note, if we reach this point, then +		 * statbuf is guaranteed to have been filled in. +		 */ +		smpp->spd_dev = statbuf.st_dev; +		smpp->spd_ino = statbuf.st_ino;  	}  	LM_PRIVATE(smp)->spd_refcount++; diff --git a/gnu/usr.bin/man/Makefile b/gnu/usr.bin/man/Makefile index 9e5955885307..2529d8dbd491 100644 --- a/gnu/usr.bin/man/Makefile +++ b/gnu/usr.bin/man/Makefile @@ -5,6 +5,6 @@  # distribution.  # -SUBDIR = lib man manpath apropos whatis makewhatis catman +SUBDIR = lib man manpath apropos  makewhatis catman  .include <bsd.subdir.mk> diff --git a/gnu/usr.bin/man/apropos/Makefile b/gnu/usr.bin/man/apropos/Makefile index bc6bdec90242..25dd83046268 100644 --- a/gnu/usr.bin/man/apropos/Makefile +++ b/gnu/usr.bin/man/apropos/Makefile @@ -1,44 +1,9 @@ -# $Id: Makefile,v 1.7 1994/06/05 21:57:03 csgr Exp $ +# $Id: Makefile,v 1.8 1994/08/28 18:33:42 bde Exp $ -.if exists(${.CURDIR}/obj) -MAN1=  ${.CURDIR}/obj/apropos.1 -TARG=  ${.CURDIR}/obj/apropos -.else -MAN1=  ${.CURDIR}/apropos.1 -TARG=  ${.CURDIR}/apropos -.endif +SHPROG=	apropos -MANDEPEND=	${MAN1} +MLINKS=	apropos.1 whatis.1 +LINKS=	${BINDIR}/apropos ${BINDIR}/whatis -CLEANFILES+=	${TARG} ${MAN1} - -all:	${TARG} ${MAN1} - -depend rcsfreeze tags all: -	@echo -n - -${TARG}: ${.CURDIR}/apropos.sh -	sed -e 's,%libdir%,${libdir},' -e 's,%bindir%,${bindir},' \ -	    -e 's,%pager%,${pager},' \ -		${.CURDIR}/apropos.sh > ${.TARGET} - -${MAN1}: ${.CURDIR}/apropos.man -	sed -e 's,%libdir%,${libdir},' -e 's,%bindir%,${bindir},' \ -	    -e 's,%pager%,${pager},' -e 's,%troff%,${troff},' \ -	    -e 's,%manpath_config_file%,${manpath_config_file},' \ -		${.CURDIR}/apropos.man > ${.TARGET} - -install: ${TARG} maninstall -	install -c -o bin -g bin -m 555 ${TARG} ${DESTDIR}/usr/bin - -.include "../Makefile.inc" - -.if make(maninstall) || make(install) -.if !defined(NOMAN) -.include <bsd.man.mk> -.elif !target(maninstall) -maninstall: -.endif -.endif - -.include <bsd.prog.mk> +.include "../../Makefile.inc" +.include "../Makefile.shprog" diff --git a/gnu/usr.bin/man/apropos/apropos.man b/gnu/usr.bin/man/apropos/apropos.man index 3bb3e17d617e..62b7d7a9d044 100644 --- a/gnu/usr.bin/man/apropos/apropos.man +++ b/gnu/usr.bin/man/apropos/apropos.man @@ -1,4 +1,4 @@ -.\" Man page for apropos +.\" Man page for apropos an whatis  .\"  .\" Copyright (c) 1990, 1991, John W. Eaton.  .\" @@ -15,13 +15,19 @@  .TH apropos 1 "Jan 15, 1991"  .LO 1  .SH NAME -apropos \- search the whatis database for strings +apropos, whatis \- search the whatis database  .SH SYNOPSIS  .BI apropos  keyword ... + +.BI whatis +keyword ...  .SH DESCRIPTION -apropos searches a set of database files containing short descriptions +.B apropos  +searches a set of database files containing short descriptions  of system commands for keywords and displays the result on the  standard output. +.B whatis +display only complete word matches.  .SH "SEE ALSO" -whatis(1), man(1). +man(1), makewhatis(1). diff --git a/gnu/usr.bin/man/apropos/apropos.sh b/gnu/usr.bin/man/apropos/apropos.sh index 070b8481c1ed..91b77c2530f0 100644 --- a/gnu/usr.bin/man/apropos/apropos.sh +++ b/gnu/usr.bin/man/apropos/apropos.sh @@ -13,52 +13,64 @@  # Department of Chemical Engineering  # The University of Texas at Austin  # Austin, Texas  78712 +# +# rewritten by Wolfram Schneider, Berlin, Feb 1996 +# +# $Id$ + -PATH=/usr/local/bin:/bin:/usr/ucb:/usr/bin +PATH=/bin:/usr/bin:$PATH +db=whatis	# name of whatis data base +grepopt='' -libdir=%libdir% +# argument test +case $# in 0)   +	echo "usage: `basename $0` keyword ..." >&2 +	exit 1 +	;;  +esac -if [ $# = 0 ] -then -    echo "usage: `basename $0` keyword ..." -    exit 1 -fi +case "$0" in +	*whatis) grepopt='-w';;	# run as whatis(1) +	*)	 grepopt='';;	# otherwise run as apropos(1) +esac +# test manpath  manpath=`%bindir%/manpath -q | tr : '\040'` +case X"$manpath" in X)  +	echo "`basename $0`: manpath is null, use \"/usr/share/man\"" >&2 +	manpath=/usr/share/man +	;; +esac -if [ "$manpath" = "" ] -then -    echo "whatis: manpath is null" -    exit 1 -fi -if [ "$PAGER" = "" ] -then -    PAGER="%pager%" -fi +# reset $PAGER if $PAGER is empty +case X"$PAGER" in X)  +	PAGER="%pager%" +	;;  +esac -while [ $1 ] +# search for existing */whatis databases +mandir='' +for d in $manpath  do -    found=0 -    for d in $manpath /usr/lib -    do -        if [ -f $d/whatis ] -        then -            grep -i "$1" $d/whatis -            status=$? -            if [ "$status" = "0" ] -            then -                found=1 -            fi -        fi -    done +        if [ -f "$d/$db" -a -r "$d/$db" ] +	then +		mandir="$mandir $d/$db" +	fi +done -    if [ "$found" = "0" ] -    then -        echo "$1: nothing appropriate" -    fi +case X"$mandir" in X) +	echo "`basename $0`: no whatis databases in $manpath" >&2 +	exit 1 +esac -    shift + +for manpage +do +	if grep -hi $grepopt "$manpage" $mandir; then : +	else +        	echo "$manpage: nothing appropriate" +	fi  done | $PAGER -exit diff --git a/gnu/usr.bin/man/catman/catman.1 b/gnu/usr.bin/man/catman/catman.1 index 09749777b026..1ac287b06589 100644 --- a/gnu/usr.bin/man/catman/catman.1 +++ b/gnu/usr.bin/man/catman/catman.1 @@ -30,7 +30,7 @@  .\"  .\"   E-mail: Wolfram Schneider <wosch@cs.tu-berlin.de>  .\" -.\" $Id: catman.1,v 1.4 1995/03/31 04:00:17 joerg Exp $ +.\" $Id: catman.1,v 1.5 1995/05/06 19:04:06 joerg Exp $  .\"  .Dd Mar 12, 1995 @@ -125,6 +125,13 @@ or  .Sh FEATURES  Very fast if all man pages already formatted. +Does not support the +.Fl w +option as some other systems do.  Use +.Xr makewhatis 1 +to rebuild the +.Ql whatis +database.  .Sh BUGS  .Xr man 1  is a setuid program.  Be careful that user diff --git a/gnu/usr.bin/man/catman/catman.perl b/gnu/usr.bin/man/catman/catman.perl index d21562fcb66c..d0723290f1ff 100644 --- a/gnu/usr.bin/man/catman/catman.perl +++ b/gnu/usr.bin/man/catman/catman.perl @@ -35,7 +35,7 @@  #  #   Email: Wolfram Schneider <wosch@cs.tu-berlin.de>  # -# $Id: catman.perl,v 1.12 1995/05/19 21:07:26 w Exp w $ +# $Id: catman.perl,v 1.6 1995/05/20 19:02:53 ache Exp $  sub usage { @@ -237,7 +237,7 @@ sub parse_subdir {  	next if $file eq "." || $file eq "..";  	# fo_09-o.bar0 -	if ($file !~ /^[\w\-\[\.]+\.\w+$/) { +	if ($file !~ /^[\w\-\+\[\.]+\.\w+$/) {  	    &garbage("$mandir/$file", "Assume garbage")  		unless -d "$mandir/$file";  	    next; @@ -294,7 +294,7 @@ sub parse_subdir {      foreach $file (readdir(D)) {  	next if $file =~ /^(\.|\.\.)$/;	# skip current and parent directory -	if ($file !~ /^[\w\-\[\.]+\.\w+$/) { +	if ($file !~ /^[\w\-\+\[\.]+\.\w+$/) {  	    &garbage("$catdir/$file", "Assume garbage")  		unless -d "$catdir/$file";  	    next; diff --git a/gnu/usr.bin/man/lib/config.h_dist b/gnu/usr.bin/man/lib/config.h_dist index 3438e6f0082a..4900c4d4a050 100644 --- a/gnu/usr.bin/man/lib/config.h_dist +++ b/gnu/usr.bin/man/lib/config.h_dist @@ -170,7 +170,7 @@  #ifndef MANPATH_MAIN    static char *std_sections[] =       { -       "1", "n", "l", "6", "8", "2", "3", "4", "5", "7", "p", "o", NULL +       "1", "n", "l", "6", "8", "2", "3", "4", "5", "7", "9", "p", "o", NULL      };  #endif diff --git a/gnu/usr.bin/man/makewhatis/Makefile b/gnu/usr.bin/man/makewhatis/Makefile index 644a3a59b6ed..7849d739de10 100644 --- a/gnu/usr.bin/man/makewhatis/Makefile +++ b/gnu/usr.bin/man/makewhatis/Makefile @@ -1,7 +1,16 @@  MAN1=	makewhatis.1 +MAN8=	makewhatis.local.8 +MLINKS=	makewhatis.local.8 catman.local.8 + +libexecdir=/usr/libexec +LINKS=${libexecdir}/makewhatis.local ${libexecdir}/catman.local   beforeinstall:  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \  	    ${.CURDIR}/makewhatis.perl ${DESTDIR}${BINDIR}/makewhatis +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ +	    ${.CURDIR}/makewhatis.local.sh \ +	    ${DESTDIR}${libexecdir}/makewhatis.local +  .include <bsd.prog.mk> diff --git a/gnu/usr.bin/man/makewhatis/makewhatis.1 b/gnu/usr.bin/man/makewhatis/makewhatis.1 index 4570b58d617e..71f69eb434fb 100644 --- a/gnu/usr.bin/man/makewhatis/makewhatis.1 +++ b/gnu/usr.bin/man/makewhatis/makewhatis.1 @@ -1,5 +1,5 @@  .\" -.\" (c) Copyright 1995 Wolfram Schneider. All rights reserved. +.\" (c) Copyright 1995 Wolfram Schneider, Berlin. All rights reserved.  .\"  .\" Redistribution and use in source and binary forms, with or without  .\" modification, are permitted provided that the following conditions @@ -30,7 +30,7 @@  .\"  .\"   Email: Wolfram Schneider <wosch@cs.tu-berlin.de>  .\" -.\" $Id: makewhatis.1,v 1.1 1995/02/15 22:52:51 joerg Exp $ +.\" $Id: makewhatis.1,v 1.2 1995/03/31 04:00:51 joerg Exp $  .\"  .Dd Jan, 12, 1995 @@ -41,26 +41,27 @@  .Nd create whatis database  .Sh SYNOPSIS -.Nm makewhatis +.Nm +.Op Fl a | Fl append +.Op Fl h | Fl help  .Op Fl i | Fl indent Ar column  .Op Fl n | Fl name Ar name  .Op Fl o | Fl outfile Ar file  .Op Fl v | Fl verbose -.Op Fl h | Fl help  .Op Ar directories ...  .Sh DESCRIPTION  -.Nm Makewhatis +.Nm  extracts the name and a short description from unformatted manpages  and creates the  .Xr whatis 1  database.  -.Nm Makewhatis  +.Nm  can read gzip'ed manpages.  .Ar Directory  names a directory containing manpage subdirectories -.Pq named Pa man[0-8] . +.Pq named Pa man.+ .  Colons are treated as spaces, hence  .Ic makewhatis $MANPATH  or @@ -69,34 +70,43 @@ are allowed.  .Sh OPTIONS  .Bl -tag -width Ds +.It Fl a , Fl append +Append mode. Don't delete old entries in whatis database. Note:  +the new database will be sorted without repeated lines and +.Nm +does not check if old entries are valid. +  .It Fl h , Fl help  Print options and exit. -.It Fl v, Fl verbose -Issue more warnings -.Pq to stderr . -For every parsed man page write a single char: -.Ql \&. -for an uncompressed page, -.Ql * -for a compressed page, and -.Ql + -for a link.  .It Fl i , Fl indent Ar column  Justify description strings to  .Ar column Pq default 24 . +.It Fl n , Fl name Ar name +Use +.Ar name +instead of +.Pa whatis Ns . +  .It Fl o , Fl outfile Ar file  Write all output to  .Ar file  instead of  .Pa dirname/whatis Ns . -.It Fl n , Fl name Ar name -Use -.Ar name -instead of -.Pa whatis Ns . +.It Fl v, Fl verbose +Issue more warnings +.Pq to stderr . +For every parsed man page write a single char: +.Ql \&. +for an uncompressed page, +.Ql * +for a compressed page, and +.Ql + +for a link. +.El +  .Sh EXAMPLES  .Pp @@ -108,8 +118,7 @@ Create whatis database for all directories in your  .Ic makewhatis -outfile /tmp/mywhatis /usr/local/man $HOME/man  .Pp  Create whatis database  -.Pa /tmp/mywhatis -\&. +.Pa /tmp/mywhatis .  Traverse directories  .Pa /usr/local/man  and @@ -133,16 +142,19 @@ May be useful for Solaris.  whatis database  .It Pa /etc/weekly  run -.Nm +.Nm makewhatis.local  every week  .El  .Sh SEE ALSO -.Xr man 1 , -.Xr whatis 1 ,  .Xr apropos 1 , +.Xr catman 1 , +.Xr sort 1 , +.Xr makewhatis.local 1 , +.Xr man 1 ,  .Xr manpath 1 , -.Xr catman 1 . +.Xr uniq 1 , +.Xr whatis 1 .  .Sh HISTORY  This @@ -150,6 +162,5 @@ This  command appeared in FreeBSD 2.1.  .Sh AUTHOR -Wolfram Schneider -.Aq wosch@cs.tu-berlin.de , -Germany +Wolfram Schneider, Berlin. + diff --git a/gnu/usr.bin/man/makewhatis/makewhatis.perl b/gnu/usr.bin/man/makewhatis/makewhatis.perl index af2fc5d1a1ff..e6a7748d0eba 100644 --- a/gnu/usr.bin/man/makewhatis/makewhatis.perl +++ b/gnu/usr.bin/man/makewhatis/makewhatis.perl @@ -35,7 +35,7 @@  #  #   E-Mail: Wolfram Schneider <wosch@cs.tu-berlin.de>  # -# $Id: makewhatis.perl,v 1.5 1995/03/31 04:00:53 joerg Exp $ +# $Id: makewhatis.perl,v 1.6 1995/04/01 11:43:09 joerg Exp $  #  sub usage { @@ -61,14 +61,38 @@ sub open_output {      }      $tmp = $whatisdb;		# for signals -    if (!open(A, "> $whatisdb")) { -	die "$whatisdb: $!\n" if $outfile; -	warn "$whatisdb: $!\n"; $err++; return 0; -    } +    # Array of all entries      @a = (); + +    # Append mode +    if ($append) { +	local($file) = $whatisdb; +	$file =~ s/\.tmp$// if !$outfile; +	 +	if (open(A, "$file")) { +	    warn "Open $file for append mode\n" if $verbose;	     +	    while(<A>) { +		push(@a, $_); +	    } +	    close A; +	}  + +	else { +	    warn "$whatisdb: $!\n" if lstat($file) && $verbose;	#  +	} +	undef $file; +    } + +      warn "Open $whatisdb\n" if $verbose; +    if (!open(A, "> $whatisdb")) { +        die "$whatisdb: $!\n" if $outfile; + +        warn "$whatisdb: $!\n"; $err++; return 0; +    } +       select A;      return 1;  } @@ -83,21 +107,21 @@ sub close_output {      if ($success) {		# success  	# uniq -	@b = ();  	warn "\n" if $verbose && $pointflag;  	warn "sort -u > $whatisdb\n" if $verbose;  	foreach $i (sort @a) {  	    if ($i ne $last) {  		push(@b, $i); -		$counter++;  	    }  	    $last =$i;  	} + +	$counter = $#b + 1;  	print @b; close A; select STDOUT;  	if (!$outfile) { -	    rename($whatisdb, $w);  	    warn "Rename $whatisdb to $w\n" if $verbose; +	    rename($whatisdb, $w) || warn "rename $whatisdb $w\n";  	    $counter_all += $counter;  	    warn "$counter entries in $w\n" if $verbose;  	} else { @@ -220,8 +244,9 @@ sub ext {  sub name {      local($name) = @_; -    $name =~ s/.*\///g; -    $name =~ s/\.[^.]*$//; +    $name =~ s=.*/==; +    $name =~ s=$ext$==o; +    $name =~ s=\.[^\.]+$==;      return "$name";  } @@ -250,6 +275,9 @@ sub out {      $man =~ s/[,. ]+$//;      $man =~ s/,/($extension),/g;      $man .= "($extension)"; + +    &manpagename; +      $desc =~ s/^[ \t]+//;      for($i = length($man); $i < $indent && $desc; $i++) { @@ -262,6 +290,33 @@ sub out {      }  } +# The filename of manual page is not a keyword.  +# This is bad, because you don't find the manpage +# whith: $ man <section> <keyword> +# +# Add filename if a) filename is not a keyword and b) no keyword(s) +# exist as file in same mansection +# +sub manpagename { +    foreach (split(/,\s+/, $man)) { +	s/\(.+//; +	# filename is keyword +	return if $name eq $_; +    } + +    local($f) = $file;  $f =~ s%/*[^/]+$%%;		# dirname +    local($e) = $file;  $e =~ s/$ext$//;  $e =~ s%.*(\.[^.]+)$%$1%; # .1 + +    foreach (split(/,\s+/, $man)) { +	s/\(.+//; + +	# a keyword exist as file +	return if -e "$f/$_$e" || -e "$f/$_$e$ext";     +    } + +    $man = "$name($extension), $man"; +} +  # looking for NAME  sub manual {      local($file) = @_; @@ -380,11 +435,12 @@ sub variables {      $indent = 24;		# indent for description      $outfile = 0;		# Don't write to ./whatis      $whatis_name = "whatis";	# Default name for DB +    $append = 0;		# Don't delete old entries      # if no argument for directories given      @defaultmanpath = ( '/usr/share/man' ); -    $ext = ".gz";		# extension +    $ext = '.gz';		# extension      umask(022);      $err = 0;			# exit code @@ -422,6 +478,7 @@ sub parse {  	elsif (/^--?(o|outfile)$/)      { $outfile = $argv[0]; shift @argv }  	elsif (/^--?(f|format|i|indent)$/) { $i = $argv[0]; shift @argv }  	elsif (/^--?(n|name)$/)         { $whatis_name = $argv[0];shift @argv } +	elsif (/^--?(a|append)$/)       { $append = 1 }  	else                            { &usage }      } diff --git a/gnu/usr.bin/man/man/Makefile b/gnu/usr.bin/man/man/Makefile index 5eafd803f00e..1807455e219d 100644 --- a/gnu/usr.bin/man/man/Makefile +++ b/gnu/usr.bin/man/man/Makefile @@ -18,8 +18,10 @@ DPADD+=  ${MAN1}  CFLAGS+= -I${.CURDIR}/../lib -DSTDC_HEADERS -DPOSIX -DHAS_TROFF  CFLAGS+= -DDO_COMPRESS -DALT_SYSTEMS -DSETREUID -DCATMODE=0664  CLEANFILES+=	${MAN1} +MANDEPEND+=	${MAN1}  ${MAN1}: ${.CURDIR}/man.man +	@${ECHO} echo Making ${.TARGET:T} from ${.ALLSRC:T}; \  	sed -e 's,%libdir%,${libdir},' -e 's,%bindir%,${bindir},' \  	    -e 's,%pager%,${pager},' -e 's,%troff%,${troff},' \  	    -e 's,%manpath_config_file%,${manpath_config_file},' \ diff --git a/gnu/usr.bin/man/man/man.man b/gnu/usr.bin/man/man/man.man index bddfc028b7f7..7556c58d3074 100644 --- a/gnu/usr.bin/man/man/man.man +++ b/gnu/usr.bin/man/man/man.man @@ -127,7 +127,7 @@ the man page.  By default,  .B %pager%  is used.  .SH "SEE ALSO" -apropos(1), whatis(1), manpath(1), less(1), groff(1). +apropos(1), whatis(1), manpath(1), more(1), groff(1).  .SH BUGS  The  .B \-t diff --git a/gnu/usr.bin/man/manpath/Makefile b/gnu/usr.bin/man/manpath/Makefile index 970f442a58f3..6633d6c1bd04 100644 --- a/gnu/usr.bin/man/manpath/Makefile +++ b/gnu/usr.bin/man/manpath/Makefile @@ -17,14 +17,17 @@ DPADD+=  ${MAN1}  CFLAGS+= -DMAIN -DSTDC_HEADERS -DPOSIX -DHAS_TROFF -DDO_UNCOMPRESS  CFLAGS+= -DALT_SYSTEMS -I${.CURDIR}/../lib -I${.CURDIR}/../lib/obj  CLEANFILES+=	${MAN1} +MANDEPEND+=	${MAN1}  ${MAN1}: ${.CURDIR}/manpath.man +	@${ECHO} Making ${.TARGET:T} from ${.ALLSRC:T}; \  	sed -e 's,%libdir%,${libdir},' -e 's,%bindir%,${bindir},' \  	    -e 's,%pager%,${pager},' -e 's,%troff%,${troff},' \  	    -e 's,%manpath_config_file%,${manpath_config_file},' \  	${.CURDIR}/manpath.man > ${MAN1}  afterinstall: -	install -c -o bin -g bin -m 644 ${.CURDIR}/manpath.config ${DESTDIR}${manpath_config_file}.sample +	${INSTALL} -c -o bin -g bin -m 644 ${.CURDIR}/manpath.config \ +	    ${DESTDIR}${manpath_config_file}.sample  .include <bsd.prog.mk> diff --git a/gnu/usr.bin/man/manpath/manpath.config b/gnu/usr.bin/man/manpath/manpath.config index b43c7a6aee27..91aac298531e 100644 --- a/gnu/usr.bin/man/manpath/manpath.config +++ b/gnu/usr.bin/man/manpath/manpath.config @@ -16,7 +16,7 @@  #  MANDATORY_MANPATH	/usr/share/man  MANDATORY_MANPATH	/usr/local/man -MANDATORY_MANPATH	/usr/X386/man +#MANDATORY_MANPATH	/usr/X386/man  MANDATORY_MANPATH	/usr/X11R6/man  #  # set up PATH to MANPATH mapping diff --git a/gnu/usr.bin/mkisofs/ChangeLog b/gnu/usr.bin/mkisofs/ChangeLog index b31a554e7d31..8dc41be1ffc9 100644 --- a/gnu/usr.bin/mkisofs/ChangeLog +++ b/gnu/usr.bin/mkisofs/ChangeLog @@ -1,4 +1,39 @@ -Wed Jan 11 13:46:50 1995  Eric Youngdale  (eric@localhost) +Sun Feb 26 01:52:06 1995  Eric Youngdale  (eric@largo) + +	* Add patches from Ross Biro to allow you to merge arbitrary +	trees into the image.  This is not compiled in by default but +	you need to add -DADD_FILES when compiling. + +Fri Feb 17 02:29:03 1995  Paul Eggert  <eggert@twinsun.com> + +	* tree.c: Port to Solaris 2.4.  Prefer <sys/mkdev.h> if +	HASMKDEV.  Cast unknown integer types to unsigned long and +	print them with %lu or %lx. + +Thu Jan 26 15:25:00 1995  H. Peter Anvin  (hpa@yggdrasil.com) + +	* mkisofs.c: Substitute underscore for leading dot in non-Rock +	Ridge filenames, since MS-DOS cannot read files whose names +	begin with a period. + +Mon Jan 16 18:31:41 1995  Eric Youngdale  (eric@aib.com) + +	* rock.c (generate_rock_ridge_attributes): Only use ROOT +	record for symlinks if we are at the start of the symlink. +	Otherwise just generate an empty entry. + +Mon Jan 16 16:19:50 1995  Eric Youngdale  (eric@aib.com) + +	* diag/isodump.c: Use isonum_733 instead of trying to dereference +	pointers when trying to decode 733 numbers in the iso9660 image. + +	* diag/isovfy.c: Likewise. + +	* write.c: Always assign an extent number, even for zero length +	files.  A zero length file with a NULL extent is apparently dropped +	by many readers. + +Wed Jan 11 13:46:50 1995  Eric Youngdale  (eric@aib.com)  	* mkisofs.c: Modify extension record to conform to IEEE P1282  	specifications.  This is commented out right now, but a trivial diff --git a/gnu/usr.bin/mkisofs/Makefile.in b/gnu/usr.bin/mkisofs/Makefile.in index dd0d318acc5f..dceb17c2c483 100644 --- a/gnu/usr.bin/mkisofs/Makefile.in +++ b/gnu/usr.bin/mkisofs/Makefile.in @@ -43,7 +43,9 @@ mkisofs.o: mkisofs.c iso9660.h mkisofs.h exclude.h  clean:  	/bin/rm -f *.o core mkisofs *~ #*# +	(cd diag/; make clean) +	(cd cdwrite/; make clean)  dist: -	tar -cvf - README Configure Makefile.in make.com TODO  COPYING  ChangeLog *.8 *.c *.h diag | gzip > mkisofs-1.02.tar.gz +	tar -cvf - README Configure Makefile.in make.com TODO  COPYING  ChangeLog *.8 *.c *.h diag cdwrite.old cdwrite-1.5 | gzip > mkisofs-1.04.tar.gz diff --git a/gnu/usr.bin/mkisofs/README b/gnu/usr.bin/mkisofs/README index f71e2d7ff7c8..f2f415f66215 100644 --- a/gnu/usr.bin/mkisofs/README +++ b/gnu/usr.bin/mkisofs/README @@ -1,3 +1,8 @@ +Note: +	There is a feature which can be optionally compiled into +mkisofs that allows you to merge arbitrary directory trees into the +image you are creating.  You need to compile with -DADD_FILES for my +changes to take effect.   Thanks to Ross Biro biro@yggdrasil.com.  	This program requires a lot of virtual memory to run since it  builds all of the directories in memory.  The exact requirements @@ -5,6 +10,9 @@ depend upon a lot of things, but for Rock Ridge discs 12Mb would not  be unreasonable.  Without RockRidge and without the translation  tables, the requirements would be considerably less. +	The cdwrite utility is maintained separately from mkisofs by +yggdrasil.com.  It is enclosed here as a convenience, since the two programs +are often useful together.    *****************************  Notes for version 1.2. diff --git a/gnu/usr.bin/mkisofs/defaults.h b/gnu/usr.bin/mkisofs/defaults.h index 27b258cbddc0..03960d1471ab 100644 --- a/gnu/usr.bin/mkisofs/defaults.h +++ b/gnu/usr.bin/mkisofs/defaults.h @@ -11,12 +11,24 @@  #define  ABSTRACT_DEFAULT 	NULL  #define  VOLSET_ID_DEFAULT 	NULL  #define  VOLUME_ID_DEFAULT 	"CDROM" +  #ifdef __FreeBSD__  #define  SYSTEM_ID_DEFAULT 	"FreeBSD" -#else +#endif +  #ifdef __QNX__  #define  SYSTEM_ID_DEFAULT 	"QNX" -#else +#endif + +#ifdef __linux__  #define  SYSTEM_ID_DEFAULT 	"LINUX"  #endif + + +#ifdef __osf__ +#define  SYSTEM_ID_DEFAULT 	"OSF" +#endif + +#ifndef SYSTEM_ID_DEFAULT +#define  SYSTEM_ID_DEFAULT 	"UNKNOWNSYS"  #endif diff --git a/gnu/usr.bin/mkisofs/diag/Makefile b/gnu/usr.bin/mkisofs/diag/Makefile index 1aefdf68d418..e6f3a12f117f 100644 --- a/gnu/usr.bin/mkisofs/diag/Makefile +++ b/gnu/usr.bin/mkisofs/diag/Makefile @@ -1,10 +1,16 @@ -all: dump isodump isovfy +#CC = gcc +CC = cc -traditional + +all: dump isodump isovfy  + +isoinfo:isoinfo.c +	${CC} -g -o isoinfo isoinfo.c  dump:dump.c -	gcc -o dump dump.c +	${CC} -o dump dump.c  isodump:isodump.c -	gcc -o isodump isodump.c +	${CC} -o isodump isodump.c  isovfy:isovfy.c -	gcc -o isovfy isovfy.c +	${CC} -o isovfy isovfy.c  clean: -	rm dump isodump isovfy +	rm -f dump isodump isovfy isoinfo diff --git a/gnu/usr.bin/mkisofs/diag/isodump.c b/gnu/usr.bin/mkisofs/diag/isodump.c index 49ef4b91299d..442c6ed466f2 100644 --- a/gnu/usr.bin/mkisofs/diag/isodump.c +++ b/gnu/usr.bin/mkisofs/diag/isodump.c @@ -52,7 +52,7 @@ isonum_731 (char * p)  int -isonum_733 (char * p) +isonum_733 (unsigned char * p)  {  	return (isonum_731 (p));  } @@ -104,7 +104,7 @@ struct iso_directory_record {  	unsigned char interleave			[ISODCL (28, 28)]; /* 711 */  	unsigned char volume_sequence_number	[ISODCL (29, 32)]; /* 723 */  	unsigned char name_len		[ISODCL (33, 33)]; /* 711 */ -	unsigned char name			[0]; +	unsigned char name			[1];  };  #ifdef USE_TERMIOS @@ -285,13 +285,15 @@ int  dump_rr(struct iso_directory_record * idr)  {  	int len; -	char * pnt; +	unsigned char * pnt;  	len = idr->length[0] & 0xff;  	len -= sizeof(struct iso_directory_record); +	len += sizeof(idr->name);  	len -= idr->name_len[0]; -	pnt = (char *) idr; +	pnt = (unsigned char *) idr;  	pnt += sizeof(struct iso_directory_record); +	pnt -= sizeof(idr->name);  	pnt += idr->name_len[0];  	if((idr->name_len[0] & 1) == 0){  		pnt++; @@ -318,9 +320,9 @@ showblock(int flag){  		  if(idr->length[0] == 0) break;  		  printf("%3d ", idr->length[0]);  		  printf("[%2d] ", idr->volume_sequence_number[0]); -		  printf("%5x ", *((unsigned int *) idr->extent)); -		  printf("%8d ", *((unsigned int *) idr->size)); -		  printf ((idr->flags[0] & 2) ? "*" : " "); +		  printf("%5x ", isonum_733(idr->extent)); +		  printf("%8d ", isonum_733(idr->size)); +		  printf ((idr->flags[0] & 2) ? "*" : " ");   		  if(idr->name_len[0] == 1 && idr->name[0] == 0)  			  printf(".             ");  		  else if(idr->name_len[0] == 1 && idr->name[0] == 1) diff --git a/gnu/usr.bin/mkisofs/diag/isovfy.c b/gnu/usr.bin/mkisofs/diag/isovfy.c index 43e13895ee10..eb52c914689c 100644 --- a/gnu/usr.bin/mkisofs/diag/isovfy.c +++ b/gnu/usr.bin/mkisofs/diag/isovfy.c @@ -112,7 +112,7 @@ isonum_732 (char * p)  }  int -isonum_733 (char * p) +isonum_733 (unsigned char * p)  {  	return (isonum_731 (p));  } @@ -312,14 +312,14 @@ check_tree(int file_addr, int file_size, int parent_addr){  		  else if(idr->name_len[0] == 1 && idr->name[0] == 0) {  			  iline += sprintf(&lbuffer[iline],".             ");  			  rflag = 0; -			  if(orig_file_addr !=*((unsigned int *) idr->extent)) +			  if(orig_file_addr !=isonum_733(idr->extent))  				  iline += sprintf(&lbuffer[iline],"***** Directory has null extent.", goof++);  			  if(i1)  				  iline += sprintf(&lbuffer[iline],"***** . not  first entry.", rr_goof++);  		  } else if(idr->name_len[0] == 1 && idr->name[0] == 1) {  			  iline += sprintf(&lbuffer[iline],"..            ");  			  rflag = 0; -			  if(parent_file_addr !=*((unsigned int *) idr->extent)) +			  if(parent_file_addr !=isonum_733(idr->extent))  				  iline += sprintf(&lbuffer[iline],"***** Directory has null extent.", goof++);  			  if(i1 != 1)  				  iline += sprintf(&lbuffer[iline],"***** .. not second entry.", rr_goof++); @@ -332,7 +332,10 @@ check_tree(int file_addr, int file_size, int parent_addr){  		  };  		  if(size && extent == 0) iline += sprintf(&lbuffer[iline],"****Extent==0, size != 0", goof++); +#if 0 +		  /* This is apparently legal. */  		  if(size == 0 && extent) iline += sprintf(&lbuffer[iline],"****Extent!=0, size == 0", goof++); +#endif  		  if(idr->flags[0] & 0xfd)  			  iline += sprintf(&lbuffer[iline],"Flags=(%x) ", idr->flags[0], goof++); @@ -361,8 +364,8 @@ check_tree(int file_addr, int file_size, int parent_addr){ -		  if(rflag && (idr->flags[0] & 2)) check_tree((*((unsigned int *) idr->extent)) << 11, -						   *((unsigned int *) idr->size), +		  if(rflag && (idr->flags[0] & 2)) check_tree((isonum_733(idr->extent)) << 11, +						   isonum_733(idr->size),  						   orig_file_addr << 11);  		  i += buffer[i];  		  i1++; diff --git a/gnu/usr.bin/mkisofs/exclude.c b/gnu/usr.bin/mkisofs/exclude.c index 99c66bd4e03b..c20ea2848534 100644 --- a/gnu/usr.bin/mkisofs/exclude.c +++ b/gnu/usr.bin/mkisofs/exclude.c @@ -29,8 +29,7 @@ char * fn;      return;    } - -  excl[i] = malloc(strlen(fn)+1); +  excl[i] = (char *) malloc(strlen(fn)+1);    if (! excl[i]) {      fprintf(stderr,"Can't allocate memory for excluded filename\n");      return; diff --git a/gnu/usr.bin/mkisofs/mkisofs.8 b/gnu/usr.bin/mkisofs/mkisofs.8 index 8eb29ec3a7a6..d05909bf537e 100644 --- a/gnu/usr.bin/mkisofs/mkisofs.8 +++ b/gnu/usr.bin/mkisofs/mkisofs.8 @@ -1,5 +1,5 @@  .\" -*- nroff -*- -.TH MKISOFS 8 "August 1993" "Version 1.03" +.TH MKISOFS 8 "January 1995" "Version 1.04"  .SH NAME  mkisofs \- create a iso9660  filesystem with optional Rock Ridge attributes.  .SH SYNOPSIS @@ -32,6 +32,12 @@ mkisofs \- create a iso9660  filesystem with optional Rock Ridge attributes.  .B \-l  ]  [ +.B \-L +] +[ +.B \-L +] +[  .B \-V  ]  [ @@ -39,6 +45,10 @@ mkisofs \- create a iso9660  filesystem with optional Rock Ridge attributes.  .I volid  ]  [ +.B \-i +.I include-list +] +[  .B \-p  .I preparer  ] @@ -88,49 +98,76 @@ example of this would be the files foo.bar and  foo.bar.~1~ - the file foo.bar.~1~ would be  written  as FOO.000;1 and the file  foo.bar would be written as  FOO.BAR;1  .PP +Note that +.B mkisofs +is not designed to communicate with the writer directly.  Most writers +have proprietary command sets which vary from one manufacturer to +another, and you need a specialized tool to actually burn the disk. +The cdwrite utility that comes with mkisofs is capable of communicating +with Phillips drives (newer versions of cdwrite should be available from +Yggdrasil).  Most writers come with some version of DOS software +that allows a direct image copy of an iso9660 image to the writer. +.PP +Also you should know that most cd writers are very particular about timing. +Once you start to burn a disc, you cannot let their buffer empty before you +are done, or you will end up with a corrupt disc.  Thus it is critical +that you be able to maintain an uninterupted data stream to the writer +for the entire time that the disc is being written. +.PP  .br  .B path  is the path of the directory tree to be copied into the iso9660 filesystem.  .SH OPTIONS  .TP -.I -a +.I \-a  Include all files on the iso9660 filesystem.  Normally files that contain the  characters '~' or '#' will not be included (these are typically backup files  for editors under unix).  .TP -.I -A application_id +.I \-A application_id  Specifies a text string that will be written into the volume header.  This should describe the application that will be on the disc.  There  is space on the disc for 128 characters of information.  This parameter can  also be set in the file .mkisofsrc with APPL=id.  If specified in both  places, the command line version is used.  .TP -.I -d +.I \-d  Omit trailing period from files that do not have a period.  This violates the  ISO9660 standard, but it happens to work on many systems.  Use with caution.  .TP -.I -D +.I \-D  Do not use deep directory relocation, and instead just pack them in the  way we see them.  This violates the ISO9660 standard, but it works on many  systems.  Use with caution.  .TP -.I -f +.I \-f  Follow symbolic links when generating the filesystem.  When this option is not  in use, symbolic links will be entered using Rock Ridge if enabled, otherwise  the file will be ignored.  .TP -.I -l +.I \-i include-list +Use the specified file as a list of files to add to the directory tree. +This is useful for quickly repacking a CD while adding files to it. +The format of this file is path1/file=path2 where path1 is the directory +in the ISO9660 file system where file should appear and path2 is the +where to find the file. +.TP +.I \-l  Allow full 32 character filenames.  Normally the ISO9660 filename will be in an  8.3 format which is compatible with MS-DOS, even though the ISO9660 standard  allows filenames of up to 32 characters.  If you use this option, the disc may  be difficult to use on a MS-DOS system, but this comes in handy on some other  systems (such as the Amiga).  Use with caution.  .TP -.I -N +.I \-L +Allow filenames to begin with a period.  Ususally, a leading dot is +replaced with an underscore in order to maintain MS-DOS compatibility. +.TP +.I \-N  Omit version numbers from ISO9660 file names.  This may violate the ISO9660  standard, but no one really uses the version numbers anyway.  Use with caution.  .TP -.I -o filename +.I \-o filename  is the name of the file to which the iso9660 filesystem image should be  written.  This can be a disk file, a tape drive, or it can correspond directly  to the device name of the optical disc writer.  If not specified, stdout is @@ -138,7 +175,7 @@ to the device name of the optical disc writer.  If not specified, stdout is  disk  drive, in which case  the disk partition can be mounted  and examined to  ensure that the premastering was done correctly.  .TP -.I -P publisher_id +.I \-P publisher_id  Specifies a text string that will be written into the volume header.  This should describe the publisher of the CDROM, usually with a  mailing address and phone number.  There is space on the disc for 128 @@ -146,7 +183,7 @@ characters of information.  This parameter can also be set in the file  .mkisofsrc with PUBL=.  If specified in both places, the command line  version is used.  .TP -.I -p preparer_id +.I \-p preparer_id  Specifies a text string that will be written into the volume header.  This should describe the preparer of the CDROM, usually with a mailing  address and phone number.  There is space on the disc for 128 @@ -154,26 +191,26 @@ characters of information.  This parameter can also be set in the file  .mkisofsrc with PREP=.  If specified in both places, the command  line version is used.  .TP -.I -R +.I \-R  Generate SUSP and RR records using the Rock Ridge protocol to further describe  the files on the iso9660 filesystem.  .TP -.I -T +.I \-T  Generate a file TRANS.TBL in each directory on the CDROM, which can be used  on non-Rock Ridge capable systems to help establish the correct file names.  There is also information present in the file that indicates the major and  minor numbers for block and character devices, and each symlink has the name of  the link file given.  .TP -.I -V volid +.I \-V volid  Specifies the volume ID to be written into the master block.  This  parameter can also be set in the file .mkisofsrc with VOLI=id.  If  specified in both places, the command line version is used.  .TP -.I -v +.I \-v  Verbose execution.  .TP -.I -x path +.I \-x path  Exclude   .I path  from being written to CDROM.  @@ -183,9 +220,9 @@ given as command line argument and the path relative to this directory.  Multiple paths may be excluded (up to 1000).  Example:  -mkisofs -o cd -x /local/dir1 -x /local/dir2 /local +mkisofs \-o cd \-x /local/dir1 \-x /local/dir2 /local  .TP -.I -z +.I \-z  Generate special SUSP records for transparently compressed files.  This is  only of use and interest for hosts that support transparent decompression.  This is an experimental feature, and no hosts yet support this, but there @@ -215,7 +252,7 @@ filesystem.   The  name mkisofs  is probably a bit of a misnomer, since it  not only creates the filesystem, but it also populates it as well.  .PP  .br -Eric Youngdale <ericy@cais.com> wrote both the linux isofs9660 filesystem +Eric Youngdale <eric@aib.com> wrote both the linux isofs9660 filesystem  and the mkisofs utility, and is currently maintaining them.  The copyright for  the mkisofs utility is held by Yggdrasil Computing, Incorporated.  .SH BUGS diff --git a/gnu/usr.bin/mkisofs/mkisofs.c b/gnu/usr.bin/mkisofs/mkisofs.c index 4cfed7861eeb..e1948caf5c0f 100644 --- a/gnu/usr.bin/mkisofs/mkisofs.c +++ b/gnu/usr.bin/mkisofs/mkisofs.c @@ -20,6 +20,8 @@     along with this program; if not, write to the Free Software     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ +/* ADD_FILES changes made by Ross Biro biro@yggdrasil.com 2/23/95 */ +  #include "mkisofs.h"  #include <assert.h> @@ -54,7 +56,7 @@  struct directory * root = NULL; -static char version_string[] = "mkisofs v1.03"; +static char version_string[] = "mkisofs v1.04";  FILE * discimage;  unsigned int next_extent = 0; @@ -90,6 +92,7 @@ int omit_version_number = 0;     /* May violate iso9660, but noone uses vers*/  int RR_relocation_depth = 6;     /* Violates iso9660, but most systems work */  int full_iso9660_filenames = 0;  /* Used with Amiga.  Disc will not work with  				  DOS */ +int allow_leading_dots = 0;	 /* DOS cannot read names with leading dots */  struct rcopts{    char * tag; @@ -185,7 +188,7 @@ void usage(){  	fprintf(stderr,"Usage:\n");  	fprintf(stderr,  "mkisofs [-o outfile] [-R] [-V volid] [-v] [-a] \ -[-T]\n [-l] [-d] [-V] [-D] [-p preparer] \ +[-T]\n [-l] [-d] [-V] [-D] [-L] [-p preparer] \  [-P publisher] [ -A app_id ] [-z] \  [-x path -x path ...] path\n");  	exit(1); @@ -280,9 +283,15 @@ int FDECL3(iso9660_file_length,const char*, name, struct directory_entry *, sres        if(current_length < 30) *result++ = (islower(*pnt) ? toupper(*pnt) : *pnt);      } else { /* Dos style filenames */        if(*pnt == '.') { -	if (seen_dot) {ignore++; continue;} -	if(result) *result++ = '.'; -	seen_dot++; +        if (!chars_before_dot && !allow_leading_dots) { +	  /* DOS can't read files with dot first */ +          chars_before_dot++; +          if (result) *result++ = '_'; /* Substitute underscore */ +        } else { +          if (seen_dot) {ignore++; continue;} +	  if(result) *result++ = '.'; +	  seen_dot++; +        }        } else if (seen_dot) {  	if(chars_after_dot < 3) {  	  chars_after_dot++; @@ -367,6 +376,154 @@ int FDECL3(iso9660_file_length,const char*, name, struct directory_entry *, sres    return chars_before_dot + chars_after_dot + seen_dot + extra;  } +#ifdef ADD_FILES + +struct file_adds *root_file_adds = NULL; + +void +FDECL2(add_one_file, char *, addpath, char *, path ) +{ +  char *cp; +  char *name; +  struct file_adds *f; +  struct file_adds *tmp; + +  f = root_file_adds; +  tmp = NULL; + +  name = rindex (addpath, PATH_SEPARATOR); +  if (name == NULL) { +    name = addpath; +  } else { +    name++; +  } + +  cp = strtok (addpath, SPATH_SEPARATOR); + +  while (cp != NULL && strcmp (name, cp)) { +     if (f == NULL) { +        root_file_adds = e_malloc (sizeof *root_file_adds); +        f=root_file_adds; +        f->name = NULL; +        f->child = NULL; +        f->next = NULL; +        f->add_count = 0; +        f->adds = NULL; +	f->used = 0; +     } +    if (f->child) { +      for (tmp = f->child; tmp->next != NULL; tmp =tmp->next) { +         if (strcmp (tmp->name, cp) == 0) { +           f = tmp; +           goto next; +         } +      } +      if (strcmp (tmp->name, cp) == 0) { +          f=tmp; +          goto next; +      } +      /* add a new node. */ +      tmp->next = e_malloc (sizeof (*tmp->next)); +      f=tmp->next; +      f->name = strdup (cp); +      f->child = NULL; +      f->next = NULL; +      f->add_count = 0; +      f->adds = NULL; +      f->used = 0; +    } else { +      /* no children. */ +      f->child = e_malloc (sizeof (*f->child)); +      f = f->child; +      f->name = strdup (cp); +      f->child = NULL; +      f->next = NULL; +      f->add_count = 0; +      f->adds = NULL; +      f->used = 0; + +    } +   next: +     cp = strtok (NULL, SPATH_SEPARATOR); +   } +  /* Now f if non-null points to where we should add things */ +  if (f == NULL) { +     root_file_adds = e_malloc (sizeof *root_file_adds); +     f=root_file_adds; +     f->name = NULL; +     f->child = NULL; +     f->next = NULL; +     f->add_count = 0; +     f->adds = NULL; +   } + +  /* Now f really points to where we should add this name. */ +  f->add_count++; +  f->adds = realloc (f->adds, sizeof (*f->adds)*f->add_count); +  f->adds[f->add_count-1].path = strdup (path); +  f->adds[f->add_count-1].name = strdup (name); +} + +void +FDECL3(add_file_list, int, argc, char **,argv, int, ind) +{ +  char *ptr; +  char *dup_arg; + +  while (ind < argc) { +     dup_arg = strdup (argv[ind]); +     ptr = index (dup_arg,'='); +     if (ptr == NULL) { +        free (dup_arg); +        return; +     } +     *ptr = 0; +     ptr++; +     add_one_file (dup_arg, ptr); +     free (dup_arg); +     ind++; +  } +} +void +FDECL1(add_file, char *, filename) +{ +  char buff[1024]; +  FILE *f; +  char *ptr; +  char *p2; +  int count=0; + +  if (strcmp (filename, "-") == 0) { +    f = stdin; +  } else { +    f = fopen (filename, "r"); +    if (f == NULL) { +      perror ("fopen"); +      exit (1); +    } +  } +  while (fgets (buff, 1024, f)) { +    count++; +    ptr = buff; +    while (isspace (*ptr)) ptr++; +    if (*ptr==0) continue; +    if (*ptr=='#') continue; + +    if (ptr[strlen(ptr)-1]== '\n') ptr[strlen(ptr)-1]=0; +    p2 = index (ptr, '='); +    if (p2 == NULL) { +      fprintf (stderr, "Error in line %d: %s\n", count, buff); +      exit (1); +    } +    *p2 = 0; +    p2++; +    add_one_file (ptr, p2); +  } +  if (f != stdin) fclose (f); +} + +#endif +  int FDECL2(main, int, argc, char **, argv){    char * outfile;    struct directory_entry de; @@ -374,6 +531,9 @@ int FDECL2(main, int, argc, char **, argv){    struct stat statbuf;    char * scan_tree;    int c; +#ifdef ADD_FILES +  char *add_file_file = NULL; +#endif    if (argc < 2)      usage(); @@ -382,7 +542,7 @@ int FDECL2(main, int, argc, char **, argv){    read_rcfile(argv[0]);    outfile = NULL; -  while ((c = getopt(argc, argv, "o:V:RfvaTp:P:x:dDlNzA:")) != EOF) +  while ((c = getopt(argc, argv, "i:o:V:RfvaTp:P:x:dDlLNzA:")) != EOF)      switch (c)        {        case 'p': @@ -415,6 +575,9 @@ int FDECL2(main, int, argc, char **, argv){        case 'l':  	full_iso9660_filenames++;  	break; +      case 'L': +        allow_leading_dots++; +        break;        case 'N':  	omit_version_number++;  	break; @@ -450,6 +613,11 @@ int FDECL2(main, int, argc, char **, argv){        case 'x':          exclude(optarg);  	break; +      case 'i': +#ifdef ADD_FILES +	add_file_file = optarg; +	break; +#endif        default:  	usage();  	exit(1); @@ -478,6 +646,13 @@ int FDECL2(main, int, argc, char **, argv){    scan_tree = argv[optind]; +#ifdef ADD_FILES +  if (add_file_file) { +    add_file(add_file_file); +  } +  add_file_list (argc, argv, optind+1); +#endif +    if(!scan_tree){  	  usage();  	  exit(1); @@ -499,7 +674,7 @@ int FDECL2(main, int, argc, char **, argv){  #else  	extension_record = generate_rr_extension_record("IEEE_P1282",  				       "THE IEEE P1282 PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS", -				       "PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT,PISCATAWAY, NJ, USA FOR THE P1282 SPECIFICATION.", &extension_record_size); +				       "PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT, PISCATAWAY, NJ, USA FOR THE P1282 SPECIFICATION.", &extension_record_size);  #endif    }; diff --git a/gnu/usr.bin/mkisofs/mkisofs.h b/gnu/usr.bin/mkisofs/mkisofs.h index e17bb848a9cd..efdd8a8356e4 100644 --- a/gnu/usr.bin/mkisofs/mkisofs.h +++ b/gnu/usr.bin/mkisofs/mkisofs.h @@ -19,6 +19,9 @@     along with this program; if not, write to the Free Software     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ +/* ADD_FILES changes made by Ross Biro biro@yggdrasil.com 2/23/95 */ + +#include <sys/types.h>  #include <stdio.h>  /* This symbol is used to indicate that we do not have things like @@ -40,7 +43,6 @@  #endif  #include <string.h> -#include <sys/types.h>  #include <sys/stat.h>  #ifdef linux @@ -100,6 +102,7 @@ struct directory_entry{    unsigned int priority;    char * name;    char * table; +  char * whole_name;    struct directory * filedir;    struct directory_entry * parent_rec;    unsigned int flags; @@ -141,6 +144,23 @@ struct deferred{    unsigned int flags;  }; +#ifdef ADD_FILES +struct file_adds { +  char *name; +  struct file_adds *child; +  struct file_adds *next; +  int add_count; +  int used; +  struct dirent de; +  struct { +    char *path; +    char *name; +  } *adds; +}; +extern struct file_adds *root_file_adds; + +#endif +  extern void DECL(sort_n_finish,(struct directory *));  extern int goof;  extern struct directory * root; diff --git a/gnu/usr.bin/mkisofs/rock.c b/gnu/usr.bin/mkisofs/rock.c index dfa774f02057..f3361cef32df 100644 --- a/gnu/usr.bin/mkisofs/rock.c +++ b/gnu/usr.bin/mkisofs/rock.c @@ -279,7 +279,7 @@ int deep_opt;  	  nchar -= 1;  	} else if(cpnt[0] == 0){  	  if(MAYBE_ADD_CE_ENTRY(2)) add_CE_entry(); -	  Rock[ipnt++] = SL_ROOT; +	  Rock[ipnt++] = (cpnt == &symlink_buff[0] ? SL_ROOT : 0);  	  Rock[ipnt++] = 0;  /* length is zero */  	  lenval += 2;  	} else { diff --git a/gnu/usr.bin/mkisofs/tree.c b/gnu/usr.bin/mkisofs/tree.c index c07c52e12eaf..5060c41a1740 100644 --- a/gnu/usr.bin/mkisofs/tree.c +++ b/gnu/usr.bin/mkisofs/tree.c @@ -20,16 +20,22 @@     along with this program; if not, write to the Free Software     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ +/* ADD_FILES changes made by Ross Biro biro@yggdrasil.com 2/23/95 */ +  #include <stdlib.h>  #include <string.h>  #include <time.h>  #include <errno.h>  #ifndef VMS -#include <unistd.h> -#ifdef HASSYSMACROS +#if defined(HASSYSMACROS) && !defined(HASMKDEV)  #include <sys/sysmacros.h>  #endif +#include <unistd.h> +#ifdef HASMKDEV +#include <sys/types.h> +#include <sys/mkdev.h> +#endif  #else  #include <sys/file.h>  #include <vms/fabdef.h> @@ -475,6 +481,89 @@ void finish_cl_pl_entries(){      d_entry = d_entry->next;    };  } + +#ifdef ADD_FILES +/* This function looks up additions. */ +char * +FDECL3(look_up_addition,char **, newpath, char *,path, struct dirent **,de) { +  char *dup_path; +  char *cp; +  struct file_adds *f; +  struct file_adds *tmp; + +  f=root_file_adds; +  if (!f) return NULL; + +  /* I don't trust strtok */ +  dup_path = strdup (path); + +  cp = strtok (dup_path, SPATH_SEPARATOR); +  while (cp != NULL) { +    for (tmp = f->child; tmp != NULL; tmp=tmp->next) { +      if (strcmp (tmp->name, cp) == 0) break; +    } +    if (tmp == NULL) { +      /* no match */ +      free (dup_path); +      return (NULL); +    } +    f = tmp; +    cp = strtok(NULL, SPATH_SEPARATOR); +  } +  free (dup_path); + +  /* looks like we found something. */ +  if (tmp->used >= tmp->add_count) return (NULL); + +  *newpath = tmp->adds[tmp->used].path; +  tmp->used++; +  *de = &(tmp->de); +  return (tmp->adds[tmp->used-1].name); +   +} + +/* This function lets us add files from outside the standard file tree. +   It is useful if we want to duplicate a cd, but add/replace things. +   We should note that the real path will be used for exclusions. */ + +struct dirent * +FDECL3(readdir_add_files, char **, pathp, char *,path, DIR *, dir){ +  struct dirent *de; + +  char *addpath; +  char *name; + +  de = readdir (dir); +  if (de) { +    return (de); +  } + +  name=look_up_addition (&addpath, path, &de); + +  if (!name) { +    return; +  } + +  *pathp=addpath; +   +  /* Now we must create the directory entry. */ +  /* fortuneately only the name seems to matter. */ +  /* +  de->d_ino = -1; +  de->d_off = 0; +  de->d_reclen = strlen (name); +  */ +  strncpy (de->d_name, name, NAME_MAX); +  de->d_name[NAME_MAX]=0; +  return (de); + +} +#else +struct dirent * +FDECL3(readdir_add_files, char **, pathp, char *,path, DIR *, dir){ +  return (readdir (dir)); +} +#endif  /*   * This function scans the directory tree, looking for files, and it makes   * note of everything that is found.  We also begin to construct the ISO9660 @@ -493,6 +582,7 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){    char * cpnt;    int new_reclen;    int deep_flag; +  char *old_path;    current_dir = opendir(path);    d_entry = NULL; @@ -500,7 +590,9 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){    /* Apparently NFS sometimes allows you to open the directory, but       then refuses to allow you to read the contents.  Allow for this */ -  if(current_dir) d_entry = readdir(current_dir); +  old_path = path; + +  if(current_dir) d_entry = readdir_add_files(&path, old_path, current_dir);    if(!current_dir || !d_entry) {  	  fprintf(stderr,"Unable to open directory %s\n", path); @@ -578,7 +670,7 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){      /* The first time through, skip this, since we already asked for         the first entry when we opened the directory. */ -    if(dflag) d_entry = readdir(current_dir); +    if(dflag) d_entry = readdir_add_files(&path, old_path, current_dir);      dflag++;      if(!d_entry) break; @@ -629,10 +721,11 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){      if(S_ISLNK(lstatbuf.st_mode)){ -	    /* Here we decide how to handle the symbolic links.  Here we -	       handle the general case - if we are not following links or there is an -	       error, then we must change something.  If RR is in use, it is easy, we -	       let RR describe the file.  If not, then we punt the file. */ +	    /* Here we decide how to handle the symbolic links.  Here +	       we handle the general case - if we are not following +	       links or there is an error, then we must change +	       something.  If RR is in use, it is easy, we let RR +	       describe the file.  If not, then we punt the file. */  	    if((status || !follow_links)){  		    if(use_RockRidge){ @@ -652,35 +745,50 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){  		    };  	    } -	    /* Here we handle a different kind of case.  Here we have a symlink, -	       but we want to follow symlinks.  If we run across a directory loop, -	       then we need to pretend that we are not following symlinks for this file. -	       If this is the first time we have seen this, then make this seem -	       as if there was no symlink there in the first place */ - -	    else if(strcmp(d_entry->d_name, ".") && -	       strcmp(d_entry->d_name, "..")) { -		    if(find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf))){ -			    fprintf(stderr, "Infinite loop detected (%s)\n", whole_path); -			    if(!use_RockRidge) continue; -			    statbuf.st_size = 0; -			    STAT_INODE(statbuf) = UNCACHED_INODE; -			    statbuf.st_dev = (dev_t) UNCACHED_DEVICE; -			    statbuf.st_mode = (statbuf.st_mode & ~S_IFMT) | S_IFREG; +	    if( follow_links +	       && S_ISDIR(statbuf.st_mode) )  +	      { +		if(   strcmp(d_entry->d_name, ".") +		   && strcmp(d_entry->d_name, "..") ) +		  { +		    if(find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf))) +		      { +			if(!use_RockRidge)  +			  { +			    fprintf(stderr, "Already cached directory seen (%s)\n",  +				    whole_path); +			    continue; +			  } +			statbuf.st_size = 0; +			STAT_INODE(statbuf) = UNCACHED_INODE; +			statbuf.st_dev = (dev_t) UNCACHED_DEVICE; +			statbuf.st_mode = (statbuf.st_mode & ~S_IFMT) | S_IFREG;  		    } else { -			    lstatbuf = statbuf; -			    add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf)); -		    }; -	    }; -    }; +		      lstatbuf = statbuf; +		      add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf)); +		    } +		  } +	      } +    } +    /* +     * Add directories to the cache so that we don't waste space even +     * if we are supposed to be following symlinks. +     */ +    if( follow_links +       && strcmp(d_entry->d_name, ".") +       && strcmp(d_entry->d_name, "..") +       && S_ISDIR(statbuf.st_mode) )  +	  { +	    add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf)); +	  }  #ifdef VMS      if(!S_ISDIR(lstatbuf.st_mode) && (statbuf.st_fab_rfm != FAB$C_FIX &&  				      statbuf.st_fab_rfm != FAB$C_STMLF)) {        fprintf(stderr,"Warning - file %s has an unsupported VMS record"  	      " format (%d)\n",  	      whole_path, statbuf.st_fab_rfm); -    }; +    }  #endif      if(S_ISREG(lstatbuf.st_mode) && (status = access(whole_path, R_OK))){ @@ -691,11 +799,15 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){      /* Add this so that we can detect directory loops with hard links.       If we are set up to follow symlinks, then we skip this checking. */ -    if(!follow_links && S_ISDIR(lstatbuf.st_mode) && strcmp(d_entry->d_name, ".") && -       strcmp(d_entry->d_name, "..")) { +    if(   !follow_links  +       && S_ISDIR(lstatbuf.st_mode)  +       && strcmp(d_entry->d_name, ".")  +       && strcmp(d_entry->d_name, "..") )  +      {  	    if(find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf))) { -		    fprintf(stderr,"Directory loop - fatal goof (%s %x %d).\n", -			    whole_path, statbuf.st_dev, STAT_INODE(statbuf)); +		    fprintf(stderr,"Directory loop - fatal goof (%s %lx %lu).\n", +			    whole_path, (unsigned long) statbuf.st_dev, +			    (unsigned long) STAT_INODE(statbuf));  		    exit(1);  	    };  	    add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf)); @@ -727,6 +839,7 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){      s_entry->table = NULL;      s_entry->name = strdup(d_entry->d_name); +    s_entry->whole_name = strdup (whole_path);      s_entry->filedir = this_dir;      s_entry->isorec.flags[0] = 0; @@ -810,18 +923,20 @@ FDECL2(scan_directory_tree,char *, path, struct directory_entry *, de){  		    break;  #ifndef NON_UNIXFS  	    case S_IFBLK: -		    sprintf(buffer,"B\t%s\t%d %d\n", +		    sprintf(buffer,"B\t%s\t%lu %lu\n",  			    s_entry->name, -			    major(statbuf.st_rdev), minor(statbuf.st_rdev)); +			    (unsigned long) major(statbuf.st_rdev), +			    (unsigned long) minor(statbuf.st_rdev));  		    break;  	    case S_IFIFO:  		    sprintf(buffer,"P\t%s\n",  			    s_entry->name);  		    break;  	    case S_IFCHR: -		    sprintf(buffer,"C\t%s\t%d %d\n", +		    sprintf(buffer,"C\t%s\t%lu %lu\n",  			    s_entry->name, -			    major(statbuf.st_rdev), minor(statbuf.st_rdev)); +			    (unsigned long) major(statbuf.st_rdev), +			    (unsigned long) minor(statbuf.st_rdev));  		    break;  	    case S_IFLNK:  		    readlink(whole_path, symlink_buff, sizeof(symlink_buff)); diff --git a/gnu/usr.bin/mkisofs/write.c b/gnu/usr.bin/mkisofs/write.c index 3a98a3907624..64b4a3ce593c 100644 --- a/gnu/usr.bin/mkisofs/write.c +++ b/gnu/usr.bin/mkisofs/write.c @@ -376,11 +376,7 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt){  	      dwpnt->name = NULL;  	    } else {  	      dwpnt->table = NULL; -	      strcpy(whole_path, s_entry->filedir->whole_name); -#ifndef VMS -	      if(strlen(whole_path)) strcat(whole_path, "/"); -#endif -	      strcat(whole_path, s_entry->name); +	      strcpy(whole_path, s_entry->whole_name);  	      dwpnt->name = strdup(whole_path);  	    };  	    dwpnt->next = NULL; @@ -407,8 +403,15 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt){  	      fprintf(stderr,"Reported file size is %d extents\n", s_entry->size);  	      exit(1);  	    }; -	  } else -	    set_733(s_entry->isorec.extent, 0); +	  } else { +	    /* +	     * This is for zero-length files.  If we leave the extent 0, +	     * then we get screwed, because many readers simply drop files +	     * that have an extent of zero.  Thus we leave the size 0, +	     * and just assign the extent number. +	     */ +	    set_733(s_entry->isorec.extent, last_extent); +	  }  	};        };      }; diff --git a/gnu/usr.bin/patch/patch.1 b/gnu/usr.bin/patch/patch.1 index 6af062a28896..edc690f13516 100644 --- a/gnu/usr.bin/patch/patch.1 +++ b/gnu/usr.bin/patch/patch.1 @@ -1,8 +1,11 @@  .\" -*- nroff -*-  .rn '' }` -'\" $Header: /home/cvs/386BSD/src/gnu/usr.bin/patch/patch.1,v 1.3 1994/02/17 22:20:33 jkh Exp $ +'\" $Header: /home/ncvs/src/gnu/usr.bin/patch/patch.1,v 1.4 1994/02/25 21:45:59 phk Exp $  '\"   '\" $Log: patch.1,v $ +.\" Revision 1.4  1994/02/25  21:45:59  phk +.\" added the -C/-check again. +.\"  .\" Revision 1.3  1994/02/17  22:20:33  jkh  .\" Put this back - I was somehow under the erroneous impression that patch was in  .\" ports, until I saw the the commit messages, that is! :-)  All changed backed out. @@ -208,7 +211,7 @@ Only context diffs have lines like that, but if there is an \*(L"Index:\*(R"  line in the leading garbage,  .I patch  will try to use the file name from that line. -The context diff header takes precedence over an Index line. +The Index line, if present, takes precedence over the context diff header.  If no file name can be intuited from the leading garbage, you will be asked  for the name of the file to patch.  .PP diff --git a/gnu/usr.bin/patch/pch.c b/gnu/usr.bin/patch/pch.c index 6e84b7de41c1..a607f67641cb 100644 --- a/gnu/usr.bin/patch/pch.c +++ b/gnu/usr.bin/patch/pch.c @@ -1,6 +1,9 @@ -/* $Header: /home/ncvs/src/gnu/usr.bin/patch/pch.c,v 1.5.4.1 1995/09/17 06:39:59 davidg Exp $ +/* $Header: /home/ncvs/src/gnu/usr.bin/patch/pch.c,v 1.5.4.2 1996/04/11 10:33:45 markm Exp $   *   * $Log: pch.c,v $ + * Revision 1.5.4.2  1996/04/11  10:33:45  markm + * Merge with HEAD an improved Index: priority fix. + *   * Revision 1.5.4.1  1995/09/17 06:39:59  davidg   * Brought in changes from rev 1.6: Give 'Index:' priority over other paths.   * @@ -370,8 +373,6 @@ intuit_diff_type()  	    else  		filearg[0] = savestr(newname);  	} -	else if (indname) -	    filearg[0] = savestr(indname);  	else if (oldname)  	    filearg[0] = savestr(oldname);  	else if (newname) diff --git a/gnu/usr.bin/perl/lib/Makefile b/gnu/usr.bin/perl/lib/Makefile index 387824ba0708..158cbfa26c42 100644 --- a/gnu/usr.bin/perl/lib/Makefile +++ b/gnu/usr.bin/perl/lib/Makefile @@ -2,14 +2,14 @@ PLIBDIR= ${DESTDIR}/usr/share/perl  PLIB+= abbrev.pl assert.pl bigfloat.pl bigint.pl bigrat.pl cacheout.pl  PLIB+= chat2.pl complete.pl ctime.pl dumpvar.pl exceptions.pl fastcwd.pl -PLIB+= find.pl finddepth.pl flush.pl getcwd.pl getopts.pl importenv.pl -PLIB+= look.pl newgetopt.pl open2.pl perldb.pl pwd.pl shellwords.pl -PLIB+= stat.pl syslog.pl termcap.pl timelocal.pl validate.pl +PLIB+= find.pl finddepth.pl flush.pl getcwd.pl gethostname.pl getopts.pl +PLIB+= importenv.pl look.pl newgetopt.pl open2.pl perldb.pl pwd.pl +PLIB+= shellwords.pl stat.pl syslog.pl termcap.pl timelocal.pl validate.pl  NOOBJ=  install: -	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${PLIB} ${PLIBDIR} +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${PLIB} ${PLIBDIR}  clean:  cleandir: diff --git a/gnu/usr.bin/perl/x2p/Makefile b/gnu/usr.bin/perl/x2p/Makefile index cc6c2fe58dbc..8057dfbb9ad8 100644 --- a/gnu/usr.bin/perl/x2p/Makefile +++ b/gnu/usr.bin/perl/x2p/Makefile @@ -11,9 +11,9 @@ DPADD= ${LIBM}  MAN1+= a2p.1 s2p.1 h2ph.1  beforeinstall: -	install -c -o ${BINOWN} -g ${BINGRP} -m 555 ${.CURDIR}/s2p \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${.CURDIR}/s2p \  		${DESTDIR}${BINDIR} -	install -c -o ${BINOWN} -g ${BINGRP} -m 555 ${.CURDIR}/h2ph \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${.CURDIR}/h2ph \  		${DESTDIR}${BINDIR}  afterinstall: diff --git a/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh b/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh index d4a4b58081e0..e7ef3fdfc324 100644 --- a/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh +++ b/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh @@ -2,7 +2,7 @@  # rcsfreeze - assign a symbolic revision number to a configuration of RCS files -#	$Id: rcsfreeze.sh,v 1.1.1.1 1993/06/18 04:22:16 jkh Exp $ +#	$Id: rcsfreeze.sh,v 1.1.1.1.8.1 1996/02/23 09:32:17 peter Exp $  #       The idea is to run rcsfreeze each time a new version is checked  #       in. A unique symbolic revision number (C_[number], where number @@ -25,7 +25,7 @@  #       {RCS/}.rcsfreeze.ver	version number  #       {RCS/}.rscfreeze.log	log messages, most recent first -PATH=/usr/local/bin:/bin:/usr/bin:/usr/ucb:$PATH +PATH=/bin:/usr/bin:$PATH  export PATH  DATE=`date` || exit diff --git a/gnu/usr.bin/rcs/rcstest b/gnu/usr.bin/rcs/rcstest index e0b6c828f7c5..6eca1f55f1ca 100755 --- a/gnu/usr.bin/rcs/rcstest +++ b/gnu/usr.bin/rcs/rcstest @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh  # Test RCS's functions.  # The RCS commands are searched for in the PATH as usual; @@ -15,10 +15,10 @@  # The current directory and ./RCS must be readable, writable, and searchable. -#	$Id: rcstest,v 5.8 1991/11/20 17:58:10 eggert Exp $ +#	$Id: rcstest,v 1.1.1.1 1993/06/18 04:22:10 jkh Exp $ -#    Copyright 1990, 1991 by Paul Eggert +#    Copyright 1990, 1991, 1992, 1993, 1994, 1995 Paul Eggert  #    Distributed under license by the Free Software Foundation, Inc.  #  # This file is part of RCS. @@ -34,13 +34,23 @@  # GNU General Public License for more details.  #  # You should have received a copy of the GNU General Public License -# along with RCS; see the file COPYING.  If not, write to -# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# along with RCS; see the file COPYING. +# If not, write to the Free Software Foundation, +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  #  # Report problems and direct all questions to:  #  #     rcs-bugs@cs.purdue.edu +# The Makefile overrides the following defaults. +: ${ALL_CFLAGS=-Dhas_conf_h} +: ${CC=cc} +: ${DIFF=diff} +# : ${LDFLAGS=} ${LIBS=} tickles old shell bug + +CL="$CC $ALL_CFLAGS $LDFLAGS -o a.out" +L=$LIBS +  RCSINIT=-x  export RCSINIT @@ -55,26 +65,26 @@ case $1 in  *) echo >&2 "$0: usage: $0 [-v]"; exit 2  esac -test -d RCS || { -	echo >&2 "$0: RCS: not a directory; please \`mkdir RCS' first." -	exit 1 -} +if test -d RCS +then rmdir=: +else rmdir=rmdir; mkdir RCS || exit +fi  rm -f a.* $RCSfile $RCS_alt $lockfile &&  echo 1.1 >a.11 &&  echo 1.1.1.1 >a.3x1 &&  echo 1.2 >a.12 || { echo "#initialization failed"; exit 2; } -case `diff -c a.11 a.3x1` in -*'! 1.1.1.1') -	diff='diff -c';; +case "`$DIFF -c a.11 a.3x1`" in +*!\ 1.1.1.1) +	diff="$DIFF -c";;  *) -	echo "#warning: diff -c does not work, so diagnostics may be cryptic" -	diff=diff +	echo "#warning: $DIFF -c does not work, so diagnostics may be cryptic" +	diff=$DIFF  esac  rcs -i -L -ta.11 $q a.c && -<$RCSfile || { +test -r $RCSfile || {  	echo "#rcs -i -L failed; perhaps RCS is not properly installed."  	exit 1  } @@ -84,7 +94,7 @@ rm -f $RCSfile || exit 2  cp a.11 a.c &&  ci -ta.11 -mm $q a.c && -<$RCSfile && +test -r $RCSfile &&  rcs -L $q a.c || { echo "#ci+rcs -L failed"; exit 1; }  test ! -f a.c || { echo "#ci did not remove working file"; exit 1; }  for l in '' '-l' @@ -99,6 +109,7 @@ ci -mm $q a.c &&  co $q a.c &&  $diff a.12 a.c || { echo "#ci+co failed"; exit 1; } +rm -f a.c &&  co -r1.1 $q a.c &&  $diff a.11 a.c || { echo "#can't retrieve first revision"; exit 1; } @@ -108,21 +119,24 @@ ci -r1.1.1 -mm $q a.c &&  co -r1.1.1.1 $q a.c &&  $diff a.3x1 a.c || { echo "#branches failed"; exit 1; } +rm -f a.c &&  co -l $q a.c &&  ci -f -mm $q a.c &&  co -r1.3 $q a.c &&  $diff a.12 a.c || { echo "#(co -l; ci -f) failed"; exit 1; } +rm -f a.c &&  co -l $q a.c &&  echo 1.4 >a.c &&  ci -l -mm $q a.c &&  echo error >a.c &&  ci -mm $q a.c || { echo "#ci -l failed"; exit 1; } +rm -f a.c &&  co -l $q a.c &&  echo 1.5 >a.c &&  ci -u -mm $q a.c && -<a.c || { echo "#ci -u didn't create a working file"; exit 1; } +test -r a.c || { echo "#ci -u didn't create a working file"; exit 1; }  rm -f a.c &&  echo error >a.c || exit 2  ci -mm $q a.c 2>/dev/null && { echo "#ci -u didn't unlock the file"; exit 1; } @@ -166,42 +180,28 @@ case $LOGNAME in  		esac  	esac  esac -date=`date -u 2>/dev/null` || -date=`TZ=GMT0 date 2>/dev/null` || -date=`TZ= date` || exit 2 -set $date -case $2 in -Jan) m=01;; Feb) m=02;; Mar) m=03;; Apr) m=04;; May) m=05;; Jun) m=06;; -Jul) m=07;; Aug) m=08;; Sep) m=09;; Oct) m=10;; Nov) m=11;; Dec) m=12;; -*) echo >&2 "$0: $2: unknown month name"; exit 2 -esac -case $3 in -?) d=0$3;; -*) d=$3 -esac -case $6 in -[0-9][0-9][0-9][0-9]*) D=$6/$m/$d;; -*) -	case $5 in -	[0-9][0-9][0-9][0-9]*) D=$5/$m/$d;; -	*) echo >&2 "$0: bad date format: $date"; exit 2 -	esac + + +# Get the date of the previous revision in UTC. +date=`rlog -r a.c | sed -n '/^date: /{ s///; s/;.*//; p; q; }'` || exit +case $date in +[0-9][0-9][0-9]*[0-9]/[0-1][0-9]/[0-3][0-9]\ [0-2][0-9]:[0-5][0-9]:[0-6][0-9]);; +*) echo >&2 "$0: $date: bad rlog date output"; exit 1  esac -T=$4 -case $PWD in -'') PWD=`pwd` -esac && +PWD=`pwd` && export PWD && +rm -f a.c &&  co -l $q a.c &&  sed 's/@/$/g' >a.kv <<EOF  @Author: w @ -@Date: $D $T @ -@Header: $PWD$SLASH$RCSfile 2.1 $D $T w s @ -@Id: a.c 2.1 $D $T w s @ +@Date: $date @ +@Header: $PWD$SLASH$RCSfile 2.1 $date w s @ +@Id: a.c 2.1 $date w s @  @Locker:  @ -@Log: a.c @ - * Revision 2.1  $D  $T  w + * @Log: a.c @ + * Revision 2.1  $date  w   * m   * +@Name: Oz @  @RCSfile: a.c @  @Revision: 2.1 @  @Source: $PWD$SLASH$RCSfile @ @@ -210,25 +210,28 @@ EOF  test $? = 0 &&  sed 's/:.*\$/$/' a.kv >a.k &&  sed -e 's/w s [$]/w s '"$me"' $/' -e 's/[$]Locker: /&'"$me/" a.kv >a.kvl && -sed -e '/^\$/!d' -e 's/\$$/: old $/' a.k >a.o && +sed s/Oz//g a.kv >a.e && +sed s/Oz/N/g a.kv >a.N && +sed -e '/\$/!d' -e 's/\$$/: old $/' a.k >a.o &&  sed -e 's/\$[^ ]*: //' -e 's/ \$//' a.kv >a.v &&  cp a.o a.c && -ci -d"$date" -ss -ww -u2.1 -mm $q a.c && +ci -d"$date" -nOz -ss -ww -u2.1 -mm $q a.c &&  $diff a.kv a.c || { echo "#keyword expansion failed"; exit 1; } -co -p -ko $q a.c >a.oo && +co -pOz -ko $q a.c >a.oo &&  $diff a.o a.oo || { echo "#co -p -ko failed"; exit 1; } -cp a.kv a.o || exit 2 -rcs -o2.1 $q a.c && +cp a.kv a.o && cp a.o a.b || exit 2 +rcs -oOz $q a.c &&  rcs -l $q a.c &&  ci -k -u $q a.c &&  $diff a.kv a.c || { echo "#ci -k failed"; exit 1; } -sed '/^[^$]/d' a.kv >a.i && +sed -n 's/^[^$]*\$/$/p' a.kv >a.i &&  ident a.c >a.i1 &&  sed -e 1d -e 's/^[	 ]*//' a.i1 >a.i2 &&  $diff a.i a.i2 || { echo "#ident failed"; exit 1; }  rcs -i $q a.c 2>/dev/null && { echo "#rcs -i permitted existing file"; exit 1; } +rm -f a.c &&  co -l $q a.c &&  echo 2.2 >a.c &&  ci -mm $q a.c && @@ -259,40 +262,73 @@ rcs -nN:1.1 $q a.c &&  co -rN $q a.c &&  $diff a.11 a.c || { echo "#rcs -n failed"; exit 1; } +rm -f a.c &&  rcs -NN:2.1 $q a.c &&  co -rN $q a.c && -$diff a.kv a.c || { echo "#rcs -N failed"; exit 1; } +$diff a.N a.c || { echo "#rcs -N failed"; exit 1; } +rm -f a.c &&  co -l $q a.c && -rcs -c':::' $q a.c && -echo '$''Log$' >a.c && +echo ':::$''Log$' >a.c &&  ci -u -mm $q a.c && -test " `sed '$!d' a.c`" = ' :::' || { echo "#rcs -c failed"; exit 1; } +test " `sed '$!d' a.c`" = ' :::' || { echo "#comment leader failed"; exit 1; } +rm -f a.c &&  rcs -o2.2: $q a.c &&  co $q a.c && -$diff a.kv a.c || { echo "#rcs -o failed"; exit 1; } +$diff a.e a.c || { echo "#rcs -o failed"; exit 1; } -rcsdiff -r1.1 -r2.1 $q a.c >a.0 +rcsdiff -r1.1 -rOz $q a.c >a.0  case $? in  1) ;;  *) echo "#rcsdiff bad status"; exit 1  esac -diff a.11 a.kv >a.1 +$DIFF a.11 a.kv >a.1  $diff a.0 a.1 || { echo "#rcsdiff failed"; exit 1; }  rcs -l2.1 $q a.c || { echo "#rcs -l2.1 failed"; exit 1; } -for i in k kv kvl o v +for i in b k kv kvl o v  do  	rm -f a.c &&  	cp a.$i a.c && -	rcsdiff -k$i $q a.c || { echo "#rcsdiff -k$i failed"; exit 1; } +	rcsdiff -k$i -rOz $q a.c || { echo "#rcsdiff -k$i failed"; exit 1; }  done  co -p1.1 -ko $q a.c >a.t &&  $diff a.11 a.t || { echo "#co -p1.1 -ko failed"; exit 1; }  rcs -u2.1 $q a.c || { echo "#rcs -u2.1 failed"; exit 1; }  rm -f a.c && +rcsclean $q a.c && +rcsclean -u $q a.c || { echo "#rcsclean botched a nonexistent file"; exit 1; } + +rm -f a.c && +co $q a.c && +rcsclean -n $q a.c && +rcsclean -n -u $q a.c && +test -f a.c || { echo "#rcsclean -n removed a file"; exit 1; } + +rm -f a.c && +co $q a.c && +rcsclean $q a.c && +test ! -f a.c || { echo "#rcsclean missed an unlocked file"; exit 1; } + +rm -f a.c && +co -l $q a.c && +rcsclean $q a.c && +test -f a.c || { echo "#rcsclean removed a locked file"; exit 1; } +rcsclean -u $q a.c && +test ! -f a.c || { +	echo "#rcsclean -u missed an unchanged locked file"; exit 1; +} + +rm -f a.c && +co -l $q a.c && +echo change >>a.c && +rcsclean $q a.c && +rcsclean $q -u a.c && +test -f a.c || { echo "#rcsclean removed a changed file"; exit 1; } + +rm -f a.c &&  co -l $q a.c &&  cat >a.c <<'EOF'  2.2 @@ -324,7 +360,7 @@ b1  c  d1  EOF -rcsmerge -r2.2 -r2.3 $q a.c +rcsmerge -E -r2.2 -r2.3 $q a.c  case $? in  0)  	if $diff a.0 a.c >/dev/null @@ -343,16 +379,36 @@ case $? in  	echo "#rcsmerge bad status"; exit 1  esac -nl=' -' +# Avoid `tr' if possible; it's not portable, and it can't handle null bytes. +# Our substitute exclusive-ORs with '\n'; +# this ensures null bytes on output, which is even better than `tr', +# since some diffs think a file is binary only if it contains null bytes. +cat >a.c <<'EOF' +#include <stdio.h> +int main() { +	int c; +	while ((c=getchar()) != EOF) +		putchar(c ^ '\n'); +	return 0; +} +EOF +tr=tr +if (rm -f a.exe a.out && $CL a.c $L >&2) >/dev/null 2>&1 +then +	if test -s a.out +	then tr=./a.out +	elif test -s a.exe +	then tr=./a.exe +	fi +fi  { -	co -p $q a.c | tr "$nl" '\200' >a.24 && +	co -p $q a.c | $tr '\012' '\200' >a.24 &&  	cp a.24 a.c &&  	ciOut=`(ci -l -mm $q a.c 2>&1)` &&  	case $ciOut in  	?*) echo >&2 "$ciOut"  	esac && -	co -p $q a.c | tr '\200' "$nl" >a.c && +	co -p $q a.c | $tr '\200' '\012' >a.c &&  	rcsdiff -r2.3 $q a.c >/dev/null &&  	echo 2.5 >a.c && @@ -378,15 +434,15 @@ locks: strict  access list:  symbolic names:  	N: 2.1 +	Oz: 2.1  	n: 1.8 -comment leader: ":::"  keyword substitution: kv  total revisions: 13;	selected revisions: 1  description:  1.1  ----------------------------  revision 2.1 -date: $D $T;  author: w;  state: s;  lines: +13 -1 +date: $date;  author: w;  state: s;  lines: +14 -1  =============================================================================  EOF  test $? = 0 || { echo "#rlog failed"; exit 1; } @@ -394,4 +450,5 @@ test $? = 0 || { echo "#rlog failed"; exit 1; }  test ! -f $lockfile || { echo "#lock file not removed"; exit 1; } -exec rm -f a.* $RCSfile $RCS_alt +rm -f a.* $RCSfile $RCS_alt +$rmdir RCS diff --git a/gnu/usr.bin/send-pr/Makefile b/gnu/usr.bin/send-pr/Makefile index a3a765be3993..a6e4d222f975 100644 --- a/gnu/usr.bin/send-pr/Makefile +++ b/gnu/usr.bin/send-pr/Makefile @@ -4,11 +4,15 @@  MAN1=		send-pr.1  SUBMITTERS=	current-users -RELEASE!=	uname -rsm +RELEASE=	`uname -rsm` +RELEASE_EV!=	uname -rsm  CLEANFILES+=	send-pr send-pr.el  SUBDIR+= doc +LINKS=	${BINDIR}/send-pr ${BINDIR}/sendbug +MLINKS=	send-pr.1 sendbug.1 +  all: send-pr _PROGSUBDIR  send-pr:	send-pr.sh Makefile @@ -19,14 +23,14 @@ send-pr:	send-pr.sh Makefile  send-pr.el:	send-pr-el.in Makefile  	sed -e 's,@DATADIR@,/etc,g' \ -	    -e 's/@DEFAULT_RELEASE@/$(RELEASE)/g' \ +	    -e 's/@DEFAULT_RELEASE@/$(RELEASE_EV)/g' \  	    -e 's/"unknown"/"$(SUBMITTERS)"/g' \  	    ${.ALLSRC:N*Makefile} > ${.TARGET}  beforeinstall: -	install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \  		send-pr ${DESTDIR}${BINDIR}/send-pr -	install -c -o ${BINOWN} -g ${BINGRP} -m 0644 \ +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 0644 \  		${.CURDIR}/categories  ${DESTDIR}/etc/gnats/freefall  .include <bsd.prog.mk> diff --git a/gnu/usr.bin/send-pr/send-pr.1 b/gnu/usr.bin/send-pr/send-pr.1 index 3717ebd90c17..af29f44a11e9 100644 --- a/gnu/usr.bin/send-pr/send-pr.1 +++ b/gnu/usr.bin/send-pr/send-pr.1 @@ -237,15 +237,6 @@ for installation instructions.  .I Reporting Problems Using send-pr  (also installed as the GNU Info file  .BR send-pr.info ). -.LP -.BR gnats (l), -.BR query-pr (1), -.BR edit-pr (1), -.BR gnats (8), -.BR queue-pr (8), -.BR at-pr (8), -.BR mkcat (8), -.BR mkdist (8).  .SH AUTHORS  Jeffrey Osier, Brendan Kehoe, Jason Merrill, Heinz G. Seidl (Cygnus  Support) diff --git a/gnu/usr.bin/sort/Makefile b/gnu/usr.bin/sort/Makefile index 78eb30de1716..73d919cf5eb9 100644 --- a/gnu/usr.bin/sort/Makefile +++ b/gnu/usr.bin/sort/Makefile @@ -1,11 +1,6 @@  PROG=	sort -SRCS=	sort.c error.c version.c long-options.c getopt.c getopt1.c - -CFLAGS+=-I${.CURDIR} -DDIRENT=1 -DHAVE_LONG_DOUBLE=1 -DHAVE_LONG_DOUBLE=1	\ -	-DHAVE_ST_BLKSIZE=1 -DHAVE_VPRINTF=1 -DRETSIGTYPE=void	\ -	-DSTDC_HEADERS=1 -DHAVE_STRERROR=1 -DHAVE_FCNTL_H=1	\ -	-DHAVE_LIMITS_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRING_H=1	\ -	-DHAVE_UNISTD_H=1 +SRCS=	sort.c error.c version.c long-options.c getopt.c getopt1.c xstrtod.c +CFLAGS+=-I${.CURDIR} -DHAVE_CONFIG_H  .include <bsd.prog.mk> diff --git a/gnu/usr.bin/sort/error.c b/gnu/usr.bin/sort/error.c index 611f220d07d2..21a9ca4df64d 100644 --- a/gnu/usr.bin/sort/error.c +++ b/gnu/usr.bin/sort/error.c @@ -1,5 +1,5 @@  /* error.c -- error handler for noninteractive utilities -   Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc. +   Copyright (C) 1990, 91, 92, 93, 94, 95 Free Software Foundation, Inc.     This program is free software; you can redistribute it and/or modify     it under the terms of the GNU General Public License as published by @@ -15,53 +15,55 @@     along with this program; if not, write to the Free Software     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ -/* Written by David MacKenzie.  */ +/* Written by David MacKenzie <djm@gnu.ai.mit.edu>.  */  #ifdef HAVE_CONFIG_H -#if defined (CONFIG_BROKETS) -/* We use <config.h> instead of "config.h" so that a compilation -   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h -   (which it would do because it found this file in $srcdir).  */  #include <config.h> -#else -#include "config.h" -#endif  #endif  #include <stdio.h> -#ifdef HAVE_VPRINTF - -#if __STDC__ -#include <stdarg.h> -#define VA_START(args, lastarg) va_start(args, lastarg) -#else /* !__STDC__ */ -#include <varargs.h> -#define VA_START(args, lastarg) va_start(args) -#endif /* !__STDC__ */ +#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC +# if __STDC__ +#  include <stdarg.h> +#  define VA_START(args, lastarg) va_start(args, lastarg) +# else +#  include <varargs.h> +#  define VA_START(args, lastarg) va_start(args) +# endif +#else +# define va_alist a1, a2, a3, a4, a5, a6, a7, a8 +# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; +#endif -#else /* !HAVE_VPRINTF */ +#if STDC_HEADERS || _LIBC +# include <stdlib.h> +# include <string.h> +#else +void exit (); +#endif -#ifdef HAVE_DOPRNT -#define va_alist args -#define va_dcl int args; -#else /* !HAVE_DOPRNT */ -#define va_alist a1, a2, a3, a4, a5, a6, a7, a8 -#define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; -#endif /* !HAVE_DOPRNT */ +/* This variable is incremented each time `error' is called.  */ +unsigned int error_message_count; -#endif /* !HAVE_VPRINTF */ +/* If NULL, error will flush stdout, then print on stderr the program +   name, a colon and a space.  Otherwise, error will call this +   function without parameters instead.  */ +void (*error_print_progname) () = NULL; -#ifdef STDC_HEADERS -#include <stdlib.h> -#include <string.h> -#else /* !STDC_HEADERS */ -void exit (); -#endif /* !STDC_HEADERS */ +#ifdef _LIBC +#define program_name program_invocation_name +#endif +/* The calling program should define program_name and set it to the +   name of the executing program.  */  extern char *program_name; -#ifndef HAVE_STRERROR +#if HAVE_STRERROR || _LIBC +# ifndef strerror		/* On some systems, strerror is a macro */ +char *strerror (); +# endif +#else  static char *  private_strerror (errnum)       int errnum; @@ -73,40 +75,51 @@ private_strerror (errnum)    return "Unknown system error";  }  #define strerror private_strerror -#endif /* !HAVE_STRERROR */ +#endif  /* Print the program name and error message MESSAGE, which is a printf-style     format string with optional args.     If ERRNUM is nonzero, print its corresponding system error message.     Exit with status STATUS if it is nonzero.  */  /* VARARGS */ +  void -#if defined (HAVE_VPRINTF) && __STDC__ -error (int status, int errnum, char *message, ...) -#else /* !HAVE_VPRINTF or !__STDC__ */ +#if defined(VA_START) && __STDC__ +error (int status, int errnum, const char *message, ...) +#else  error (status, errnum, message, va_alist)       int status;       int errnum;       char *message;       va_dcl -#endif /* !HAVE_VPRINTF or !__STDC__ */ +#endif  { -#ifdef HAVE_VPRINTF +#ifdef VA_START    va_list args; -#endif /* HAVE_VPRINTF */ +#endif -  fprintf (stderr, "%s: ", program_name); -#ifdef HAVE_VPRINTF +  if (error_print_progname) +    (*error_print_progname) (); +  else +    { +      fflush (stdout); +      fprintf (stderr, "%s: ", program_name); +    } + +#ifdef VA_START    VA_START (args, message); +# if HAVE_VPRINTF || _LIBC    vfprintf (stderr, message, args); +# else +  _doprnt (message, args, stderr); +# endif    va_end (args); -#else /* !HAVE_VPRINTF */ -#ifdef HAVE_DOPRNT -  _doprnt (message, &args, stderr); -#else /* !HAVE_DOPRNT */ +#else    fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); -#endif /* !HAVE_DOPRNT */ -#endif /* !HAVE_VPRINTF */ +#endif + +  ++error_message_count; +    if (errnum)      fprintf (stderr, ": %s", strerror (errnum));    putc ('\n', stderr); diff --git a/gnu/usr.bin/sort/getopt.c b/gnu/usr.bin/sort/getopt.c index 7a4673b8d8db..8bcf5594571c 100644 --- a/gnu/usr.bin/sort/getopt.c +++ b/gnu/usr.bin/sort/getopt.c @@ -3,7 +3,7 @@     "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu     before changing it! -   Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 +   Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95     	Free Software Foundation, Inc.     This program is free software; you can redistribute it and/or modify it @@ -20,18 +20,17 @@     along with this program; if not, write to the Free Software     Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */ +/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. +   Ditto for AIX 3.2 and <stdlib.h>.  */ +#ifndef _NO_PROTO +#define _NO_PROTO +#endif +  #ifdef HAVE_CONFIG_H -#if defined (emacs) || defined (CONFIG_BROKETS) -/* We use <config.h> instead of "config.h" so that a compilation -   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h -   (which it would do because it found this file in $srcdir).  */  #include <config.h> -#else -#include "config.h" -#endif  #endif -#ifndef __STDC__ +#if !defined (__STDC__) || !__STDC__  /* This is a separate conditional since some stdc systems     reject `defined (const)'.  */  #ifndef const @@ -39,11 +38,6 @@  #endif  #endif -/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.  */ -#ifndef _NO_PROTO -#define _NO_PROTO -#endif -  #include <stdio.h>  /* Comment out all this code if we are using the GNU C Library, and are not @@ -65,10 +59,16 @@  #include <stdlib.h>  #endif	/* GNU C library.  */ -/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a -   long-named option.  Because this is not POSIX.2 compliant, it is -   being phased out.  */ -/* #define GETOPT_COMPAT */ +#ifndef _ +/* This is for other GNU distributions with internationalized messages. +   When compiling libc, the _ macro is predefined.  */ +#ifdef HAVE_LIBINTL_H +# include <libintl.h> +# define _(msgid)	gettext (msgid) +#else +# define _(msgid)	(msgid) +#endif +#endif  /* This version of `getopt' appears to the caller like standard Unix `getopt'     but it behaves differently for the user, since it allows the user @@ -92,7 +92,7 @@     Also, when `ordering' is RETURN_IN_ORDER,     each non-option ARGV-element is returned here.  */ -char *optarg = 0; +char *optarg = NULL;  /* Index in ARGV of the next element to be scanned.     This is used for communication to and from the caller @@ -162,6 +162,9 @@ static enum  {    REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER  } ordering; + +/* Value of POSIXLY_CORRECT environment variable.  */ +static char *posixly_correct;  #ifdef	__GNU_LIBRARY__  /* We want to avoid inclusion of string.h with non-GNU libraries @@ -192,19 +195,18 @@ my_index (str, chr)  }  /* If using GCC, we can safely declare strlen this way. -   If not using GCC, it is ok not to declare it. -   (Supposedly there are some machines where it might get a warning, -   but changing this conditional to __STDC__ is too risky.)  */ +   If not using GCC, it is ok not to declare it.  */  #ifdef __GNUC__ -#ifdef IN_GCC -#include "gstddef.h" -#else -#include <stddef.h> -#endif -extern size_t strlen (const char *); -#endif - -#endif				/* GNU C library.  */ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. +   That was relevant to code that was here before.  */ +#if !defined (__STDC__) || !__STDC__ +/* gcc with -traditional declares the built-in strlen to return int, +   and has done so at least since version 2.4.5. -- rms.  */ +extern int strlen (const char *); +#endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */  /* Handle permutation of arguments.  */ @@ -279,6 +281,42 @@ exchange (argv)    first_nonopt += (optind - last_nonopt);    last_nonopt = optind;  } + +/* Initialize the internal data when the first call is made.  */ + +static const char * +_getopt_initialize (optstring) +     const char *optstring; +{ +  /* Start processing options with ARGV-element 1 (since ARGV-element 0 +     is the program name); the sequence of previously skipped +     non-option ARGV-elements is empty.  */ + +  first_nonopt = last_nonopt = optind = 1; + +  nextchar = NULL; + +  posixly_correct = getenv ("POSIXLY_CORRECT"); + +  /* Determine how to handle the ordering of options and nonoptions.  */ + +  if (optstring[0] == '-') +    { +      ordering = RETURN_IN_ORDER; +      ++optstring; +    } +  else if (optstring[0] == '+') +    { +      ordering = REQUIRE_ORDER; +      ++optstring; +    } +  else if (posixly_correct != NULL) +    ordering = REQUIRE_ORDER; +  else +    ordering = PERMUTE; + +  return optstring; +}  /* Scan elements of ARGV (whose length is ARGC) for option characters     given in OPTSTRING. @@ -345,41 +383,18 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)       int *longind;       int long_only;  { -  int option_index; - -  optarg = 0; - -  /* Initialize the internal data when the first call is made. -     Start processing options with ARGV-element 1 (since ARGV-element 0 -     is the program name); the sequence of previously skipped -     non-option ARGV-elements is empty.  */ +  optarg = NULL;    if (optind == 0)      { -      first_nonopt = last_nonopt = optind = 1; - -      nextchar = NULL; - -      /* Determine how to handle the ordering of options and nonoptions.  */ - -      if (optstring[0] == '-') -	{ -	  ordering = RETURN_IN_ORDER; -	  ++optstring; -	} -      else if (optstring[0] == '+') -	{ -	  ordering = REQUIRE_ORDER; -	  ++optstring; -	} -      else if (getenv ("POSIXLY_CORRECT") != NULL) -	ordering = REQUIRE_ORDER; -      else -	ordering = PERMUTE; +      optstring = _getopt_initialize (optstring); +      optind = 1;		/* Don't scan ARGV[0], the program name.  */      }    if (nextchar == NULL || *nextchar == '\0')      { +      /* Advance to the next ARGV-element.  */ +        if (ordering == PERMUTE)  	{  	  /* If we have just processed some options following some non-options, @@ -390,21 +405,16 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)  	  else if (last_nonopt != optind)  	    first_nonopt = optind; -	  /* Now skip any additional non-options +	  /* Skip any additional non-options  	     and extend the range of non-options previously skipped.  */  	  while (optind < argc -		 && (argv[optind][0] != '-' || argv[optind][1] == '\0') -#ifdef GETOPT_COMPAT -		 && (longopts == NULL -		     || argv[optind][0] != '+' || argv[optind][1] == '\0') -#endif				/* GETOPT_COMPAT */ -		 ) +		 && (argv[optind][0] != '-' || argv[optind][1] == '\0'))  	    optind++;  	  last_nonopt = optind;  	} -      /* Special ARGV-element `--' means premature end of options. +      /* The special ARGV-element `--' means premature end of options.  	 Skip it like a null option,  	 then exchange with previous non-options as if it were an option,  	 then skip everything else like a non-option.  */ @@ -437,12 +447,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)        /* If we have come to a non-option and did not permute it,  	 either stop the scan or describe it to the caller and pass it by.  */ -      if ((argv[optind][0] != '-' || argv[optind][1] == '\0') -#ifdef GETOPT_COMPAT -	  && (longopts == NULL -	      || argv[optind][0] != '+' || argv[optind][1] == '\0') -#endif				/* GETOPT_COMPAT */ -	  ) +      if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))  	{  	  if (ordering == REQUIRE_ORDER)  	    return EOF; @@ -451,36 +456,53 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)  	}        /* We have found another option-ARGV-element. -	 Start decoding its characters.  */ +	 Skip the initial punctuation.  */        nextchar = (argv[optind] + 1  		  + (longopts != NULL && argv[optind][1] == '-'));      } +  /* Decode the current option-ARGV-element.  */ + +  /* Check whether the ARGV-element is a long option. + +     If long_only and the ARGV-element has the form "-f", where f is +     a valid short option, don't consider it an abbreviated form of +     a long option that starts with f.  Otherwise there would be no +     way to give the -f short option. + +     On the other hand, if there's a long option "fubar" and +     the ARGV-element is "-fu", do consider that an abbreviation of +     the long option, just like "--fu", and not "-f" with arg "u". + +     This distinction seems to be the most useful approach.  */ +    if (longopts != NULL -      && ((argv[optind][0] == '-' -	   && (argv[optind][1] == '-' || long_only)) -#ifdef GETOPT_COMPAT -	  || argv[optind][0] == '+' -#endif				/* GETOPT_COMPAT */ -	  )) +      && (argv[optind][1] == '-' +	  || (long_only && (argv[optind][2] +			    || !my_index (optstring, argv[optind][1])))))      { +      char *nameend;        const struct option *p; -      char *s = nextchar; +      const struct option *pfound = NULL;        int exact = 0;        int ambig = 0; -      const struct option *pfound = NULL;        int indfound; +      int option_index; + +      for (nameend = nextchar; *nameend && *nameend != '='; nameend++) +	/* Do nothing.  */ ; -      while (*s && *s != '=') -	s++; +#ifdef lint +      indfound = 0;  /* Avoid spurious compiler warning.  */ +#endif -      /* Test all options for either exact match or abbreviated matches.  */ -      for (p = longopts, option_index = 0; p->name; -	   p++, option_index++) -	if (!strncmp (p->name, nextchar, s - nextchar)) +      /* Test all long options for either exact match +	 or abbreviated matches.  */ +      for (p = longopts, option_index = 0; p->name; p++, option_index++) +	if (!strncmp (p->name, nextchar, nameend - nextchar))  	  { -	    if (s - nextchar == strlen (p->name)) +	    if (nameend - nextchar == strlen (p->name))  	      {  		/* Exact match found.  */  		pfound = p; @@ -495,14 +517,14 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)  		indfound = option_index;  	      }  	    else -	      /* Second nonexact match found.  */ +	      /* Second or later nonexact match found.  */  	      ambig = 1;  	  }        if (ambig && !exact)  	{  	  if (opterr) -	    fprintf (stderr, "%s: option `%s' is ambiguous\n", +	    fprintf (stderr, _("%s: option `%s' is ambiguous\n"),  		     argv[0], argv[optind]);  	  nextchar += strlen (nextchar);  	  optind++; @@ -513,27 +535,26 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)  	{  	  option_index = indfound;  	  optind++; -	  if (*s) +	  if (*nameend)  	    {  	      /* Don't test has_arg with >, because some C compilers don't  		 allow it to be used on enums.  */  	      if (pfound->has_arg) -		optarg = s + 1; +		optarg = nameend + 1;  	      else  		{  		  if (opterr) -		    { -		      if (argv[optind - 1][1] == '-') -			/* --option */ -			fprintf (stderr, -				 "%s: option `--%s' doesn't allow an argument\n", -				 argv[0], pfound->name); -		      else -			/* +option or -option */ -			fprintf (stderr, -			     "%s: option `%c%s' doesn't allow an argument\n", -			     argv[0], argv[optind - 1][0], pfound->name); -		    } +		   if (argv[optind - 1][1] == '-') +		    /* --option */ +		    fprintf (stderr, +		     _("%s: option `--%s' doesn't allow an argument\n"), +		     argv[0], pfound->name); +		   else +		    /* +option or -option */ +		    fprintf (stderr, +		     _("%s: option `%c%s' doesn't allow an argument\n"), +		     argv[0], argv[optind - 1][0], pfound->name); +  		  nextchar += strlen (nextchar);  		  return '?';  		} @@ -545,8 +566,9 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)  	      else  		{  		  if (opterr) -		    fprintf (stderr, "%s: option `%s' requires an argument\n", -			     argv[0], argv[optind - 1]); +		    fprintf (stderr, +			   _("%s: option `%s' requires an argument\n"), +			   argv[0], argv[optind - 1]);  		  nextchar += strlen (nextchar);  		  return optstring[0] == ':' ? ':' : '?';  		} @@ -561,25 +583,23 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)  	    }  	  return pfound->val;  	} +        /* Can't find it as a long option.  If this is not getopt_long_only,  	 or the option starts with '--' or is not a valid short  	 option, then it's an error.  	 Otherwise interpret it as a short option.  */        if (!long_only || argv[optind][1] == '-' -#ifdef GETOPT_COMPAT -	  || argv[optind][0] == '+' -#endif				/* GETOPT_COMPAT */  	  || my_index (optstring, *nextchar) == NULL)  	{  	  if (opterr)  	    {  	      if (argv[optind][1] == '-')  		/* --option */ -		fprintf (stderr, "%s: unrecognized option `--%s'\n", +		fprintf (stderr, _("%s: unrecognized option `--%s'\n"),  			 argv[0], nextchar);  	      else  		/* +option or -option */ -		fprintf (stderr, "%s: unrecognized option `%c%s'\n", +		fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),  			 argv[0], argv[optind][0], nextchar);  	    }  	  nextchar = (char *) ""; @@ -588,7 +608,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)  	}      } -  /* Look at and handle the next option-character.  */ +  /* Look at and handle the next short option-character.  */    {      char c = *nextchar++; @@ -602,16 +622,13 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)        {  	if (opterr)  	  { -#if 0 -	    if (c < 040 || c >= 0177) -	      fprintf (stderr, "%s: unrecognized option, character code 0%o\n", +	    if (posixly_correct) +	      /* 1003.2 specifies the format of this message.  */ +	      fprintf (stderr, _("%s: illegal option -- %c\n"),  		       argv[0], c);  	    else -	      fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c); -#else -	    /* 1003.2 specifies the format of this message.  */ -	    fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); -#endif +	      fprintf (stderr, _("%s: invalid option -- %c\n"), +		       argv[0], c);  	  }  	optopt = c;  	return '?'; @@ -627,7 +644,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)  		optind++;  	      }  	    else -	      optarg = 0; +	      optarg = NULL;  	    nextchar = NULL;  	  }  	else @@ -644,14 +661,10 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)  	      {  		if (opterr)  		  { -#if 0 -		    fprintf (stderr, "%s: option `-%c' requires an argument\n", -			     argv[0], c); -#else  		    /* 1003.2 specifies the format of this message.  */ -		    fprintf (stderr, "%s: option requires an argument -- %c\n", -			     argv[0], c); -#endif +		    fprintf (stderr, +			   _("%s: option requires an argument -- %c\n"), +			   argv[0], c);  		  }  		optopt = c;  		if (optstring[0] == ':') diff --git a/gnu/usr.bin/sort/getopt.h b/gnu/usr.bin/sort/getopt.h index 45541f5ac0f9..4ac33b71824d 100644 --- a/gnu/usr.bin/sort/getopt.h +++ b/gnu/usr.bin/sort/getopt.h @@ -1,5 +1,5 @@  /* Declarations for getopt. -   Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. +   Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.     This program is free software; you can redistribute it and/or modify it     under the terms of the GNU General Public License as published by the @@ -76,7 +76,7 @@ extern int optopt;  struct option  { -#if	__STDC__ +#if defined (__STDC__) && __STDC__    const char *name;  #else    char *name; @@ -94,15 +94,15 @@ struct option  #define required_argument	1  #define optional_argument	2 -#if __STDC__ -#if defined(__GNU_LIBRARY__) +#if defined (__STDC__) && __STDC__ +#ifdef __GNU_LIBRARY__  /* Many other libraries have conflicting prototypes for getopt, with     differences in the consts, in stdlib.h.  To avoid compilation     errors, only prototype getopt for the GNU C library.  */  extern int getopt (int argc, char *const *argv, const char *shortopts);  #else /* not __GNU_LIBRARY__ */  extern int getopt (); -#endif /* not __GNU_LIBRARY__ */ +#endif /* __GNU_LIBRARY__ */  extern int getopt_long (int argc, char *const *argv, const char *shortopts,  		        const struct option *longopts, int *longind);  extern int getopt_long_only (int argc, char *const *argv, @@ -120,7 +120,7 @@ extern int getopt_long ();  extern int getopt_long_only ();  extern int _getopt_internal (); -#endif /* not __STDC__ */ +#endif /* __STDC__ */  #ifdef	__cplusplus  } diff --git a/gnu/usr.bin/sort/getopt1.c b/gnu/usr.bin/sort/getopt1.c index f784b5757c59..4580211cfac3 100644 --- a/gnu/usr.bin/sort/getopt1.c +++ b/gnu/usr.bin/sort/getopt1.c @@ -1,5 +1,5 @@  /* getopt_long and getopt_long_only entry points for GNU getopt. -   Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 +   Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994  	Free Software Foundation, Inc.     This program is free software; you can redistribute it and/or modify it @@ -17,19 +17,12 @@     Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */  #ifdef HAVE_CONFIG_H -#if defined (emacs) || defined (CONFIG_BROKETS) -/* We use <config.h> instead of "config.h" so that a compilation -   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h -   (which it would do because it found this file in $srcdir).  */  #include <config.h> -#else -#include "config.h" -#endif  #endif  #include "getopt.h" -#ifndef __STDC__ +#if !defined (__STDC__) || !__STDC__  /* This is a separate conditional since some stdc systems     reject `defined (const)'.  */  #ifndef const diff --git a/gnu/usr.bin/sort/long-options.c b/gnu/usr.bin/sort/long-options.c index 85876677a1b1..dd7a8ca14822 100644 --- a/gnu/usr.bin/sort/long-options.c +++ b/gnu/usr.bin/sort/long-options.c @@ -1,5 +1,5 @@  /* Utility to accept --help and --version options as unobtrusively as possible. -   Copyright (C) 1993 Free Software Foundation, Inc. +   Copyright (C) 1993, 1994 Free Software Foundation, Inc.     This program is free software; you can redistribute it and/or modify     it under the terms of the GNU General Public License as published by @@ -18,21 +18,11 @@  /* Jim Meyering (meyering@comco.com) */  #ifdef HAVE_CONFIG_H -#if defined (CONFIG_BROKETS) -/* We use <config.h> instead of "config.h" so that a compilation -   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h -   (which it would do because it found this file in $srcdir).  */  #include <config.h> -#else -#include "config.h" -#endif  #endif  #include <stdio.h>  #include <getopt.h> -#include <sys/types.h> -#include "system.h" -#include "version.h"  #include "long-options.h"  static struct option const long_options[] = @@ -46,9 +36,11 @@ static struct option const long_options[] =     Be careful not to gobble up `--'.  */  void -parse_long_options (argc, argv, usage) +parse_long_options (argc, argv, command_name, version_string, usage)       int argc;       char **argv; +     const char *command_name; +     const char *version_string;       void (*usage)();  {    int c; @@ -67,10 +59,10 @@ parse_long_options (argc, argv, usage)        switch (c)  	{  	case 'h': -	  usage (0); +	  (*usage) (0);  	case 'v': -	  printf ("%s\n", version_string); +	  printf ("%s - %s\n", command_name, version_string);  	  exit (0);  	default: diff --git a/gnu/usr.bin/sort/long-options.h b/gnu/usr.bin/sort/long-options.h index 9d1a9c73a393..986a52d0d47c 100644 --- a/gnu/usr.bin/sort/long-options.h +++ b/gnu/usr.bin/sort/long-options.h @@ -1 +1,10 @@ -void parse_long_options (); +#undef __P +#if defined (__STDC__) && __STDC__ +#define __P(args) args +#else +#define __P(args) () +#endif + +void +  parse_long_options __P ((int _argc, char **_argv, const char *_command_name, +			   const char *_version_string, void (*_usage) (int))); diff --git a/gnu/usr.bin/sort/sort.1 b/gnu/usr.bin/sort/sort.1 index 17ea03f62acc..e9f4b1ed290c 100644 --- a/gnu/usr.bin/sort/sort.1 +++ b/gnu/usr.bin/sort/sort.1 @@ -1,4 +1,4 @@ -.TH SORT 1 \" -*- nroff -*- +.TH SORT 1 "GNU Text Utilities" "FSF" \" -*- nroff -*-  .SH NAME  sort \- sort lines of text files  .SH SYNOPSIS @@ -192,7 +192,7 @@ option is taken to apply to both the \fI+pos\fP and the \fI\-pos\fP  parts of a key specification.  Keys may span multiple fields.  .PP  In addition, when GNU -.B join +.B sort  is invoked with exactly one argument, the following options are recognized:  .TP  .I "\-\-help" diff --git a/gnu/usr.bin/sort/sort.c b/gnu/usr.bin/sort/sort.c index 74d4b466ffc5..5a93de6fa621 100644 --- a/gnu/usr.bin/sort/sort.c +++ b/gnu/usr.bin/sort/sort.c @@ -1,5 +1,5 @@  /* sort - sort lines of text (with all kinds of options). -   Copyright (C) 1988, 1991 Free Software Foundation +   Copyright (C) 1988, 1991, 1992, 1993, 1994, 1995 Free Software Foundation     This program is free software; you can redistribute it and/or modify     it under the terms of the GNU General Public License as published by @@ -13,22 +13,13 @@     You should have received a copy of the GNU General Public License     along with this program; if not, write to the Free Software -   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.     Written December 1988 by Mike Haertel.     The author may be reached (Email) at the address mike@gnu.ai.mit.edu,     or (US mail) as Mike Haertel c/o Free Software Foundation. */ -#ifdef HAVE_CONFIG_H -#if defined (CONFIG_BROKETS) -/* We use <config.h> instead of "config.h" so that a compilation -   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h -   (which it would do because it found this file in $srcdir).  */  #include <config.h> -#else -#include "config.h" -#endif -#endif  /* Get isblank from GNU libc.  */  #define _GNU_SOURCE @@ -36,10 +27,16 @@  #include <sys/types.h>  #include <signal.h>  #include <stdio.h> +#ifdef __FreeBSD__ +#include <locale.h> +#endif  #include "system.h" +#include "version.h"  #include "long-options.h" +#include "error.h" +#include "xstrtod.h" -#ifdef _POSIX_VERSION +#ifdef HAVE_LIMITS_H  #include <limits.h>  #else  #ifndef UCHAR_MAX @@ -52,16 +49,73 @@ char *realloc ();  void free ();  #endif -void error (); -static void usage (); - +/* Undefine, to avoid warning about redefinition on some systems.  */ +#undef min  #define min(a, b) ((a) < (b) ? (a) : (b)) +  #define UCHAR_LIM (UCHAR_MAX + 1)  #define UCHAR(c) ((unsigned char) (c)) +#ifndef DEFAULT_TMPDIR +#define DEFAULT_TMPDIR "/tmp" +#endif +  /* The kind of blanks for '-b' to skip in various options. */  enum blanktype { bl_start, bl_end, bl_both }; +/* Lines are held in core as counted strings. */ +struct line +{ +  char *text;			/* Text of the line. */ +  int length;			/* Length not including final newline. */ +  char *keybeg;			/* Start of first key. */ +  char *keylim;			/* Limit of first key. */ +}; + +/* Arrays of lines. */ +struct lines +{ +  struct line *lines;		/* Dynamically allocated array of lines. */ +  int used;			/* Number of slots used. */ +  int alloc;			/* Number of slots allocated. */ +  int limit;			/* Max number of slots to allocate.  */ +}; + +/* Input buffers. */ +struct buffer +{ +  char *buf;			/* Dynamically allocated buffer. */ +  int used;			/* Number of bytes used. */ +  int alloc;			/* Number of bytes allocated. */ +  int left;			/* Number of bytes left after line parsing. */ +}; + +struct keyfield +{ +  int sword;			/* Zero-origin 'word' to start at. */ +  int schar;			/* Additional characters to skip. */ +  int skipsblanks;		/* Skip leading white space at start. */ +  int eword;			/* Zero-origin first word after field. */ +  int echar;			/* Additional characters in field. */ +  int skipeblanks;		/* Skip trailing white space at finish. */ +  int *ignore;			/* Boolean array of characters to ignore. */ +  char *translate;		/* Translation applied to characters. */ +  int numeric;			/* Flag for numeric comparison.  Handle +				   strings of digits with optional decimal +				   point, but no exponential notation. */ +  int general_numeric;		/* Flag for general, numeric comparison. +				   Handle numbers in exponential notation. */ +  int month;			/* Flag for comparison by month name. */ +  int reverse;			/* Reverse the sense of comparison. */ +  struct keyfield *next;	/* Next keyfield to try. */ +}; + +struct month +{ +  char *name; +  int val; +}; +  /* The name this program was run with. */  char *program_name; @@ -82,11 +136,7 @@ static char fold_toupper[UCHAR_LIM];  /* Table mapping 3-letter month names to integers.     Alphabetic order allows binary search. */ -static struct month -{ -  char *name; -  int val; -} const monthtab[] = +static struct month const monthtab[] =  {    {"APR", 4},    {"AUG", 8}, @@ -107,17 +157,17 @@ static struct month  /* Initial buffer size for in core sorting.  Will not grow unless a     line longer than this is seen. */ -static int sortalloc =  524288; +static int sortalloc = 512 * 1024;  /* Initial buffer size for in core merge buffers.  Bear in mind that     up to NMERGE * mergealloc bytes may be allocated for merge buffers. */ -static int mergealloc =  16384; +static int mergealloc =  16 * 1024;  /* Guess of average line length. */  static int linelength = 30;  /* Maximum number of elements for the array(s) of struct line's, in bytes.  */ -#define LINEALLOC 262144 +#define LINEALLOC (256 * 1024)  /* Prefix for temporary file names. */  static char *temp_file_prefix; @@ -142,49 +192,55 @@ static int unique;  /* Nonzero if any of the input files are the standard input. */  static int have_read_stdin; -/* Lines are held in core as counted strings. */ -struct line -{ -  char *text;			/* Text of the line. */ -  int length;			/* Length not including final newline. */ -  char *keybeg;			/* Start of first key. */ -  char *keylim;			/* Limit of first key. */ -}; - -/* Arrays of lines. */ -struct lines -{ -  struct line *lines;		/* Dynamically allocated array of lines. */ -  int used;			/* Number of slots used. */ -  int alloc;			/* Number of slots allocated. */ -  int limit;			/* Max number of slots to allocate.  */ -}; - -/* Input buffers. */ -struct buffer -{ -  char *buf;			/* Dynamically allocated buffer. */ -  int used;			/* Number of bytes used. */ -  int alloc;			/* Number of bytes allocated. */ -  int left;			/* Number of bytes left after line parsing. */ -}; -  /* Lists of key field comparisons to be tried. */ -static struct keyfield +static struct keyfield keyhead; + +static void +usage (int status)  { -  int sword;			/* Zero-origin 'word' to start at. */ -  int schar;			/* Additional characters to skip. */ -  int skipsblanks;		/* Skip leading white space at start. */ -  int eword;			/* Zero-origin first word after field. */ -  int echar;			/* Additional characters in field. */ -  int skipeblanks;		/* Skip trailing white space at finish. */ -  int *ignore;			/* Boolean array of characters to ignore. */ -  char *translate;		/* Translation applied to characters. */ -  int numeric;			/* Flag for numeric comparison. */ -  int month;			/* Flag for comparison by month name. */ -  int reverse;			/* Reverse the sense of comparison. */ -  struct keyfield *next;	/* Next keyfield to try. */ -} keyhead; +  if (status != 0) +    fprintf (stderr, _("Try `%s --help' for more information.\n"), +	     program_name); +  else +    { +      printf (_("\ +Usage: %s [OPTION]... [FILE]...\n\ +"), +	      program_name); +      printf (_("\ +Write sorted concatenation of all FILE(s) to standard output.\n\ +\n\ +  +POS1 [-POS2]    start a key at POS1, end it before POS2\n\ +  -M               compare (unknown) < `JAN' < ... < `DEC', imply -b\n\ +  -T DIRECT        use DIRECT for temporary files, not $TMPDIR or %s\n\ +  -b               ignore leading blanks in sort fields or keys\n\ +  -c               check if given files already sorted, do not sort\n\ +  -d               consider only [a-zA-Z0-9 ] characters in keys\n\ +  -f               fold lower case to upper case characters in keys\n\ +  -g               compare according to general numerical value, imply -b\n\ +  -i               consider only [\\040-\\0176] characters in keys\n\ +  -k POS1[,POS2]   same as +POS1 [-POS2], but all positions counted from 1\n\ +  -m               merge already sorted files, do not sort\n\ +  -n               compare according to string numerical value, imply -b\n\ +  -o FILE          write result on FILE instead of standard output\n\ +  -r               reverse the result of comparisons\n\ +  -s               stabilize sort by disabling last resort comparison\n\ +  -t SEP           use SEParator instead of non- to whitespace transition\n\ +  -u               with -c, check for strict ordering\n\ +  -u               with -m, only output the first of an equal sequence\n\ +      --help       display this help and exit\n\ +      --version    output version information and exit\n\ +\n\ +POS is F[.C][OPTS], where F is the field number and C the character\n\ +position in the field, both counted from zero.  OPTS is made up of one\n\ +or more of Mbdfinr, this effectively disable global -Mbdfinr settings\n\ +for that key.  If no key given, use the entire line as key.  With no\n\ +FILE, or when FILE is -, read standard input.\n\ +") +	      , DEFAULT_TMPDIR); +    } +  exit (status); +}  /* The list of temporary files. */  static struct tempnode @@ -196,7 +252,7 @@ static struct tempnode  /* Clean up any remaining temporary files. */  static void -cleanup () +cleanup (void)  {    struct tempnode *node; @@ -206,16 +262,15 @@ cleanup ()  /* Allocate N bytes of memory dynamically, with error checking.  */ -char * -xmalloc (n) -     unsigned n; +static char * +xmalloc (unsigned int n)  {    char *p;    p = malloc (n);    if (p == 0)      { -      error (0, 0, "virtual memory exhausted"); +      error (0, 0, _("virtual memory exhausted"));        cleanup ();        exit (2);      } @@ -227,10 +282,8 @@ xmalloc (n)     If P is NULL, run xmalloc.     If N is 0, run free and return NULL.  */ -char * -xrealloc (p, n) -     char *p; -     unsigned n; +static char * +xrealloc (char *p, unsigned int n)  {    if (p == 0)      return xmalloc (n); @@ -242,7 +295,7 @@ xrealloc (p, n)    p = realloc (p, n);    if (p == 0)      { -      error (0, 0, "virtual memory exhausted"); +      error (0, 0, _("virtual memory exhausted"));        cleanup ();        exit (2);      } @@ -250,50 +303,81 @@ xrealloc (p, n)  }  static FILE * -xfopen (file, how) -     char *file, *how; +xtmpfopen (const char *file)  { -  FILE *fp = strcmp (file, "-") ? fopen (file, how) : stdin; +  FILE *fp; +  int fd; -  if (fp == 0) +  fd = open (file, O_WRONLY | O_CREAT | O_TRUNC, 0600); +  if (fd < 0 || (fp = fdopen (fd, "w")) == NULL)      {        error (0, errno, "%s", file);        cleanup ();        exit (2);      } + +  return fp; +} + +static FILE * +xfopen (const char *file, const char *how) +{ +  FILE *fp; + +  if (strcmp (file, "-") == 0) +    { +      fp = stdin; +    } +  else +    { +      if ((fp = fopen (file, how)) == NULL) +	{ +	  error (0, errno, "%s", file); +	  cleanup (); +	  exit (2); +	} +    } +    if (fp == stdin)      have_read_stdin = 1;    return fp;  }  static void -xfclose (fp) -     FILE *fp; +xfclose (FILE *fp)  { -  fflush (fp); -  if (fp != stdin && fp != stdout) +  if (fp == stdin)      { -      if (fclose (fp) != 0) +      /* Allow reading stdin from tty more than once. */ +      if (feof (fp)) +	clearerr (fp); +    } +  else if (fp == stdout) +    { +      if (fflush (fp) != 0)  	{ -	  error (0, errno, "error closing file"); +	  error (0, errno, _("flushing file"));  	  cleanup ();  	  exit (2);  	}      }    else -    /* Allow reading stdin from tty more than once. */ -    clearerr (fp); +    { +      if (fclose (fp) != 0) +	{ +	  error (0, errno, _("error closing file")); +	  cleanup (); +	  exit (2); +	} +    }  }  static void -xfwrite (buf, size, nelem, fp) -     char *buf; -     int size, nelem; -     FILE *fp; +xfwrite (const char *buf, int size, int nelem, FILE *fp)  {    if (fwrite (buf, size, nelem, fp) != nelem)      { -      error (0, errno, "write error"); +      error (0, errno, _("write error"));        cleanup ();        exit (2);      } @@ -302,18 +386,25 @@ xfwrite (buf, size, nelem, fp)  /* Return a name for a temporary file. */  static char * -tempname () +tempname (void)  { -  static int seq; +  static unsigned int seq;    int len = strlen (temp_file_prefix); -  char *name = xmalloc (len + 16); -  struct tempnode *node = -  (struct tempnode *) xmalloc (sizeof (struct tempnode)); +  char *name = xmalloc (len + 1 + sizeof ("sort") - 1 + 5 + 5 + 1); +  struct tempnode *node; + +  node = (struct tempnode *) xmalloc (sizeof (struct tempnode)); +  sprintf (name, +	   "%s%ssort%5.5d%5.5d", +	   temp_file_prefix, +	   (len && temp_file_prefix[len - 1] != '/') ? "/" : "", +	   (unsigned int) getpid () & 0xffff, seq); + +  /* Make sure that SEQ's value fits in 5 digits.  */ +  ++seq; +  if (seq >= 100000) +    seq = 0; -  if (len && temp_file_prefix[len - 1] != '/') -    sprintf (name, "%s/sort%5.5d%5.5d", temp_file_prefix, getpid (), ++seq); -  else -    sprintf (name, "%ssort%5.5d%5.5d", temp_file_prefix, getpid (), ++seq);    node->name = name;    node->next = temphead.next;    temphead.next = node; @@ -324,8 +415,7 @@ tempname ()     remove it if it is found on the list. */  static void -zaptemp (name) -     char *name; +zaptemp (char *name)  {    struct tempnode *node, *temp; @@ -345,7 +435,7 @@ zaptemp (name)  /* Initialize the character class tables. */  static void -inittables () +inittables (void)  {    int i; @@ -369,9 +459,7 @@ inittables ()  /* Initialize BUF, allocating ALLOC bytes initially. */  static void -initbuf (buf, alloc) -     struct buffer *buf; -     int alloc; +initbuf (struct buffer *buf, int alloc)  {    buf->alloc = alloc;    buf->buf = xmalloc (buf->alloc); @@ -384,13 +472,11 @@ initbuf (buf, alloc)     of bytes buffered. */  static int -fillbuf (buf, fp) -     struct buffer *buf; -     FILE *fp; +fillbuf (struct buffer *buf, FILE *fp)  {    int cc; -  bcopy (buf->buf + buf->used - buf->left, buf->buf, buf->left); +  memmove (buf->buf, buf->buf + buf->used - buf->left, buf->left);    buf->used = buf->left;    while (!feof (fp) && (buf->used == 0 || !memchr (buf->buf, '\n', buf->used))) @@ -403,7 +489,7 @@ fillbuf (buf, fp)        cc = fread (buf->buf + buf->used, 1, buf->alloc - buf->used, fp);        if (ferror (fp))  	{ -	  error (0, errno, "read error"); +	  error (0, errno, _("read error"));  	  cleanup ();  	  exit (2);  	} @@ -428,10 +514,7 @@ fillbuf (buf, fp)     for, ever.  */  static void -initlines (lines, alloc, limit) -     struct lines *lines; -     int alloc; -     int limit; +initlines (struct lines *lines, int alloc, int limit)  {    lines->alloc = alloc;    lines->lines = (struct line *) xmalloc (lines->alloc * sizeof (struct line)); @@ -443,9 +526,7 @@ initlines (lines, alloc, limit)     by KEY in LINE. */  static char * -begfield (line, key) -     struct line *line; -     struct keyfield *key; +begfield (const struct line *line, const struct keyfield *key)  {    register char *ptr = line->text, *lim = ptr + line->length;    register int sword = key->sword, schar = key->schar; @@ -471,8 +552,10 @@ begfield (line, key)      while (ptr < lim && blanks[UCHAR (*ptr)])        ++ptr; -  while (ptr < lim && schar--) -    ++ptr; +  if (ptr + schar <= lim) +    ptr += schar; +  else +    ptr = lim;    return ptr;  } @@ -481,19 +564,28 @@ begfield (line, key)     in LINE specified by KEY. */  static char * -limfield (line, key) -     struct line *line; -     struct keyfield *key; +limfield (const struct line *line, const struct keyfield *key)  {    register char *ptr = line->text, *lim = ptr + line->length;    register int eword = key->eword, echar = key->echar; +  /* Note: from the POSIX spec: +     The leading field separator itself is included in +     a field when -t is not used.  FIXME: move this comment up... */ + +  /* Move PTR past EWORD fields or to one past the last byte on LINE, +     whichever comes first.  If there are more than EWORD fields, leave +     PTR pointing at the beginning of the field having zero-based index, +     EWORD.  If a delimiter character was specified (via -t), then that +     `beginning' is the first character following the delimiting TAB. +     Otherwise, leave PTR pointing at the first `blank' character after +     the preceding field.  */    if (tab)      while (ptr < lim && eword--)        {  	while (ptr < lim && *ptr != tab)  	  ++ptr; -	if (ptr < lim && (eword || key->skipeblanks)) +	if (ptr < lim && (eword || echar > 0))  	  ++ptr;        }    else @@ -505,23 +597,54 @@ limfield (line, key)  	  ++ptr;        } -  if (key->skipeblanks) +  /* Make LIM point to the end of (one byte past) the current field.  */ +  if (tab) +    { +      char *newlim; +      newlim = memchr (ptr, tab, lim - ptr); +      if (newlim) +	lim = newlim; +    } +  else +    { +      char *newlim; +      newlim = ptr; +      while (newlim < lim && blanks[UCHAR (*newlim)]) +	++newlim; +      while (newlim < lim && !blanks[UCHAR (*newlim)]) +	++newlim; +      lim = newlim; +    } + +  /* If we're skipping leading blanks, don't start counting characters +     until after skipping past any leading blanks.  */ +  if (key->skipsblanks)      while (ptr < lim && blanks[UCHAR (*ptr)])        ++ptr; -  while (ptr < lim && echar--) -    ++ptr; +  /* Advance PTR by ECHAR (if possible), but no further than LIM.  */ +  if (ptr + echar <= lim) +    ptr += echar; +  else +    ptr = lim;    return ptr;  } +/* FIXME */ + +void +trim_trailing_blanks (const char *a_start, char **a_end) +{ +  while (*a_end > a_start && blanks[UCHAR (*(*a_end - 1))]) +    --(*a_end); +} +  /* Find the lines in BUF, storing pointers and lengths in LINES. -   Also replace newlines with NULs. */ +   Also replace newlines in BUF with NULs. */  static void -findlines (buf, lines) -     struct buffer *buf; -     struct lines *lines; +findlines (struct buffer *buf, struct lines *lines)  {    register char *beg = buf->buf, *lim = buf->buf + buf->used, *ptr;    struct keyfield *key = keyhead.next; @@ -566,6 +689,11 @@ findlines (buf, lines)  		  ++beg;  	      lines->lines[lines->used].keybeg = beg;  	    } +	  if (key->skipeblanks) +	    { +	      trim_trailing_blanks (lines->lines[lines->used].keybeg, +				    &lines->lines[lines->used].keylim); +	    }  	}        else  	{ @@ -585,8 +713,7 @@ findlines (buf, lines)     of the fraction.  Strings not of this form are considered to be zero. */  static int -fraccompare (a, b) -     register char *a, *b; +fraccompare (register const char *a, register const char *b)  {    register tmpa = UCHAR (*a), tmpb = UCHAR (*b); @@ -641,12 +768,12 @@ fraccompare (a, b)     hideously fast. */  static int -numcompare (a, b) -     register char *a, *b; +numcompare (register const char *a, register const char *b)  {    register int tmpa, tmpb, loga, logb, tmp; -  tmpa = UCHAR (*a), tmpb = UCHAR (*b); +  tmpa = UCHAR (*a); +  tmpb = UCHAR (*b);    while (blanks[tmpa])      tmpa = UCHAR (*++a); @@ -655,19 +782,30 @@ numcompare (a, b)    if (tmpa == '-')      { -      tmpa = UCHAR (*++a); +      do +	tmpa = UCHAR (*++a); +      while (tmpa == '0');        if (tmpb != '-')  	{ -	  if (digits[tmpa] && digits[tmpb]) +	  if (tmpa == '.') +	    do +	      tmpa = UCHAR (*++a); +	    while (tmpa == '0'); +	  if (digits[tmpa]) +	    return -1; +	  while (tmpb == '0') +	    tmpb = UCHAR (*++b); +	  if (tmpb == '.') +	    do +	      tmpb = *++b; +	    while (tmpb == '0'); +	  if (digits[tmpb])  	    return -1;  	  return 0;  	} -      tmpb = UCHAR (*++b); - -      while (tmpa == '0') -	tmpa = UCHAR (*++a); -      while (tmpb == '0') +      do  	tmpb = UCHAR (*++b); +      while (tmpb == '0');        while (tmpa == tmpb && digits[tmpa])  	tmpa = UCHAR (*++a), tmpb = UCHAR (*++b); @@ -697,7 +835,22 @@ numcompare (a, b)      }    else if (tmpb == '-')      { -      if (digits[UCHAR (tmpa)] && digits[UCHAR (*++b)]) +      do +	tmpb = UCHAR (*++b); +      while (tmpb == '0'); +      if (tmpb == '.') +	do +	  tmpb = *++b; +	while (tmpb == '0'); +      if (digits[tmpb]) +	return 1; +      while (tmpa == '0') +	tmpa = UCHAR (*++a); +      if (tmpa == '.') +	do +	  tmpa = UCHAR (*++a); +	while (tmpa == '0'); +      if (digits[tmpa])  	return 1;        return 0;      } @@ -736,13 +889,29 @@ numcompare (a, b)      }  } +static int +general_numcompare (const char *sa, const char *sb) +{ +  double a, b; +  /* FIXME: add option to warn about failed conversions.  */ +  /* FIXME: maybe add option to try expensive FP conversion +     only if A and B can't be compared more cheaply/accurately.  */ +  if (xstrtod (sa, NULL, &a)) +    { +      a = 0; +    } +  if (xstrtod (sb, NULL, &b)) +    { +      b = 0; +    } +  return a == b ? 0 : a < b ? -1 : 1; +} +  /* Return an integer <= 12 associated with month name S with length LEN,     0 if the name in S is not recognized. */  static int -getmonth (s, len) -     char *s; -     int len; +getmonth (const char *s, int len)  {    char month[4];    register int i, lo = 0, hi = 12; @@ -771,8 +940,7 @@ getmonth (s, len)     are no more keys or a difference is found. */  static int -keycompare (a, b) -     struct line *a, *b; +keycompare (const struct line *a, const struct line *b)  {    register char *texta, *textb, *lima, *limb, *translate;    register int *ignore; @@ -821,6 +989,16 @@ keycompare (a, b)        if (lenb < 0)  	lenb = 0; +      if (key->skipeblanks) +        { +	  char *a_end = texta + lena; +	  char *b_end = textb + lenb; +	  trim_trailing_blanks (texta, &a_end); +	  trim_trailing_blanks (textb, &b_end); +	  lena = a_end - texta; +	  lenb = b_end - textb; +	} +        /* Actually compare the fields. */        if (key->numeric)  	{ @@ -839,6 +1017,23 @@ keycompare (a, b)  	    return key->reverse ? -diff : diff;  	  continue;  	} +      else if (key->general_numeric) +	{ +	  if (*lima || *limb) +	    { +	      char savea = *lima, saveb = *limb; + +	      *lima = *limb = '\0'; +	      diff = general_numcompare (texta, textb); +	      *lima = savea, *limb = saveb; +	    } +	  else +	    diff = general_numcompare (texta, textb); + +	  if (diff) +	    return key->reverse ? -diff : diff; +	  continue; +	}        else if (key->month)  	{  	  diff = getmonth (texta, lena) - getmonth (textb, lenb); @@ -847,38 +1042,64 @@ keycompare (a, b)  	  continue;  	}        else if (ignore && translate) -	while (texta < lima && textb < limb) -	  { -	    while (texta < lima && ignore[UCHAR (*texta)]) -	      ++texta; -	    while (textb < limb && ignore[UCHAR (*textb)]) -	      ++textb; -	    if (texta < lima && textb < limb && -		translate[UCHAR (*texta++)] != translate[UCHAR (*textb++)]) -	      { -		diff = translate[UCHAR (*--texta)] - translate[UCHAR (*--textb)]; -		break; -	      } -	  } + +#define CMP_WITH_IGNORE(A, B)						\ +  do									\ +    {									\ +	  while (texta < lima && textb < limb)				\ +	    {								\ +	      while (texta < lima && ignore[UCHAR (*texta)])		\ +		++texta;						\ +	      while (textb < limb && ignore[UCHAR (*textb)])		\ +		++textb;						\ +	      if (texta < lima && textb < limb)				\ +		{							\ +		  if ((A) != (B))					\ +		    {							\ +		      diff = (A) - (B);					\ +		      break;						\ +		    }							\ +		  ++texta;						\ +		  ++textb;						\ +		}							\ +									\ +	      if (texta == lima && textb < limb && !ignore[UCHAR (*textb)]) \ +		diff = -1;						\ +	      else if (texta < lima && textb == limb			\ +		       && !ignore[UCHAR (*texta)])			\ +		diff = 1;						\ +	    }								\ +									\ +	  if (diff == 0)						\ +	    {								\ +	      while (texta < lima && ignore[UCHAR (*texta)])		\ +		++texta;						\ +	      while (textb < limb && ignore[UCHAR (*textb)])		\ +		++textb;						\ +									\ +	      if (texta == lima && textb < limb)			\ +		diff = -1;						\ +	      else if (texta < lima && textb == limb)			\ +		diff = 1;						\ +	    }								\ +	  /* Relative lengths are meaningless if characters were ignored.  \ +	     Handling this case here avoids what might be an invalid length  \ +	     comparison below.  */					\ +	  if (diff == 0 && texta == lima && textb == limb)		\ +	    return 0;							\ +    }									\ +  while (0) + +	CMP_WITH_IGNORE (translate[UCHAR (*texta)], translate[UCHAR (*textb)]);        else if (ignore) -	while (texta < lima && textb < limb) -	  { -	    while (texta < lima && ignore[UCHAR (*texta)]) -	      ++texta; -	    while (textb < limb && ignore[UCHAR (*textb)]) -	      ++textb; -	    if (texta < lima && textb < limb && *texta++ != *textb++) -	      { -		diff = *--texta - *--textb; -		break; -	      } -	  } +	CMP_WITH_IGNORE (*texta, *textb);        else if (translate)  	while (texta < lima && textb < limb)  	  {  	    if (translate[UCHAR (*texta++)] != translate[UCHAR (*textb++)])  	      { -		diff = translate[UCHAR (*--texta)] - translate[UCHAR (*--textb)]; +		diff = (translate[UCHAR (*--texta)] +			- translate[UCHAR (*--textb)]);  		break;  	      }  	  } @@ -898,8 +1119,7 @@ keycompare (a, b)     depending on whether A compares less than, equal to, or greater than B. */  static int -compare (a, b) -     register struct line *a, *b; +compare (register const struct line *a, register const struct line *b)  {    int diff, tmpa, tmpb, mini; @@ -938,18 +1158,17 @@ compare (a, b)  }  /* Check that the lines read from the given FP come in order.  Return -   1 if they do and 0 if there is a disorder. */ +   1 if they do and 0 if there is a disorder. +   FIXME: return number of first out-of-order line if not sorted.  */  static int -checkfp (fp) -     FILE *fp; +checkfp (FILE *fp)  {    struct buffer buf;		/* Input buffer. */    struct lines lines;		/* Lines scanned from the buffer. */    struct line temp;		/* Copy of previous line. */    int cc;			/* Character count. */ -  int cmp;			/* Result of calling compare. */ -  int alloc, i, success = 1; +  int alloc, sorted = 1;    initbuf (&buf, mergealloc);    initlines (&lines, mergealloc / linelength + 1, @@ -958,64 +1177,69 @@ checkfp (fp)    temp.text = xmalloc (alloc);    cc = fillbuf (&buf, fp); +  if (cc == 0) +    goto finish; +    findlines (&buf, &lines); -  if (cc) -    do -      { -	/* Compare each line in the buffer with its successor. */ -	for (i = 0; i < lines.used - 1; ++i) -	  { -	    cmp = compare (&lines.lines[i], &lines.lines[i + 1]); -	    if ((unique && cmp >= 0) || (cmp > 0)) -	      { -		success = 0; -		goto finish; -	      } -	  } +  while (1) +    { +      struct line *prev_line;	/* Pointer to previous line. */ +      int cmp;			/* Result of calling compare. */ +      int i; -	/* Save the last line of the buffer and refill the buffer. */ -	if (lines.lines[lines.used - 1].length > alloc) -	  { -	    while (lines.lines[lines.used - 1].length + 1 > alloc) -	      alloc *= 2; -	    temp.text = xrealloc (temp.text, alloc); -	  } -	bcopy (lines.lines[lines.used - 1].text, temp.text, -	       lines.lines[lines.used - 1].length + 1); -	temp.length = lines.lines[lines.used - 1].length; +      /* Compare each line in the buffer with its successor. */ +      for (i = 0; i < lines.used - 1; ++i) +	{ +	  cmp = compare (&lines.lines[i], &lines.lines[i + 1]); +	  if ((unique && cmp >= 0) || (cmp > 0)) +	    { +	      sorted = 0; +	      goto finish; +	    } +	} -	cc = fillbuf (&buf, fp); -	if (cc) -	  { -	    findlines (&buf, &lines); -	    /* Make sure the line saved from the old buffer contents is -	       less than or equal to the first line of the new buffer. */ -	    cmp = compare (&temp, &lines.lines[0]); -	    if ((unique && cmp >= 0) || (cmp > 0)) -	      { -		success = 0; -		break; -	      } -	  } -      } -    while (cc); +      /* Save the last line of the buffer and refill the buffer. */ +      prev_line = lines.lines + (lines.used - 1); +      if (prev_line->length > alloc) +	{ +	  while (prev_line->length + 1 > alloc) +	    alloc *= 2; +	  temp.text = xrealloc (temp.text, alloc); +	} +      memcpy (temp.text, prev_line->text, prev_line->length + 1); +      temp.length = prev_line->length; +      temp.keybeg = temp.text + (prev_line->keybeg - prev_line->text); +      temp.keylim = temp.text + (prev_line->keylim - prev_line->text); + +      cc = fillbuf (&buf, fp); +      if (cc == 0) +        break; + +      findlines (&buf, &lines); +      /* Make sure the line saved from the old buffer contents is +	 less than or equal to the first line of the new buffer. */ +      cmp = compare (&temp, &lines.lines[0]); +      if ((unique && cmp >= 0) || (cmp > 0)) +	{ +	  sorted = 0; +	  break; +	} +    }  finish:    xfclose (fp);    free (buf.buf);    free ((char *) lines.lines);    free (temp.text); -  return success; +  return sorted;  }  /* Merge lines from FPS onto OFP.  NFPS cannot be greater than NMERGE.     Close FPS before returning. */  static void -mergefps (fps, nfps, ofp) -     FILE *fps[], *ofp; -     register int nfps; +mergefps (FILE **fps, register int nfps, FILE *ofp)  {    struct buffer buffer[NMERGE];	/* Input buffers for each file. */    struct lines lines[NMERGE];	/* Line tables for each buffer. */ @@ -1029,6 +1253,10 @@ mergefps (fps, nfps, ofp)  				   output. */    register int i, j, t; +#ifdef lint  /* Suppress `used before initialized' warning.  */ +  savealloc = 0; +#endif +    /* Allocate space for a saved line if necessary. */    if (unique)      { @@ -1072,7 +1300,7 @@ mergefps (fps, nfps, ofp)    /* Repeatedly output the smallest line until no input remains. */    while (nfps)      { -      /* If uniqified output is turned out, output only the first of +      /* If uniqified output is turned on, output only the first of  	 an identical series of lines. */        if (unique)  	{ @@ -1091,7 +1319,7 @@ mergefps (fps, nfps, ofp)  		  saved.text = xrealloc (saved.text, savealloc);  		}  	      saved.length = lines[ord[0]].lines[cur[ord[0]]].length; -	      bcopy (lines[ord[0]].lines[cur[ord[0]]].text, saved.text, +	      memcpy (saved.text, lines[ord[0]].lines[cur[ord[0]]].text,  		     saved.length + 1);  	      if (lines[ord[0]].lines[cur[ord[0]]].keybeg != NULL)  		{ @@ -1173,9 +1401,7 @@ mergefps (fps, nfps, ofp)  /* Sort the array LINES with NLINES members, using TEMP for temporary space. */  static void -sortlines (lines, nlines, temp) -     struct line *lines, *temp; -     int nlines; +sortlines (struct line *lines, int nlines, struct line *temp)  {    register struct line *lo, *hi, *t;    register int nlo, nhi; @@ -1216,9 +1442,7 @@ sortlines (lines, nlines, temp)     Return a count of disordered files. */  static int -check (files, nfiles) -     char *files[]; -     int nfiles; +check (char **files, int nfiles)  {    int i, disorders = 0;    FILE *fp; @@ -1228,7 +1452,7 @@ check (files, nfiles)        fp = xfopen (files[i], "r");        if (!checkfp (fp))  	{ -	  printf ("%s: disorder on %s\n", program_name, files[i]); +	  fprintf (stderr, _("%s: disorder on %s\n"), program_name, files[i]);  	  ++disorders;  	}      } @@ -1238,10 +1462,7 @@ check (files, nfiles)  /* Merge NFILES FILES onto OFP. */  static void -merge (files, nfiles, ofp) -     char *files[]; -     int nfiles; -     FILE *ofp; +merge (char **files, int nfiles, FILE *ofp)  {    int i, j, t;    char *temp; @@ -1254,7 +1475,7 @@ merge (files, nfiles, ofp)  	{  	  for (j = 0; j < NMERGE; ++j)  	    fps[j] = xfopen (files[i * NMERGE + j], "r"); -	  tfp = xfopen (temp = tempname (), "w"); +	  tfp = xtmpfopen (temp = tempname ());  	  mergefps (fps, NMERGE, tfp);  	  xfclose (tfp);  	  for (j = 0; j < NMERGE; ++j) @@ -1263,7 +1484,7 @@ merge (files, nfiles, ofp)  	}        for (j = 0; j < nfiles % NMERGE; ++j)  	fps[j] = xfopen (files[i * NMERGE + j], "r"); -      tfp = xfopen (temp = tempname (), "w"); +      tfp = xtmpfopen (temp = tempname ());        mergefps (fps, nfiles % NMERGE, tfp);        xfclose (tfp);        for (j = 0; j < nfiles % NMERGE; ++j) @@ -1282,10 +1503,7 @@ merge (files, nfiles, ofp)  /* Sort NFILES FILES onto OFP. */  static void -sort (files, nfiles, ofp) -     char **files; -     int nfiles; -     FILE *ofp; +sort (char **files, int nfiles, FILE *ofp)  {    struct buffer buf;    struct lines lines; @@ -1293,7 +1511,7 @@ sort (files, nfiles, ofp)    int i, ntmp;    FILE *fp, *tfp;    struct tempnode *node; -  int ntemp = 0; +  int n_temp_files = 0;    char **tempfiles;    initbuf (&buf, sortalloc); @@ -1316,12 +1534,12 @@ sort (files, nfiles, ofp)  		xrealloc ((char *) tmp, ntmp * sizeof (struct line));  	    }  	  sortlines (lines.lines, lines.used, tmp); -	  if (feof (fp) && !nfiles && !ntemp && !buf.left) +	  if (feof (fp) && !nfiles && !n_temp_files && !buf.left)  	    tfp = ofp;  	  else  	    { -	      ++ntemp; -	      tfp = xfopen (tempname (), "w"); +	      ++n_temp_files; +	      tfp = xtmpfopen (tempname ());  	    }  	  for (i = 0; i < lines.used; ++i)  	    if (!unique || i == 0 @@ -1340,13 +1558,13 @@ sort (files, nfiles, ofp)    free ((char *) lines.lines);    free ((char *) tmp); -  if (ntemp) +  if (n_temp_files)      { -      tempfiles = (char **) xmalloc (ntemp * sizeof (char *)); -      i = ntemp; +      tempfiles = (char **) xmalloc (n_temp_files * sizeof (char *)); +      i = n_temp_files;        for (node = temphead.next; i > 0; node = node->next)  	tempfiles[--i] = node->name; -      merge (tempfiles, ntemp, ofp); +      merge (tempfiles, n_temp_files, ofp);        free ((char *) tempfiles);      }  } @@ -1354,8 +1572,7 @@ sort (files, nfiles, ofp)  /* Insert key KEY at the end of the list (`keyhead'). */  static void -insertkey (key) -     struct keyfield *key; +insertkey (struct keyfield *key)  {    struct keyfield *k = &keyhead; @@ -1366,28 +1583,26 @@ insertkey (key)  }  static void -badfieldspec (s) -     char *s; +badfieldspec (const char *s)  { -  error (2, 0, "invalid field specification `%s'", s); +  error (2, 0, _("invalid field specification `%s'"), s);  }  /* Handle interrupts and hangups. */  static void -sighandler (sig) -     int sig; +sighandler (int sig)  { -#ifdef _POSIX_VERSION +#ifdef SA_INTERRUPT    struct sigaction sigact;    sigact.sa_handler = SIG_DFL;    sigemptyset (&sigact.sa_mask);    sigact.sa_flags = 0;    sigaction (sig, &sigact, NULL); -#else				/* !_POSIX_VERSION */ +#else				/* !SA_INTERRUPT */    signal (sig, SIG_DFL); -#endif				/* _POSIX_VERSION */ +#endif				/* SA_INTERRUPT */    cleanup ();    kill (getpid (), sig);  } @@ -1398,10 +1613,8 @@ sighandler (sig)     BLANKTYPE is the kind of blanks that 'b' should skip. */  static char * -set_ordering (s, key, blanktype) -     register char *s; -     struct keyfield *key; -     enum blanktype blanktype; +set_ordering (register const char *s, struct keyfield *key, +	      enum blanktype blanktype)  {    while (*s)      { @@ -1419,11 +1632,9 @@ set_ordering (s, key, blanktype)  	case 'f':  	  key->translate = fold_toupper;  	  break; -#if 0  	case 'g': -	  /* Reserved for comparing floating-point numbers. */ +	  key->general_numeric = 1;  	  break; -#endif  	case 'i':  	  key->ignore = nonprinting;  	  break; @@ -1432,22 +1643,24 @@ set_ordering (s, key, blanktype)  	  break;  	case 'n':  	  key->numeric = 1; +	  if (blanktype == bl_start || blanktype == bl_both) +	    key->skipsblanks = 1; +	  if (blanktype == bl_end || blanktype == bl_both) +	    key->skipeblanks = 1;  	  break;  	case 'r':  	  key->reverse = 1;  	  break;  	default: -	  return s; +	  return (char *) s;  	}        ++s;      } -  return s; +  return (char *) s;  }  void -main (argc, argv) -     int argc; -     char *argv[]; +main (int argc, char **argv)  {    struct keyfield *key = NULL, gkey;    char *s; @@ -1455,22 +1668,25 @@ main (argc, argv)    int checkonly = 0, mergeonly = 0, nfiles = 0;    char *minus = "-", *outfile = minus, **files, *tmp;    FILE *ofp; -#ifdef _POSIX_VERSION +#ifdef SA_INTERRUPT    struct sigaction oldact, newact; -#endif				/* _POSIX_VERSION */ +#endif				/* SA_INTERRUPT */ +#ifdef __FreeBSD__ +  (void) setlocale(LC_CTYPE, ""); +#endif    program_name = argv[0]; -  parse_long_options (argc, argv, usage); +  parse_long_options (argc, argv, "sort", version_string, usage);    have_read_stdin = 0;    inittables ();    temp_file_prefix = getenv ("TMPDIR");    if (temp_file_prefix == NULL) -    temp_file_prefix = "/tmp"; +    temp_file_prefix = DEFAULT_TMPDIR; -#ifdef _POSIX_VERSION +#ifdef SA_INTERRUPT    newact.sa_handler = sighandler;    sigemptyset (&newact.sa_mask);    newact.sa_flags = 0; @@ -1487,7 +1703,7 @@ main (argc, argv)    sigaction (SIGTERM, NULL, &oldact);    if (oldact.sa_handler != SIG_IGN)      sigaction (SIGTERM, &newact, NULL); -#else				/* !_POSIX_VERSION */ +#else				/* !SA_INTERRUPT */    if (signal (SIGINT, SIG_IGN) != SIG_IGN)      signal (SIGINT, sighandler);    if (signal (SIGHUP, SIG_IGN) != SIG_IGN) @@ -1496,12 +1712,12 @@ main (argc, argv)      signal (SIGPIPE, sighandler);    if (signal (SIGTERM, SIG_IGN) != SIG_IGN)      signal (SIGTERM, sighandler); -#endif				/* !_POSIX_VERSION */ +#endif				/* !SA_INTERRUPT */    gkey.sword = gkey.eword = -1;    gkey.ignore = NULL;    gkey.translate = NULL; -  gkey.numeric = gkey.month = gkey.reverse = 0; +  gkey.numeric =  gkey.general_numeric = gkey.month = gkey.reverse = 0;    gkey.skipsblanks = gkey.skipeblanks = 0;    files = (char **) xmalloc (sizeof (char *) * argc); @@ -1517,9 +1733,9 @@ main (argc, argv)  	  key->ignore = NULL;  	  key->translate = NULL;  	  key->skipsblanks = key->skipeblanks = 0; -	  key->numeric = key->month = key->reverse = 0; +	  key->numeric = key->general_numeric = key->month = key->reverse = 0;  	  s = argv[i] + 1; -	  if (!digits[UCHAR (*s)]) +	  if (! (digits[UCHAR (*s)] || (*s == '.' && digits[UCHAR (s[1])])))  	    badfieldspec (argv[i]);  	  for (t = 0; digits[UCHAR (*s)]; ++s)  	    t = 10 * t + *s - '0'; @@ -1541,7 +1757,7 @@ main (argc, argv)        else if (argv[i][0] == '-' && argv[i][1])  	{  	  s = argv[i] + 1; -	  if (digits[UCHAR (*s)]) +	  if (digits[UCHAR (*s)] || (*s == '.' && digits[UCHAR (s[1])]))  	    {  	      if (!key)  		usage (2); @@ -1576,7 +1792,7 @@ main (argc, argv)  		    else  		      {  			if (i == argc - 1) -			  error (2, 0, "option `-k' requires an argument"); +			  error (2, 0, _("option `-k' requires an argument"));  			else  			  s = argv[++i];  		      } @@ -1594,15 +1810,34 @@ main (argc, argv)  		      badfieldspec (argv[i]);  		    for (t = 0; digits[UCHAR (*s)]; ++s)  		      t = 10 * t + *s - '0'; -		    if (t) -		      t--; +		    if (t == 0) +		      { +			/* Provoke with `sort -k0' */ +			error (0, 0, _("the starting field number argument \ +to the `-k' option must be positive")); +			badfieldspec (argv[i]); +		      } +		    --t;  		    t2 = 0;  		    if (*s == '.')  		      { +			if (!digits[UCHAR (s[1])]) +			  { +			    /* Provoke with `sort -k1.' */ +			    error (0, 0, _("starting field spec has `.' but \ +lacks following character offset")); +			    badfieldspec (argv[i]); +			  }  			for (++s; digits[UCHAR (*s)]; ++s)  			  t2 = 10 * t2 + *s - '0'; -			if (t2) -			  t2--; +			if (t2 == 0) +			  { +			    /* Provoke with `sort -k1.0' */ +			    error (0, 0, _("starting field character offset \ +argument to the `-k' option\nmust be positive")); +			    badfieldspec (argv[i]); +			  } +			--t2;  		      }  		    if (t2 || t)  		      { @@ -1612,20 +1847,52 @@ main (argc, argv)  		    else  		      key->sword = -1;  		    s = set_ordering (s, key, bl_start); -		    if (*s && *s != ',') +		    if (*s == 0) +		      { +			key->eword = -1; +			key->echar = 0; +		      } +		    else if (*s != ',')  		      badfieldspec (argv[i]); -		    else if (*s++) +		    else if (*s == ',')  		      { +			/* Skip over comma.  */ +			++s; +			if (*s == 0) +			  { +			    /* Provoke with `sort -k1,' */ +			    error (0, 0, _("field specification has `,' but \ +lacks following field spec")); +			    badfieldspec (argv[i]); +			  }  			/* Get POS2. */  			for (t = 0; digits[UCHAR (*s)]; ++s)  			  t = t * 10 + *s - '0'; +			if (t == 0) +			  { +			    /* Provoke with `sort -k1,0' */ +			    error (0, 0, _("ending field number argument \ +to the `-k' option must be positive")); +			    badfieldspec (argv[i]); +			  } +			--t;  			t2 = 0;  			if (*s == '.')  			  { +			    if (!digits[UCHAR (s[1])]) +			      { +				/* Provoke with `sort -k1,1.' */ +				error (0, 0, _("ending field spec has `.' \ +but lacks following character offset")); +				badfieldspec (argv[i]); +			      }  			    for (++s; digits[UCHAR (*s)]; ++s)  			      t2 = t2 * 10 + *s - '0'; -			    if (t2) -			      t--; +			  } +			else +			  { +			    /* `-k 2,3' is equivalent to `+1 -3'.  */ +			    ++t;  			  }  			key->eword = t;  			key->echar = t2; @@ -1645,7 +1912,7 @@ main (argc, argv)  		    else  		      {  			if (i == argc - 1) -			  error (2, 0, "option `-o' requires an argument"); +			  error (2, 0, _("option `-o' requires an argument"));  			else  			  outfile = argv[++i];  		      } @@ -1662,19 +1929,20 @@ main (argc, argv)  			goto outer;  		      }  		    else -		      error (2, 0, "option `-t' requires an argument"); +		      error (2, 0, _("option `-t' requires an argument"));  		    break;  		  case 'T':  		    if (s[1])  		      temp_file_prefix = ++s; -		    else if (i < argc - 1) +		    else  		      { -			temp_file_prefix = argv[++i]; -			goto outer; +			if (i < argc - 1) +			  temp_file_prefix = argv[++i]; +			else +			  error (2, 0, _("option `-T' requires an argument"));  		      } -		    else -		      error (2, 0, "option `-T' requires an argument"); -		    break; +		    goto outer; +		    /* break; */  		  case 'u':  		    unique = 1;  		    break; @@ -1683,7 +1951,7 @@ main (argc, argv)  		       Solaris 2.  */  		    goto outer;  		  default: -		    fprintf (stderr, "%s: unrecognized option `-%c'\n", +		    fprintf (stderr, _("%s: unrecognized option `-%c'\n"),  			     argv[0], *s);  		    usage (2);  		  } @@ -1704,7 +1972,8 @@ main (argc, argv)    /* Inheritance of global options to individual keys. */    for (key = keyhead.next; key; key = key->next)      if (!key->ignore && !key->translate && !key->skipsblanks && !key->reverse -	&& !key->skipeblanks && !key->month && !key->numeric) +	&& !key->skipeblanks && !key->month && !key->numeric +        && !key->general_numeric)        {  	key->ignore = gkey.ignore;  	key->translate = gkey.translate; @@ -1712,11 +1981,13 @@ main (argc, argv)  	key->skipeblanks = gkey.skipeblanks;  	key->month = gkey.month;  	key->numeric = gkey.numeric; +	key->general_numeric = gkey.general_numeric;  	key->reverse = gkey.reverse;        }    if (!keyhead.next && (gkey.ignore || gkey.translate || gkey.skipsblanks -			|| gkey.skipeblanks || gkey.month || gkey.numeric)) +			|| gkey.skipeblanks || gkey.month || gkey.numeric +                        || gkey.general_numeric))      insertkey (&gkey);    reverse = gkey.reverse; @@ -1731,32 +2002,61 @@ main (argc, argv)    if (strcmp (outfile, "-"))      { -      for (i = 0; i < nfiles; ++i) -	if (!strcmp (outfile, files[i])) -	  break; -      if (i == nfiles) -	ofp = xfopen (outfile, "w"); -      else +      struct stat outstat; +      if (stat (outfile, &outstat) == 0)  	{ -	  char buf[8192]; -	  FILE *fp = xfopen (outfile, "r"); -	  int cc; - -	  tmp = tempname (); -	  ofp = xfopen (tmp, "w"); -	  while ((cc = fread (buf, 1, sizeof buf, fp)) > 0) -	    xfwrite (buf, 1, cc, ofp); -	  if (ferror (fp)) +	  /* The following code prevents a race condition when +	     people use the brain dead shell programming idiom: +		  cat file | sort -o file +	     This feature is provided for historical compatibility, +	     but we strongly discourage ever relying on this in +	     new shell programs. */ + +	  /* Temporarily copy each input file that might be another name +	     for the output file.  When in doubt (e.g. a pipe), copy.  */ +	  for (i = 0; i < nfiles; ++i)  	    { -	      error (0, errno, "%s", outfile); -	      cleanup (); -	      exit (2); +	      char buf[8192]; +	      FILE *fp; +	      int cc; + +	      if (S_ISREG (outstat.st_mode) && strcmp (outfile, files[i])) +		{ +		  struct stat instat; +		  if ((strcmp (files[i], "-") +		       ? stat (files[i], &instat) +		       : fstat (fileno (stdin), &instat)) != 0) +		    { +		      error (0, errno, "%s", files[i]); +		      cleanup (); +		      exit (2); +		    } +		  if (S_ISREG (instat.st_mode) +		      && (instat.st_ino != outstat.st_ino +			  || instat.st_dev != outstat.st_dev)) +		    { +		      /* We know the files are distinct.  */ +		      continue; +		    } +		} + +	      fp = xfopen (files[i], "r"); +	      tmp = tempname (); +	      ofp = xtmpfopen (tmp); +	      while ((cc = fread (buf, 1, sizeof buf, fp)) > 0) +		xfwrite (buf, 1, cc, ofp); +	      if (ferror (fp)) +		{ +		  error (0, errno, "%s", files[i]); +		  cleanup (); +		  exit (2); +		} +	      xfclose (ofp); +	      xfclose (fp); +	      files[i] = tmp;  	    } -	  xfclose (ofp); -	  xfclose (fp); -	  files[i] = tmp; -	  ofp = xfopen (outfile, "w");  	} +      ofp = xfopen (outfile, "w");      }    else      ofp = stdout; @@ -1773,57 +2073,12 @@ main (argc, argv)       Solaris, Ultrix, and Irix.  This premature fflush makes the output       reappear. --karl@cs.umb.edu  */    if (fflush (ofp) < 0) -    error (1, errno, "fflush", outfile); +    error (1, errno, _("%s: write error"), outfile);    if (have_read_stdin && fclose (stdin) == EOF) -    error (1, errno, "-"); +    error (1, errno, outfile);    if (ferror (stdout) || fclose (stdout) == EOF) -    error (1, errno, "write error"); +    error (1, errno, _("%s: write error"), outfile);    exit (0);  } - -static void -usage (status) -     int status; -{ -  if (status != 0) -    fprintf (stderr, "Try `%s --help' for more information.\n", -	     program_name); -  else -    { -      printf ("\ -Usage: %s [OPTION]... [FILE]...\n\ -", -	      program_name); -      printf ("\ -\n\ -  +POS1 [-POS2]    start a key at POS1, end it before POS2\n\ -  -M               compare (unknown) < `JAN' < ... < `DEC', imply -b\n\ -  -T DIRECT        use DIRECTfor temporary files, not $TEMPDIR nor /tmp\n\ -  -b               ignore leading blanks in sort fields or keys\n\ -  -c               check if given files already sorted, do not sort\n\ -  -d               consider only [a-zA-Z0-9 ] characters in keys\n\ -  -f               fold lower case to upper case characters in keys\n\ -  -i               consider only [\\040-\\0176] characters in keys\n\ -  -k POS1[,POS2]   same as +POS1 [-POS2], but all positions counted from 1\n\ -  -m               merge already sorted files, do not sort\n\ -  -n               compare according to string numerical value, imply -b\n\ -  -o FILE          write result on FILE instead of standard output\n\ -  -r               reverse the result of comparisons\n\ -  -s               stabilize sort by disabling last resort comparison\n\ -  -t SEP           use SEParator instead of non- to whitespace transition\n\ -  -u               with -c, check for strict ordering\n\ -  -u               with -m, only output the first of an equal sequence\n\ -      --help       display this help and exit\n\ -      --version    output version information and exit\n\ -\n\ -POS is F[.C][OPTS], where F is the field number and C the character\n\ -position in the field, both counted from zero.  OPTS is made up of one\n\ -or more of Mbdfinr, this effectively disable global -Mbdfinr settings\n\ -for that key.  If no key given, use the entire line as key.  With no\n\ -FILE, or when FILE is -, read standard input.\n\ -"); -    } -  exit (status); -} diff --git a/gnu/usr.bin/sort/system.h b/gnu/usr.bin/sort/system.h index 4aeaaea188b6..bfb19e121c34 100644 --- a/gnu/usr.bin/sort/system.h +++ b/gnu/usr.bin/sort/system.h @@ -13,48 +13,25 @@     You should have received a copy of the GNU General Public License     along with this program; if not, write to the Free Software -   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ +   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */  /* Include sys/types.h before this file.  */  #include <sys/stat.h> -#ifdef	STAT_MACROS_BROKEN -#ifdef S_ISBLK +#ifdef STAT_MACROS_BROKEN  #undef S_ISBLK -#endif -#ifdef S_ISCHR  #undef S_ISCHR -#endif -#ifdef S_ISDIR  #undef S_ISDIR -#endif -#ifdef S_ISFIFO  #undef S_ISFIFO -#endif -#ifdef S_ISLNK  #undef S_ISLNK -#endif -#ifdef S_ISMPB  #undef S_ISMPB -#endif -#ifdef S_ISMPC  #undef S_ISMPC -#endif -#ifdef S_ISNWK  #undef S_ISNWK -#endif -#ifdef S_ISREG  #undef S_ISREG -#endif -#ifdef S_ISSOCK  #undef S_ISSOCK -#endif -#endif	/* STAT_MACROS_BROKEN.  */ +#endif /* STAT_MACROS_BROKEN.  */ -#ifndef S_ISREG			/* Doesn't have POSIX.1 stat stuff. */ -#define mode_t unsigned short -#endif  #if !defined(S_ISBLK) && defined(S_IFBLK)  #define	S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)  #endif @@ -90,42 +67,56 @@  #ifdef HAVE_UNISTD_H  #include <unistd.h>  #endif +  #ifndef _POSIX_VERSION  off_t lseek ();  #endif -#if defined(HAVE_STRING_H) || defined(STDC_HEADERS) -#if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) -#include <memory.h> -#endif -#include <string.h> -#ifndef index -#define index strchr -#endif -#ifndef rindex -#define rindex strrchr +#ifndef STDIN_FILENO +#define STDIN_FILENO 0  #endif -/* Don't define bcopy; we need one that can handle overlaps.  */ -#ifndef bzero -#define bzero(s, n) memset ((s), 0, (n)) + +#ifndef STDOUT_FILENO +#define STDOUT_FILENO 1  #endif -#ifndef bcmp -#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) + +#ifndef STDERR_FILENO +#define STDERR_FILENO 2  #endif + +/* Don't use bcopy!  Use memmove if source and destination may overlap, +   memcpy otherwise.  */ + +#ifdef HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +#  include <memory.h> +# endif +# include <string.h>  #else -#include <strings.h> +# include <strings.h>  char *memchr ();  #endif  #include <errno.h> +#ifndef errno +extern int errno; +#endif +  #ifdef STDC_HEADERS  #include <stdlib.h>  #else  char *getenv (); -extern int errno;  #endif -#if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION) +#ifndef EXIT_FAILURE +# define EXIT_FAILURE 1 +#endif + +#ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +#endif + +#ifdef HAVE_FCNTL_H  #include <fcntl.h>  #else  #include <sys/file.h> @@ -173,28 +164,42 @@ extern int errno;  #include <ctype.h> -#ifndef isascii -#define isascii(c) 1 +#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) +#define ISASCII(c) 1 +#else +#define ISASCII(c) isascii(c)  #endif  #ifdef isblank -#define ISBLANK(c) (isascii (c) && isblank (c)) +#define ISBLANK(c) (ISASCII (c) && isblank (c))  #else  #define ISBLANK(c) ((c) == ' ' || (c) == '\t')  #endif  #ifdef isgraph -#define ISGRAPH(c) (isascii (c) && isgraph (c)) +#define ISGRAPH(c) (ISASCII (c) && isgraph (c))  #else -#define ISGRAPH(c) (isascii (c) && isprint (c) && !isspace (c)) -#endif - -#define ISPRINT(c) (isascii (c) && isprint (c)) -#define ISDIGIT(c) (isascii (c) && isdigit (c)) -#define ISALNUM(c) (isascii (c) && isalnum (c)) -#define ISALPHA(c) (isascii (c) && isalpha (c)) -#define ISCNTRL(c) (isascii (c) && iscntrl (c)) -#define ISLOWER(c) (isascii (c) && islower (c)) -#define ISPUNCT(c) (isascii (c) && ispunct (c)) -#define ISSPACE(c) (isascii (c) && isspace (c)) -#define ISUPPER(c) (isascii (c) && isupper (c)) -#define ISXDIGIT(c) (isascii (c) && isxdigit (c)) +#define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c)) +#endif + +#define ISPRINT(c) (ISASCII (c) && isprint (c)) +#define ISDIGIT(c) (ISASCII (c) && isdigit (c)) +#define ISALNUM(c) (ISASCII (c) && isalnum (c)) +#define ISALPHA(c) (ISASCII (c) && isalpha (c)) +#define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) +#define ISLOWER(c) (ISASCII (c) && islower (c)) +#define ISPUNCT(c) (ISASCII (c) && ispunct (c)) +#define ISSPACE(c) (ISASCII (c) && isspace (c)) +#define ISUPPER(c) (ISASCII (c) && isupper (c)) +#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) + +/* Disable string localization for the time being.  */ +#undef _ +#define _(String) String + +#ifndef __P +# if PROTOTYPES +#  define __P(Args) Args +# else +#  define __P(Args) () +# endif +#endif diff --git a/gnu/usr.bin/sort/version.c b/gnu/usr.bin/sort/version.c index 64c62b1953ab..0289fcb69842 100644 --- a/gnu/usr.bin/sort/version.c +++ b/gnu/usr.bin/sort/version.c @@ -1,13 +1,3 @@ -#ifdef HAVE_CONFIG_H -#if defined (CONFIG_BROKETS) -/* We use <config.h> instead of "config.h" so that a compilation -   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h -   (which it would do because it found this file in $srcdir).  */  #include <config.h> -#else -#include "config.h" -#endif -#endif -  #include "version.h" -const char *version_string = "GNU textutils 1.9"; +const char *version_string = "GNU textutils 1.14"; diff --git a/gnu/usr.bin/tar/Makefile b/gnu/usr.bin/tar/Makefile index c0b6d4410405..c9c76bfdda4b 100644 --- a/gnu/usr.bin/tar/Makefile +++ b/gnu/usr.bin/tar/Makefile @@ -15,4 +15,3 @@ DPADD+= ${LIBGNUREGEX}  LDADD+= -lgnuregex  .include <bsd.prog.mk> -.include "../../usr.bin/Makefile.inc" diff --git a/gnu/usr.bin/tar/tar.1 b/gnu/usr.bin/tar/tar.1 index e97edc5c153c..2cb50b30c01e 100644 --- a/gnu/usr.bin/tar/tar.1 +++ b/gnu/usr.bin/tar/tar.1 @@ -3,7 +3,7 @@  .\"  .\"	Written by John F. Woods <jfw@jfwhome.funhouse.com>  .\" -.\"	$Id: tar.1,v 1.2 1995/01/31 04:36:48 jkh Exp $ +.\"	$Id: tar.1,v 1.3 1995/04/10 11:47:34 jkh Exp $  .\"  .Dd 6 August 1994  .Os FreeBSD @@ -39,7 +39,7 @@ regular disk file.  The first argument word of the  .Nm  command line is usually a command word of bundled function and modifier -letters, optionally preceeded by a dash; +letters, optionally preceded by a dash;  it must contain exactly one function letter from the set  .Cm A ,  .Cm c , @@ -53,7 +53,7 @@ extract (further described below).  The command word can also contain other  function modifiers described below, some of which will take arguments from  the command line in the order they are specified in the command word (review  the EXAMPLES section).  Functions and function modifiers can also be specified -with the GNU argument convention (preceeded by two dashes, one function or +with the GNU argument convention (preceded by two dashes, one function or  modifier per word.  Command-line arguments that specify files to  add to, extract from, or list from an archive may be given as shell  pattern matching strings. @@ -132,7 +132,7 @@ this will change the inode-change time!).  Sets the block size for reading or writing to N 512-byte blocks.  .It Fl B  .It Fl -read-full-blocks -Re-assemble short readsinto full blocks (for reading 4.2BSD pipes). +Re-assemble short reads into full blocks (for reading 4.2BSD pipes).  .It Fl C Ar directory  .It Fl -directory Ar directory  Change to @@ -176,7 +176,7 @@ Ignore blocks of zeroes in archive (usually means End-Of-File).  .It Fl -ignore-failed-read  Don't exit with non-zero status on unreadable files.  .It Fl k --It Fl -keep-old-files +.It Fl -keep-old-files  Keep files which already exist on disk; don't overwrite them from the archive.  .It Fl K Ar file  .It Fl -starting-file Ar file @@ -215,6 +215,9 @@ Extract all protection information.  .It Fl -preserve  Has the effect of  .Fl p s. +.It Fl P +.It Fl -absolute-paths +Don't strip leading `/' from file names.  .It Fl R  .It Fl -record-number  Show record number within archive with each message. @@ -372,7 +375,7 @@ domain version), Jay Fenlason (first GNU author), Joy Kendall, Jim  Kingdon, David J. MacKenzie, Michael I Bushnell, Noah Friedman, and  innumerable others who have contributed fixes and additions. -Obtained by the FreeBSD group from the NetBSD 1.0 release. +Man page obtained by the FreeBSD group from the NetBSD 1.0 release.  .Sh BUGS  The  .Fl C diff --git a/gnu/usr.bin/tar/tar.c b/gnu/usr.bin/tar/tar.c index 84e2b94283ce..8fb8f810a345 100644 --- a/gnu/usr.bin/tar/tar.c +++ b/gnu/usr.bin/tar/tar.c @@ -25,6 +25,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */  #include <stdio.h>  #include <sys/types.h>		/* Needed for typedefs in tar.h */ +#ifdef __FreeBSD__ +#include <locale.h> +#endif  #include "getopt.h"  /* @@ -198,6 +201,10 @@ main (argc, argv)  {    extern char version_string[]; +#ifdef __FreeBSD__ +  (void) setlocale (LC_ALL, ""); +#endif +    tar = argv[0];		/* JF: was "tar" Set program name */    filename_terminator = '\n';    errors = 0; diff --git a/gnu/usr.bin/texinfo/Makefile.inc b/gnu/usr.bin/texinfo/Makefile.inc index 9b2886022b7e..3bc46441f473 100644 --- a/gnu/usr.bin/texinfo/Makefile.inc +++ b/gnu/usr.bin/texinfo/Makefile.inc @@ -1,5 +1,3 @@  # Texinfo defaults. -# $Id$ - -INFODIR?= /usr/share/info +# $Id: Makefile.inc,v 1.2 1994/09/15 12:09:36 jkh Exp $ diff --git a/gnu/usr.bin/texinfo/info-files/Makefile b/gnu/usr.bin/texinfo/info-files/Makefile index 1337187d7885..eeda5bd5f4a3 100644 --- a/gnu/usr.bin/texinfo/info-files/Makefile +++ b/gnu/usr.bin/texinfo/info-files/Makefile @@ -5,7 +5,7 @@  INFOFILES= dir  install: -	install ${COPY} -g ${BINGRP} -o ${BINOWN} -m 444 ${INFOFILES} \ +	${INSTALL} -c -g ${BINGRP} -o ${BINOWN} -m 444 ${INFOFILES} \  		${DESTDIR}${INFODIR}  clean cleandir obj: diff --git a/gnu/usr.bin/texinfo/info-files/dir b/gnu/usr.bin/texinfo/info-files/dir index ddedcfbcc747..6c7f9002d373 100644 --- a/gnu/usr.bin/texinfo/info-files/dir +++ b/gnu/usr.bin/texinfo/info-files/dir @@ -15,6 +15,9 @@ File: dir	Node: Top	This is the top of the INFO tree  System utilities:  * AMD: (amdref).		AMD Reference Manual. +* CVS: (cvs).			CVS Reference Manual. +* CVS-CLIENT: (cvsclient).	CVS client/server Reference Manual. +* DIFF: (diff).			DIFF/PATCH Reference Manual.  * DC: (dc).			The GNU desk calculator.  * GAWK: (gawk).			The GNU AWK language interpreter manual.  * Info: (info).			Manual for this documentation browsing system. @@ -43,6 +46,7 @@ Programming & development tools:  * GXX Internals: (gxxint).	Guide to the internals of the GNU C++ compiler.  * GDB: (gdb).			The GNU Debugger (C & C++) manual.  * GDB Internals: (gdbint).	Guide to the internals of GDB. +* GMP: (gmp).			The GNU MP Math library.  * History: (history).		The GNU History library.  * Readline: (readline).		The GNU Readline library  * Regex: (regex).		The GNU regular expression library. diff --git a/gnu/usr.bin/texinfo/info/info.1 b/gnu/usr.bin/texinfo/info/info.1 index 674bcefb8dde..aabfcf12962d 100644 --- a/gnu/usr.bin/texinfo/info/info.1 +++ b/gnu/usr.bin/texinfo/info/info.1 @@ -216,7 +216,8 @@ is not given.  .B INFO_PRINT_COMMAND  The command used for printing.  .SH SEE ALSO -.BR emacs (1) +.BR man (1) +.\" .BR emacs (1)  .SH AUTHOR  .RS  Brian Fox, Free Software Foundation diff --git a/gnu/usr.bin/texinfo/misc/Makefile b/gnu/usr.bin/texinfo/misc/Makefile index 59fb65f61a2c..c53561dd405c 100644 --- a/gnu/usr.bin/texinfo/misc/Makefile +++ b/gnu/usr.bin/texinfo/misc/Makefile @@ -39,8 +39,8 @@ LOADLIBES = $(LIBS)  SHELL = /bin/sh -CFLAGS = -g -LDFLAGS = -g +CFLAGS = -O2 +LDFLAGS = -O2  prefix = /usr/local  exec_prefix = $(prefix) diff --git a/gnu/usr.sbin/Makefile b/gnu/usr.sbin/Makefile index e86265cc82de..0ddbbf4b1af3 100644 --- a/gnu/usr.sbin/Makefile +++ b/gnu/usr.sbin/Makefile @@ -1,6 +1,6 @@ -#	$Id: Makefile,v 1.20 1995/01/19 17:03:28 bde Exp $ +#	$Id: Makefile,v 1.1 1995/01/31 09:14:01 wpaul Exp $ -SUBDIR= yppasswdd ypserv yp_mkdb +SUBDIR=  .include <bsd.subdir.mk> diff --git a/lib/csu/i386/Makefile b/lib/csu/i386/Makefile index 5c484e7ddad9..f4f8f7eb55ea 100644 --- a/lib/csu/i386/Makefile +++ b/lib/csu/i386/Makefile @@ -1,8 +1,8 @@  #	from: @(#)Makefile	5.6 (Berkeley) 5/22/91 -#	$Id: Makefile,v 1.15 1995/03/30 06:40:31 phk Exp $ +#	$Id: Makefile,v 1.24 1996/05/07 23:16:08 wosch Exp $ -CFLAGS+=	-DLIBC_SCCS -DDYNAMIC -OBJS=		crt0.o gcrt0.o c++rt0.o +CFLAGS+=        -DLIBC_SCCS -fno-omit-frame-pointer +OBJS=		crt0.o c++rt0.o gcrt0.o scrt0.o sgcrt0.o  CLEANFILES+=	a.out  MAN3+=		dlopen.3  MLINKS+=	dlopen.3 dlsym.3 \ @@ -12,23 +12,35 @@ MLINKS+=	dlopen.3 dlsym.3 \  all: ${OBJS}  crt0.o: crt0.c -	${CC} ${CFLAGS} -c -DCRT0 ${.CURDIR}/crt0.c -o ${.TARGET} +	${CC} ${CFLAGS} -c -DCRT0 -DDYNAMIC ${.CURDIR}/crt0.c -o ${.TARGET}  	${LD} -x -r ${.TARGET} -	mv a.out ${.TARGET} +	mv -f a.out ${.TARGET}  c++rt0.o: c++rt0.c  	${CC} ${CFLAGS} -fpic -c ${.CURDIR}/c++rt0.c  	@${LD} -x -r ${.TARGET} -	@mv a.out ${.TARGET} +	@mv -f a.out ${.TARGET}  #  # gcrt0.o doesn't really depend on crt0.o, but this is the easiest way  # to get the dependencies mostly correct.  #  gcrt0.o: crt0.o +	${CC} ${CFLAGS} -c -DMCRT0 -DDYNAMIC ${.CURDIR}/crt0.c -o ${.TARGET} +	${LD} -x -r ${.TARGET} +	mv -f a.out ${.TARGET} + +# dependencies fudged as for gcrt0.o +scrt0.o: crt0.o +	${CC} ${CFLAGS} -c -DCRT0 ${.CURDIR}/crt0.c -o ${.TARGET} +	${LD} -x -r ${.TARGET} +	mv -f a.out ${.TARGET} + +# dependencies fudged as for gcrt0.o +sgcrt0.o: scrt0.o  	${CC} ${CFLAGS} -c -DMCRT0 ${.CURDIR}/crt0.c -o ${.TARGET}  	${LD} -x -r ${.TARGET} -	mv a.out ${.TARGET} +	mv -f a.out ${.TARGET}  beforeinstall:  	cmp -s ${.CURDIR}/dlfcn.h ${DESTDIR}/usr/include/dlfcn.h || \ @@ -46,7 +58,7 @@ depend:	.depend  .depend:	crt0.c c++rt0.c  	rm -f .depend -	mkdep ${CFLAGS} -DCRT0 ${.CURDIR}/crt0.c +	mkdep ${CFLAGS} -DCRT0 -DDYNAMIC ${.CURDIR}/crt0.c  	mkdep -a ${CFLAGS} ${.CURDIR}/c++rt0.c  lint tags: diff --git a/lib/csu/i386/c++rt0.c b/lib/csu/i386/c++rt0.c index aa281093be80..9b397929e693 100644 --- a/lib/csu/i386/c++rt0.c +++ b/lib/csu/i386/c++rt0.c @@ -27,7 +27,7 @@   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.   * - *	$Id: c++rt0.c,v 1.2 1995/05/30 05:39:36 rgrimes Exp $ + *	$Id: c++rt0.c,v 1.5 1996/02/20 04:07:26 jdp Exp $   */  /* @@ -38,8 +38,8 @@   * number of pointers in each.   * The tables are also null-terminated.   */ -void (*__CTOR_LIST__[0])(void); -void (*__DTOR_LIST__[0])(void); +void (*__CTOR_LIST__[2])(void); +void (*__DTOR_LIST__[2])(void);  static void  __dtors(void) diff --git a/lib/csu/i386/crt0.c b/lib/csu/i386/crt0.c index f13613dd2510..46e3a425c89d 100644 --- a/lib/csu/i386/crt0.c +++ b/lib/csu/i386/crt0.c @@ -27,101 +27,105 @@   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF   * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.   * - *	$Id: crt0.c,v 1.16.4.1 1995/08/25 07:08:38 davidg Exp $ + *	$Id: crt0.c,v 1.23 1996/01/30 05:55:20 nate Exp $   */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "%W% (Erasmus) %G%"; -#endif /* LIBC_SCCS and not lint */ - -extern void exit(); -int _callmain(); -  #include <sys/param.h> -#include <locale.h>  #include <stdlib.h> -extern void _startup_setlocale __P((int, const char *));  #ifdef DYNAMIC  #include <sys/types.h>  #include <sys/syscall.h>  #include <a.out.h>  #include <string.h> +#include <sys/mman.h> +#include <link.h> + +/* !!! + * This is gross, ld.so is a ZMAGIC a.out, but has `sizeof(hdr)' for + * an entry point and not at PAGSIZ as the N_*ADDR macros assume. + */ +#undef N_DATADDR +#define N_DATADDR(x)	((x).a_text) + +#undef N_BSSADDR +#define N_BSSADDR(x)	((x).a_text + (x).a_data) +  #ifndef N_GETMAGIC  #define N_GETMAGIC(x)	((x).a_magic) -#endif -#ifndef N_BSSADDR -#define N_BSSADDR(x)	(N_DATADDR(x)+(x).a_data) -#endif -#include <sys/mman.h> -#ifdef sun -#define MAP_COPY	MAP_PRIVATE -#define MAP_FILE	0 -#define MAP_ANON	0 -#else -#ifdef BSD -#if BSD>=199306 && !defined(MAP_FILE) +#endif /* N_GETMAGIC */ + +#ifndef	MAP_PRIVATE +#define MAP_PRIVATE	MAP_COPY +#endif /* MAP_PRIVATE */ + +#ifndef MAP_FILE  #define MAP_FILE	0 -#endif /* BSD>=199306 */ -#endif /* BSD */ -#endif /* sun */ +#endif /* MAP_FILE */ -#include <link.h> +#ifndef MAP_ANON +#define MAP_ANON	0 +#endif /* MAP_ANON */ -extern struct _dynamic _DYNAMIC; -static struct ld_entry	*ld_entry; -static void	__do_dynamic_link (); -static char	*_getenv(); -static int	_strncmp(); +#ifdef DEBUG  +/* + * We need these two because we are going to call them before the ld.so is + * finished (as a matter of fact before we know if it exists !) so we must + * provide these versions for them + */ +static char		*_getenv(); +static int		_strncmp(); +#endif /* DEBUG */ -#ifdef sun -#define LDSO	"/usr/lib/ld.so" -#endif -#ifdef BSD -#define LDSO	"/usr/libexec/ld.so" -#endif +#ifndef LDSO +#define LDSO		"/usr/libexec/ld.so" +#endif /* LDSO */ +extern struct _dynamic	_DYNAMIC; +static struct ld_entry	*ld_entry; +static void		__do_dynamic_link ();  #endif /* DYNAMIC */ -static char		*_strrchr(); - +int			_callmain(); +int			errno; +static char		empty[1]; +char			*__progname = empty;  char			**environ; -#ifdef BSD  extern	unsigned char	etext;  extern	unsigned char	eprol asm ("eprol");  extern			start() asm("start");  extern			mcount() asm ("mcount"); +extern	int		main(int argc, char **argv, char **envp); +int			__syscall(int syscall,...); +#ifdef MCRT0 +void			monstartup(void *low, void *high); +#endif /* MCRT0 */ -int			errno; -static char		empty[1]; -char			*__progname = empty; -#endif  /* - * We need these system calls, but can't use library stubs + * We need these system calls, but can't use library stubs because the are + * not accessible until we have done the ld.so stunt.   */ -#define _exit(v)		__syscall(SYS_exit, (int)(v)) -#define open(name, f, m)	__syscall(SYS_open, (char *)(name), (int)(f), (int)(m)) -#define close(fd)		__syscall(SYS_close, (int)(fd)) -#define read(fd, s, n)		__syscall(SYS_read, (int)(fd), (void *)(s), (size_t)(n)) -#define write(fd, s, n)		__syscall(SYS_write, (int)(fd), (void *)(s), (size_t)(n)) -#define dup(fd)			__syscall(SYS_dup, (int)(fd)) -#define dup2(fd, fdnew)		__syscall(SYS_dup2, (int)(fd), (int)(fdnew)) -#ifdef sun -#define mmap(addr, len, prot, flags, fd, off)	\ -    __syscall(SYS_mmap, (addr), (len), (prot), _MAP_NEW|(flags), (fd), (off)) -#else -#define mmap(addr, len, prot, flags, fd, off)	\ -    __syscall(SYS_mmap, (caddr_t)(addr), (size_t)(len), (int)(prot), (int)(flags), (int)(fd), (long)0L, (off_t)(off)) -#endif -#define _PUTNMSG(str, len)	write(2, (str), (len)) +#define _exit(v) \ +	__syscall(SYS_exit, (int)(v)) +#define _open(name, f, m) \ +	__syscall(SYS_open, (char *)(name), (int)(f), (int)(m)) +#define _read(fd, s, n) \ +	__syscall(SYS_read, (int)(fd), (void *)(s), (size_t)(n)) +#define _write(fd, s, n) \ +	__syscall(SYS_write, (int)(fd), (void *)(s), (size_t)(n)) +#define _mmap(addr, len, prot, flags, fd, off)	\ +	(caddr_t) __syscall(SYS_mmap, (caddr_t)(addr), (size_t)(len), \ +		(int)(prot), (int)(flags), (int)(fd), (long)0L, (off_t)(off)) + +#define _PUTNMSG(str, len)	_write(2, (str), (len))  #define _PUTMSG(str)		_PUTNMSG((str), sizeof (str) - 1)  #define _FATAL(str)		( _PUTMSG(str), _exit(1) ) +int  start()  {  	struct kframe { @@ -154,22 +158,20 @@ start()  		--targv;  	environ = targv; -	if (argv[0]) -		if ((__progname = _strrchr(argv[0], '/')) == NULL) -			__progname = argv[0]; -		else -			++__progname; +	if (argv[0]) { +		register char *s; +		__progname = argv[0]; +		for (s=__progname; *s != '\0'; s++) +			if (*s == '/') +				__progname = s+1; +	}  #ifdef DYNAMIC  	/* ld(1) convention: if DYNAMIC = 0 then statically linked */ -#ifdef stupid_gcc -	if (&_DYNAMIC) -		__do_dynamic_link(); -#else +	/* sometimes GCC is too smart/stupid for its own good */  	x = (caddr_t)&_DYNAMIC;  	if (x)  		__do_dynamic_link(); -#endif  #endif /* DYNAMIC */  asm("eprol:"); @@ -179,9 +181,6 @@ asm("eprol:");  	monstartup(&eprol, &etext);  #endif /* MCRT0 */ -	if (getenv("ENABLE_STARTUP_LOCALE") != NULL) -		_startup_setlocale(LC_ALL, ""); -  asm ("__callmain:");		/* Defined for the benefit of debuggers */  	exit(main(kfp->kargc, argv, environ));  } @@ -202,13 +201,15 @@ __do_dynamic_link ()  #endif  		ldso = LDSO; -	crt.crt_ldfd = open(ldso, 0, 0); +	crt.crt_ldfd = _open(ldso, 0, 0);  	if (crt.crt_ldfd == -1) { -		_FATAL("No ld.so\n"); +		_PUTMSG("Couldn't open "); +		_PUTMSG(LDSO); +		_FATAL(".\n");  	}  	/* Read LDSO exec header */ -	if (read(crt.crt_ldfd, &hdr, sizeof hdr) < sizeof hdr) { +	if (_read(crt.crt_ldfd, &hdr, sizeof hdr) < sizeof hdr) {  		_FATAL("Failure reading ld.so\n");  	}  	if ((N_GETMAGIC_NET(hdr) != ZMAGIC) && (N_GETMAGIC(hdr) != QMAGIC)) { @@ -219,39 +220,29 @@ __do_dynamic_link ()  	crt.crt_dzfd = -1;  	/* Map in ld.so */ -	crt.crt_ba = mmap(0, hdr.a_text, +	crt.crt_ba = (int)_mmap(0, hdr.a_text,  			PROT_READ|PROT_EXEC, -			MAP_FILE|MAP_COPY, +			MAP_FILE|MAP_PRIVATE,  			crt.crt_ldfd, N_TXTOFF(hdr));  	if (crt.crt_ba == -1) { -		_FATAL("Cannot map ld.so\n"); +		_FATAL("Cannot map ld.so (text)\n");  	} -#ifdef BSD -/* !!! - * This is gross, ld.so is a ZMAGIC a.out, but has `sizeof(hdr)' for - * an entry point and not at PAGSIZ as the N_*ADDR macros assume. - */ -#undef N_DATADDR -#undef N_BSSADDR -#define N_DATADDR(x)	((x).a_text) -#define N_BSSADDR(x)	((x).a_text + (x).a_data) -#endif -  	/* Map in data segment of ld.so writable */ -	if (mmap(crt.crt_ba+N_DATADDR(hdr), hdr.a_data, +	if ((int)_mmap((caddr_t)(crt.crt_ba+N_DATADDR(hdr)), hdr.a_data,  			PROT_READ|PROT_WRITE, -			MAP_FIXED|MAP_FILE|MAP_COPY, +			MAP_FIXED|MAP_FILE|MAP_PRIVATE,  			crt.crt_ldfd, N_DATOFF(hdr)) == -1) { -		_FATAL("Cannot map ld.so\n"); +		_FATAL("Cannot map ld.so (data)\n");  	}  	/* Map bss segment of ld.so zero */ -	if (hdr.a_bss && mmap(crt.crt_ba+N_BSSADDR(hdr), hdr.a_bss, +	if (hdr.a_bss && (int)_mmap((caddr_t)(crt.crt_ba+N_BSSADDR(hdr)), +			hdr.a_bss,  			PROT_READ|PROT_WRITE, -			MAP_FIXED|MAP_ANON|MAP_COPY, +			MAP_FIXED|MAP_ANON|MAP_PRIVATE,  			crt.crt_dzfd, 0) == -1) { -		_FATAL("Cannot map ld.so\n"); +		_FATAL("Cannot map ld.so (bss)\n");  	}  	crt.crt_dp = &_DYNAMIC; @@ -335,6 +326,7 @@ dlerror()   * Support routines   */ +#ifdef DEBUG  static int  _strncmp(s1, s2, n)  	register char *s1, *s2; @@ -369,6 +361,8 @@ _getenv(name)  	return (char *)0;  } +#endif /* DEBUG */ +  	asm("	___syscall:");  	asm("		popl %ecx");  	asm("		popl %eax"); @@ -385,21 +379,6 @@ _getenv(name)  #endif /* DYNAMIC */ -static char * -_strrchr(p, ch) -register char *p, ch; -{ -	register char *save; - -	for (save = NULL;; ++p) { -		if (*p == ch) -			save = (char *)p; -		if (!*p) -			return(save); -	} -/* NOTREACHED */ -} -  #ifdef MCRT0  asm ("	.text");  asm ("_eprol:"); diff --git a/share/mk/Makefile b/share/mk/Makefile index d6e1c3a8c440..b2f831ed643a 100644 --- a/share/mk/Makefile +++ b/share/mk/Makefile @@ -1,8 +1,8 @@ -#	$Id: Makefile,v 1.9 1995/09/08 19:27:48 jfieber Exp $ +#	$Id: Makefile,v 1.7.4.1 1995/09/18 03:27:17 davidg Exp $  #	From: @(#)Makefile	8.1 (Berkeley) 6/8/93  FILES=	bsd.README -FILES+=	bsd.dep.mk bsd.doc.mk bsd.info.mk bsd.kmod.mk +FILES+=	bsd.dep.mk bsd.doc.mk bsd.info.mk bsd.kmod.mk bsd.obj.mk  FILES+=	bsd.lib.mk bsd.man.mk bsd.own.mk bsd.port.mk  FILES+=	bsd.port.subdir.mk bsd.prog.mk bsd.sgml.mk bsd.subdir.mk  FILES+=	sys.mk diff --git a/share/mk/bsd.README b/share/mk/bsd.README index 534b6149de0f..a64229aed262 100644 --- a/share/mk/bsd.README +++ b/share/mk/bsd.README @@ -205,39 +205,19 @@ DPADD		Additional dependencies for the program.  Usually used for  			SRCLIB=${LIBCOMPAT} ${LIBUTIL} -		The following libraries are predefined for DPADD: - -			LIBCRT0		/usr/lib/crt0.o (sic) -			LIBC		/usr/lib/libc.a -			LIBCOMPAT	/usr/lib/libcompat.a -			LIBCRYPT	/usr/lib/libcrypt.a -			LIBCURSES	/usr/lib/libcurses.a -			LIBDES		/usr/lib/libdes.a -			LIBDIALOG	/usr/lib/libdialog.a -			LIBEDIT		/usr/lib/libedit.a -			LIBGCC		/usr/lib/libgcc.a -			LIBGNUMALLOC	/usr/lib/libgnumalloc.a -			LIBGNUREGEX	/usr/lib/libgnuregex.a -			LIBKDB		/usr/lib/libkdb.a -			LIBKRB		/usr/lib/libkrb.a -			LIBKVM		/usr/lib/libkvm.a -			LIBL		/usr/lib/libl.a -			LIBM		/usr/lib/libm.a -			LIBMD		/usr/lib/libmd.a -			LIBMP		/usr/lib/libmp.a -			LIBMYTINFO	/usr/lib/libmytinfo.a -			LIBNCURSES	/usr/lib/libncurses.a -			LIBPC		/usr/lib/libpc.a -			LIBPLOT		/usr/lib/libplot.a -			LIBREADLINE	/usr/lib/libreadline.a -			LIBRESOLV	/usr/lib/libresolv.a -			LIBRPCSVC	/usr/lib/librpcsvc.a -			LIBSCRYPT	/usr/lib/libscrypt.a -			LIBSKEY		/usr/lib/libskey.a -			LIBTELNET	/usr/lib/libtelnet.a -			LIBTERMCAP	/usr/lib/libtermcap.a -			LIBUTIL		/usr/lib/libutil.a -			LIBY		/usr/lib/liby.a +		There is a predefined identifier for each (non-profiled, +		non-shared) library and object.  Library file names are +		transformed to identifiers by removing the extension and +		converting to upper case. + +		There are no special identifiers for profiled or shared +		libraries or objects.  The identifiers for the standard +		libraries are used in DPADD.  This works correctly iff all +		the libraries are built at the same time.  Unfortunately, +		it causes unnecessary relinks to shared libraries when +		only the static libraries have changed.  Dependencies on +		shared libraries should be only on the library version +		numbers.  STRIP		The flag passed to the install program to cause the binary  		to be stripped. diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk index 9c7afab83bb8..8977d0622807 100644 --- a/share/mk/bsd.dep.mk +++ b/share/mk/bsd.dep.mk @@ -1,25 +1,64 @@ -#	$Id: bsd.dep.mk,v 1.1 1994/08/04 21:10:07 wollman Exp $ +#	$Id: bsd.dep.mk,v 1.2 1995/02/08 21:35:24 bde Exp $ +# +# The include file <bsd.dep.mk> handles Makefile dependencies. +# +# +# +++ variables +++ +# +# DEPENDFILE	dependencies file [.depend] +# +# MKDEP		Options for ${MKDEPCMD} [not set] +# +# MKDEPCMD	Makefile dependency list program [mkdep] +#  +# SRCS          List of source files (c, c++, assembler) +# +# +# +++ targets +++ +# +#	cleandepend: +#		Remove depend and tags file +# +#	depend: +#		Make the dependencies for the source files, and store +#		them in the file ${DEPENDFILE}. +# +#	tags: +#		Create a tags file for the source files. +# + + +MKDEPCMD?=	mkdep +DEPENDFILE?=	.depend  # some of the rules involve .h sources, so remove them from mkdep line  .if !target(depend) -depend: beforedepend .depend afterdepend ${_DEPSUBDIR} +depend: beforedepend ${DEPENDFILE} afterdepend ${_DEPSUBDIR}  .if defined(SRCS) -.depend: ${SRCS} -	rm -f .depend -	files="${.ALLSRC:M*.[sS]}"; \ -	if [ "$$files" != "" ]; then \ -	  mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} ${AINC} $$files; \ -	fi -	files="${.ALLSRC:M*.c}"; \ -	if [ "$$files" != "" ]; then \ -	  mkdep -a ${MKDEP} ${CFLAGS:M-[ID]*} $$files; \ -	fi -	files="${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx}"; \ -	if [ "$$files" != "  " ]; then \ -	  mkdep -a ${MKDEP} ${CXXFLAGS:M-nostd*} ${CXXFLAGS:M-[ID]*} $$files; \ -	fi + +# .if defined ${SRCS:M*.[sS]} does not work +__depend_s=	${SRCS:M*.[sS]} +__depend_c=	${SRCS:M*.c} +__depend_cc=	${SRCS:M*.cc} ${SRCS:M*.C} ${SRCS:M*.cxx} + +${DEPENDFILE}: ${SRCS} +	rm -f ${DEPENDFILE} +.if defined(__depend_s) && !empty(__depend_s) +	${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} ${CFLAGS:M-[ID]*} ${AINC} \ +		${.ALLSRC:M*.[sS]} +.endif +.if defined(__depend_c) && !empty(__depend_c) +	${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} ${CFLAGS:M-[ID]*} \ +		${.ALLSRC:M*.c} +.endif +.if defined(__depend_cc) && !empty(__depend_cc) +	${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \ +		${CXXFLAGS:M-nostd*} ${CXXFLAGS:M-[ID]*} \ +		${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cxx} +.endif +  .else -.depend: ${_DEPSUBDIR} +${DEPENDFILE}: ${_DEPSUBDIR}  .endif  .if !target(beforedepend)  beforedepend: @@ -43,5 +82,5 @@ tags:  clean:  cleandir: cleandepend  cleandepend: -	rm -f .depend ${.CURDIR}/tags +	rm -f ${DEPENDFILE} ${.CURDIR}/tags  .endif diff --git a/share/mk/bsd.doc.mk b/share/mk/bsd.doc.mk index 774a1035a306..6fb27f423f78 100644 --- a/share/mk/bsd.doc.mk +++ b/share/mk/bsd.doc.mk @@ -1,5 +1,5 @@  #	from: @(#)bsd.doc.mk	5.3 (Berkeley) 1/2/91 -#	$Id: bsd.doc.mk,v 1.19.4.2 1995/10/15 08:32:22 jkh Exp $ +#	$Id: bsd.doc.mk,v 1.19.4.3 1995/10/15 16:30:48 jkh Exp $  PRINTER?=	ascii @@ -16,6 +16,11 @@ ROFF?=          groff -mtty-char ${TRFLAGS} ${MACROS} -o${PAGES}  ROFF?=		groff ${TRFLAGS} ${MACROS} -o${PAGES}  .endif  SOELIM?=	soelim +SOELIMPP=	sed ${SOELIMPPARGS} +SOELIMPPARGS0=	${SRCS} ${EXTRA} +SOELIMPPARGS1=	${SOELIMPPARGS0:S/^/-e\\ \'s:\(\.so[\\ \\	][\\ \\	]*\)\(/} +SOELIMPPARGS2=	${SOELIMPPARGS1:S/$/\)\$:\1${SRCDIR}\/\2:\'/} +SOELIMPPARGS=	${SOELIMPPARGS2:S/\\'/'/g}  TBL?=		tbl  DOC?=		paper @@ -83,7 +88,7 @@ obj:  clean:  	rm -f ${DOC}.${PRINTER} ${DOC}.ps ${DOC}.ascii \ -		${DOC}.ps.gz ${DOC}.ascii.gz [eE]rrs mklog ${CLEANFILES} +		${DOC}.ps.gz ${DOC}.ascii.gz Errs errs mklog ${CLEANFILES}  cleandir: clean  	cd ${.CURDIR}; rm -rf obj @@ -112,7 +117,7 @@ afterinstall:  .endif -DISTRIBUTION?=	bin +DISTRIBUTION?=	doc  .if !target(distribute)  distribute:  	cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies @@ -128,8 +133,15 @@ BINMODE=        444  SRCDIR?=	${.CURDIR}  .if !target(${DFILE}) -${DFILE}:	${SRCS} +${DFILE}::	${SRCS} ${EXTRA} ${OBJS} +# XXX ${.ALLSRC} doesn't work unless there are a lot of .PATH.foo statements. +ALLSRCS=	${SRCS:S;^;${SRCDIR}/;} +${DFILE}::	${SRCS} +.if defined(USE_SOELIMPP) +	${SOELIMPP} ${ALLSRCS} | ${ROFF} | ${GZIPCMD} > ${.TARGET} +.else  	(cd ${SRCDIR}; ${ROFF} ${.ALLSRC}) | ${GZIPCMD} > ${.TARGET} +.endif  .else  .if !defined(NODOCCOMPRESS)  ${DFILE}:	${DOC}.${PRINTER} diff --git a/share/mk/bsd.info.mk b/share/mk/bsd.info.mk index 472ba22ded01..0300c7df1890 100644 --- a/share/mk/bsd.info.mk +++ b/share/mk/bsd.info.mk @@ -1,9 +1,9 @@ -# $Id: bsd.info.mk,v 1.15 1995/07/27 15:03:27 wollman Exp $ +# $Id: bsd.info.mk,v 1.13.4.1 1995/09/17 11:14:36 davidg Exp $  BINMODE=        444  BINDIR?=	/usr/share/info  MAKEINFO?=	makeinfo -MAKEINFOFLAGS?=	--no-split # simplify some things, e.g., compression +MAKEINFOFLAGS+=	--no-split # simplify some things, e.g., compression  .MAIN: all @@ -66,7 +66,7 @@ obj:  .endif  clean: -	rm -f ${INFO:S/$/.info*/g} [eE]rrs mklog ${CLEANFILES} +	rm -f ${INFO:S/$/.info*/g} Errs errs mklog ${CLEANFILES}  cleandir: clean  	cd ${.CURDIR}; rm -rf obj diff --git a/share/mk/bsd.kmod.mk b/share/mk/bsd.kmod.mk index 49381184defd..4591d0a3a156 100644 --- a/share/mk/bsd.kmod.mk +++ b/share/mk/bsd.kmod.mk @@ -1,5 +1,84 @@  #	From: @(#)bsd.prog.mk	5.26 (Berkeley) 6/25/91 -#	$Id: bsd.kmod.mk,v 1.11 1995/03/20 19:18:51 wollman Exp $ +#	$Id: bsd.kmod.mk,v 1.11.4.1 1996/04/03 12:10:28 phk Exp $ +# +# The include file <bsd.kmod.mk> handles installing Loadable Kernel Modules. +# <bsd.kmod.mk> includes the file named "../Makefile.inc" if it exists, +# as well as the include file <bsd.obj.mk>, <bsd.dep.mk>, and +# may be <bsd.man.mk> +# +# +# +++ variables +++ +# +# CLEANFILES	Additional files to remove for the clean and cleandir targets. +# +# DISTRIBUTION  Name of distribution. [bin] +# +# EXPORT_SYMS	??? +# +# KERN		Main Kernel source directory. [${.CURDIR}/../../sys/kern] +# +# KMOD          The name of the loadable kernel module to build. +# +# KMODDIR	Base path for loadable kernel modules +#		(see lkm(4)). [/lkm] +# +# KMODOWN	LKM owner. [${BINOWN}] +# +# KMODGRP	LKM group. [${BINGRP}] +# +# KMODMODE	LKM mode. [${BINMODE}] +# +# LINKS		The list of LKM links; should be full pathnames, the +#               linked-to file coming first, followed by the linked +#               file.  The files are hard-linked.  For example, to link +#               /lkm/master and /lkm/meister, use: +# +#			LINKS=  /lkm/master /lkm/meister +# +# LN_FLAGS	Flags for ln(1) (see variable LINKS) +# +# NOMAN		LKM does not have a manual page if set. +# +# PROG          The name of the loadable kernel module to build.  +#		If not supplied, ${KMOD} is used. +# +# PSEUDO_LKM	??? +# +# SRCS          List of source files  +# +# SUBDIR        A list of subdirectories that should be built as well. +#               Each of the targets will execute the same target in the +#               subdirectories. +# +# DESTDIR, DISTDIR are set by other Makefiles (e.g. bsd.own.mk) +# +# +# +++ targets +++ +# +#       distribute: +#               This is a variant of install, which will +#               put the stuff into the right "distribution". +# +# 	install: +#               install the program and its manual pages; if the Makefile +#               does not itself define the target install, the targets +#               beforeinstall and afterinstall may also be used to cause +#               actions immediately before and after the install target +#		is executed. +# +# 	load:	 +#		Load LKM. +# +# 	tags: +#		Create a tags file for the source files. +# +# 	unload: +#		Unload LKM. +# +# bsd.obj.mk: clean, cleandir and obj +# bsd.dep.mk: depend +# bsd.man.mk: maninstall +#  .if exists(${.CURDIR}/../Makefile.inc)  .include "${.CURDIR}/../Makefile.inc" @@ -12,12 +91,14 @@  # ${.CURDIR}/../../sys.  We don't bother adding a .PATH since nothing  # actually lives in /sys directly.  # -CWARNFLAGS?= -W -Wcomment -Wredundant-decls -CFLAGS+=${COPTS} -DKERNEL -I${.CURDIR}/../../sys ${CWARNFLAGS} +CWARNFLAGS?= -W -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit \ +	-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes \ +	-Winline -KMODGRP?=	bin -KMODOWN?=	bin -KMODMODE?=	555 +CFLAGS+=${COPTS} -DKERNEL -DACTUALLY_LKM_NOT_KERNEL -I${.CURDIR}/../../sys \ +	${CWARNFLAGS} + +EXPORT_SYMS?= _${KMOD}  .if defined(VFS_LKM)  CFLAGS+= -DVFS_LKM -DMODVNOPS=${KMOD}vnops -I. @@ -37,14 +118,26 @@ PROG=	${KMOD}.o  .endif  ${PROG}: ${DPSRCS} ${OBJS} ${DPADD}  -	${LD} -r ${LDFLAGS} -o ${.TARGET} ${OBJS} +	${LD} -r ${LDFLAGS} -o tmp.o ${OBJS} +.if defined(EXPORT_SYMS) +	@rm -f symb.tmp +	@for i in ${EXPORT_SYMS} ; do echo $$i >> symb.tmp ; done +	symorder -c symb.tmp tmp.o +	@rm -f symb.tmp +.endif +	mv tmp.o ${.TARGET} -.if	!defined(MAN1) && !defined(MAN2) && !defined(MAN3) && \ -	!defined(MAN4) && !defined(MAN5) && !defined(MAN6) && \ -	!defined(MAN7) && !defined(MAN8) && !defined(NOMAN) +.if !defined(NOMAN) +.include <bsd.man.mk> +.if !defined(_MANPAGES) || empty(_MANPAGES)  MAN1=	${KMOD}.4  .endif +.elif !target(maninstall) +maninstall: +all-man: +.endif +  _PROGSUBDIR: .USE  .if defined(SUBDIR) && !empty(SUBDIR)  	@for entry in ${SUBDIR}; do \ @@ -59,19 +152,9 @@ _PROGSUBDIR: .USE  .endif  .MAIN: all -all: ${PROG} _PROGSUBDIR +all: ${PROG} all-man _PROGSUBDIR -.if !target(clean) -clean: _PROGSUBDIR -	rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES}  -.endif - -.if !target(cleandir) -cleandir: _PROGSUBDIR -	rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES} -	rm -f ${.CURDIR}/tags .depend -	cd ${.CURDIR}; rm -rf obj; -.endif +CLEANFILES+=${PROG} ${OBJS}   .if !target(install)  .if !target(beforeinstall) @@ -82,8 +165,8 @@ afterinstall:  .endif  realinstall: _PROGSUBDIR -	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ -	    ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} +	${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ +	    ${INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}  .if defined(LINKS) && !empty(LINKS)  	@set ${LINKS}; \  	while test $$# -ge 2; do \ @@ -112,22 +195,6 @@ distribute:  	cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies  .endif -.if !target(obj) -.if defined(NOOBJ) -obj: _PROGSUBDIR -.else -obj: _PROGSUBDIR -	@cd ${.CURDIR}; rm -rf obj; \ -	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \ -	${ECHO} "$$here -> $$dest"; ln -s $$dest obj; \ -	if test -d /usr/obj -a ! -d $$dest; then \ -		mkdir -p $$dest; \ -	else \ -		true; \ -	fi; -.endif -.endif -  .if !target(tags)  tags: ${SRCS} _PROGSUBDIR  .if defined(PROG) @@ -136,11 +203,6 @@ tags: ${SRCS} _PROGSUBDIR  .endif  .endif -.if !defined(NOMAN) -.include <bsd.man.mk> -.elif !target(maninstall) -maninstall: -.endif  .if !target(load)  load:	${PROG} @@ -160,4 +222,7 @@ vnode_if.h:	${KERN}/vnode_if.sh ${KERN}/vnode_if.src  ./vnode_if.h:	vnode_if.h  _DEPSUBDIR=	_PROGSUBDIR +_SUBDIRUSE:	_PROGSUBDIR +.include <bsd.obj.mk>  .include <bsd.dep.mk> + diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index bac67dd1229f..1f031a6ef305 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -1,5 +1,5 @@  #	from: @(#)bsd.lib.mk	5.26 (Berkeley) 5/2/91 -#	$Id: bsd.lib.mk,v 1.24 1995/03/28 17:54:11 nate Exp $ +#	$Id: bsd.lib.mk,v 1.24.4.1 1995/08/27 03:12:58 davidg Exp $  #  .if exists(${.CURDIR}/../Makefile.inc) @@ -20,23 +20,10 @@ CXXINCLUDES+= -I${DESTDIR}/usr/include/${CXX}  CFLAGS+= ${DEBUG_FLAGS}  .endif -RANTOUCH?=	${RANLIB} -t - -LIBDIR?=	/usr/lib -LINTLIBDIR?=	/usr/libdata/lint -LIBGRP?=	bin -LIBOWN?=	bin -LIBMODE?=	444 -SHLIBDIR?=	${LIBDIR} -  .if !defined(DEBUG_FLAGS)  STRIP?=	-s  .endif -BINGRP?=	bin -BINOWN?=	bin -BINMODE?=	555 -  .MAIN: all  # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries @@ -46,66 +33,66 @@ BINMODE?=	555  .c.o:  	${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} -	@${LD} -x -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .c.po:  	${CC} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} -	@${LD} -X -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -X -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .c.so:  	${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} -	@${LD} -x -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .cc.o .cxx.o .C.o:  	${CXX} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} -	@${LD} -x -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .cc.po .C.po .cxx.o:  	${CXX} -p ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} -	@${LD} -X -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -X -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .cc.so .C.so:  	${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} -	@${LD} -x -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .f.o:  	${FC} ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}  -	@${LD} -x -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .f.po:  	${FC} -p ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}  -	@${LD} -X -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -X -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .f.so:  	${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} -	@${LD} -x -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .s.o:  	${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \  	    ${AS} -o ${.TARGET} -	@${LD} -x -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .s.po:  	${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \  	    ${AS} -o ${.TARGET} -	@${LD} -X -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -X -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .s.so:  	${CPP} -E -DPIC ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \  	   ${AS} -k -o ${.TARGET} -	@${LD} -x -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .S.o:  	${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ @@ -118,18 +105,18 @@ BINMODE?=	555  .S.so:  	${CPP} -E -DPIC ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \  	   ${AS} -k -o ${.TARGET} -	@${LD} -x -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .m.po:  	${CC} ${CFLAGS} -p -c ${.IMPSRC} -o ${.TARGET} -	@${LD} -X -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -X -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .m.o:  	${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} -	@${LD} -X -r ${.TARGET} -	@mv a.out ${.TARGET} +	@${LD} -o ${.TARGET}.tmp -X -r ${.TARGET} +	@mv ${.TARGET}.tmp ${.TARGET}  .if !defined(INTERNALLIB) || defined(INTERNALSTATICLIB)  .if !defined(NOPROFILE) && !defined(INTERNALLIB) @@ -165,7 +152,7 @@ _LIBSUBDIR: .USE  	done  .endif -all: ${_LIBS} _LIBSUBDIR # llib-l${LIB}.ln +all: ${_LIBS} all-man _LIBSUBDIR # llib-l${LIB}.ln  OBJS+=	${SRCS:N*.h:R:S/$/.o/g} @@ -197,7 +184,7 @@ SOBJS+= ${OBJS:.o=.so}  lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: ${SOBJS}  	@${ECHO} building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)  	@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} -	@${LD} -Bshareable \ +	@${LD} -Bshareable -x \  	    -o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \  	    `lorder ${SOBJS} | tsort` ${LDDESTDIR} ${LDADD} @@ -251,11 +238,9 @@ realinstall: beforeinstall  .if !defined(INTERNALLIB)  	${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \  	    ${INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR} -	${RANTOUCH} ${DESTDIR}${LIBDIR}/lib${LIB}.a  .if !defined(NOPROFILE)  	${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \  	    ${INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR} -	${RANTOUCH} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a  .endif  .endif  .if !defined(NOPIC) @@ -268,7 +253,6 @@ realinstall: beforeinstall  .if defined(INSTALL_PIC_ARCHIVE)  	${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \  	    ${INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR} -	${RANTOUCH} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a  .endif  .endif  .if defined(LINKS) && !empty(LINKS) @@ -312,6 +296,7 @@ tags: ${SRCS}  .include <bsd.man.mk>  .elif !target(maninstall)  maninstall: +all-man:  .endif  .if !target(obj) diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk index 2dd9d99df1d6..e48afa95e3c3 100644 --- a/share/mk/bsd.man.mk +++ b/share/mk/bsd.man.mk @@ -1,101 +1,123 @@ -#	from: @(#)bsd.man.mk	5.2 (Berkeley) 5/11/90 -#	$Id: bsd.man.mk,v 1.3 1994/08/28 15:37:40 bde Exp $ +#	$Id: bsd.man.mk,v 1.12 1996/05/25 23:09:48 wosch Exp $ +# +# The include file <bsd.man.mk> handles installing manual pages and  +# their links. <bsd.man.mk> includes the file named "../Makefile.inc"  +# if it exists. +# +# +# +++ variables +++ +# +# DESTDIR	Change the tree where the man pages gets installed. [not set] +# +# MANDIR	Base path for manual installation. [${SHAREDIR}/man/man] +# +# MANOWN	Manual owner. [${SHAREOWN}] +# +# MANGRP	Manual group. [${SHAREGRP}] +# +# MANMODE	Manual mode. [${NOBINMODE}] +# +# MANSUBDIR	Subdirectory under the manual page section, i.e. "/i386" +#		or "/tahoe" for machine specific manual pages. +# +# MAN${sect}	The manual pages to be installed. For sections see +#		variable ${SECTIONS} +# +# _MANPAGES	List of all man pages to be installed. +#		(``_MANPAGES=$MAN1 $MAN2 ... $MANn'') +# +# MCOMPRESS	Program to compress man pages. Output is to +#		stdout. [gzip -c] +# +# MLINKS	List of manual page links (using a suffix). The +#		linked-to file must come first, the linked file  +#		second, and there may be multiple pairs. The files  +#		are hard-linked. +# +# NOMANCOMPRESS	If you do not want unformatted manual pages to be  +#		compressed when they are installed. [not set] +# +# +# +++ targets +++ +# +#	maninstall: +#		Install the manual pages and their links. +# +  .if exists(${.CURDIR}/../Makefile.inc)  .include "${.CURDIR}/../Makefile.inc"  .endif -MANGRP?=	bin -MANOWN?=	bin -MANMODE?=	444 - -MANDIR?=	/usr/share/man/man  MANSRC?=	${.CURDIR} -MINSTALL=	${INSTALL}  ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} +MINSTALL=	${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} -MCOMPRESS=	gzip -f -BASENAME=	basename +MCOMPRESS=	gzip -c  ZEXTENSION=	.gz -.if !defined(NOMANCOMPRESS) -ZEXT=		${ZEXTENSION} -.else -ZEXT= -.endif -MANALL=		${MAN1} ${MAN2} ${MAN3} ${MAN3F} ${MAN4} ${MAN5}	\ -		${MAN6} ${MAN7} ${MAN8} +SECTIONS=	1 2 3 3f 4 5 6 7 8 9 -maninstall: ${MANDEPEND} -.if defined(MAN1) && !empty(MAN1) -	(cd ${MANSRC}; ${MINSTALL} ${MAN1} ${DESTDIR}${MANDIR}1${MANSUBDIR}) -.endif -.if defined(MAN2) && !empty(MAN2) -	(cd ${MANSRC}; ${MINSTALL} ${MAN2} ${DESTDIR}${MANDIR}2${MANSUBDIR}) -.endif -.if defined(MAN3) && !empty(MAN3) -	(cd ${MANSRC}; ${MINSTALL} ${MAN3} ${DESTDIR}${MANDIR}3${MANSUBDIR}) -.endif -.if defined(MAN3F) && !empty(MAN3F) -	(cd ${MANSRC}; ${MINSTALL} ${MAN3F} ${DESTDIR}${MANDIR}3f${MANSUBDIR}) -.endif -.if defined(MAN4) && !empty(MAN4) -	(cd ${MANSRC}; ${MINSTALL} ${MAN4} ${DESTDIR}${MANDIR}4${MANSUBDIR}) -.endif -.if defined(MAN5) && !empty(MAN5) -	(cd ${MANSRC}; ${MINSTALL} ${MAN5} ${DESTDIR}${MANDIR}5${MANSUBDIR}) +.undef _MANPAGES +.for sect in ${SECTIONS} +.if defined(MAN${sect}) && !empty(MAN${sect}) +.SUFFIXES: .${sect} +.PATH.${sect}: ${MANSRC} +_MANPAGES+= ${MAN${sect}}  .endif -.if defined(MAN6) && !empty(MAN6) -	(cd ${MANSRC}; ${MINSTALL} ${MAN6} ${DESTDIR}${MANDIR}6${MANSUBDIR}) -.endif -.if defined(MAN7) && !empty(MAN7) -	(cd ${MANSRC}; ${MINSTALL} ${MAN7} ${DESTDIR}${MANDIR}7${MANSUBDIR}) +.endfor + +all-man: ${MANDEPEND} + +.if defined(NOMANCOMPRESS) + +COPY=		-c +ZEXT= + +.else + +ZEXT=		${ZEXTENSION} + +.for sect in ${SECTIONS} +.if defined(MAN${sect}) && !empty(MAN${sect}) +CLEANFILES+=	${MAN${sect}:T:S/$/${ZEXTENSION}/g} +.for page in ${MAN${sect}} +.for target in ${page:T:S/$/${ZEXTENSION}/} +all-man: ${target} +${target}: ${page} +	${MCOMPRESS} ${.ALLSRC} > ${.TARGET} +.endfor +.endfor  .endif -.if defined(MAN8) && !empty(MAN8) -	(cd ${MANSRC}; ${MINSTALL} ${MAN8} ${DESTDIR}${MANDIR}8${MANSUBDIR}) +.endfor +  .endif -# by default all pages are compressed -# we don't handle .so's yet -.if !empty(MANALL:S/ //g) -.if !defined(NOMANCOMPRESS)  -	@set ${MANALL} ;						\ -	while test $$# -ge 1; do					\ -		name=`${BASENAME} $$1`;					\ -		sect=`expr $$name : '.*\.\([^.]*\)'`;			\ -		${ECHO} "compressing in"				\ -			"${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}:"	\ -			"$$name -> $${name}${ZEXT}";			\ -		${MCOMPRESS} ${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name ; \ -		shift ;							\ -	done ; true +maninstall:: +.for sect in ${SECTIONS} +.if defined(MAN${sect}) && !empty(MAN${sect}) +maninstall:: ${MAN${sect}} +.if defined(NOMANCOMPRESS) +	${MINSTALL} ${.ALLSRC} ${DESTDIR}${MANDIR}${sect}${MANSUBDIR}  .else -# we are installing uncompressed pages, so nuke any compressed pages -	@set ${MANALL} ;						\ -	while test $$# -ge 1; do					\ -		name=`${BASENAME} $$1`;					\ -		sect=`expr $$name : '.*\.\([^.]*\)'`;			\ -		rm -f ${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name${ZEXTENSION};\ -		shift ;							\ -	done ; true +	${MINSTALL} ${.ALLSRC:T:S/$/${ZEXTENSION}/g} \ +		${DESTDIR}${MANDIR}${sect}${MANSUBDIR}  .endif  .endif +.endfor  .if defined(MLINKS) && !empty(MLINKS) -	@set ${MLINKS}; \ -	while test $$# -ge 2; do \ -		name=$$1; \ -		shift; \ -		sect=`expr $$name : '.*\.\([^.]*\)'`; \ -		dir=${DESTDIR}${MANDIR}$$sect; \ -		l=$${dir}${MANSUBDIR}/$$name; \ -		name=$$1; \ -		shift; \ -		sect=`expr $$name : '.*\.\([^.]*\)'`; \ -		dir=${DESTDIR}${MANDIR}$$sect; \ -		t=$${dir}${MANSUBDIR}/$$name; \ +	@set `echo ${MLINKS} " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \ +	while : ; do \ +		case $$# in \ +			0) break;; \ +			[123]) echo "warn: empty MLINK: $$1 $$2 $$3"; break;; \ +		esac; \ +		name=$$1; shift; sect=$$1; shift; \ +		l=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \ +		name=$$1; shift; sect=$$1; shift; \ +		t=${DESTDIR}${MANDIR}$${sect}${MANSUBDIR}/$$name; \  		${ECHO} $${t}${ZEXT} -\> $${l}${ZEXT}; \ -		rm -f $${t}${ZEXTENSION}; \ -		rm -f $${t}; \ +		rm -f $${t} $${t}${ZEXTENSION}; \  		ln $${l}${ZEXT} $${t}${ZEXT}; \ -	done; true +	done  .endif diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index e6ea911b44f9..d8ba4ba17207 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -1,16 +1,174 @@ -#	$Id: bsd.own.mk,v 1.1 1994/08/04 21:10:08 wollman Exp $ +#	$Id: bsd.own.mk,v 1.2 1994/09/16 14:30:21 jkh Exp $ +# +# The include file <bsd.own.mk> set common variables for owner, +# group, mode, and directories. Defaults are in brackets. +# +# +# +++ variables +++ +# +# where the system object and source trees are kept; can be configurable +# by the user in case they want them in ~/foosrc and ~/fooobj, for example +# where the system object and source trees are kept; can be configurable +# by the user in case they want them in ~/foosrc and ~/fooobj, for example +# BSDOBJDIR	The real path to the system 'obj' tree, so that 'make obj' +#		will work correctly. [/usr/obj] +# +# BSDSRCDIR	The real path to the system sources, so that 'make obj' +#		will work correctly. [/usr/src] +# +# DESTDIR	Change the tree where the file gets installed. [not set] +# +# DISTDIR	Change the tree where the file for a distribution +# 		gets installed (see /usr/src/release/Makefile). [not set] +# +# +# COPY		The flag passed to the install program to cause the binary +#		to be copied rather than moved.  This is to be used when +#		building our own install script so that the entire system +#		can either be installed with copies, or with moves using +#		a single knob. [-c] +# +# STRIP		The flag passed to the install program to cause the binary +#		to be stripped.  This is to be used when building your +#		own install script so that the entire system can be made +#		stripped/not-stripped using a single knob. [-s] +# +# +# +# BINOWN	Binary owner. [bin] +# +# BINGRP	Binary group. [bin] +# +# BINMODE	Binary mode. [555] +# +# NOBINMODE	Mode for non-executable files. [444] +# +# +# LIBDIR	Base path for libraries. [/usr/lib] +# +# LINTLIBDIR	Base path for lint libraries. [/usr/libdata/lint] +# +# SHLIBDIR	Base path for shared libraries. [${LIBDIR}] +# +# LIBOWN	Library mode. [${BINOWN}] +# +# LIBGRP	Library group. [${BINGRP}] +# +# LIBMODE	Library mode. [${NOBINMODE}] +# +# +# KMODDIR	Base path for loadable kernel modules +#		(see lkm(4)). [/lkm] +# +# KMODOWN	LKM owner. [${BINOWN}] +# +# KMODGRP	LKM group. [${BINGRP}] +# +# KMODMODE	LKM mode. [${BINMODE}] +# +# +# SHAREDIR	Base path for architecture-independent ascii +#		text files. [/usr/share] +# +# SHAREOWN	ASCII text file owner. [bin] +# +# SHAREGRP	ASCII text file group. [bin] +# +# SHAREMODE	ASCII text file mode. [${NOBINMODE}] +# +# +# DOCDIR	Base path for system documentation (e.g. PSD, USD, +#		handbook, FAQ etc.). [${SHAREDIR}/doc] +# +# DOCOWN	Documentation owner. [${SHAREOWN}] +# +# DOCGRP	Documentation group. [${SHAREGRP}] +# +# DOCMODE	Documentation mode. [${NOBINMODE}] +# +# +# INFODIR	Base path for GNU's hypertext system +#		called Info (see info(1)). [${SHAREDIR}/info] +# +# INFOOWN	Info owner. [${SHAREOWN}] +# +# INFOGRP	Info group. [${SHAREGRP}] +# +# INFOMODE	Info mode. [${NOBINMODE}] +# +# +# MANDIR	Base path for manual installation. [${SHAREDIR}/man/man] +# +# MANOWN	Manual owner. [${SHAREOWN}] +# +# MANGRP	Manual group. [${SHAREGRP}] +# +# MANMODE	Manual mode. [${NOBINMODE}] +# +# +# NLSDIR	Base path for National Language Support files +#		installation (see mklocale(1)). [${SHAREDIR}/nls] +# +# NLSGRP	National Language Support files group. [${SHAREOWN}] +# +# NLSOWN	National Language Support files owner. [${SHAREGRP}] +# +# NLSMODE	National Language Support files mode. [${NONBINMODE}] +# -BINGRP?=	bin + +BSDSRCDIR?=	/usr/src +BSDOBJDIR?=	/usr/obj + + +# Binaries  BINOWN?=	bin +BINGRP?=	bin  BINMODE?=	555 +NOBINMODE?=	444 + +LIBDIR?=	/usr/lib +LINTLIBDIR?=	/usr/libdata/lint +SHLIBDIR?=	${LIBDIR} +LIBOWN?=	${BINOWN} +LIBGRP?=	${BINGRP} +LIBMODE?=	${NOBINMODE} + +KMODDIR?=	/lkm +KMODOWN?=	${BINOWN} +KMODGRP?=	${BINGRP} +KMODMODE?=	${BINMODE} + +# Share files +SHAREDIR?=	/usr/share +SHAREOWN?=	bin +SHAREGRP?=	bin +SHAREMODE?=	${NOBINMODE} + +MANDIR?=	${SHAREDIR}/man/man +MANOWN?=	${SHAREOWN} +MANGRP?=	${SHAREGRP} +MANMODE?=	${NOBINMODE} + +DOCDIR?=	${SHAREDIR}/doc +DOCOWN?=	${SHAREOWN} +DOCGRP?=	${SHAREGRP} +DOCMODE?=	${NOBINMODE} + +INFODIR?=	${SHAREDIR}/info +INFOOWN?=	${SHAREOWN} +INFOGRP?=	${SHAREGRP} +INFOMODE?=	${NOBINMODE} + +NLSDIR?=	${SHAREDIR}/nls +NLSGRP?=	${SHAREOWN} +NLSOWN?=	${SHAREGRP} +NLSMODE?=	${NONBINMODE} + +# Common variables  .if !defined(DEBUG_FLAGS)  STRIP?=		-s  .endif  COPY?=		-c - -MANDIR?=	/usr/share/man/man -MANGRP?=	bin -MANOWN?=	bin -MANMODE?=	444 diff --git a/share/mk/bsd.port.mk b/share/mk/bsd.port.mk index 0283f8b2e88f..84cae1629f26 100644 --- a/share/mk/bsd.port.mk +++ b/share/mk/bsd.port.mk @@ -3,7 +3,7 @@  #	bsd.port.mk - 940820 Jordan K. Hubbard.  #	This file is in the public domain.  # -# $Id: bsd.port.mk,v 1.165.2.2 1995/10/05 20:58:10 davidg Exp $ +# $Id: bsd.port.mk,v 1.165.2.3 1996/02/16 11:23:31 jkh Exp $  #  # Please view me with 4 column tabs! @@ -14,14 +14,14 @@  #   # PORTSDIR		- The root of the ports tree (default: /usr/ports).  # DISTDIR 		- Where to get gzip'd, tarballed copies of original sources -#				  (default: ${PORTSDIR}/distfiles). +#				  (default: ${PORTSDIR}/distfiles/${DIST_SUBDIR}).  # PREFIX		- Where to install things in general (default: /usr/local).  # MASTER_SITES	- Primary location(s) for distribution files if not found  #				  locally (default: -#				   ftp://ftp.freebsd.org/pub/FreeBSD/distfiles) -# PATCH_SITES	- Primary location(s) for distributed patch files +#				   ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/) +# PATCH_SITES	- Primary location(s) for distribution patch files  #				  (see PATCHFILES below) if not found locally (default: -#				   ftp://ftp.freebsd.org/pub/FreeBSD/distfiles) +#				   ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/)  #  # MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this  #				  value. @@ -35,8 +35,6 @@  #				  (default: ports@FreeBSD.ORG).  # CATEGORIES	- A list of descriptive categories into which this port falls  #				  (default: orphans). -# KEYWORDS		- A list of descriptive keywords that might index well for this -#				  port (default: orphans).  #  # Variables that typically apply to an individual port.  Non-Boolean  # variables without defaults are *mandatory*. @@ -49,14 +47,16 @@  #				  NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).  # DISTNAME		- Name of port or distribution.  # DISTFILES		- Name(s) of archive file(s) containing distribution -#				  (default: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}). -# PATCHFILES	- Name(s) of additional files that contain distributed +#				  (default: ${DISTNAME}${EXTRACT_SUFX}). +# PATCHFILES	- Name(s) of additional files that contain distribution  #				  patches (default: none).  make will look for them at  #				  PATCH_SITES (see above).  They will automatically be  #				  uncompressed before patching if the names end with  #				  ".gz" or ".Z". -# PATCH_PRFX	- Filename prefix for distribution patches (default: none) -#				  typically ${DISTNAME}/ or foo- +# DIST_SUBDIR	- Suffix to ${DISTDIR} (see above).  If set, all ${DISTFILES}  +#				  and ${PATCHFILES} will be put in this subdirectory of +#				  ${DISTDIR}.  Also they will be fetched in this subdirectory  +#				  from FreeBSD mirror sites.  # PKGNAME		- Name of the package file to create if the DISTNAME   #				  isn't really relevant for the port/package  #				  (default: ${DISTNAME}). @@ -83,10 +83,13 @@  # NO_BUILD		- Use a dummy (do-nothing) build target.  # NO_PACKAGE	- Use a dummy (do-nothing) package target.  # NO_INSTALL	- Use a dummy (do-nothing) install target. +# NO_CDROM		- Use dummy (do-nothing) targets if FOR_CDROM is set.  # NO_WRKSUBDIR	- Assume port unpacks directly into ${WRKDIR}.  # NO_WRKDIR		- There's no work directory at all; port does this someplace  #				  else.  # NO_DEPENDS	- Don't verify build of dependencies. +# BROKEN		- Port is broken. +# RESTRICTED	- Port is restricted.  Set this string to the reason why.  # USE_GMAKE		- Says that the port uses gmake.  # USE_IMAKE		- Says that the port uses imake.  # USE_X11		- Says that the port uses X11. @@ -95,8 +98,9 @@  # HAS_CONFIGURE	- Says that the port has its own configure script.  # GNU_CONFIGURE	- Set if you are using GNU configure (optional).  # CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'. -# CONFIGURE_ARGS - Pass these args to configure, if ${HAS_CONFIGURE} set. -# CONFIGURE_ENV  - Pass these env (shell-like) to configure, if ${HAS_CONFIGURE} set. +# CONFIGURE_ARGS - Pass these args to configure if ${HAS_CONFIGURE} is set. +# CONFIGURE_ENV  - Pass these env (shell-like) to configure if +#				  ${HAS_CONFIGURE} is set.  # IS_INTERACTIVE - Set this if your port needs to interact with the user  #				  during a build.  User can then decide to skip this port by  #				  setting ${BATCH}, or compiling only the interactive ports @@ -140,6 +144,14 @@  # NCFTP			- Full path to ncftp command if not in $PATH (default: ncftp).  # NCFTPFLAGS    - Arguments to ${NCFTP} (default: -N).  # +# Motif support: +# +# REQUIRES_MOTIF - Set this in your port if it requires Motif.  It will  be +#				  built only if HAVE_MOTIF is set. +# HAVE_MOTIF	- If set, means system has Motif.  Typically set in +#				  /etc/make.conf. +# MOTIF_STATIC	- If set, link libXm statically; otherwise, link it +#				  dynamically.  #  # Variables to change if you want a special behavior:  # @@ -172,8 +184,8 @@  # checkpatch	- Do a "patch -C" instead of a "patch".  Note that it may  #				  give incorrect results if multiple patches deal with  #				  the same file. -# checksum		- Use files/md5 to ensure that your distfiles are valid -# makesum		- Generate files/md5 (only do this for your own ports!) +# checksum		- Use files/md5 to ensure that your distfiles are valid. +# makesum		- Generate files/md5 (only do this for your own ports!).  #  # Default sequence for "all" is:  fetch checksum extract patch configure build  # @@ -193,9 +205,11 @@  # tree we are and thus can't go relative.  They can, of course, be overridden  # by individual Makefiles.  PORTSDIR?=		${DESTDIR}/usr/ports +LOCALBASE?=		/usr/local  X11BASE?=		/usr/X11R6 -DISTDIR?=		${PORTSDIR}/distfiles +DISTDIR?=		${PORTSDIR}/distfiles/${DIST_SUBDIR}  PACKAGES?=		${PORTSDIR}/packages +TEMPLATES?=		${PORTSDIR}/templates  .if !defined(NO_WRKDIR)  WRKDIR?=		${.CURDIR}/work  .else @@ -213,7 +227,7 @@ PKGDIR?=		${.CURDIR}/pkg  .if defined(USE_IMAKE) || defined(USE_X11)  PREFIX?=		${X11BASE}  .else -PREFIX?=		/usr/local +PREFIX?=		${LOCALBASE}  .endif  # The following 4 lines should go away as soon as the ports are all updated  .if defined(EXEC_DEPENDS) @@ -246,8 +260,10 @@ GMAKE?=			gmake  XMKMF?=			xmkmf -a  MD5?=			/sbin/md5  MD5_FILE?=		${FILESDIR}/md5 +  MAKE_FLAGS?=	-f  MAKEFILE?=		Makefile +MAKE_ENV?=		PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" CFLAGS="${CFLAGS}"  NCFTP?=			/usr/bin/ncftp  NCFTPFLAGS?=	-N @@ -265,6 +281,10 @@ PATCH_DIST_ARGS?=	-d ${WRKSRC} -E ${PATCH_DIST_STRIP}  PATCH_ARGS?=	-d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP}  PATCH_DIST_ARGS?=	-d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP}  .endif +.if defined(BATCH) +PATCH_ARGS+=		--batch +PATCH_DIST_ARGS+=	--batch +.endif  .if defined(PATCH_CHECK_ONLY)  PATCH_ARGS+=	-C @@ -308,7 +328,7 @@ PKG_ARGS+=		-k ${PKGDIR}/DEINSTALL  .if exists(${PKGDIR}/REQ)  PKG_ARGS+=		-r ${PKGDIR}/REQ  .endif -.if !defined(USE_X11) && !defined(USE_IMAKE) && defined(MTREE_LOCAL) +.if !defined(NO_MTREE) && defined(MTREE_LOCAL)  PKG_ARGS+=		-m ${MTREE_LOCAL}  .endif  .endif @@ -316,32 +336,47 @@ PKG_SUFX?=		.tgz  # where pkg_add records its dirty deeds.  PKG_DBDIR?=		/var/db/pkg +# shared/dynamic motif libs +.if defined(HAVE_MOTIF) +.if defined(MOTIF_STATIC) +MOTIFLIB?=	${X11BASE}/lib/libXm.a +.else +MOTIFLIB?=	-L${X11BASE}/lib -lXm +.endif +.endif + +ECHO?=		/bin/echo +CAT+=		/bin/cat +CP?=		/bin/cp +SETENV?=	/usr/bin/env +RM?=		/bin/rm +MKDIR?=		/bin/mkdir +GZCAT?=		/usr/bin/gzcat +BASENAME?=	/usr/bin/basename +SED?=		/usr/bin/sed +CAT?=		/bin/cat +GREP?=		/usr/bin/grep +AWK?=		/usr/bin/awk +  # Used to print all the '===>' style prompts - override this to turn them off. -ECHO_MSG?=		/bin/echo +ECHO_MSG?=		${ECHO}  ALL_TARGET?=		all  INSTALL_TARGET?=	install  # If the user has this set, go to the FreeBSD respository for everything.  .if defined(MASTER_SITE_FREEBSD) -MASTER_SITE_OVERRIDE=  ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/  +MASTER_SITE_OVERRIDE=  ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/  .endif  # I guess we're in the master distribution business! :)  As we gain mirror  # sites for distfiles, add them to this list.  .if !defined(MASTER_SITE_OVERRIDE) -MASTER_SITES+=	ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/ -PATCH_SITES+=	ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${PATCH_PRFX} +MASTER_SITES+=	ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/ +PATCH_SITES+=	ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/  .else  MASTER_SITES:=	${MASTER_SITE_OVERRIDE} ${MASTER_SITES} -PATCH_SITES:=	${MASTER_SITE_OVERRIDE}${PATCH_PRFX} ${PATCH_SITES} -.endif - -.if defined(PATCH_PRFX) -PATCHDIST!=	/bin/echo ${PATCH_PRFX} | sed 's|^\(.*\)/$$|/\1|' -PATCHDIST:=	${DISTDIR}${PATCHDIST} -.else -PATCHDIST:=	${DISTDIR} +PATCH_SITES:=	${MASTER_SITE_OVERRIDE} ${PATCH_SITES}  .endif  # Derived names so that they're easily overridable. @@ -355,7 +390,6 @@ EXTRACT_ONLY?=	${DISTFILES}  # Documentation  MAINTAINER?=	ports@FreeBSD.ORG  CATEGORIES?=	orphans -KEYWORDS+=		${CATEGORIES}  # Note this has to start with a capital letter (or more accurately, it  #  shouldn't match "[a-z]*"), see the target "delete-package-links" below. @@ -377,6 +411,8 @@ HAS_CONFIGURE=		yes  .MAIN: all  ################################################################ +# Many ways to disable a port. +#  # If we're in BATCH mode and the port is interactive, or we're  # in interactive mode and the port is non-interactive, skip all  # the important targets.  The reason we have two modes is that @@ -384,10 +420,27 @@ HAS_CONFIGURE=		yes  # overnight, then come back in the morning and do _only_ the  # interactive ones that required your intervention.  # -# This allows you to do both. +# Don't attempt to build ports that require Motif if you don't +# have Motif. +# +# Ignore ports that can't be resold if building for a CDROM. +# +# Don't build a port if it's restricted and we don't want to get +# into that. +# +# Don't build a port if it's broken.  ################################################################ -.if (defined(IS_INTERACTIVE) && defined(BATCH)) || (!defined(IS_INTERACTIVE) && defined(INTERACTIVE)) +.if (defined(IS_INTERACTIVE) && defined(BATCH)) || \ +	(!defined(IS_INTERACTIVE) && defined(INTERACTIVE)) || \ +	(defined(REQUIRES_MOTIF) && !defined(HAVE_MOTIF)) || \ +	(defined(NO_CDROM) && defined(FOR_CDROM)) || \ +	(defined(RESTRICTED) && defined(NO_RESTRICTED)) || \ +	defined(BROKEN) +IGNORE=	yes +.endif + +.if defined(IGNORE)  all:  	@${DO_NADA}  build: @@ -402,6 +455,18 @@ package:  	@${DO_NADA}  .endif +.if defined(ALL_HOOK) +all: +	@${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \ +	  DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \ +	  PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ +	  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ +	  DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \ +	  RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \ +	${ALL_HOOK} + +.endif +  .if !target(all)  all: build  .endif @@ -468,11 +533,11 @@ patch: extract  .if !target(do-fetch)  do-fetch: -	@if [ ! -d ${DISTDIR} ]; then /bin/mkdir -p ${DISTDIR}; fi +	@if [ ! -d ${DISTDIR} ]; then ${MKDIR} -p ${DISTDIR}; fi  	@(cd ${DISTDIR}; \  	 for file in ${DISTFILES}; do \ -		if [ ! -f $$file -a ! -f `/usr/bin/basename $$file` ]; then \ -			if [ -h $$file -o -h `/usr/bin/basename $$file` ]; then \ +		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \ +			if [ -h $$file -o -h `${BASENAME} $$file` ]; then \  				${ECHO_MSG} ">> ${DISTDIR}/$$file is a broken symlink."; \  				${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \  				${ECHO_MSG} ">> Please correct this problem and try again."; \ @@ -481,8 +546,8 @@ do-fetch:  			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \  			for site in ${MASTER_SITES}; do \  			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \ -				(${NCFTP} ${NCFTPFLAGS} $${site}$${file} || true); \ -				if [ -f $$file -o -f `/usr/bin/basename $$file` ]; then \ +				(${NCFTP} ${NCFTPFLAGS} $${site}$${file} ${NCFTPTAIL} || true); \ +				if [ -f $$file -o -f `${BASENAME} $$file` ]; then \  					continue 2; \  				fi \  			done; \ @@ -492,12 +557,12 @@ do-fetch:  	    fi \  	 done)  .if defined(PATCHFILES) -	@if [ ! -d ${PATCHDIST} ]; then /bin/mkdir -p ${PATCHDIST}; fi -	@(cd ${PATCHDIST}; \ +	@if [ ! -d ${DISTDIR} ]; then ${MKDIR} -p ${DISTDIR}; fi +	@(cd ${DISTDIR}; \  	 for file in ${PATCHFILES}; do \ -		if [ ! -f $$file -a ! -f `/usr/bin/basename $$file` ]; then \ -			if [ -h $$file -o -h `/usr/bin/basename $$file` ]; then \ -				${ECHO_MSG} ">> ${PATCHDIST}/$$file is a broken symlink."; \ +		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \ +			if [ -h $$file -o -h `${BASENAME} $$file` ]; then \ +				${ECHO_MSG} ">> ${DISTDIR}/$$file is a broken symlink."; \  				${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \  				${ECHO_MSG} ">> Please correct this problem and try again."; \  				exit 1; \ @@ -505,13 +570,13 @@ do-fetch:  			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \  			for site in ${PATCH_SITES}; do \  			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \ -				(${NCFTP} ${NCFTPFLAGS} $${site}$${file} || true); \ -				if [ -f $$file -o -f `/usr/bin/basename $$file` ]; then \ +				(${NCFTP} ${NCFTPFLAGS} $${site}$${file} ${NCFTPTAIL} || true); \ +				if [ -f $$file -o -f `${BASENAME} $$file` ]; then \  					continue 2; \  				fi \  			done; \  			${ECHO_MSG} ">> Couldn't fetch it - please try to retreive this";\ -			${ECHO_MSG} ">> port manually into ${PATCHDIST} and try again."; \ +			${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \  			exit 1; \  	    fi \  	 done) @@ -522,8 +587,8 @@ do-fetch:  .if !target(do-extract)  do-extract: -	@/bin/rm -rf ${WRKDIR} -	@/bin/mkdir -p ${WRKDIR} +	@${RM} -rf ${WRKDIR} +	@${MKDIR} -p ${WRKDIR}  	@for file in ${EXTRACT_ONLY}; do \  		if ! (cd ${WRKDIR};${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\  		then \ @@ -537,14 +602,14 @@ do-extract:  .if !target(do-patch)  do-patch:  .if defined(PATCHFILES) -	@${ECHO_MSG} "===>  Applying distributed patches for ${PKGNAME}" +	@${ECHO_MSG} "===>  Applying distribution patches for ${PKGNAME}"  .if defined(PATCH_DEBUG) -	@(cd ${PATCHDIST}; \ +	@(cd ${DISTDIR}; \  	  for i in ${PATCHFILES}; do \ -		${ECHO_MSG} "===>   Applying distributed patch $$i" ; \ +		${ECHO_MSG} "===>   Applying distribution patch $$i" ; \  		case $$i in \  			*.Z|*.gz) \ -				/usr/bin/gzcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ +				${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \  				;; \  			*) \  				${PATCH} ${PATCH_DIST_ARGS} < $$i; \ @@ -552,11 +617,11 @@ do-patch:  		esac; \  	  done)  .else -	@(cd ${PATCHDIST}; \ +	@(cd ${DISTDIR}; \  	  for i in ${PATCHFILES}; do \  		case $$i in \  			*.Z|*.gz) \ -				/usr/bin/gzcat $$i | ${PATCH} ${PATCH_DIST_ARGS}; \ +				${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \  				;; \  			*) \  				${PATCH} ${PATCH_DIST_ARGS} < $$i; \ @@ -602,7 +667,7 @@ do-patch:  .if !target(do-configure)  do-configure:  	@if [ -f ${SCRIPTDIR}/configure ]; then \ -		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ +		${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \  		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \  		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \  		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ @@ -624,9 +689,9 @@ do-configure:  .if !target(do-build)  do-build:  .if defined(USE_GMAKE) -	@(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} X11BASE=${X11BASE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) +	@(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})  .else defined(USE_GMAKE) -	@(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} X11BASE=${X11BASE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET}) +	@(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})  .endif  .endif @@ -635,14 +700,14 @@ do-build:  .if !target(do-install)  do-install:  .if defined(USE_GMAKE) -	@(cd ${WRKSRC}; ${GMAKE} PREFIX=${PREFIX} X11BASE=${X11BASE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) +	@(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})  .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) -	@(cd ${WRKSRC}; ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) +	@(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)  .endif  .else defined(USE_GMAKE) -	@(cd ${WRKSRC}; ${MAKE} PREFIX=${PREFIX} X11BASE=${X11BASE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET}) +	@(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})  .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES) -	@(cd ${WRKSRC}; ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man) +	@(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)  .endif  .endif  .endif @@ -655,7 +720,7 @@ do-package:  		${ECHO_MSG} "===>  Building package for ${PKGNAME}"; \  		if [ -d ${PACKAGES} ]; then \  			if [ ! -d ${PKGREPOSITORY} ]; then \ -				if ! /bin/mkdir -p ${PKGREPOSITORY}; then \ +				if ! ${MKDIR} -p ${PKGREPOSITORY}; then \  					${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \  					exit 1; \  				fi; \ @@ -679,7 +744,7 @@ package-links:  	@${MAKE} ${.MAKEFLAGS} delete-package-links  	@for cat in ${CATEGORIES}; do \  		if [ ! -d ${PACKAGES}/$$cat ]; then \ -			if ! /bin/mkdir -p ${PACKAGES}/$$cat; then \ +			if ! ${MKDIR} -p ${PACKAGES}/$$cat; then \  				${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \  				exit 1; \  			fi; \ @@ -690,13 +755,13 @@ package-links:  .if !target(delete-package-links)  delete-package-links: -	@/bin/rm -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX}; +	@${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX};  .endif  .if !target(delete-package)  delete-package:  	@${MAKE} ${.MAKEFLAGS} delete-package-links -	@/bin/rm -f ${PKGFILE} +	@${RM} -f ${PKGFILE}  .endif  ################################################################ @@ -726,7 +791,7 @@ _PORT_USE: .USE  .endif  	@${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/}  	@if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \ -		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ +		${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \  		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \  		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \  		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ @@ -735,7 +800,7 @@ _PORT_USE: .USE  	@${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/}  	@${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/}  	@if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \ -		/usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ +		${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \  		  WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \  		  FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \  		  DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ @@ -850,8 +915,8 @@ checkpatch:  reinstall: pre-reinstall install  pre-reinstall: -	@/bin/rm -f ${INSTALL_COOKIE} -	@/bin/rm -f ${PACKAGE_COOKIE} +	@${RM} -f ${INSTALL_COOKIE} +	@${RM} -f ${PACKAGE_COOKIE}  .endif  ################################################################ @@ -868,12 +933,12 @@ pre-clean:  .if !target(clean)  clean: pre-clean  	@${ECHO_MSG} "===>  Cleaning for ${PKGNAME}" -	@/bin/rm -f ${EXTRACT_COOKIE} ${CONFIGURE_COOKIE} ${INSTALL_COOKIE} \ +	@${RM} -f ${EXTRACT_COOKIE} ${CONFIGURE_COOKIE} ${INSTALL_COOKIE} \  		${BUILD_COOKIE} ${PATCH_COOKIE}  .if defined(NO_WRKDIR) -	@/bin/rm -f ${WRKDIR}/.*_done +	@${RM} -f ${WRKDIR}/.*_done  .else -	@/bin/rm -rf ${WRKDIR} +	@${RM} -rf ${WRKDIR}  .endif  .endif @@ -881,26 +946,26 @@ clean: pre-clean  .if !target(fetch-list)  fetch-list: -	@if [ ! -d ${DISTDIR} ]; then /bin/mkdir -p ${DISTDIR}; fi +	@if [ ! -d ${DISTDIR} ]; then ${MKDIR} -p ${DISTDIR}; fi  	@(cd ${DISTDIR}; \  	 for file in ${DISTFILES}; do \ -		if [ ! -f $$file -a ! -f `/usr/bin/basename $$file` ]; then \ +		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \  			for site in ${MASTER_SITES}; do \ -				/bin/echo -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} '||' ; \ +				${ECHO} -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} "${NCFTPTAIL}" '||' ; \  					break; \  			done; \ -			/bin/echo "echo $${file} not fetched" ; \ +			${ECHO} "echo $${file} not fetched" ; \  		fi \  	done)  .if defined(PATCHFILES)  	@(cd ${DISTDIR}; \  	 for file in ${PATCHFILES}; do \ -		if [ ! -f $$file -a ! -f `/usr/bin/basename $$file` ]; then \ +		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \  			for site in ${PATCH_SITES}; do \ -				/bin/echo -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} ${PATCH_PRFX}$${file} '||' ; \ +				${ECHO} -n ${NCFTP} ${NCFTPFLAGS} $${site}$${file} "${NCFTPTAIL}" '||' ; \  					break; \  			done; \ -			/bin/echo "echo $${file} not fetched" ; \ +			${ECHO} "echo $${file} not fetched" ; \  		fi \  	 done)  .endif @@ -910,10 +975,10 @@ fetch-list:  .if !target(makesum)  makesum: fetch -	@if [ ! -d ${FILESDIR} ]; then /bin/mkdir -p ${FILESDIR}; fi -	@if [ -f ${MD5_FILE} ]; then /bin/rm -f ${MD5_FILE}; fi +	@if [ ! -d ${FILESDIR} ]; then ${MKDIR} -p ${FILESDIR}; fi +	@if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi  	@(cd ${DISTDIR}; \ -	 for file in ${DISTFILES} ${PATCHFILES:S|^|${PATCH_PRFX}|}; do \ +	 for file in ${DISTFILES} ${PATCHFILES}; do \  		${MD5} $$file >> ${MD5_FILE}; \  	 done)  .endif @@ -924,9 +989,9 @@ checksum: fetch  		${ECHO_MSG} ">> No MD5 checksum file."; \  	else \  		(cd ${DISTDIR}; OK=""; \ -		  for file in ${DISTFILES} ${PATCHFILES:S|^|${PATCH_PRFX}|}; do \ -			CKSUM=`${MD5} $$file | awk '{print $$4}'`; \ -			CKSUM2=`grep "($$file)" ${MD5_FILE} | awk '{print $$4}'`; \ +		  for file in ${DISTFILES} ${PATCHFILES}; do \ +			CKSUM=`${MD5} $$file | ${AWK} '{print $$4}'`; \ +			CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \  			if [ "$$CKSUM2" = "" ]; then \  				${ECHO_MSG} ">> No checksum recorded for $$file"; \  				OK="false"; \ @@ -952,9 +1017,7 @@ checksum: fetch  .if !target(package-name)  package-name: -.if !defined(NO_PACKAGE) -	@/bin/echo ${PKGNAME} -.endif +	@${ECHO} ${PKGNAME}  .endif  # Show (recursively) all the packages this package depends on. @@ -962,7 +1025,7 @@ package-name:  .if !target(package-depends)  package-depends:  	@for i in ${RUN_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \ -		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \ +		dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \  		(cd $$dir ; ${MAKE} package-name package-depends); \  	done  .endif @@ -973,7 +1036,7 @@ package-depends:  repackage: pre-repackage package  pre-repackage: -	@/bin/rm -f ${PACKAGE_COOKIE} +	@${RM} -f ${PACKAGE_COOKIE}  .endif  # Build a package but don't check the cookie for installation, also don't @@ -1011,18 +1074,36 @@ _DEPENDS_USE:	.USE  .if defined(NO_DEPENDS)  # Just print out messages  	@for i in ${DEPENDS_TMP}; do \ -		prog=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \ -		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \ -		${ECHO_MSG} "===>  ${PKGNAME} depends on executable:  $$prog ($$dir)"; \ +		prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ +		dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ +		if expr "$$prog" : \\/ >/dev/null; then \ +			${ECHO_MSG} "===>  ${PKGNAME} depends on file:  $$prog ($$dir)"; \ +		else \ +			${ECHO_MSG} "===>  ${PKGNAME} depends on executable:  $$prog ($$dir)"; \ +		fi; \  	done  .else  	@for i in ${DEPENDS_TMP}; do \ -		prog=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \ -		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \ -		if which -s "$$prog"; then \ -			${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \ +		prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ +		dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ +		if expr "$$prog" : \\/ >/dev/null; then \ +			if [ -e "$$prog" ]; then \ +				${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - found"; \ +				notfound=0; \ +			else \ +				${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - not found"; \ +				notfound=1; \ +			fi; \  		else \ -			${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - not found"; \ +			if which -s "$$prog"; then \ +				${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \ +				notfound=0; \ +			else \ +				${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - not found"; \ +				notfound=1; \ +			fi; \ +		fi; \ +		if [ $$notfound != 0 ]; then \  			${ECHO_MSG} "===>  Verifying build for $$prog in $$dir"; \  			if [ ! -d "$$dir" ]; then \  				${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \ @@ -1046,15 +1127,15 @@ lib-depends:  .if defined(NO_DEPENDS)  # Just print out messages  	@for i in ${LIB_DEPENDS}; do \ -		lib=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \ -		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \ +		lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ +		dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \  		${ECHO_MSG} "===>  ${PKGNAME} depends on shared library:  $$lib ($$dir)"; \  	done  .else  	@for i in ${LIB_DEPENDS}; do \ -		lib=`/bin/echo $$i | /usr/bin/sed -e 's/:.*//'`; \ -		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \ -		if /sbin/ldconfig -r | grep -q -e "-l$$lib"; then \ +		lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \ +		dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \ +		if /sbin/ldconfig -r | ${GREP} -q -e "-l$$lib"; then \  			${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - found"; \  		else \  			${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - not found"; \ @@ -1092,6 +1173,14 @@ misc-depends:  .endif +.if !target(depends-list) +depends-list: +	@for i in ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \ +		dir=`/bin/echo $$i | /usr/bin/sed -e 's/.*://'`; \ +		(cd $$dir ; ${MAKE} package-name depends-list); \ +	done +.endif +  ################################################################  # Everything after here are internal targets and really  # shouldn't be touched by anybody but the release engineers. @@ -1101,24 +1190,67 @@ misc-depends:  # a large index.  Format is:  #  # distribution-name|port-path|installation-prefix|comment| \ -#  description-file|maintainer|categories|keywords +#  description-file|maintainer|categories|build deps|run deps  #  .if !target(describe)  describe: -	@/bin/echo -n "${PKGNAME}|${.CURDIR}/${PKGNAME}|" -	@/bin/echo -n "${PREFIX}|" +	@${ECHO} -n "${PKGNAME}|${.CURDIR}/${PKGNAME}|" +	@${ECHO} -n "${PREFIX}|"  	@if [ -f ${PKGDIR}/COMMENT ]; then \ -		/bin/echo -n "`/bin/cat ${PKGDIR}/COMMENT`"; \ +		${ECHO} -n "`${CAT} ${PKGDIR}/COMMENT`"; \  	else \ -		/bin/echo -n "** No Description"; \ +		${ECHO} -n "** No Description"; \  	fi  	@if [ -f ${PKGDIR}/DESCR ]; then \ -		/bin/echo -n "|${PKGDIR}/DESCR"; \ +		${ECHO} -n "|${PKGDIR}/DESCR"; \  	else \ -		/bin/echo -n "|/dev/null"; \ +		${ECHO} -n "|/dev/null"; \  	fi -	@/bin/echo -n "|${MAINTAINER}|${CATEGORIES}|${KEYWORDS}" -	@/bin/echo "" +	@${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|" +	@${ECHO} -n `make depends-list|sort|uniq` +	@${ECHO} -n "|" +	@${ECHO} -n `make package-depends|sort|uniq` +	@${ECHO} "" +.endif + +.if !target(readmes) +readmes:	readme +.endif + +.if !target(readme) +readme: +	@rm -f README.html +	@make README.html +.endif + +README.html: +	@${ECHO_MSG} "===>  Creating README.html for ${PKGNAME}" +	@${CAT} ${TEMPLATES}/README.port | \ +		${SED} -e 's%%PORT%%'`${ECHO} ${.CURDIR} | ${SED} -e 's.*/\([^/]*/[^/]*\)$$\1'`'g' \ +			-e 's%%PKG%%${PKGNAME}g' \ +			-e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \ +			-e '/%%COMMENT%%/d' \ +			-e 's%%BUILD_DEPENDS%%'"`${MAKE} print-depends-list`"'' \ +			-e 's%%RUN_DEPENDS%%'"`${MAKE} print-package-depends`"'' \ +		>> $@ + +.if !target(print-depends-list) +print-depends-list: +.if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \ +	defined(LIB_DEPENDS) || defined(DEPENDS) +	@${ECHO} -n 'This port requires package(s) "' +	@${ECHO} -n `make depends-list | sort | uniq` +	@${ECHO} '" to build.' +.endif +.endif + +.if !target(print-package-depends) +print-package-depends: +.if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS) +	@${ECHO} -n 'This port requires package(s) "' +	@${ECHO} -n `make package-depends | sort | uniq` +	@${ECHO} '" to run.' +.endif  .endif  # Fake installation of package so that user can pkg_delete it later. @@ -1127,30 +1259,30 @@ describe:  .if !target(fake-pkg)  fake-pkg: -	@if [ ! -f ${PKGDIR}/PLIST -o ! -f ${PKGDIR}/COMMENT -o ! -f ${PKGDIR}/DESCR ]; then /bin/echo "** Missing package files for ${PKGNAME} - installation not recorded."; exit 1; fi -	@if [ ! -d ${PKG_DBDIR} ]; then /bin/rm -f ${PKG_DBDIR}; /bin/mkdir -p ${PKG_DBDIR}; fi +	@if [ ! -f ${PKGDIR}/PLIST -o ! -f ${PKGDIR}/COMMENT -o ! -f ${PKGDIR}/DESCR ]; then ${ECHO} "** Missing package files for ${PKGNAME} - installation not recorded."; exit 1; fi +	@if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} -p ${PKG_DBDIR}; fi  .if defined(FORCE_PKG_REGISTER) -	@/bin/rm -rf ${PKG_DBDIR}/${PKGNAME} +	@${RM} -rf ${PKG_DBDIR}/${PKGNAME}  .endif  	@if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \  		${ECHO_MSG} "===>  Registering installation for ${PKGNAME}"; \ -		/bin/mkdir -p ${PKG_DBDIR}/${PKGNAME}; \ +		${MKDIR} -p ${PKG_DBDIR}/${PKGNAME}; \  		${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \ -		/bin/cp ${PKGDIR}/DESCR ${PKG_DBDIR}/${PKGNAME}/+DESC; \ -		/bin/cp ${PKGDIR}/COMMENT ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \ +		${CP} ${PKGDIR}/DESCR ${PKG_DBDIR}/${PKGNAME}/+DESC; \ +		${CP} ${PKGDIR}/COMMENT ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \  		if [ -f ${PKGDIR}/INSTALL ]; then \ -			/bin/cp ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \ +			${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \  		fi; \  		if [ -f ${PKGDIR}/DEINSTALL ]; then \ -			/bin/cp ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \ +			${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \  		fi; \  		if [ -f ${PKGDIR}/REQ ]; then \ -			/bin/cp ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \ +			${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \  		fi; \  	else \  		${ECHO_MSG} "===> ${PKGNAME} is already installed - perhaps an older version?"; \  		${ECHO_MSG} "     If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \ -		${ECHO_MSG} "     this port again to upgrade it properly."; \ +		${ECHO_MSG} "     this port again by \`\`make reinstall'' to upgrade it properly."; \  	fi  .endif diff --git a/share/mk/bsd.port.subdir.mk b/share/mk/bsd.port.subdir.mk index b571142dcee3..ab920b063f56 100644 --- a/share/mk/bsd.port.subdir.mk +++ b/share/mk/bsd.port.subdir.mk @@ -1,5 +1,5 @@  #	from: @(#)bsd.subdir.mk	5.9 (Berkeley) 2/1/91 -#	$Id: bsd.port.subdir.mk,v 1.10 1995/03/03 23:30:32 gpalmer Exp $ +#	$Id: bsd.port.subdir.mk,v 1.11 1995/03/21 03:59:13 jkh Exp $  .MAIN: all @@ -7,9 +7,6 @@  STRIP?=	-s  .endif -BINGRP?=	bin -BINOWN?=	bin -BINMODE?=	555  ECHO_MSG?=	echo @@ -45,49 +42,12 @@ ${SUBDIR}::  	fi; \  	${MAKE} all -.if !target(all) -all: _SUBDIRUSE -.endif - -.if !target(fetch) -fetch: _SUBDIRUSE -.endif - -.if !target(fetch-list) -fetch-list: _SUBDIRUSE -.endif - -.if !target(package) -package: _SUBDIRUSE -.endif - -.if !target(extract) -extract: _SUBDIRUSE -.endif - -.if !target(configure) -configure: _SUBDIRUSE -.endif - -.if !target(build) -build: _SUBDIRUSE -.endif - -.if !target(clean) -clean: _SUBDIRUSE -.endif - -.if !target(depend) -depend: _SUBDIRUSE -.endif - -.if !target(describe) -describe: _SUBDIRUSE -.endif - -.if !target(reinstall) -reinstall: _SUBDIRUSE +.for __target in all fetch fetch-list package extract configure \ +		 build clean depend describe reinstall tags checksum +.if !target(__target) +${__target}: _SUBDIRUSE  .endif +.endfor  .if !target(install)  .if !target(beforeinstall) @@ -101,10 +61,45 @@ afterinstall: realinstall  realinstall: beforeinstall _SUBDIRUSE  .endif -.if !target(tags) -tags: _SUBDIRUSE -.endif - -.if !target(checksum) -checksum: _SUBDIRUSE -.endif +.if !target(readmes) +readmes: readme _SUBDIRUSE +.endif + +.if !target(readme) +readme: +	@rm -f README.html +	@make README.html +.endif + +PORTSDIR ?= /usr/ports +TEMPLATES ?= ${PORTSDIR}/templates +.if defined(PORTSTOP) +README=	${TEMPLATES}/README.top +.else +README=	${TEMPLATES}/README.category +.endif + +README.html: +	@echo "===>  Creating README.html" +	@> $@.tmp +.for entry in ${SUBDIR} +.if defined(PORTSTOP) +	@echo -n '<a href="'${entry}/README.html'">${entry}</a>: ' >> $@.tmp +.else +	@echo -n '<a href="'${entry}/README.html'">'"`cd ${entry}; make package-name`</a>: " >> $@.tmp +.endif +.if exists(${entry}/pkg/COMMENT) +	@cat ${entry}/pkg/COMMENT >> $@.tmp +.else +	@echo "(no description)" >> $@.tmp +.endif +.endfor +	@sort -t '>' +1 -2 $@.tmp > $@.tmp2 +	@cat ${README} | \ +		sed -e 's%%CATEGORY%%'`echo ${.CURDIR} | sed -e 's.*/\([^/]*\)$$\1'`'g' \ +			-e '/%%DESCR%%/r${.CURDIR}/pkg/DESCR' \ +			-e '/%%DESCR%%/d' \ +			-e '/%%SUBDIR%%/r$@.tmp2' \ +			-e '/%%SUBDIR%%/d' \ +		> $@ +	@rm -f $@.tmp $@.tmp2 diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 74172c24f4a6..c85bd1a662e1 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -1,5 +1,5 @@  #	from: @(#)bsd.prog.mk	5.26 (Berkeley) 6/25/91 -#	$Id: bsd.prog.mk,v 1.25 1995/04/26 14:34:19 jkh Exp $ +#	$Id: bsd.prog.mk,v 1.26 1995/05/07 06:39:30 bde Exp $  .if exists(${.CURDIR}/../Makefile.inc)  .include "${.CURDIR}/../Makefile.inc" @@ -17,30 +17,39 @@ CXXINCLUDES+= -I${DESTDIR}/usr/include/${CXX}  STRIP?=	-s  .endif -BINGRP?=	bin -BINOWN?=	bin -BINMODE?=	555  LIBCRT0?=	${DESTDIR}/usr/lib/crt0.o +LIBKZHEAD?=	${DESTDIR}/usr/lib/kzhead.o +LIBKZTAIL?=	${DESTDIR}/usr/lib/kztail.o +  LIBC?=		${DESTDIR}/usr/lib/libc.a +LIBC_PIC=	${DESTDIR}/usr/lib/libc_pic.a +LIBCOM_ERR=	${DESTDIR}/usr/lib/libcom_err.a  LIBCOMPAT?=	${DESTDIR}/usr/lib/libcompat.a  LIBCRYPT?=	${DESTDIR}/usr/lib/libcrypt.a  LIBCURSES?=	${DESTDIR}/usr/lib/libcurses.a  LIBDES?=	${DESTDIR}/usr/lib/libdes.a	# XXX doesn't exist  LIBDIALOG?=	${DESTDIR}/usr/lib/libdialog.a +LIBDISK?=	${DESTDIR}/usr/lib/libdisk.a  LIBEDIT?=	${DESTDIR}/usr/lib/libedit.a +LIBF2C?=	${DESTDIR}/usr/lib/libf2c.a +LIBFL?=		"don't use LIBFL, use LIBL"  LIBFORMS?=	${DESTDIR}/usr/lib/libforms.a -LIBFTP?=	${DESTDIR}/usr/lib/libftp.a +LIBGPLUSPLUS?=	${DESTDIR}/usr/lib/libg++.a  LIBGCC?=	${DESTDIR}/usr/lib/libgcc.a -LIBGNUMALLOC?=	${DESTDIR}/usr/lib/libgnumalloc.a +LIBGCC_PIC?=	${DESTDIR}/usr/lib/libgcc_pic.a +LIBGMP?=	${DESTDIR}/usr/lib/libgmp.a  LIBGNUREGEX?=	${DESTDIR}/usr/lib/libgnuregex.a +LIBIPX?=	${DESTDIR}/usr/lib/libipx.a  LIBKDB?=	${DESTDIR}/usr/lib/libkdb.a	# XXX doesn't exist  LIBKRB?=	${DESTDIR}/usr/lib/libkrb.a	# XXX doesn't exist +LIBKEYCAP?=	${DESTDIR}/usr/lib/libkeycap.a  LIBKVM?=	${DESTDIR}/usr/lib/libkvm.a  LIBL?=		${DESTDIR}/usr/lib/libl.a +LIBLN?=		"don't use, LIBLN, use LIBL"  LIBM?=		${DESTDIR}/usr/lib/libm.a  LIBMD?=		${DESTDIR}/usr/lib/libmd.a -LIBMP?=		${DESTDIR}/usr/lib/libmp.a	# XXX doesn't exist +LIBMP?=		${DESTDIR}/usr/lib/libmp.a  LIBMYTINFO?=	${DESTDIR}/usr/lib/libmytinfo.a  LIBNCURSES?=	${DESTDIR}/usr/lib/libncurses.a  LIBPC?=		${DESTDIR}/usr/lib/libpc.a	# XXX doesn't exist @@ -49,12 +58,15 @@ LIBPLOT?=	${DESTDIR}/usr/lib/libplot.a	# XXX doesn't exist  LIBREADLINE?=	${DESTDIR}/usr/lib/libreadline.a  LIBRESOLV?=	${DESTDIR}/usr/lib/libresolv.a  LIBRPCSVC?=	${DESTDIR}/usr/lib/librpcsvc.a -LIBSCRYPT?=	${DESTDIR}/usr/lib/libscrypt.a	# XXX don't use, use LIBCRYPT +LIBSCRYPT?=	"don't use LIBSCRYPT, use LIBCRYPT"  LIBSCSI?=	${DESTDIR}/usr/lib/libscsi.a  LIBSKEY?=	${DESTDIR}/usr/lib/libskey.a +LIBSS?=		${DESTDIR}/usr/lib/libss.a  LIBTELNET?=	${DESTDIR}/usr/lib/libtelnet.a  LIBTERMCAP?=	${DESTDIR}/usr/lib/libtermcap.a +LIBTERMLIB?=	"don't use LIBTERMLIB, use LIBTERMCAP"  LIBUTIL?=	${DESTDIR}/usr/lib/libutil.a +LIBXPG4?=	${DESTDIR}/usr/lib/libxpg4.a  LIBY?=		${DESTDIR}/usr/lib/liby.a  .if defined(NOSHARED) @@ -134,16 +146,16 @@ _PROGSUBDIR: .USE  # here (or does maninstall always work when nothing is made?),  .MAIN: all -all: ${PROG} ${MANDEPEND} _PROGSUBDIR +all: ${PROG} all-man _PROGSUBDIR  .if !target(clean)  clean: _PROGSUBDIR -	rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES}  +	rm -f a.out Errs errs mklog ${PROG} ${OBJS} ${CLEANFILES}   .endif  .if !target(cleandir)  cleandir: _PROGSUBDIR -	rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES} +	rm -f a.out Errs errs mklog ${PROG} ${OBJS} ${CLEANFILES}  	rm -f ${.CURDIR}/tags .depend  	cd ${.CURDIR}; rm -rf obj;  .endif @@ -228,6 +240,7 @@ tags: ${SRCS} _PROGSUBDIR  .include <bsd.man.mk>  .elif !target(maninstall)  maninstall: +all-man:  .endif  _DEPSUBDIR=	_PROGSUBDIR diff --git a/share/mk/bsd.sgml.mk b/share/mk/bsd.sgml.mk index bc9a1d8828ad..0c12fd3b0f10 100644 --- a/share/mk/bsd.sgml.mk +++ b/share/mk/bsd.sgml.mk @@ -1,7 +1,7 @@  #       bsd.sgml.mk - 8 Sep 1995 John Fieber  #       This file is in the public domain.  # -#	$Id: bsd.sgml.mk,v 1.3 1995/09/10 21:49:24 jfieber Exp $ +#	$Id: bsd.sgml.mk,v 1.3.2.1 1995/10/15 08:33:48 jkh Exp $  .if exists(${.CURDIR}/../Makefile.inc)  .include "${.CURDIR}/../Makefile.inc" @@ -19,7 +19,7 @@ VOLUME?=	${.CURDIR:T}  DOC?=		${.CURDIR:T}  BINDIR?=	/usr/share/doc  SRCDIR?=	${.CURDIR} -DISTRIBUTION?=	bin +DISTRIBUTION?=	doc  SGMLFMT?=	sgmlfmt  LPR?=		lpr @@ -50,7 +50,7 @@ obj:  .endif  clean: ${FORMATS:S/^/clean-/g} -	rm -f [eE]rrs mklog +	rm -f Errs errs mklog  cleandir: clean  	cd ${.CURDIR}; rm -rf obj diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index ec2a5fa214e8..c7d7cf964124 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -1,16 +1,8 @@  #	from: @(#)bsd.subdir.mk	5.9 (Berkeley) 2/1/91 -#	$Id: bsd.subdir.mk,v 1.7 1995/01/23 20:50:56 jkh Exp $ +#	$Id: bsd.subdir.mk,v 1.8 1995/02/25 20:51:14 phk Exp $  .MAIN: all -.if !defined(DEBUG_FLAGS) -STRIP?=	-s -.endif - -BINGRP?=	bin -BINOWN?=	bin -BINMODE?=	555 -  _SUBDIRUSE: .USE  	@for entry in ${SUBDIR}; do \  		(if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ @@ -33,34 +25,12 @@ ${SUBDIR}::  	fi; \  	${MAKE} all -.if !target(all) -all: _SUBDIRUSE -.endif - -.if !target(clean) -clean: _SUBDIRUSE -.endif - -.if !target(cleandir) -cleandir: _SUBDIRUSE -.endif - -.if !target(depend) -depend: _SUBDIRUSE -.endif -.if !target (maninstall) -maninstall: _SUBDIRUSE -.endif - -DISTRIBUTION?=	bin -.if !target(afterdistribute) -afterdistribute: -.endif -.if !target(distribute) -distribute: _SUBDIRUSE  -	cd ${.CURDIR} ; ${MAKE} afterdistribute DESTDIR=${DISTDIR}/${DISTRIBUTION} +.for __target in all clean cleandir obj depend maninstall lint tags  +.if !target(__target) +${__target}: _SUBDIRUSE  .endif +.endfor  .if !target(install)  .if !target(beforeinstall) @@ -74,14 +44,11 @@ afterinstall: realinstall  realinstall: beforeinstall _SUBDIRUSE  .endif -.if !target(lint) -lint: _SUBDIRUSE -.endif - -.if !target(obj) -obj: _SUBDIRUSE +DISTRIBUTION?=	bin +.if !target(afterdistribute) +afterdistribute:  .endif - -.if !target(tags) -tags: _SUBDIRUSE +.if !target(distribute) +distribute: _SUBDIRUSE  +	cd ${.CURDIR} ; ${MAKE} afterdistribute DESTDIR=${DISTDIR}/${DISTRIBUTION}  .endif diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 4143c90c5969..371aa1a9c7c2 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -1,9 +1,9 @@  #	from: @(#)sys.mk	8.2 (Berkeley) 3/21/94 -#	$Id: sys.mk,v 1.9 1994/12/28 03:51:03 ache Exp $ +#	$Id: sys.mk,v 1.9.4.1 1995/08/18 23:50:42 davidg Exp $  unix		?=	We run FreeBSD, not UNIX. -.SUFFIXES:	.out .a .ln .o .c .cc .cxx .C .F .f .e .r .y .l .S .s .cl .p .h  +.SUFFIXES:	.out .a .ln .o .c .cc .cxx .C .F .f .e .r .y .l .S .s .cl .p .h .sh  .LIBS:		.a @@ -17,12 +17,7 @@ AS		?=	as  AFLAGS		?=  CC		?=	cc - -.if ${MACHINE} == "sparc" -CFLAGS		?=	-O4 -.else  CFLAGS		?=	-O -.endif  CXX		?=	c++  CXXFLAGS	?=	${CXXINCLUDES} ${CFLAGS} @@ -69,10 +64,12 @@ SHELL		?=	sh  YACC		?=	yacc  YFLAGS		?=	-d -# This rule currently causes both make from 1.x and 2.x to have problems, -# and is not being used so disable it for now. -#.c: -#	${CC} ${CFLAGS} ${.IMPSRC} -o ${.TARGET} +.c: +	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} + +.sh: +	cp -p ${.IMPSRC} ${.TARGET} +	chmod a+x ${.TARGET}  .c.o:  	${CC} ${CFLAGS} -c ${.IMPSRC} @@ -92,40 +89,46 @@ YFLAGS		?=	-d  .s.o:  	${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} +# XXX not -j safe  .y.o:  	${YACC} ${YFLAGS} ${.IMPSRC}  	${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}  	rm -f y.tab.c +# XXX not -j safe  .l.o:  	${LEX} ${LFLAGS} ${.IMPSRC}  	${CC} ${CFLAGS} -c lex.yy.c -o ${.TARGET}  	rm -f lex.yy.c +# XXX not -j safe  .y.c:  	${YACC} ${YFLAGS} ${.IMPSRC}  	mv y.tab.c ${.TARGET} +# XXX not -j safe  .l.c:  	${LEX} ${LFLAGS} ${.IMPSRC}  	mv lex.yy.c ${.TARGET}  .s.out .c.out .o.out: -	${CC} ${CFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} +	${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}  .f.out .F.out .r.out .e.out: -	${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${.IMPSRC} \ +	${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \  	    ${LDLIBS} -o ${.TARGET}  	rm -f ${.PREFIX}.o +# XXX not -j safe  .y.out:  	${YACC} ${YFLAGS} ${.IMPSRC} -	${CC} ${CFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} +	${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}  	rm -f y.tab.c +# XXX not -j safe  .l.out:  	${LEX} ${LFLAGS} ${.IMPSRC} -	${CC} ${CFLAGS} lex.yy.c ${LDLIBS} -ll -o ${.TARGET} +	${CC} ${CFLAGS} ${LDFLAGS} lex.yy.c ${LDLIBS} -ll -o ${.TARGET}  	rm -f lex.yy.c  .include <bsd.own.mk>  | 
