CVS commit: src/games/larn

2024-03-26 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Mar 26 20:50:29 UTC 2024

Modified Files:
src/games/larn: io.c

Log Message:
Fix header comment to align text using 8 space tabs.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/games/larn/io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/larn/io.c
diff -u src/games/larn/io.c:1.30 src/games/larn/io.c:1.31
--- src/games/larn/io.c:1.30	Sat Mar 23 21:10:45 2024
+++ src/games/larn/io.c	Tue Mar 26 20:50:29 2024
@@ -1,66 +1,66 @@
-/*	$NetBSD: io.c,v 1.30 2024/03/23 21:10:45 andvar Exp $	*/
+/*	$NetBSD: io.c,v 1.31 2024/03/26 20:50:29 andvar Exp $	*/
 
 /*
- * io.c			 Larn is copyrighted 1986 by Noah Morgan.
+ * io.c			Larn is copyrighted 1986 by Noah Morgan.
  *
  * Below are the functions in this file:
  *
  * setupvt100()		Subroutine to set up terminal in correct mode for game
  * clearvt100()		Subroutine to clean up terminal when the game is over
  * ttgetch()		Routine to read in one character from the terminal
- * scbr()			Function to set cbreak -echo for the terminal
- * sncbr()			Function to set -cbreak echo for the terminal
+ * scbr()		Function to set cbreak -echo for the terminal
+ * sncbr()		Function to set -cbreak echo for the terminal
  * newgame()		Subroutine to save the initial time and seed rnd()
  *
  * FILE OUTPUT ROUTINES
  *
- * lprintf(format,args . . .)	printf to the output buffer 
- * lprint(integer)send binary integer to output buffer
- * lwrite(buf,len)write a buffer to the output buffer
- * lprcat(str)	append a string to the output buffer
+ * lprintf(format,args . . .)	printf to the output buffer
+ * lprint(integer)		send binary integer to output buffer
+ * lwrite(buf,len)		write a buffer to the output buffer
+ * lprcat(str)			append a string to the output buffer
  *
  * FILE OUTPUT MACROS (in header.h)
  *
- * lprc(character)put the character into the output buffer
+ * lprc(character)		put the character into the output buffer
  *
  * FILE INPUT ROUTINES
  *
- * long lgetc()	read one character from input buffer
- * long larn_lrint()			read one integer from input buffer
- * lrfill(address,number)		put input bytes into a buffer char
- * *lgetw()		get a whitespace ended word from
- * input char *lgetl()			get a \n or EOF ended line from input
+ * long lgetc()			read one character from input buffer
+ * long larn_lrint()		read one integer from input buffer
+ * lrfill(address,number)	put input bytes into a buffer char
+ * *lgetw()			get a whitespace ended word from
+ * input char *lgetl()		get a \n or EOF ended line from input
  *
  * FILE OPEN / CLOSE ROUTINES
  *
- * lcreat(filename)create a new file for write
- * lopen(filename)open a file for read
- * lappend(filename)			open for append to an existing file
- * lrclose()	close the input file
- * lwclose()	close output file 
- * lflush()		flush the output buffer
+ * lcreat(filename)		create a new file for write
+ * lopen(filename)		open a file for read
+ * lappend(filename)		open for append to an existing file
+ * lrclose()			close the input file
+ * lwclose()			close output file
+ * lflush()			flush the output buffer
  *
  * Other Routines
  *
- * cursor(x,y)	position cursor at [x,y]
- * cursors()	position cursor at [1,24] (saves memory)
- * cl_line(x,y)	clear line at [1,y] and leave cursor at [x,y]
- * cl_up(x,y)	clear screen from [x,1] to current line
- * cl_dn(x,y)	clear screen from [1,y] to end of display
- * standout(str)print the string in standout mode
- * set_score_output()			called when output should be literally printed
- * ttputch(ch)	print one character in decoded output buffer
- * flush_buf()	flush buffer with decoded output
- * init_term()	terminal initialization -- setup termcap info
- * char *tmcapcnv(sd,ss)		routine to convert VT100 \33's to termcap format
- * beep()		routine to emit a beep if enabled
- * (see no-beep in .larnopts)
+ * cursor(x,y)			position cursor at [x,y]
+ * cursors()			position cursor at [1,24] (saves memory)
+ * cl_line(x,y)			clear line at [1,y] and leave cursor at [x,y]
+ * cl_up(x,y)			clear screen from [x,1] to current line
+ * cl_dn(x,y)			clear screen from [1,y] to end of display
+ * standout(str)		print the string in standout mode
+ * set_score_output()		called when output should be literally printed
+ * ttputch(ch)			print one character in decoded output buffer
+ * flush_buf()			flush buffer with decoded output
+ * init_term()			terminal initialization -- setup termcap info
+ * char *tmcapcnv(sd,ss)	routine to convert VT100 \33's to termcap format
+ * beep()			routine to emit a beep if enabled
+ * (see no-beep in .larnopts)
  *
  * Note: ** entries are available only in termcap mode.
  */
 #include 
 #ifndef lint
