diff --git a/src/cmd.c b/src/cmd.c
index bfddbce..39bb169 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -332,6 +332,7 @@ void cmd_movenow(void) {}
  * dir. Again, how does one handle paths portably across Unix/Windows?
  *   -- Lukas 
  */
+#ifdef DEBUG
 void cmd_name(void)
 {
   int suffix = 0;
@@ -358,6 +359,12 @@ void cmd_name(void)
   fprintf(stderr, "Could not create logfile, all slots occupied.\n");
   fprintf(stderr, "You may consider deleting or renaming your existing logfiles.\n");
 }
+#else /* !DEBUG */
+void cmd_name(void)
+{
+   ofp = stdout;
+}
+#endif /* DEBUG */
 
 void cmd_new(void)
 {
diff --git a/src/common.h b/src/common.h
index 18ed6e2..e24cdaf 100644
--- a/src/common.h
+++ b/src/common.h
@@ -716,7 +716,6 @@ void DBTest (void);
 
 /* Input thread and thread function */
 #include <pthread.h>
-extern pthread_t input_thread;
 void *input_func(void *);
 
 /*
diff --git a/src/epd.c b/src/epd.c
index 755c4d5..da908e9 100644
--- a/src/epd.c
+++ b/src/epd.c
@@ -321,7 +321,7 @@ void SaveEPD (char *p)
    int r, c, sq, k;
    char c1;
 
-   sscanf (p, "%s ", file);
+   sscanf (p, "%31s ", file);
    fp = fopen (file, "a");
    for (r = A8; r >= A1; r -= 8)
    {
diff --git a/src/gnuchessx b/src/gnuchessx
index 17dfadc..67c49c0 100755
--- a/src/gnuchessx
+++ b/src/gnuchessx
@@ -8,5 +8,6 @@
 # bug in some old Unix-like systems; see the GNU autoconf documentation
 # for the rationale.
 
+echo "gnuchessx is obsolete, please read the manpage for details." >&2
 gnuchess xboard ${1+"$@"}
 
diff --git a/src/lexpgn.l b/src/lexpgn.l
index fe5ccf0..25a72f4 100644
--- a/src/lexpgn.l
+++ b/src/lexpgn.l
@@ -178,7 +178,7 @@ NONSPACE	[^ \t\n\r\f]
 <tagsymbol>blackELO		{ctag = BLACK_ELO_TAG; BEGIN(tagsep);}
 <tagsymbol>[a-z0-9_]+		{
 	ctag = OTHER_TAG;
-	if (yyleng >= (sizeof(tagname)-1)) {
+	if ((size_t)yyleng >= (sizeof(tagname)-1)) {
 		printf("Error, tagname too long: %s", yytext);
 		return 1;
 	}
@@ -313,6 +313,7 @@ NONSPACE	[^ \t\n\r\f]
 				append_str(&pgn_othertags, "\"]\n");
 			}
 			break;
+		case NO_TAG: /* Nothing */ ;
 	}
 	}
 
diff --git a/src/pgn.c b/src/pgn.c
index 7bd90e4..cfddbae 100644
--- a/src/pgn.c
+++ b/src/pgn.c
@@ -39,6 +39,7 @@
 #define NULL2EMPTY(x) ( (x) ? (x) : "")
 
 extern FILE *yyin;
+extern int yylex(void);
 
 void PGNSaveToFile (const char *file, const char *resultstr)
 /****************************************************************************
@@ -49,7 +50,7 @@ void PGNSaveToFile (const char *file, const char *resultstr)
  ****************************************************************************/
 {
    FILE *fp;
-   char s[100];
+   char s[100], s2[100];
    int len;
    char *p;
    int i;
@@ -126,9 +127,11 @@ void PGNSaveToFile (const char *file, const char *resultstr)
    for (i = 0; i <= GameCnt; i++)
    {
       if (! (i % 2)) {
-        sprintf (s, "%s%d. ", s, i/2 + 1);
+        sprintf (s2, "%d. ", i/2 + 1);
+        strcat (s, s2);
       }
-      sprintf (s, "%s%s ", s, Game[i].SANmv);
+      strcat (s, Game[i].SANmv);
+      strcat (s, " ");
       if (strlen (s) > 80)
       {
          p = s + 79;
@@ -300,7 +303,7 @@ static const char *const trusted_players[] = {
 int IsTrustedPlayer(const char *name)
 /* Return 1 if name in trusted_players list, else 0 */
 {
-	int i;
+	size_t i;
 	for (i = 0; i < (sizeof(trusted_players) / sizeof(*trusted_players));
 	    	i++) {
 		if (strstr(name, trusted_players[i]) != NULL)
