Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 30590cb001265e4258071e6c719711b9 > files > 15

libnatspec-devel-0.2.6-6.fc18.i686.rpm

natspec patch: encoding output to locale charset
diff -urN o3read-0.0.4.old/Makefile o3read-0.0.4/Makefile
--- o3read-0.0.4.old/Makefile	2005-01-07 11:28:47 +0300
+++ o3read-0.0.4/Makefile	2005-08-29 17:24:20 +0400
@@ -4,9 +4,10 @@
 
 CC = gcc
 CFLAGS = -Wall -ansi -pedantic -O -g
+LDFLAGS = -lnatspec
 PREFIX = /usr/local
 BINDIR = $(PREFIX)/bin
-MANDIR = $(PREFIX)/man/man1
+MANDIR = $(PREFIX)/share/man/man1
 DOCS = COPYING INSTALL README TODO ChangeLog filformat.sxw
 BINS = o3read o3totxt o3tohtml utf8tolatin1
 SRCS = o3read.h main.c o3read.c o3totxt.c o3tohtml.c utf8tolatin1.c
@@ -17,19 +18,19 @@
 all: $(BINS)
 
 utf8tolatin1: utf8tolatin1.o
-	$(CC) -o utf8tolatin1 utf8tolatin1.o
+	$(CC) $(LDFLAGS) -o utf8tolatin1 utf8tolatin1.o
 
 o3totxt: o3totxt.o o3read.o
-	$(CC) -o o3totxt o3totxt.o o3read.o
+	$(CC) $(LDFLAGS) -o o3totxt o3totxt.o o3read.o
 
 o3tohtml: o3tohtml.o o3read.o
-	$(CC) -o o3tohtml o3tohtml.o o3read.o
+	$(CC) $(LDFLAGS) -o o3tohtml o3tohtml.o o3read.o
 
 o3tosiag: o3tosiag.o o3read.o
-	$(CC) -o o3tosiag o3tosiag.o o3read.o
+	$(CC) $(LDFLAGS) -o o3tosiag o3tosiag.o o3read.o
 
 o3read: main.o o3read.o
-	$(CC) -o o3read main.o o3read.o
+	$(CC) $(LDFLAGS) -o o3read main.o o3read.o
 
 dist:
 	rm -rf $(PACKAGE)-$(VERSION)
diff -urN o3read-0.0.4.old/o3read.c o3read-0.0.4/o3read.c
--- o3read-0.0.4.old/o3read.c	2005-01-07 11:28:47 +0300
+++ o3read-0.0.4/o3read.c	2005-08-29 17:35:55 +0400
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <natspec.h>
 
 #include "o3read.h"
 
@@ -91,6 +92,13 @@
 	return h;
 }
 
+void putstring(const char *str)
+{
+	char *newstr = natspec_convert_with_translit(str, NULL, "UTF-8");
+	printf(newstr);
+	free(newstr);
+}
+
 static void indent(int i)
 {
 	int j;
diff -urN o3read-0.0.4.old/o3read.h o3read-0.0.4/o3read.h
--- o3read-0.0.4.old/o3read.h	2005-01-07 11:28:47 +0300
+++ o3read-0.0.4/o3read.h	2005-08-29 17:35:02 +0400
@@ -34,3 +34,4 @@
 extern void *cmalloc(size_t);
 extern char *cstrdup(const char *);
 extern int cstrncasecmp(const char *, const char *, size_t);
+extern void putstring(const char *str);
diff -urN o3read-0.0.4.old/o3tohtml.c o3read-0.0.4/o3tohtml.c
--- o3read-0.0.4.old/o3tohtml.c	2005-01-07 11:28:47 +0300
+++ o3read-0.0.4/o3tohtml.c	2005-08-29 17:37:33 +0400
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <locale.h>
 
 #include "o3read.h"
 
@@ -302,6 +303,8 @@
 */
 static void text(hnode *h, hstate *s)
 {
+	putstring(h->text);
+	/* TODO: Lav: fix later
 	int i;
 	for (i = 0; h->text[i]; i++) {
 		switch (h->text[i]) {
@@ -312,9 +315,10 @@
 			printf("&gt;");
 			break;
 		default:
-			putchar(h->text[i]);
+			putchar_locale(h->text[i]);
 		}
 	}
+	*/
 	/* can't have children */
 	tree(h->next, s);
 }
@@ -340,7 +344,7 @@
 
 	href = 0;
 	hrefs = NULL;
-
+	setlocale(LC_ALL, "");
 	h = parse_html(nextc, stdin);
 	if (h == NULL) usage();
 
diff -urN o3read-0.0.4.old/o3totxt.c o3read-0.0.4/o3totxt.c
--- o3read-0.0.4.old/o3totxt.c	2005-01-07 11:28:47 +0300
+++ o3read-0.0.4/o3totxt.c	2005-08-29 17:37:30 +0400
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <locale.h>
 
 #include "o3read.h"
 
@@ -113,9 +114,12 @@
 static void text(hnode *h, hstate *s)
 {
 	int i;
+	putstring(h->text);
+	/*
 	for (i = 0; h->text[i]; i++) {
-		putchar(h->text[i]);
+		putchar_locale(h->text[i]);
 	}
+	*/
 	/* can't have children */
 	tree(h->next, s);
 }
@@ -141,7 +145,7 @@
 
 	href = 0;
 	hrefs = NULL;
-
+	setlocale(LC_ALL, "");
 	h = parse_html(nextc, stdin);
 	if (h == NULL) usage();