No. 47/622 Index Prev Next
Relay-Version: version B 2.10.2 9/18/84; site titcca.UUCP
Posting-Version: version B 2.10.2 9/18/84; site nttdpe.ntt.junet
Path: titcca!nttlab!nttdpe!enjo
From: enjo@nttdpe.ntt.junet (Hidekazu Enjo)
Newsgroups: fj.kanji
Subject: modification of VN (yet another newsreader) (In broken Eng.)
Message-ID: < 134@nttdpe.ntt.junet> 
Date: 4 Jul 86 05:46:49 GMT
Date-Received: 4 Jul 86 09:24:24 GMT
Distribution: fj
Organization: Integrated Communications Lab. NTT, Yokosuka, Japan
Lines: 705

I modified VN (yet another newsreader) which was distributed through
net.sources.  The modified functions are following:

1) VN can run on BSD4.1.
2) VN can understand KANJI ESCape sequence.

Restriction:

For KANJI displayed function
1) A terminal has to understand that the 3 byte escape sequence
   (" ESC $ F"  F is any character) designate JIS6226.
2) A terminal has to understand that the 3 byte escape sequence
   (" ESC ( F"  F is any character) designate ASCII or JIS roma-ji.


*** Makefile.1	Fri Jul  4 12:54:00 1986
--- Makefile	Fri Jul  4 12:54:43 1986
***************
*** 1,6
! CFLAGS=	-O -Dregfree=free
! REGLIB=
! LIBS= -ltermcap
  
  OBJS=	hash.o groupdir.o envir_set.o newsrc.o pagefile.o reader.o storage.o sig_set.o term_set.o tty_set.o userlist.o vn.o vnglob.o digest.o strings.o ucb.o
  

--- 1,6 -----
! CFLAGS=	-O -Dregfree=free -DBSD4_1 -DKANJI -DCIT600
! REGLIB=  -lreg
! LIBS= -ltermcap -ljobs
  
  OBJS=	hash.o groupdir.o envir_set.o newsrc.o pagefile.o reader.o storage.o sig_set.o term_set.o tty_set.o userlist.o vn.o vnglob.o digest.o strings.o ucb.o
  
***************
*** 6,8
  
  vn:	$(OBJS)
  	cc -o vn $(OBJS) $(REGLIB) $(LIBS)

--- 6,11 -----
  
  vn:	$(OBJS)
  	cc -o vn $(OBJS) $(REGLIB) $(LIBS)
+ 
+ clean:
+ 	rm *.o vn
*** envir_set.c.1	Fri Jul  4 11:06:17 1986
--- envir_set.c	Fri Jul  4 08:41:42 1986
***************
*** 3,8
  #include 
  #include " config.h" 
  
  extern char *Editor,*Ps1,*Mailer,*Printer,*Poster;
  extern char *Onews,*Newsrc,*Orgdir,*Savedir;	/* path names */
  

--- 3,12 -----
  #include 
  #include "config.h"
  
+ #ifdef BSD4_1
+ #define MAXPATHLEN 256
+ #endif
+ 
  extern char *Editor,*Ps1,*Mailer,*Printer,*Poster;
  extern char *Onews,*Newsrc,*Orgdir,*Savedir;	/* path names */
  
*** pagefile.c.1	Fri Jul  4 11:06:20 1986
--- pagefile.c	Fri Jul  4 13:40:30 1986
***************
*** 1,4
  #include 
  #include 
  #include " vn.h" 
  #include " head.h" 

--- 1,9 -----
  #include 
+ #ifdef BSD4_1
+ /* following two lines appended by nttdpe!yamada */
+ #include 
+ #include 
+ #endif
  #include 
  #include " vn.h" 
  #include " head.h" 
***************
*** 13,18
  
  extern char *T_head, *F_head, *L_head;
  
  static int Tdes;	/* temp file descriptor */
  static int Pgsize;	/* block size for seeking file */
  

--- 18,26 -----
  
  extern char *T_head, *F_head, *L_head;
  
+ #ifdef BSD4_1
+ static FILE * Tdes;	/* temp file descriptor */
+ #else
  static int Tdes;	/* temp file descriptor */
  #endif
  static int Pgsize;	/* block size for seeking file */
***************
*** 14,19
  extern char *T_head, *F_head, *L_head;
  
  static int Tdes;	/* temp file descriptor */
  static int Pgsize;	/* block size for seeking file */
  
  /*

--- 22,28 -----
  static FILE * Tdes;	/* temp file descriptor */
  #else
  static int Tdes;	/* temp file descriptor */
+ #endif
  static int Pgsize;	/* block size for seeking file */
  
  /*
***************
*** 26,31
  temp_open ()
  {
  	char tmpart [L_tmpnam];
  	Lrec = -1;
  	tmpnam (tmpart);
  	Pgsize = sizeof (HEAD) + L_allow * sizeof(BODY);

--- 35,43 -----
  temp_open ()
  {
  	char tmpart [L_tmpnam];
+ #ifdef BSD4_1
+ 	FILE *fopen();
+ #endif
  	Lrec = -1;
  	tmpnam (tmpart);
  	Pgsize = sizeof (HEAD) + L_allow * sizeof(BODY);
***************
*** 29,34
  	Lrec = -1;
  	tmpnam (tmpart);
  	Pgsize = sizeof (HEAD) + L_allow * sizeof(BODY);
  	if ((Tdes = open(tmpart,O_RDWR|O_CREAT)) <  0)
  		printex (" can't open %s" ,tmpart);
  	unlink (tmpart);

--- 41,51 -----
  	Lrec = -1;
  	tmpnam (tmpart);
  	Pgsize = sizeof (HEAD) + L_allow * sizeof(BODY);
+ #ifdef BSD4_1
+ 	if ((Tdes = fopen(tmpart," w+" )) == 0)
+ 		printex (" can't open %s" ,tmpart);
+ 	chmod(tmpart,0666);
+ #else
  	if ((Tdes = open(tmpart,O_RDWR|O_CREAT)) <  0)
  		printex (" can't open %s" ,tmpart);
  #endif
***************
*** 31,36
  	Pgsize = sizeof (HEAD) + L_allow * sizeof(BODY);
  	if ((Tdes = open(tmpart,O_RDWR|O_CREAT)) <  0)
  		printex (" can't open %s" ,tmpart);
  	unlink (tmpart);
  }
  

--- 48,54 -----
  #else
  	if ((Tdes = open(tmpart,O_RDWR|O_CREAT)) <  0)
  		printex ("can't open %s",tmpart);
+ #endif
  	unlink (tmpart);
  }
  
***************
*** 92,97
  	Cur_page = n;
  	off = Pgsize;
  	off *= (long) n;
  	lseek (Tdes, off, 0);
  	if (read(Tdes, (char *) & (Page.h), sizeof(HEAD)) < sizeof(HEAD))
  		printex(" bad temp file read" );

--- 110,120 -----
  	Cur_page = n;
  	off = Pgsize;
  	off *= (long) n;
+ #ifdef BSD4_1
+ 	fseek (Tdes, off, 0);
+ 	if (fread( (char *) & (Page.h), sizeof(HEAD),1,Tdes) < 1)
+ 		printex(" bad temp file read head" );
+ #else
  	lseek (Tdes, off, 0);
  	if (read(Tdes, (char *) & (Page.h), sizeof(HEAD)) < sizeof(HEAD))
  		printex(" bad temp file read" );
***************
*** 95,100
  	lseek (Tdes, off, 0);
  	if (read(Tdes, (char *) & (Page.h), sizeof(HEAD)) < sizeof(HEAD))
  		printex(" bad temp file read" );
  	i = Pgsize - sizeof(HEAD);
  	if (read(Tdes, (char *) Page.b, i) <  i)
  		printex(" bad temp file read" );

--- 118,124 -----
  	lseek (Tdes, off, 0);
  	if (read(Tdes, (char *) & (Page.h), sizeof(HEAD)) < sizeof(HEAD))
  		printex("bad temp file read");
+ #endif
  	i = Pgsize - sizeof(HEAD);
  #ifdef BSD4_1
  	if (fread( (char *) Page.b, i,1,Tdes) <  1)
***************
*** 96,101
  	if (read(Tdes, (char *) & (Page.h), sizeof(HEAD)) < sizeof(HEAD))
  		printex(" bad temp file read" );
  	i = Pgsize - sizeof(HEAD);
  	if (read(Tdes, (char *) Page.b, i) <  i)
  		printex(" bad temp file read" );
  	last = -1;

--- 120,129 -----
  		printex(" bad temp file read" );
  #endif
  	i = Pgsize - sizeof(HEAD);
+ #ifdef BSD4_1
+ 	if (fread( (char *) Page.b, i,1,Tdes) <  1)
+ 		printex(" bad temp file read body" );
+ #else
  	if (read(Tdes, (char *) Page.b, i) <  i)
  		printex(" bad temp file read" );
  #endif
***************
*** 98,103
  	i = Pgsize - sizeof(HEAD);
  	if (read(Tdes, (char *) Page.b, i) <  i)
  		printex(" bad temp file read" );
  	last = -1;
  	for (i=0; i <  Ncount; ++i)
  	{

--- 126,132 -----
  #else
  	if (read(Tdes, (char *) Page.b, i) <  i)
  		printex("bad temp file read");
+ #endif
  	last = -1;
  	for (i=0; i <  Ncount; ++i)
  	{
***************
*** 122,127
  	{
  		off = Pgsize;
  		off *= (long) Cur_page;
  		lseek (Tdes, off, 0);
  		do_write();
  	}

--- 151,159 -----
  	{
  		off = Pgsize;
  		off *= (long) Cur_page;
+ #ifdef BSD4_1
+ 		fseek (Tdes, off, 0);
+ #else
  		lseek (Tdes, off, 0);
  #endif
  		do_write();
***************
*** 123,128
  		off = Pgsize;
  		off *= (long) Cur_page;
  		lseek (Tdes, off, 0);
  		do_write();
  	}
  }

--- 155,161 -----
  		fseek (Tdes, off, 0);
  #else
  		lseek (Tdes, off, 0);
+ #endif
  		do_write();
  	}
  }
***************
*** 131,136
  {
  	int num;
  
  	if (write(Tdes, (char *) & (Page.h), sizeof(HEAD)) < sizeof(HEAD))
  		printex (" Bad temp file write" );
  	num = L_allow * sizeof(BODY);

--- 164,172 -----
  {
  	int num;
  
+ #ifdef BSD4_1
+ 	if (fwrite( (char *) & (Page.h), sizeof(HEAD),1,Tdes) < 1)
+ #else
  	if (write(Tdes, (char *) & (Page.h), sizeof(HEAD)) < sizeof(HEAD))
  #endif
  		printex (" Bad temp file write" );
***************
*** 132,137
  	int num;
  
  	if (write(Tdes, (char *) & (Page.h), sizeof(HEAD)) < sizeof(HEAD))
  		printex (" Bad temp file write" );
  	num = L_allow * sizeof(BODY);
  	if (write(Tdes, (char *) Page.b, num) <  num)

--- 168,174 -----
  	if (fwrite( (char *) & (Page.h), sizeof(HEAD),1,Tdes) < 1)
  #else
  	if (write(Tdes, (char *) & (Page.h), sizeof(HEAD)) < sizeof(HEAD))
+ #endif
  		printex (" Bad temp file write" );
  	num = L_allow * sizeof(BODY);
  #ifdef BSD4_1
***************
*** 134,139
  	if (write(Tdes, (char *) & (Page.h), sizeof(HEAD)) < sizeof(HEAD))
  		printex (" Bad temp file write" );
  	num = L_allow * sizeof(BODY);
  	if (write(Tdes, (char *) Page.b, num) <  num)
  		printex (" Bad temp file write" );
  }

--- 171,179 -----
  #endif
  		printex (" Bad temp file write" );
  	num = L_allow * sizeof(BODY);
+ #ifdef BSD4_1
+ 	if (fwrite( (char *) Page.b, num,1,Tdes) <  1)
+ #else
  	if (write(Tdes, (char *) Page.b, num) <  num)
  #endif
  		printex (" Bad temp file write" );
***************
*** 135,140
  		printex (" Bad temp file write" );
  	num = L_allow * sizeof(BODY);
  	if (write(Tdes, (char *) Page.b, num) <  num)
  		printex (" Bad temp file write" );
  }
  

--- 175,181 -----
  	if (fwrite( (char *) Page.b, num,1,Tdes) <  1)
  #else
  	if (write(Tdes, (char *) Page.b, num) <  num)
+ #endif
  		printex (" Bad temp file write" );
  }
  
*** reader.c.1	Fri Jul  4 11:06:23 1986
--- reader.c	Wed Jun 18 19:32:09 1986
***************
*** 10,15
  extern char *Editor,*Mailer,*Poster,*Orgdir,*Savefile,*Savedir;
  extern int L_allow;
  extern int C_allow;
  extern int Rot;
  extern int Headflag;
  extern int Digest;

--- 10,21 -----
  extern char *Editor,*Mailer,*Poster,*Orgdir,*Savefile,*Savedir;
  extern int L_allow;
  extern int C_allow;
+ #ifdef KANJI
+ extern char KI;
+ extern char AI;
+ extern int Mode;
+ extern int Kanji;
+ #endif
  extern int Rot;
  extern int Headflag;
  extern int Digest;
***************
*** 160,165
  		** hlines, rlines and lcount refer to records.
  		*/
  		rf = buf;
  		lines += do_out(optr,& optr,L_allow-lines);
  		while (lines < L_allow & &  (rf = fgets(buf,RECLEN-1,Fpread)) != NULL)
  		{

--- 166,175 -----
  		** hlines, rlines and lcount refer to records.
  		*/
  		rf = buf;
+ #ifdef KANJI
+ 		if (Mode == JIS6226)
+ 			term_set(JIS6226);
+ #endif
  		lines += do_out(optr,& optr,L_allow-lines);
  		while (lines < L_allow & &  (rf = fgets(buf,RECLEN-1,Fpread)) != NULL)
  		{
***************
*** 173,178
  			}
  			lines += do_out(buf,& optr,L_allow-lines);
  		}
  
  		if (rf != NULL)
  		{

--- 183,192 -----
  			}
  			lines += do_out(buf,& optr,L_allow-lines);
  		}
+ #ifdef KANJI
+ 		if (Mode == JIS6226)
+ 			term_set(ASCII);
+ #endif
  
  		if (rf != NULL)
  		{
***************
*** 645,650
  				*s = '_';
  				++len;
  				break;
  			default:
  				if (*s <  ' ')
  					*s += 'A' - 1;

--- 659,684 -----
  				*s = '_';
  				++len;
  				break;
+ #ifdef KANJI
+ 			case '\033':		/* accept ESC (nttdpe!enjo)*/ 
+ 				if (!Kanji)
+ 					;
+ 				else if (strncmp(s, " \033$@" , 3) == 0 ||
+ 					 strncmp(s, " \033$B" , 3) == 0) {
+ 					s[2] = KI;
+ 					s += 2;
+ 					break;
+ 				}
+ 				else if (strncmp(s, " \033(B" , 3) == 0 ||
+ #ifndef RIGHTESC
+ 					 strncmp(s, " \033(H" , 3) == 0 ||
+ #endif
+ 					 strncmp(s, " \033(J" , 3) == 0) {
+ 					s[2] = AI;
+ 					s += 2;
+ 					break;
+ 				}
+ #endif
  			default:
  				if (*s <  ' ')
  					*s += 'A' - 1;
***************
*** 648,654
  			default:
  				if (*s <  ' ')
  					*s += 'A' - 1;
! 				++len;		/* fall through */
  			case '\07':
  				break;
  			}

