[ds6-devel] nc6/src circ_buf.c,1.17,1.18 connection.c,1.18,1.19 filter.c,1.16,1.17 io_stream.c,1.17,1.18 main.c,1.16,1.17 misc.c,1.12,1.13 misc.h,1.14,1.15 network.c,1.29,1.30 parser.c,1.33,1.34 readwrite.c,1.29,1.30

simone at deepspace6.net simone at deepspace6.net
Sat Jan 11 15:05:50 CET 2003


Update of /ds6/cvs/nc6/src

Modified Files:
	circ_buf.c connection.c filter.c io_stream.c main.c misc.c 
	misc.h network.c parser.c readwrite.c 
Log Message:

String marking for i18n completed.

>From now on, please use _("strings") anytime you add a new literal
string that you think it makes sense to translate.

What have been done:
Many "strings" have been transformed in _("strings)
_() is a macro, currently it's in misc.h and does nothing.



Index: circ_buf.c
===================================================================
RCS file: /ds6/cvs/nc6/src/circ_buf.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- circ_buf.c	10 Jan 2003 21:08:29 -0000	1.17
+++ circ_buf.c	11 Jan 2003 14:05:47 -0000	1.18
@@ -40,8 +40,8 @@
 	    cb->buf == NULL ||
 	    cb->ptr == NULL ||
 	    cb->buf_size < cb->data_size) 
-		fatal("internal error with circular buffers: please "
-		      "contact the authors of nc6 for bugfixing ;-)");
+		fatal(_("internal error with circular buffers: please "
+		        "contact the authors of nc6 for bugfixing ;-)"));
 }
 #else
 #define cb_assert(CB)	do {} while(0)
Index: connection.c
===================================================================
RCS file: /ds6/cvs/nc6/src/connection.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- connection.c	5 Jan 2003 13:40:01 -0000	1.18
+++ connection.c	11 Jan 2003 14:05:47 -0000	1.19
@@ -92,7 +92,7 @@
 #ifdef ENABLE_IPV6
 			ainfo->ai_family = PF_INET6;
 #else
-			fatal("internal error: system does not support ipv6");
+			fatal(_("internal error: system does not support ipv6"));
 #endif
 			break;
 		case PROTO_IPv4:
@@ -102,7 +102,7 @@
 			ainfo->ai_family = PF_UNSPEC;
 			break;
 		default:
-			fatal("internal error: unknown socket domain");
+			fatal(_("internal error: unknown socket domain"));
 	}
 	
 	switch (attrs->protocol) {
@@ -123,7 +123,7 @@
 			ainfo->ai_socktype = SOCK_STREAM;
 			break;
 		default:
-			fatal("internal error: unknown socket type");
+			fatal(_("internal error: unknown socket type"));
 	}
 }
 
