BSD 4_3_Net_2 release
[unix-history] / usr / src / games / atc / main.c
index 24218d7..e4ce3d0 100644 (file)
@@ -1,3 +1,39 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ed James.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
 /*
  * Copyright (c) 1987 by Ed James, UC Berkeley.  All rights reserved.
  *
 /*
  * Copyright (c) 1987 by Ed James, UC Berkeley.  All rights reserved.
  *
@@ -7,7 +43,18 @@
  * For more info on this and all of my stuff, mail edjames@berkeley.edu.
  */
 
  * For more info on this and all of my stuff, mail edjames@berkeley.edu.
  */
 
+#ifndef lint
+char copyright[] =
+"@(#) Copyright (c) 1990 The Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)main.c     5.4 (Berkeley) 3/5/91";
+#endif /* not lint */
+
 #include "include.h"
 #include "include.h"
+#include "pathnames.h"
 
 main(ac, av)
        char    *av[];
 
 main(ac, av)
        char    *av[];
@@ -20,8 +67,8 @@ main(ac, av)
 #ifdef BSD
        struct itimerval        itv;
 #endif
 #ifdef BSD
        struct itimerval        itv;
 #endif
-       extern int              update(), quit(), log_score();
        extern char             *default_game(), *okay_game();
        extern char             *default_game(), *okay_game();
+       extern void             log_score(), quit(), update();
 
        start_time = seed = time(0);
 
 
        start_time = seed = time(0);
 
@@ -81,7 +128,7 @@ main(ac, av)
        if (f_printpath) {
                char    buf[100];
 
        if (f_printpath) {
                char    buf[100];
 
-               strcpy(buf, SPECIAL_DIR);
+               strcpy(buf, _PATH_GAMES);
                buf[strlen(buf) - 1] = '\0';
                puts(buf);
        }
                buf[strlen(buf) - 1] = '\0';
                puts(buf);
        }
@@ -199,7 +246,7 @@ default_game()
        static char     file[256];
        char            line[256], games[256];
 
        static char     file[256];
        char            line[256], games[256];
 
-       strcpy(games, SPECIAL_DIR);
+       strcpy(games, _PATH_GAMES);
        strcat(games, GAMES);
 
        if ((fp = fopen(games, "r")) == NULL) {
        strcat(games, GAMES);
 
        if ((fp = fopen(games, "r")) == NULL) {
@@ -212,7 +259,7 @@ default_game()
        }
        fclose(fp);
        line[strlen(line) - 1] = '\0';
        }
        fclose(fp);
        line[strlen(line) - 1] = '\0';
-       strcpy(file, SPECIAL_DIR);
+       strcpy(file, _PATH_GAMES);
        strcat(file, line);
        return (file);
 }
        strcat(file, line);
        return (file);
 }
@@ -225,7 +272,7 @@ okay_game(s)
        static char     file[256];
        char            *ret = NULL, line[256], games[256];
 
        static char     file[256];
        char            *ret = NULL, line[256], games[256];
 
-       strcpy(games, SPECIAL_DIR);
+       strcpy(games, _PATH_GAMES);
        strcat(games, GAMES);
 
        if ((fp = fopen(games, "r")) == NULL) {
        strcat(games, GAMES);
 
        if ((fp = fopen(games, "r")) == NULL) {
@@ -235,7 +282,7 @@ okay_game(s)
        while (fgets(line, sizeof(line), fp) != NULL) {
                line[strlen(line) - 1] = '\0';
                if (strcmp(s, line) == 0) {
        while (fgets(line, sizeof(line), fp) != NULL) {
                line[strlen(line) - 1] = '\0';
                if (strcmp(s, line) == 0) {
-                       strcpy(file, SPECIAL_DIR);
+                       strcpy(file, _PATH_GAMES);
                        strcat(file, line);
                        ret = file;
                        break;
                        strcat(file, line);
                        ret = file;
                        break;
@@ -258,7 +305,7 @@ list_games()
        char            line[256], games[256];
        int             num_games = 0;
 
        char            line[256], games[256];
        int             num_games = 0;
 
-       strcpy(games, SPECIAL_DIR);
+       strcpy(games, _PATH_GAMES);
        strcat(games, GAMES);
 
        if ((fp = fopen(games, "r")) == NULL) {
        strcat(games, GAMES);
 
        if ((fp = fopen(games, "r")) == NULL) {