--- 682,696 -----
  			default:
  				if (*s <  ' ')
  					*s += 'A' - 1;
! #ifdef KANJI
! 				if (Mode == JIS6226 & & 
! 				    ' ' < s[1] & &  s[1] < '\177') {
! 					len += 2;
! 					word = ++s;
! 					}
! 				else
! #endif
! 					++len;	/* fall through */
  			case '\07':
  				break;
  			}
*** sig_set.c.1	Fri Jul  4 11:06:25 1986
--- sig_set.c	Fri Jul  4 08:45:06 1986
***************
*** 1,4
  #include 
  #include 
  #include 
  #include 

--- 1,5 -----
  #include 
+ #ifndef BSD4_1
  #include 
  #else
  #include 
***************
*** 1,5
  #include 
  #include 
  #include 
  #include 
  #include " tty.h" 

--- 1,9 -----
  #include 
  #ifndef BSD4_1
  #include 
+ #else
+ #include 
+ #endif
  #include 
  #include 
  #include " tty.h" 
***************
*** 54,59
  
  		/* Send the TSTP signal to suspend our process group */
  		signal(SIGTSTP, SIG_DFL);
  		sigsetmask(0);
  		kill (0, SIGTSTP);
  

--- 58,64 -----
  
  		/* Send the TSTP signal to suspend our process group */
  		signal(SIGTSTP, SIG_DFL);
+ #ifndef BSD4_1
  		sigsetmask(0);
  #endif
  		kill (0, SIGTSTP);
***************
*** 55,60
  		/* Send the TSTP signal to suspend our process group */
  		signal(SIGTSTP, SIG_DFL);
  		sigsetmask(0);
  		kill (0, SIGTSTP);
  
  		/* WE ARE NOW STOPPED */