@@ -132,24 +132,24 @@
 {
 	switch (attrs->remote_stream.socktype) {
 	case SOCK_STREAM:
-		warn("using stream socket");
+		warn(_("using stream socket"));
 		break;
 	case SOCK_DGRAM:
-		warn("using datagram socket");
+		warn(_("using datagram socket"));
 		break;
 	default:
-		fatal("internal error: unsupported socktype %d",
+		fatal(_("internal error: unsupported socktype %d"),
 		      attrs->remote_stream.socktype);
 	}
 
-	warn("using remote receive buffer size of %d",
+	warn(_("using remote receive buffer size of %d"),
 	     attrs->remote_buffer.buf_size);
 
 	if (attrs->remote_stream.nru)
-		warn("using remote receive nru of %d",
+		warn(_("using remote receive nru of %d"),
 		     attrs->remote_stream.nru);
 
 	if (attrs->remote_stream.mtu)
-		warn("using remote send mtu of %d",
+		warn(_("using remote send mtu of %d"),
 		     attrs->remote_stream.mtu);
 }
Index: filter.c
===================================================================
RCS file: /ds6/cvs/nc6/src/filter.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- filter.c	5 Jan 2003 13:40:01 -0000	1.16
+++ filter.c	11 Jan 2003 14:05:47 -0000	1.17
@@ -194,7 +194,7 @@
 	
 	err = getaddrinfo(addr->address, addr->service, &hints, &res);
 	if (err != 0) 
-		fatal("getaddrinfo error: %s", gai_strerror(err));
+		fatal(_("getaddrinfo error: %s"), gai_strerror(err));
 
 	for (ptr = res; ptr != NULL; ptr = ptr->ai_next) {
 
Index: io_stream.c
===================================================================
RCS file: /ds6/cvs/nc6/src/io_stream.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- io_stream.c	4 Jan 2003 14:41:47 -0000	1.17
+++ io_stream.c	11 Jan 2003 14:05:48 -0000	1.18
@@ -73,8 +73,8 @@
 	    ios->name == NULL ||
 	    ios->buf_in == NULL ||
 	    ios->buf_out == NULL)
-		fatal("internal error with I/O streams: please"
-		      "contact the authors of nc6 for bugfixing ;-)");
+		fatal(_("internal error with I/O streams: please"
+		      "contact the authors of nc6 for bugfixing ;-)"));
 }
 #else
 #define ios_assert(IOS) do {} while(0)
@@ -110,11 +110,11 @@
 	ios_assert(ios);
 
 	if ((ios->fd_in  = dup(STDIN_FILENO)) < 0) 
-		fatal("error in duplicating stdin file descriptor: %s", 
+		fatal(_("error in duplicating stdin file descriptor: %s"), 
 		      strerror(errno));
 	
 	if ((ios->fd_out = dup(STDOUT_FILENO)) < 0) 
-		fatal("error in duplicating stdout file descriptor: %s", 
+		fatal(_("error in duplicating stdout file descriptor: %s"), 
 		      strerror(errno));
 
 	/* pretend stdio is a stream socket */
@@ -183,9 +183,9 @@
 		timerclear(tv);
 #ifndef NDEBUG
 		if (is_flag_set(VERY_VERBOSE_MODE) == TRUE)
-			warn("%s hold timed out", ios->name);
+			warn(_("%s hold timed out"), ios->name);
 	} else if (is_flag_set(VERY_VERBOSE_MODE) == TRUE) {
-		warn("%s timer expires in %d.%06d",
+		warn(_("%s timer expires in %d.%06d"),
 		     ios->name, tv->tv_sec, tv->tv_usec);
 #endif
 	}
@@ -215,14 +215,14 @@
 		ios->rcvd += rr;
 #ifndef NDEBUG
 		if (is_flag_set(VERY_VERBOSE_MODE) == TRUE)
-			warn("read %d bytes from %s", rr, ios->name);
+			warn(_("read %d bytes from %s"), rr, ios->name);
 #endif
 		return rr;
 	} else if (rr == 0) {
 		/* read eof - close read stream */
 #ifndef NDEBUG
 		if (is_flag_set(VERY_VERBOSE_MODE) == TRUE)
-			warn("read eof from %s", ios->name);
+			warn(_("read eof from %s"), ios->name);
 #endif
 		ios_shutdown(ios, SHUT_RD);
 		return IOS_EOF;
@@ -233,7 +233,7 @@
 		/* weird error */
 #ifndef NDEBUG
 		if (is_flag_set(VERY_VERBOSE_MODE) == TRUE)
-			warn("error reading from %s: %s",
+			warn(_("error reading from %s: %s"),
 			     ios->name, strerror(errno));
 #endif
 		return IOS_FAILED;
@@ -262,7 +262,7 @@
 		ios->sent += rr;
 #ifndef NDEBUG
 		if (is_flag_set(VERY_VERBOSE_MODE) == TRUE)
-			warn("wrote %d bytes to %s", rr, ios->name);
+			warn(_("wrote %d bytes to %s"), rr, ios->name);
 #endif
 		/* shutdown the write if buf_out is empty and out_eof is set */
 		if (ios->out_eof && cb_is_empty(ios->buf_out))
@@ -278,9 +278,9 @@
 #ifndef NDEBUG
 		if (is_flag_set(VERY_VERBOSE_MODE) == TRUE) {
 			if (errno == EPIPE)
-				warn("received SIGPIPE on %s", ios->name);
+				warn(_("received SIGPIPE on %s"), ios->name);
 			else
-				warn("error writing to %s: %s",
+				warn(_("error writing to %s: %s"),
 				     ios->name, strerror(errno));
 		}
 #endif
@@ -321,7 +321,7 @@
 			close(ios->fd_out);
 #ifndef NDEBUG
 		if (is_flag_set(VERY_VERBOSE_MODE) == TRUE)
-			warn("closed %s", ios->name);
+			warn(_("closed %s"), ios->name);
 #endif
 		ios->fd_in = ios->fd_out = -1;
[...35 lines suppressed...]
Index: main.c
===================================================================
RCS file: /ds6/cvs/nc6/src/main.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- main.c	5 Jan 2003 13:40:01 -0000	1.16
+++ main.c	11 Jan 2003 14:05:48 -0000	1.17
@@ -91,7 +91,7 @@
 		do_connect(attrs);
 		break;
 	default:
-		fatal("internal error: unknown connection mode");
+		fatal(_("internal error: unknown connection mode"));
 	}
 }
 
@@ -118,7 +118,7 @@
 
 #ifndef NDEBUG
 		if (is_flag_set(VERY_VERBOSE_MODE) == TRUE)
-			warn("receiving from remote only, transmit disabled");
+			warn(_("receiving from remote only, transmit disabled"));
 #endif
 	}
 
@@ -135,7 +135,7 @@
 
 #ifndef NDEBUG
 		if (is_flag_set(VERY_VERBOSE_MODE) == TRUE)
-			warn("transmitting to remote only, receive disabled");
+			warn(_("transmitting to remote only, receive disabled"));
 #endif
 	}
 
@@ -143,7 +143,7 @@
 	retval = readwrite(remote_stream, local_stream);
 
 	if (is_flag_set(VERBOSE_MODE) == TRUE)
-		warn("connection closed (sent %d, rcvd %d)",
+		warn(_("connection closed (sent %d, rcvd %d)"),
 			ios_bytes_sent(remote_stream),
 			ios_bytes_received(remote_stream));
 
Index: misc.c
===================================================================
RCS file: /ds6/cvs/nc6/src/misc.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- misc.c	3 Jan 2003 00:14:39 -0000	1.12
+++ misc.c	11 Jan 2003 14:05:48 -0000	1.13
@@ -78,7 +78,7 @@
 {
 	register void *value = malloc(size);
 	
-	if (value == NULL) fatal("virtual memory exhausted");
+	if (value == NULL) fatal(_("virtual memory exhausted"));
 
 	return value;
 }
@@ -99,13 +99,13 @@
 {
 	int arg;
 	if ((arg = fcntl(fd, F_GETFL, 0)) < 0)
-		fatal("error reading file descriptor flags: %s",
+		fatal(_("error reading file descriptor flags: %s"),
 		      strerror(errno));
 
 	arg |= O_NONBLOCK;
 
 	if (fcntl(fd, F_SETFL, arg) < 0)
-		fatal("error setting flag O_NONBLOCK on file descriptor",
+		fatal(_("error setting flag O_NONBLOCK on file descriptor"),
 		      strerror(errno));
 }
 
@@ -122,9 +122,9 @@
 	errno = 0;
 	res = strtol(str, &c, 10);
 	if (errno == ERANGE || res > INT_MAX || res < INT_MIN)
-		fatal("error parsing integer: out of range");
+		fatal(_("error parsing integer: out of range"));
 	
-	if (*c != '\0') fatal("error parsing integer from string");
+	if (*c != '\0') fatal(_("error parsing integer from string"));
 
 	return ((int)res);
 }
Index: misc.h
===================================================================
RCS file: /ds6/cvs/nc6/src/misc.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- misc.h	3 Jan 2003 00:14:39 -0000	1.14
+++ misc.h	11 Jan 2003 14:05:48 -0000	1.15
@@ -90,4 +90,6 @@
 #define RCSID(X)
 #endif
 
+#undef _
+#define _(x) (x)
 #endif /* MISC_H */
Index: network.c
===================================================================
RCS file: /ds6/cvs/nc6/src/network.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- network.c	6 Jan 2003 15:04:44 -0000	1.29
+++ network.c	11 Jan 2003 14:05:48 -0000	1.30
@@ -83,7 +83,7 @@
 	/* get the address of the remote end of the connection */
 	err = getaddrinfo(remote->address, remote->service, &hints, &res);
 	if (err != 0)
-		fatal("forward host lookup failed for remote endpoint %s: %s",
+		fatal(_("forward host lookup failed for remote endpoint %s: %s"),
 		      remote->address, gai_strerror(err));
 
 	/* check the results of getaddrinfo */
@@ -127,7 +127,7 @@
 
 		/* this should never happen */
 		if (err != 0)
-			fatal("getnameinfo failed: %s", gai_strerror(err));
+			fatal(_("getnameinfo failed: %s"), gai_strerror(err));
 
 		/* get the real name for this destination as a string */
 		if (verbose_mode == TRUE && numeric_mode == FALSE) {
@@ -136,7 +136,7 @@
 			                  hbuf_rev, sizeof(hbuf_rev),
 					  sbuf_rev, sizeof(sbuf_rev), 0);
 			if (err != 0) {
-				warn("inverse lookup failed for %s: %s",
+				warn(_("inverse lookup failed for %s: %s"),
 				     hbuf_num, gai_strerror(err));
 				/* just make the real name the numeric string */
 				strcpy(hbuf_rev, hbuf_num);
@@ -154,7 +154,7 @@
 			/* ignore this address if it is not supported */
 			if (unsupported_sock_error(errno))
 				continue;
-			fatal("cannot create the socket: %s", strerror(errno));
+			fatal(_("cannot create the socket: %s"), strerror(errno));
 		}
 		
 #if defined(ENABLE_IPV6) && defined(IPV6_V6ONLY)
@@ -164,7 +164,7 @@
 			err = setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY,
 			                 &on, sizeof(on));
 			if (err < 0) 
-				warn("error with sockopt IPV6_V6ONLY");
+				warn(_("error with sockopt IPV6_V6ONLY"));
 		}
 #endif 
 
@@ -175,7 +175,7 @@
 			err = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
 			                 &on, sizeof(on));
 			if (err < 0) 
-				warn("error with sockopt TCP_NODELAY");
+				warn(_("error with sockopt TCP_NODELAY"));
 		}
 
 		/* setup local source address and/or service */
@@ -196,8 +196,8 @@
 			err = getaddrinfo(local->address, local->service,
 			                  &hints, &src_res);
 			if (err != 0)
-				fatal("forward host lookup failed "
-				      "for source address %s: %s",
+				fatal(_("forward host lookup failed "
+				        "for source address %s: %s"),
 				      local->address, gai_strerror(err));
 
 			/* check the results of getaddrinfo */
@@ -216,9 +216,9 @@
 				assert(src_ptr == NULL);
 				
 				if (verbose_mode == TRUE) {
-					warn("bind to source addr/port failed "
-					     "when connecting to "
-					     "%s [%s] %s (%s): %s",
+					warn(_("bind to source addr/port failed "
+					       "when connecting to "
+					       "%s [%s] %s (%s): %s"),
 					     hbuf_rev, hbuf_num,
 					     sbuf_num, sbuf_rev,
 					     strerror(errno));
@@ -260,13 +260,13 @@
 			} while (err < 0 && errno == EINTR);
 
 			if (err < 0)
-				fatal("select error: %s", strerror(errno));
+				fatal(_("select error: %s"), strerror(errno));
 			
 			if (err == 0) {
 				/* connection timed out */
 				if (is_flag_set(VERBOSE_MODE) == TRUE) {
-					warn("%s [%s] %s (%s): "
-					     "connect timed out",
+					warn(_("%s [%s] %s (%s): "
+					       "connect timed out"),
[...241 lines suppressed...]
Index: parser.c
===================================================================
RCS file: /ds6/cvs/nc6/src/parser.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- parser.c	6 Jan 2003 15:04:21 -0000	1.33
+++ parser.c	11 Jan 2003 14:05:48 -0000	1.34
@@ -153,8 +153,8 @@
 				set_flag(DONT_REUSE_ADDR);
 				break;
 			default:
-				fatal("getopt returned unexpected long option "
-				      "offset index %d\n", option_index);
+				fatal(_("getopt returned unexpected long option "
+				        "offset index %d\n"), option_index);
 			}
 			break;
 		case '4':
@@ -217,7 +217,7 @@
 			print_usage(stderr);
 			exit(EXIT_FAILURE);
 		default:	
-			fatal("getopt returned unexpected character 0%o\n", c);
+			fatal(_("getopt returned unexpected character 0%o\n"), c);
 		}
 	}
 	
@@ -255,7 +255,7 @@
 	if (is_flag_set(RECV_DATA_ONLY) == TRUE &&
 	    is_flag_set(SEND_DATA_ONLY) == TRUE)
 	{
-		fatal("Cannot set both --recv-only and --send-only");
+		fatal(_("Cannot set both --recv-only and --send-only"));
 	}
 
 	/* additional arguments are the remote address/service */
@@ -291,8 +291,8 @@
 
 	if (listen_mode == TRUE) {
 		if (local_address.service == NULL) {
-			warn("in listen mode you must specify a port "
-			     "with the -p switch");
+			warn(_("in listen mode you must specify a port "
+			       "with the -p switch"));
 			print_usage(stderr);
 			exit(EXIT_FAILURE);
 		}
@@ -300,8 +300,8 @@
 		ret = LISTEN_MODE;
 	} else {
 		if (is_flag_set(DONT_REUSE_ADDR) == TRUE) {
-			warn("--no-reuseaddr option "
-			     "can be used only in listen mode");
+			warn(_("--no-reuseaddr option "
+			       "can be used only in listen mode"));
 			print_usage(stderr);
 			exit(EXIT_FAILURE);
 		}
@@ -309,8 +309,8 @@
 		if (remote_address.address == NULL ||
 		    remote_address.service == NULL)
 		{
-			warn("you must specify the address/port couple "
-			     "of the remote endpoint");
+			warn(_("you must specify the address/port couple "
+			       "of the remote endpoint"));
 			print_usage(stderr);
 			exit(EXIT_FAILURE);
 		}
@@ -362,11 +362,11 @@
 {
 	const char *program_name = get_program_name();
 
-	fprintf(fp, "Usage:\n"
+	fprintf(fp, _("Usage:\n"
 "\t%s [options...] hostname port\n"
 "\t%s -l -p port [-s addr] [options...] [hostname] [port]\n\n"
-"Recognized options are:\n", program_name, program_name);
-	fprintf(fp,	
+"Recognized options are:\n"), program_name, program_name);
+	fprintf(fp, _(
 "  -4                Use only IPv4\n"
 "  -6                Use only IPv6\n"
 "  -h, --help        Display help\n"
@@ -393,7 +393,7 @@
 "                    Disable nagle algorithm for TCP connections\n"
 "      --no-reuseaddr\n"
 "                    Disable SO_REUSEADDR socket option (only in listen mode)\n"
-"\n");
+"\n"));
 }
 
 
Index: readwrite.c
===================================================================
RCS file: /ds6/cvs/nc6/src/readwrite.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- readwrite.c	4 Jan 2003 14:41:47 -0000	1.29
+++ readwrite.c	11 Jan 2003 14:05:48 -0000	1.30
@@ -128,7 +128,7 @@
 		if (rr < 0) {
 			if (errno == EINTR) 
 				continue;
-			fatal("select error: %s", strerror(errno));
+			fatal(_("select error: %s"), strerror(errno));
 		}
 		
 		if (ios1_read_fd >= 0 && FD_ISSET(ios1_read_fd, &read_fdset)) {



More information about the ds6-devel mailing list