Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Commit [d0e7b1] Maximize Restore History

Relocate gencat sources to tools directory.

Keith Marshall Keith Marshall 2006-01-04

removed gencat
removed gencat/Makefile.in
changed ChangeLog
changed configure
changed configure.ac
changed tools
changed tools/Makefile.in
copied gencat/gencat.h -> tools/gencat.h
copied gencat/msgcat.h -> tools/msgcat.h
copied gencat/gencat.c -> tools/gencat.c
copied gencat/genlib.c -> tools/genlib.c
gencat
File was removed.
gencat/Makefile.in
File was removed.
ChangeLog Diff Switch to side-by-side view
Loading...
configure Diff Switch to side-by-side view
Loading...
configure.ac Diff Switch to side-by-side view
Loading...
tools
Directory.
tools/Makefile.in Diff Switch to side-by-side view
Loading...
gencat/gencat.h to tools/gencat.h
File was copied or renamed.
gencat/msgcat.h to tools/msgcat.h
File was copied or renamed.
gencat/gencat.c to tools/gencat.c
--- a/gencat/gencat.c
+++ b/tools/gencat.c
@@ -42,11 +42,15 @@
 
 #include <stdio.h>
 #include <sys/types.h>
-#ifdef SYSV
+#ifdef STDC_HEADERS
+#include <stdlib.h>
 #include <sys/fcntl.h>
 #include <string.h>
 #else
 #include <strings.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
 #endif
 #include <sys/file.h>
 #include <sys/stat.h>
@@ -75,27 +79,26 @@
  * will be in C syntax, in bar.H in C++ syntax.
  */
 
-static void writeIfChanged(
 #if defined(__STDC__) || defined(__cplusplus)
-		char *fname, int lang, int orConsts
-#endif
-);
+void usage( void );
+static void writeIfChanged( char *fname, int lang, int orConsts );
+#else
+static void writeIfChanged();
+#endif
 
 void usage() {
     fprintf(stderr, "Use: gencat [-new] [-or] [-lang C|C++|ANSIC] catfile msgfile [-h <header-file>]...\n");
 }
 
-int main(
 #if defined(__STDC__) || defined(__cplusplus)
-		int argc, char *argv[])
-#else
-		argc, argv)
+int main( int argc, char *argv[] )
+#else
+int main( argc, argv )
 int argc;
 char *argv[];
 #endif
 {
     int		ofd, ifd, i;
-    FILE	*fptr;
     char	*catfile = NULL;
     char	*input = NULL;
     int		lang = MCLangC;
@@ -174,11 +177,10 @@
     return 0; /* just for gcc */
 }
 
-static void writeIfChanged(
 #if defined(__STDC__) || defined(__cplusplus)
-		char *fname, int lang, int orConsts)
-#else
-		fname, lang, orConsts)
+static void writeIfChanged( char *fname, int lang, int orConsts )
+#else
+static void writeIfChanged( fname, lang, orConsts )
 char *fname;
 int lang;
 int orConsts;
@@ -188,7 +190,7 @@
     char	buf[BUFSIZ], tbuf[BUFSIZ], *cptr, *tptr;
     int		fd, tfd;
     int		diff = False;
-    int		c, len, tlen;
+    int		len, tlen;
     struct stat	sbuf;
 
     /* If it doesn't exist, just create it */
gencat/genlib.c to tools/genlib.c
--- a/gencat/genlib.c
+++ b/tools/genlib.c
@@ -48,24 +48,18 @@
 */
 
 #include <stdio.h>
-#ifdef SYSV
+#ifdef STDC_HEADERS
+#include <stdlib.h>
 #include <sys/types.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 #ifndef __linux__
 #include <memory.h>
-static int bcopy(src, dst, length)
-char *src, *dst;
-int length;
-{
-    memcpy(dst, src, length);
-}
-static int bzero(b, length)
-char *b;
-int length;
-{
-    memset(b, '\0', length);
-}
+#define bcopy(src, dst, len)  memcpy((dst), (src), (len))
+#define bzero(dst, len)       memset((dst), '\0', (len))
 #endif
 
 #endif
@@ -85,11 +79,31 @@
 static char *curline = NULL;
 static long lineno = 0;
 
+#if defined(__STDC__) || defined(__cplusplus)
+/* prototype all static functions,
+ * to placate GCC when strict/missing prototype warnings are enabled
+ */
+static void warning( char *, char * );
+static void error( char *, char * );
+static void corrupt( void );
+static void nomem( void );
+static char *my_getline( int );
+static char *token( char * );
+static char *wskip( char * );
+static char *cskip( char * );
+static char *getmsg( int, char *, char );
+static char *dupstr( char * );
+static void printS( int, char * );
+static void printL( int, long );
+static void printLX( int, long );
+static void genconst( int, int, char *, char *, long );
+#endif
+
 static void warning(cptr, msg)
 char *cptr;
 char *msg;
 {
-    fprintf(stderr, "gencat: %s on line %d\n", msg, lineno);
+    fprintf(stderr, "gencat: %s on line %ld\n", msg, lineno);
     fprintf(stderr, "%s\n", curline);
     if (cptr) {
 	char	*tptr;
@@ -117,7 +131,7 @@
 static char *my_getline(fd)
 int fd;
 {
-    static long	len = 0, curlen = BUFSIZ;
+    static long	curlen = BUFSIZ;
     static char	buf[BUFSIZ], *bptr = buf, *bend = buf;
     char	*cptr, *cend;
     long	buflen;
@@ -169,6 +183,7 @@
     *tptr = '\0';
     return(tok);
 }
+
 static char *wskip(cptr)
 char *cptr;
 {
@@ -179,6 +194,7 @@
     while (*cptr && isspace(*cptr)) ++cptr;
     return(cptr);
 }
+
 static char *cskip(cptr)
 char *cptr;
 {
@@ -288,8 +304,6 @@
     return(msg);
 }
 
-
-
 static char *dupstr(ostr)
 char *ostr;
 {
@@ -340,21 +354,14 @@
     else return MCn86ByteOrder;
 }
 
-
-void MCParse(
-#if PROTO
-		int fd)
-#else
-		fd)
-int fd;
-#endif
+void MCParse(fd)
+int fd;
 {
     char	*cptr, *str;
     int	setid, msgid = 0;
     char	hconst[MAXTOKEN+1];
     char	quote = 0;
-    int		i;
-    
+
     if (!cat) {
 	cat = (catT *) malloc(sizeof(catT));
 	if (!cat) nomem();
@@ -363,7 +370,7 @@
 
     hconst[0] = '\0';
     
-    while (cptr = my_getline(fd)) {
+    while ((cptr = my_getline(fd)) != NULL) {
 	if (*cptr == '$') {
 	    ++cptr;
 	    if (strncmp(cptr, "set", 3) == 0) {
@@ -436,13 +443,8 @@
     }
 }
 
-void MCReadCat(
-#if PROTO
-		int fd)
-#else
-		fd)
-int fd;
-#endif
+void MCReadCat(fd)
+int fd;
 {
     MCHeaderT	mcHead;
     MCMsgT	mcMsg;
@@ -519,6 +521,7 @@
 {
     write(fd, str, strlen(str));
 }
+
 static void printL(fd, l)
 int fd;
 long l;
@@ -527,6 +530,7 @@
     sprintf(buf, "%ld", l);
     write(fd, buf, strlen(buf));
 }
+
 static void printLX(fd, l)
 int fd;
 long l;