-__RCSID("$NetBSD: io.c,v 1.30 2024/03/23 21:10:45 andvar Exp $");
+__RCSID("$NetBSD: io.c,v 1.31 2024/03/26

CVS commit: src/games/larn

2024-03-26 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Mar 26 20:50:29 UTC 2024

Modified Files:
src/games/larn: io.c

Log Message:
Fix header comment to align text using 8 space tabs.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/games/larn/io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/games/larn

2024-03-24 Thread Valery Ushakov
On Sun, Mar 24, 2024 at 21:21:39 +0200, Andrius V wrote:

> Can you a bit clarify the meaning of "8 space tabs"

This is what VT set up screen called "Set 8 Column Tabs", i.e. "set
one tab every eight columns, starting at column 9" which was the
default setting.

https://vt100.net/docs/tp83/chapter4.html#T4-11
https://vt100.net/docs/vt420-uu/chapter5.html#S5.11

Emacs calls this tab-width.  vi, I believe calls it tabstop.  Both
default to 8.

I know this is a subject that people are often religious about, but I
think it's reasonable to require that when a file is cat(1) to the
terminal (say, vt220) or an emulator (say, xterm) in it's default
state, it displays as intended.


> since file is not exactly following any completely defined pattern.

I haven't looked at the rest of the file too closely, but the indented
multi-line comments I referred to are definitely meant to be viewed
with 8 space tabs and in general the 8 space tabs are the default (see
above).  If some parts of that file deviate from that they should be
fixed, but I was referring specifically to your change that looks like
this with the default 8 column tabs (untabified to ensure that it's
displayed the same regardless of the viewer's tab settings):

 * setupvt100() Subroutine to set up terminal in correct mode for game
 * clearvt100() Subroutine to clean up terminal when the game is over
 * ttgetch()Routine to read in one character from the terminal
 * scbr()   Function to set cbreak -echo for the terminal
 * sncbr()  Function to set -cbreak echo for the terminal
 * newgame()Subroutine to save the initial time and seed rnd()


That text looks aligned with 4 column tabs (again, the text below is
untabified):

 * setupvt100() Subroutine to set up terminal in correct mode for game
 * clearvt100() Subroutine to clean up terminal when the game is over
 * ttgetch()Routine to read in one character from the terminal
 * scbr()   Function to set cbreak -echo for the terminal
 * sncbr()  Function to set -cbreak echo for the terminal
 * newgame()Subroutine to save the initial time and seed rnd()

If you would like to go and fix the rest of the file, that would be
nice, but my request was to at least not introduce more non-standart
tabs.

Thanks!

-uwe


Re: CVS commit: src/games/larn

2024-03-24 Thread Andrius V
Hi,

Can you a bit clarify the meaning of "8 space tabs", since file is not
exactly following any completely defined pattern. Should I use tabs
before multiline comment text (*^I^I) and align
text between routine name and description, also remove all unnecessary
whitespace characters? Attached reformatted file, can you please
review, if formatting would match the expectations?

On Sun, Mar 24, 2024 at 2:33 AM Valery Ushakov  wrote:
>
> On Sat, Mar 23, 2024 at 21:10:45 +, Andrius Varanavicius wrote:
>
> > Modified Files:
> >   src/games/larn: io.c
> >
> > Log Message:
> > Attempt to fix descriptions of the routines in the initial comment block.
>
> Please, can you fix this to use 8 space tabs as the rest of the file
> does, as can be verified by multiline comments formatted as
>
> /* ...
>  * ... */
>
> -uwe
/*	$NetBSD: io.c,v 1.29 2021/05/02 12:50:45 rillig Exp $	*/

/*
 *	io.c			Larn is copyrighted 1986 by Noah Morgan.
 *
 *	Below are the functions in this file:
 *
 *	setupvt100()		Subroutine to set up terminal in correct mode for game
 *	clearvt100()		Subroutine to clean up terminal when the game is over
 *	ttgetch()		Routine to read in one character from the terminal
 *	scbr()			Function to set cbreak -echo for the terminal
 *	sncbr()			Function to set -cbreak echo for the terminal
 *	newgame()		Subroutine to save the initial time and seed rnd()
 *
 *	FILE OUTPUT ROUTINES
 *
 *	lprintf(format,args . . .)	printf to the output buffer 
 *	lprint(integer)			send binary integer to output buffer
 *	lwrite(buf,len)			write a buffer to the output buffer
 *	lprcat(str)			append a string to the output buffer
 *
 *	FILE OUTPUT MACROS (in header.h)
 *
 *	lprc(character)		put the character into the output buffer
 *
 *	FILE INPUT ROUTINES
 *
 *	long lgetc()		read one character from input buffer
 *	long larn_lrint()	read one integer from input buffer
 *	lrfill(address,number)	put input bytes into a buffer char
 *	*lgetw()		get a whitespace ended word from
 *	input char *lgetl()	get a \n or EOF ended line from input
 * 
 *	FILE OPEN / CLOSE ROUTINES
 *
 *	lcreat(filename)	create a new file for write
 *	lopen(filename)		open a file for read
 *	lappend(filename)	open for append to an existing file
 *	lrclose()		close the input file
 *	lwclose()		close output file 
 *	lflush()		flush the output buffer
 *
 *	Other Routines
 *
 *	cursor(x,y)		position cursor at [x,y]
 *	cursors()		position cursor at [1,24] (saves memory)
 *	cl_line(x,y)		clear line at [1,y] and leave cursor at [x,y]
 *	cl_up(x,y)		clear screen from [x,1] to current line
 *	cl_dn(x,y)		clear screen from [1,y] to end of display
 *	standout(str)		print the string in standout mode
 *	set_score_output()	called when output should be literally printed
 *	ttputch(ch)		print one character in decoded output buffer
 *	flush_buf()		flush buffer with decoded output
 *	init_term()		terminal initialization -- setup termcap info
 *	char *tmcapcnv(sd,ss)	routine to convert VT100 \33's to termcap format
 *	beep()			routine to emit a beep if enabled
 *(see no-beep in .larnopts)
 *
 *	Note: ** entries are available only in termcap mode.
 */
#include 
#ifndef lint
__RCSID("$NetBSD: io.c,v 1.29 2021/05/02 12:50:45 rillig Exp $");
#endif /* not lint */

#include "header.h"
#include "extern.h"
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#ifdef TERMIO
#include 
#define sgttyb termio
#define stty(_a,_b) ioctl(_a,TCSETA,_b)
#define gtty(_a,_b) ioctl(_a,TCGETA,_b)
#endif
#ifdef TERMIOS
#include 
#define sgttyb termios
#define stty(_a,_b) tcsetattr(_a,TCSADRAIN,_b)
#define gtty(_a,_b) tcgetattr(_a,_b)
#endif

#if defined(TERMIO) || defined(TERMIOS)
static int  rawflg = 0;
static char saveeof, saveeol;
#define doraw(_a) \
	if(!rawflg) { \
		++rawflg; \
		saveeof = _a.c_cc[VMIN]; \
		saveeol = _a.c_cc[VTIME]; \
	} \
	_a.c_cc[VMIN] = 1; \
	_a.c_cc[VTIME] = 1; \
	_a.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL)
#define unraw(_a) \
	_a.c_cc[VMIN] = saveeof; \
	_a.c_cc[VTIME] = saveeol; \
	_a.c_lflag |= ICANON|ECHO|ECHOE|ECHOK|ECHONL

#else	/* not TERMIO or TERMIOS */

#ifndef BSD
#define CBREAK RAW		/* V7 has no CBREAK */
#endif

#define doraw(_a) (_a.sg_flags |= CBREAK,_a.sg_flags &= ~ECHO)
#define unraw(_a) (_a.sg_flags &= ~CBREAK,_a.sg_flags |= ECHO)
#include 
#endif	/* not TERMIO or TERMIOS */

#ifndef NOVARARGS	/* if we have varargs */
#include 
#else	/* NOVARARGS */	/* if we don't have varargs */
typedef char   *va_list;
#define va_dcl int va_alist;
#define va_start(plist) plist = (char *) &va_alist
#define va_end(plist)
#define va_arg(plist,mode) ((mode *)(plist += sizeof(mode)))[-1]
#endif	/* NOVARARGS */

static int ttputch(int ch);
static void flush_buf(void);

#define LINBUFSIZE 128	/* size of the lgetw() and lgetl() buffer */
int io_outfd; /* output file numbers */
int io_infd; /* input file numbers */
static struct sgttyb ttx;/* storage for the tty modes */
static int  

Re: CVS commit: src/games/larn

2024-03-23 Thread Valery Ushakov
On Sat, Mar 23, 2024 at 21:10:45 +, Andrius Varanavicius wrote:

> Modified Files:
>   src/games/larn: io.c
> 
> Log Message:
> Attempt to fix descriptions of the routines in the initial comment block.

Please, can you fix this to use 8 space tabs as the rest of the file
does, as can be verified by multiline comments formatted as

/* ...
 * ... */

-uwe


CVS commit: src/games/larn

2024-03-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Mar 23 21:10:45 UTC 2024

Modified Files:
src/games/larn: io.c

Log Message:
Attempt to fix descriptions of the routines in the initial comment block.

Something likely went wrong with copying the original text, causing
missing letters, broken indentation and formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/games/larn/io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/games/larn

2024-03-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Mar 23 21:10:45 UTC 2024

Modified Files:
src/games/larn: io.c

Log Message:
Attempt to fix descriptions of the routines in the initial comment block.

Something likely went wrong with copying the original text, causing
missing letters, broken indentation and formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/games/larn/io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/larn/io.c
diff -u src/games/larn/io.c:1.29 src/games/larn/io.c:1.30
--- src/games/larn/io.c:1.29	Sun May  2 12:50:45 2021
+++ src/games/larn/io.c	Sat Mar 23 21:10:45 2024
@@ -1,68 +1,66 @@
-/*	$NetBSD: io.c,v 1.29 2021/05/02 12:50:45 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.30 2024/03/23 21:10:45 andvar Exp $	*/
 
 /*
  * io.c			 Larn is copyrighted 1986 by Noah Morgan.
  *
  * Below are the functions in this file:
  *
- * setupvt100() 	Subroutine to set up terminal in correct mode for game
- * clearvt100()  	Subroutine to clean up terminal when the game is over
- * ttgetch() 		Routine to read in one character from the terminal
+ * setupvt100()		Subroutine to set up terminal in correct mode for game
+ * clearvt100()		Subroutine to clean up terminal when the game is over
+ * ttgetch()		Routine to read in one character from the terminal
  * scbr()			Function to set cbreak -echo for the terminal
  * sncbr()			Function to set -cbreak echo for the terminal
- * newgame() 		Subroutine to save the initial time and seed rnd()
+ * newgame()		Subroutine to save the initial time and seed rnd()
  *
  * FILE OUTPUT ROUTINES
  *
- * lprintf(format,args . . .)	printf to the output buffer lprint(integer)
- * end binary integer to output buffer lwrite(buf,len)
- * rite a buffer to the output buffer lprcat(str)
- * ent string to output buffer
+ * lprintf(format,args . . .)	printf to the output buffer 
+ * lprint(integer)send binary integer to output buffer
+ * lwrite(buf,len)write a buffer to the output buffer
+ * lprcat(str)	append a string to the output buffer
  *
  * FILE OUTPUT MACROS (in header.h)
  *
- * lprc(character)put the character into the output
- * buffer
+ * lprc(character)put the character into the output buffer
  *
  * FILE INPUT ROUTINES
  *
- * long lgetc()read one character from input buffer
+ * long lgetc()	read one character from input buffer
  * long larn_lrint()			read one integer from input buffer
  * lrfill(address,number)		put input bytes into a buffer char
- * *lgetw()get a whitespace ended word from
- * input char *lgetl()get a \n or EOF ended line
- * from input
+ * *lgetw()		get a whitespace ended word from
+ * input char *lgetl()			get a \n or EOF ended line from input
  *
  * FILE OPEN / CLOSE ROUTINES
  *
- * lcreat(filename)			create a new file for write
+ * lcreat(filename)create a new file for write
  * lopen(filename)open a file for read
  * lappend(filename)			open for append to an existing file
  * lrclose()	close the input file
- * lwclose()	close output file lflush()
- * lush the output buffer
+ * lwclose()	close output file 
+ * lflush()		flush the output buffer
  *
  * Other Routines
  *
  * cursor(x,y)	position cursor at [x,y]
- * cursors()	position cursor at [1,24]
- * (saves memory) cl_line(x,y) 		Clear line at [1,y] and leave
- * cursor at [x,y] cl_up(x,y)Clear screen
- * from [x,1] to current line. cl_dn(x,y)
- * lear screen from [1,y] to end of display. standout(str)
- * rint the string in standout mode. set_score_output()
- * alled when output should be literally printed. * ttputch(ch)
- * rint one character in decoded output buffer. * flush_buf()
- * lush buffer with decoded output. * init_term()
- * erminal initialization -- setup termcap info *	char *tmcapcnv(sd,ss)
- * outine to convert VT100 \33's to termcap format beep()
- * e to emit a beep if enabled (see no-beep in .larnopts)
+ * cursors()	position cursor at [1,24] (saves memory)
+ * cl_line(x,y)	clear line at [1,y] and leave cursor at [x,y]
+ * cl_up(x,y)	clear screen from [x,1] to current line
+ * cl_dn(x,y)	clear screen from [1,y] to end of display
+ * standout(str)print the string in standout mode
+ * set_score_output()			called when output should be literally printed
+ * ttputch(ch)	print one character in decoded output buffer
+ * flush_buf()	flush buffer with decoded output
+ * init_term()	terminal initialization -- setup termcap info
+ * char *tmcapcnv(sd,ss)		routine to convert VT100 \33's to termcap format
+ * beep()		routine to emit a beep if enabled
+ * (see no-beep in .larnopts)
  *
  * Note: ** entries are available only in termcap mode.
  */
 #include 
 #ifndef lint
-__RCSID("$NetBSD: io.c,v 1.29 2021/05/02 12:50:45 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.30 2024/03/23 21:10:45 andvar Exp $");
 #endif /* not lint */

Re: CVS commit: src/games/larn

2010-04-24 Thread David Holland
On Sat, Apr 24, 2010 at 03:49:17PM +, Christos Zoulas wrote:
 >> Log Message:
 >> Handle the "diedtime" field of the player log (which is not the high
 >> scores file, the append-only log of all games) as int32_t instead of
 >> time_t. Log files from before the 64-bit time_t change can now be read
 >> again; however, log files from the last year of -current are hosed.
 >> All none of you who play larn, take note...
 > 
 > Since it was hosed for such a long time, should we just keep it this
 > way instead of re-introducing a 32 bit time_t issue?

Well, it's not hosed in releases. The usual approach for such cases is
to break -current.

Plus the whole file format needs to be reworked sometime anyway, as
(except for the one I changed) none of the fields written out are
explicitly sized and some are different on different targets.

-- 
David A. Holland
dholl...@netbsd.org


Re: CVS commit: src/games/larn

2010-04-24 Thread Christos Zoulas
In article <20100424005615.10d1117...@cvs.netbsd.org>,
David A. Holland  wrote:
>-=-=-=-=-=-
>
>Module Name:   src
>Committed By:  dholland
>Date:  Sat Apr 24 00:56:14 UTC 2010
>
>Modified Files:
>   src/games/larn: scores.c
>
>Log Message:
>Handle the "diedtime" field of the player log (which is not the high
>scores file, the append-only log of all games) as int32_t instead of
>time_t. Log files from before the 64-bit time_t change can now be read
>again; however, log files from the last year of -current are hosed.
>All none of you who play larn, take note...
>

Since it was hosed for such a long time, should we just keep it this
way instead of re-introducing a 32 bit time_t issue?

christos