Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: Kanji cut & paste from Netscape



--------------------------------------------------------
tlug note from jwb@example.com (Jim Breen)
--------------------------------------------------------
On May 25,  5:13pm, "Andrew S. Howell" wrote:
} Subject: tlug: Kanji cut & paste from Netscape
>> 
>> I'm not sure how I did it, but I broke something. I used to be able to
>> cut and paste kanji from Netscape into xjdic. Any ideas?

Sigh. I have *never* been able to do that. Some mismatch of cut-buffers
between Netscape, which I run on a nearby Solaris box, and kterm on my
Ultrix DECstation, means I can't cut & paste between them. I *can* cut to
an ordinary xterm, so I when I want to gloss Japanese from Netscape, I run
a tiny program in an xterm window that copies each line entered to a
certain file. I put a "clip-board" mode into xjdic so it polls that file
once a second in a sleep loop. A horrible hack, but it works.

Jim

PS: here is the little program, and the xjdic changes. They will turn up
in V2.3 someday.....

++++++++++++clipit.c+++++++++++++++++++++++++++++++++++++
#include <stdio.h>
#include <ctype.h>

unsigned char ss[51];

FILE *ff,*fopen();

main()
{
	while(1)
	{
		printf("Next: ");
		gets(ss);
		ff = fopen("clipboard","w");
		fprintf(ff,"%s",ss);
		fclose(ff);
		printf("\n");
	}
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Sorry these do not match the released version of xjdfrontend_old.c !

Add some extra global variable:

> 	int clipmode=FALSE;
> 	unsigned char clipstring1[51];
> 	unsigned char clipstring2[51]={"XXXX"};
> 	FILE *fclip,*fopen();

Add this just after the " for (i = 0; (c != 0xd) && (c != 0xa); i++) "
line in main()

> 			if (clipmode) break;

Add an extra command character in the " if ((!escf) && (!bit8) && (strchr(".."
line (I use "{").

Add the following to the " if(cmdmode) " block

> 			if (c == '{')	/* } to balance {}  */
> 			{
> 				printf("\r                                      \r");
> 				printf("Now in Clipboard Mode\n");
> 				clipmode = TRUE;
> 				continue;
> 			}

Add thie *after* the cmdmode block.

> 			}
> 		}
> 		if (clipmode)
> 		{
> 			while(TRUE)
> 			{
> 				sleep(2);
> 				fclip = fopen("clipboard","r");
> 				if (fclip == NULL)
> 				{
> 					printf("\nNo Clipboard file!\n");
> 					strcpy(clipstring1,"XXXX");
> 					strcpy(clipstring2,"XXXX");
> 					break;
> 				}
> 				fgets(clipstring1,50,fclip);
> 				fclose(fclip);
> 				if (clipstring1[strlen(clipstring1)-1] < 32) clipstring1[strlen(clipstring1)-1] = 0;
> 				if (strcmp(clipstring1,"quit") == 0)
> 				{
> 					clipmode = FALSE;
> 					printf("\nLeaving Clipboard mode\n");
> 					break;
> 				}
> 				if (strcmp(clipstring1,clipstring2) == 0)
> 				{
> 					continue;
> 				}
> 				else
> 				{
> 					strcpy(clipstring2,clipstring1);
> 					strcpy(instr,clipstring1);
> 					break;
> 				}

-- 
Jim Breen          [$@%8%`!&%V%j!<%s(J@$@%b%J%7%eBg3X(J]
Department of Digital Systems.                  Monash University, 
Clayton VIC 3168 Australia (p) +61 3 9905 3298 (f) +61 3 9905 3574  
j.breen@example.com   [http://www.dgs.monash.edu.au/~jwb/]
-----------------------------------------------------------------
a word from the sponsor will appear below
-----------------------------------------------------------------
The TLUG mailing list is proudly sponsored by TWICS - Japan's First
Public-Access Internet System.  Now offering 20,000 yen/year flat
rate Internet access with no time charges.  Full line of corporate
Internet and intranet products are available.   info@example.com
Tel: 03-3351-5977   Fax: 03-3353-6096


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links