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

utf8 conversion problmem in autoconvert was fixed



hi all
   I will upload zh-autoconvert_0.3.7-2.2.
or you can apply this patch. 
   It's my mistake. 
   				saka


--- autoconvert-0.3.7/autogb.c	Sat Jan  6 22:23:01 2001
+++ zh-autoconvert-0.3.7/autogb.c	Sat Jan  6 22:11:57 2001
@@ -20,7 +20,7 @@
 /* 
 * author: Yu Guanghui <ygh@dlut.edu.cn>
 *	  Network Center
-* 	  Dalian Univ. of Tech.	
+* 	  Dalian Univ. of Tech.
 *	  1999.5
 */
 //$Header: /home/prog/autoconvert/autogb.c,v 1.5 2000/11/28 17:31:19 ygh Exp $
@@ -34,21 +34,21 @@
 void print_help(char* filename){
 	printf("\nUsage: %s [-OPTION] < input > output\n", filename);
 	puts(
-"Now autoconvert only can juduge gb/big5/hz encoding, so if you want to 
-do other convert you must set the option --input. Without --input, the 
-program will guess the encoding of the input.
+"Now autoconvert can only judge gb/big5/hz encoding, so if you want to 
+do other conversion, you must set the option --input.  Without --input,
+the program will guess the encoding of the input.
 OPTION is one of (case insensitive):
   -i encoding, --input encoding:			Set the input encoding
   -o encoding, --output encoding:			Set the output encoding
 
-  The encoding should be gb,big5,hz,uni,utf7 or utf8.
+  The encoding should be gb, big5, hz, uni, utf7 or utf8.
 	");
 
 	exit(0);
 }
 
 
-main(int argc,char*argv[])
+int main(int argc,char*argv[])
 {
 	int incode,outcode,dist;
 	char buff[MAX_BUFFER*2];
@@ -61,7 +61,7 @@
 
 	incode = 0;
 
-	pbuf=&buff[1];
+	pbuf=&buff[2];
 
 	if( strstr(argv[0],"autogb") != '\0' ){
 		outcode=GB_CODE;
@@ -127,7 +127,7 @@
 	} /* End else if */
 
 	if((count=read(0,pbuf,MAX_BUFFER))< 0){
-		fprintf(stderr,"Cant read stdin\n");
+		fprintf(stderr,"Can't read stdin\n");
 	}
 	
 	/* If incode is set in command line, don't judge. */
@@ -136,7 +136,7 @@
 
 	if (incode != outcode){
 		if((dist=search(incode,outcode,8))==0){
-			printf("I couldn't do this convert\n");
+			printf("I couldn't do this conversion\n");
 			exit(0);
 		}
 	}
@@ -148,6 +148,7 @@
 			ps=convert(pbuf,&count,0);
 			write(1,ps,count);
 		}
+		pbuf=&buff[2];
 	}while((count=read(0,pbuf,MAX_BUFFER))>0);
 	fflush(0);
 }



Reply to: