No. 71/622 Index Prev Next
Path: titcca!nttlab!nttdpe!enjo
From: enjo@nttdpe.ntt.junet (Hidekazu Enjo)
Newsgroups: fj.kanji,fj.sources
Subject: modification of new VN (In Eng.)
Message-ID: < 192@nttdpe.ntt.junet> 
Date: 27 Feb 87 03:02:01 GMT
Distribution: fj
Organization: Integrated Communications Lab. NTT, Yokosuka, Japan
Lines: 422
Xref: titcca fj.kanji:98 fj.sources:190

I modified the new VN (yet another newsreader) which was
recently distributed through mod.sources (v08i064~).
The original version was distributed through net.sources and
I posted the patch for it.  I think that you can easy
modify the VN sources using a patch program.
I want to know how many sites use my patch and what kind of
kanji functions are requested to VN.

If you use it or you want to request new functions,
please send me a e-mail.

Hidekazu Enjo			JUNET:	enjo@nttdpe.ntt.junet

=====
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.


TERMCAP:

When you use this kanji version, you have to modify your termcap.
You need to add AI (escape sequence to ascii) and KI (escape sequence
to JIS6226). (ex. AI=\E(H KI=\E$@ )

MAKEFILE:

A makefile I used is as followed:
----------------
CFLAGS=	-O -DJOBCONTROL -DBSD41 -DKANJI -DWRONGESC
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 tmpnam.o reg.o strtok.o

vn:	$(OBJS)
	cc -o vn $(OBJS) $(LIBS)
----------------
I added definitions (BSD41 KANJI WORNGESC) in CFLAGS.
BSD41 is a define for BSD4.1.
KANJI is a define for KANJI ESCape sequences.
WRONGESC is a define for acceptance of the worng JIS ESCape sequence.


diff -c vn1/envir_set.c vn2/envir_set.c
*** vn1/envir_set.c	Thu Feb 26 17:02:06 1987
--- vn2/envir_set.c	Sun Feb 22 12:26:59 1987
***************
*** 23,28
  #else
  extern char *getwd();
  #endif
  
  /*
  	environment variable, original directory string setup.

--- 23,31 -----
  #else
  extern char *getwd();
  #endif
+ #ifdef BSD41
+ #define	MAXPATHLEN 240
+ #endif
  
  /*
  	environment variable, original directory string setup.
diff -c vn1/pagefile.c vn2/pagefile.c
*** vn1/pagefile.c	Thu Feb 26 17:03:05 1987
--- vn2/pagefile.c	Thu Feb 26 16:43:24 1987
***************
*** 12,17
  #include 
  #include 
  #endif
  
  #include 
  #include " vn.h" 

--- 12,20 -----
  #include 
  #include 
  #endif
+ #ifdef BSD41
+ #include 
+ #endif
  
  #include 
  #include " vn.h" 
***************
*** 44,49
  	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);

--- 47,59 -----
  	Lrec = -1;
  	tmpnam (tmpart);
  	Pgsize = sizeof (HEAD) + L_allow * sizeof(BODY);
+ #ifdef BSD41
+ 	if ((Tdes = creat(tmpart,0666)) <  0)
+ 		printex (" can't creat %s" ,tmpart);
+ 	close(Tdes);
+ 	if ((Tdes = open(tmpart,2)) <  0)
+ 		printex (" can't open %s" ,tmpart);
+ #else
  	if ((Tdes = open(tmpart,O_RDWR|O_CREAT)) <  0)
  		printex (" can't open %s" ,tmpart);
  #endif
***************
*** 46,51
  	Pgsize = sizeof (HEAD) + L_allow * sizeof(BODY);
  	if ((Tdes = open(tmpart,O_RDWR|O_CREAT)) <  0)
  		printex (" can't open %s" ,tmpart);
  	unlink (tmpart);
  }
  

--- 56,62 -----
  #else
  	if ((Tdes = open(tmpart,O_RDWR|O_CREAT)) <  0)
  		printex ("can't open %s",tmpart);
+ #endif
  	unlink (tmpart);
  }
  
diff -c vn1/reader.c vn2/reader.c
*** vn1/reader.c	Thu Feb 26 17:05:36 1987
--- vn2/reader.c	Thu Feb 26 12:57:44 1987
***************
*** 20,25
  extern char *Printer,*Editor,*Mailer,*Poster,*Orgdir,*Savefile,*Savedir,*Ccfile;
  extern int L_allow;
  extern int C_allow;
  extern int Rot;
  extern int Headflag;
  extern int Digest;

--- 20,31 -----
  extern char *Printer,*Editor,*Mailer,*Poster,*Orgdir,*Savefile,*Savedir,*Ccfile;
  extern int L_allow;
  extern int C_allow;
+ #ifdef KANJI
+ extern int Mode;
+ extern int Kanji;
+ extern char *Ai;
+ extern char *Ki;
+ #endif
  extern int Rot;
  extern int Headflag;
  extern int Digest;
***************
*** 174,179
  		** If Lookahead is null after this loop, we've
  		** hit EOF.
  		*/
  		lines += do_out(Lookahead,L_allow-lines);
  		while (1)
  		{

--- 180,189 -----
  		** If Lookahead is null after this loop, we've
  		** hit EOF.
  		*/
+ #ifdef KANJI
+ 		if (Mode == JIS6226)
+ 			term_set(JIS6226);
+ #endif
  		lines += do_out(Lookahead,L_allow-lines);
  		while (1)
  		{
***************
*** 190,195
  				break;
  			lines += do_out(buf,L_allow-lines);
  		}
  
  		if (Lookahead != NULL)
  		{

--- 200,209 -----
  				break;
  			lines += do_out(buf,L_allow-lines);
  		}
+ #ifdef KANJI
+ 		if (Mode == JIS6226)
+ 			term_set(ASCII);
+ #endif
  
  		if (Lookahead != NULL)
  		{
***************
*** 758,763
  				*s = '_';
  				++len;
  				break;
  			default:
  				if (*s <  ' ')
  					*s += 'A' - 1;

--- 772,799 -----
  				*s = '_';
  				++len;
  				break;
+ #ifdef KANJI
+ 			case '\033':		/* accept ESC */
+ 				if (!Kanji)
+ 					;
+ 				else if (strncmp(s, " \033(B" , 3) == 0 ||
+ #ifdef WRONGESC
+ 					 strncmp(s, " \033(H" , 3) == 0 ||
+ #endif
+ 					 strncmp(s, " \033(J" , 3) == 0) {
+ 					s[2] = Ai[2];
+ 					s += 2;
+ 					Mode = ASCII;
+ 					break;
+ 				}
+ 				else if (strncmp(s, " \033$@" , 3) == 0 ||
+ 					 strncmp(s, " \033$B" , 3) == 0) {
+ 					s[2] = Ki[2];
+ 					s += 2;
+ 					Mode = JIS6226;
+ 					break;
+ 				}
+ #endif
  			default:
  #ifdef KANJI
  				if (Mode == JIS6226 & & 
***************
*** 759,764
  				++len;
  				break;
  			default:
  				if (*s <  ' ')
  					*s += 'A' - 1;
  				++len;		/* fall through */

--- 795,809 -----
  				}
  #endif
  			default:
+ #ifdef KANJI
+ 				if (Mode == JIS6226 & & 
+ 				    ' ' < s[0] & &  s[0] < '\177' & & 
+ 				    ' ' < s[1] & &  s[1] < '\177') {
+ 					++len;
+ 					word = s++;
+ 				}
+ 				else
+ #endif
  				if (*s <  ' ')
  					*s += 'A' - 1;
  				++len;		/* fall through */
diff -c vn1/sig_set.c vn2/sig_set.c
*** vn1/sig_set.c	Thu Feb 26 17:03:38 1987
--- vn2/sig_set.c	Sun Feb 22 20:54:29 1987
***************
*** 65,70
  
  		/* Send the TSTP signal to suspend our process group */
  		signal(SIGTSTP, SIG_DFL);
  		sigsetmask(0);
  		kill (0, SIGTSTP);
  

--- 65,71 -----
  
  		/* Send the TSTP signal to suspend our process group */
  		signal(SIGTSTP, SIG_DFL);
+ #ifndef BSD41
  		sigsetmask(0);
  #endif
  		kill (0, SIGTSTP);
***************
*** 66,71
  		/* Send the TSTP signal to suspend our process group */
  		signal(SIGTSTP, SIG_DFL);
  		sigsetmask(0);
  		kill (0, SIGTSTP);
  
  		/* WE ARE NOW STOPPED */

--- 67,73 -----
  		signal(SIGTSTP, SIG_DFL);
  #ifndef BSD41
  		sigsetmask(0);
+ #endif
  		kill (0, SIGTSTP);
  
  		/* WE ARE NOW STOPPED */
diff -c vn1/term_set.c vn2/term_set.c
*** vn1/term_set.c	Thu Feb 26 17:06:02 1987
--- vn2/term_set.c	Thu Feb 26 12:58:18 1987
***************
*** 12,17
  
  extern int L_allow, C_allow;
  extern char *Ku, *Kd, *Kl, *Kr;	
  
  static outc (c)
  char c;

--- 12,21 -----
  
  extern int L_allow, C_allow;
  extern char *Ku, *Kd, *Kl, *Kr;	
+ #ifdef KANJI
+ extern int Kanji;
+ extern char *Ai, *Ki;
+ #endif
  
  static outc (c)
  char c;
***************
*** 123,128
  			printex(" can't determine number of columns on terminal." );
  		printex (" too few columns for display - %d needed" ,MIN_C);
  	}
  
  	L_allow -= RECBIAS;
  	page_alloc();

--- 127,137 -----
  			printex(" can't determine number of columns on terminal." );
  		printex (" too few columns for display - %d needed" ,MIN_C);
  	}
+ #ifdef KANJI
+ 	Ai = str_store(tgetstr("AI",& c));
+ 	Ki = str_store(tgetstr("KI",& c));
+ 	Kanji = strlen(Ki) == 3 & &  strlen(Ai) == 3;
+ #endif
  
  	L_allow -= RECBIAS;
  	page_alloc();
***************
*** 212,217
  			}
  		}
  		break;
  	default:
  		printex (" term_set unknown code (%d)" ,cmd);
  		break;