--- 60,66 -----
  		signal(SIGTSTP, SIG_DFL);
  #ifndef BSD4_1
  		sigsetmask(0);
+ #endif
  		kill (0, SIGTSTP);
  
  		/* WE ARE NOW STOPPED */
*** term_set.c.1	Fri Jul  4 11:06:27 1986
--- term_set.c	Wed Jun 18 18:53:55 1986
***************
*** 3,8
  #include " vn.h" 
  
  extern int L_allow, C_allow;
  
  static outc (c)
  char c;

--- 3,12 -----
  #include " vn.h" 
  
  extern int L_allow, C_allow;
+ #ifdef KANJI
+ extern char KI, AI;
+ extern int Kanji;
+ #endif
  
  static outc (c)
  char c;
***************
*** 23,28
  static char *Cm,*Cl,*So,*Se,*Te,*Bc,*Ce;
  static int Backspace;		/* backspace works */
  static int Overstrike;
  
  static t_setup()
  {

--- 27,35 -----
  static char *Cm,*Cl,*So,*Se,*Te,*Bc,*Ce;
  static int Backspace;		/* backspace works */
  static int Overstrike;
+ #ifdef KANJI
+ static char *Ki, *Ai;
+ #endif
  
  static t_setup()
  {
***************
*** 74,79
  		printex (" too few columns for display - %d needed" ,MIN_C);
  	}
  
  	L_allow -= RECBIAS;
  	page_alloc();
  	tputs(tgetstr("ti",& c),1,outc);

--- 81,104 -----
  		printex (" too few columns for display - %d needed" ,MIN_C);
  	}
  
+ #ifdef KANJI
+ 	Ki = str_store(tgetstr("KI",& c));
+ 	Ai = str_store(tgetstr("AI",& c));
+ 	if (Kanji = (strlen(Ki) == 3 & &  strlen(Ai) == 3)) {
+ 		KI = Ki[2];
+ 		AI = Ai[2];
+ 	}
+ #ifdef CIT600
+ 	if (strcmp(" cit600" , getenv(" TERM" )) == 0) {
+ 		Ki = " \033$@" ;
+ 		Ai = " \033(H" ;
+ 		KI = '@';
+ 		AI = 'H';
+ 		Kanji = 1;
+ 	}
+ #endif
+ #endif
+ 
  	L_allow -= RECBIAS;
  	page_alloc();
  	tputs(tgetstr("ti",& c),1,outc);
***************
*** 147,152
  			}
  		}
  		break;
  	default:
  		printex (" term_set unknown code (%d)" ,cmd);
  		break;

--- 172,185 -----
  			}
  		}
  		break;
+ #ifdef KANJI
+ 	case ASCII:
+ 		tputs(Ai,1,outc);
+ 		break;
+ 	case JIS6226:
+ 		tputs(Ki,1,outc);
+ 		break;
+ #endif
  	default:
  		printex (" term_set unknown code (%d)" ,cmd);
  		break;
*** tty.h.1	Fri Jul  4 11:06:29 1986
--- tty.h	Thu Jun 12 18:31:45 1986
***************
*** 9,14
  #define ZAP 105
  #define ONREVERSE 106
  #define OFFREVERSE 107
  
  #define RAWMODE 200
  #define COOKED 201

--- 9,18 -----
  #define ZAP 105
  #define ONREVERSE 106
  #define OFFREVERSE 107
+ #ifdef KANJI
+ #define ASCII 108
+ #define JIS6226 109
+ #endif
  
  #define RAWMODE 200
  #define COOKED 201
*** vnglob.c.1	Fri Jul  4 11:06:30 1986
--- vnglob.c	Thu Jun 12 18:30:00 1986
***************
*** 27,32
  	nfltr - number of filters
  */
  int Cur_page, Lrec, L_allow, C_allow, Ncount, Nfltr;
  
  /*
  	article filters from options

--- 27,36 -----
  	nfltr - number of filters
  */
  int Cur_page, Lrec, L_allow, C_allow, Ncount, Nfltr;
+ #ifdef KANJI
+ int Mode, Kanji;
+ char AI, KI;
+ #endif
  
  /*
  	article filters from options

------------------------------------------------------------
Hidekaze Enjo

UUCP:	nttlab!nttdpe!enjo
JUNET:	enjo@nttdpe.ntt.junet
Next
Continue