--- 221,234 -----
  			}
  		}
  		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;
diff -c vn1/tty.h vn2/tty.h
*** vn1/tty.h	Thu Feb 26 17:06:08 1987
--- vn2/tty.h	Thu Feb 26 10:51:22 1987
***************
*** 15,20
  #define ONREVERSE 106
  #define OFFREVERSE 107
  #define RESTART 108
  
  #define RAWMODE 200
  #define COOKED 201

--- 15,24 -----
  #define ONREVERSE 106
  #define OFFREVERSE 107
  #define RESTART 108
+ #ifdef KANJI
+ #define ASCII 109
+ #define JIS6226 110
+ #endif
  
  #define RAWMODE 200
  #define COOKED 201
diff -c vn1/vnglob.c vn2/vnglob.c
*** vn1/vnglob.c	Thu Feb 26 17:07:03 1987
--- vn2/vnglob.c	Thu Feb 26 11:25:10 1987
***************
*** 44,49
  */
  int Cur_page, Lrec, L_allow, C_allow, Ncount, Nfltr;
  
  /*
  	article filtration options.
  */

--- 44,60 -----
  */
  int Cur_page, Lrec, L_allow, C_allow, Ncount, Nfltr;
  
+ #ifdef KANJI
+ /*
+ 	Mode - current terminal mode
+ 	Kanji - capablity of kanji display
+ 	Ai - escape sequence to ascii ('\033$?')
+ 	Ki - escape sequence to kanji ('\033(?')
+ */
+ int Mode, Kanji;
+ char *Ai, *Ki;
+ #endif
+ 
  /*
  	article filtration options.
  */
Next
Continue