BSD 4_4 release
[unix-history] / usr / src / old / refer / refer / refer1.c
index 1c62d1d..2ce581a 100644 (file)
@@ -1,9 +1,16 @@
+/*-
+ * This module is believed to contain source code proprietary to AT&T.
+ * Use and redistribution is subject to the Berkeley Software License
+ * Agreement and your Software Agreement with AT&T (Western Electric).
+ */
+
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)refer1.c    4.2 (Berkeley) %G%";
-#endif
+static char sccsid[] = "@(#)refer1.c   4.6 (Berkeley) 4/18/91";
+#endif /* not lint */
 
 #include <signal.h>
 #include "refer..c"
 
 #include <signal.h>
 #include "refer..c"
+#include "pathnames.h"
 
 main(argc,argv)                /* process command-line arguments */
 char *argv[];
 
 main(argc,argv)                /* process command-line arguments */
 char *argv[];
@@ -80,24 +87,25 @@ char *argv[];
        if (getenv("REFER") != NULL)
                *search++ = getenv("REFER");
        else if (nodeflt == 0)
        if (getenv("REFER") != NULL)
                *search++ = getenv("REFER");
        else if (nodeflt == 0)
-               *search++ = "/usr/dict/papers/Ind";
+               *search++ = _PATH_IND;
+       if (!labels) {
+               sprintf(ofile, "%s/rj%db", _PATH_TMP, getpid());
+               ftemp = fopen(ofile, "w");
+               if (ftemp == NULL) {
+                       fprintf(stderr, "Can't open scratch file\n");
+                       exit(1);
+               }
+       }
        if (endpush) {
        if (endpush) {
-               sprintf(tfile, "/tmp/rj%da", getpid());
+               sprintf(tfile, "%s/rj%da", _PATH_TMP, getpid());
                fo = fopen(tfile, "w");
                if (fo == NULL) {
                        fo = ftemp;
                        fprintf(stderr, "Can't open scratch file");
                }
                sep = 002; /* separate records without confusing sort..*/
                fo = fopen(tfile, "w");
                if (fo == NULL) {
                        fo = ftemp;
                        fprintf(stderr, "Can't open scratch file");
                }
                sep = 002; /* separate records without confusing sort..*/
-       }
-       if (sort && !labels) {
-               sprintf(ofile, "/tmp/rj%db", getpid());
-               ftemp = fopen(ofile, "w");
-               if (ftemp == NULL) {
-                       fprintf(stderr, "Can't open scratch file\n");
-                       exit(1);
-               }
-       }
+       } else 
+               fo = ftemp;
        do {
                if (argc > 1) {
                        fclose(in);
        do {
                if (argc > 1) {
                        fclose(in);
@@ -126,17 +134,17 @@ char *argv[];
        if (endpush && fo != NULL)
                dumpold();
        output("");
        if (endpush && fo != NULL)
                dumpold();
        output("");
-       if (sort && !labels)
+       if (!labels)
                recopy(ofile);
        clfgrep();
        cleanup();
        exit(0);
 }
 
                recopy(ofile);
        clfgrep();
        cleanup();
        exit(0);
 }
 
-extern int intr();
-
 signals()
 {
 signals()
 {
+       void intr();
+
        if (signal(SIGINT, SIG_IGN) != SIG_IGN)
                signal(SIGINT, intr);
        signal(SIGHUP, intr);
        if (signal(SIGINT, SIG_IGN) != SIG_IGN)
                signal(SIGINT, intr);
        signal(SIGHUP, intr);
@@ -144,6 +152,7 @@ signals()
        signal(SIGTERM, intr);
 }
 
        signal(SIGTERM, intr);
 }
 
+void
 intr()
 {
        signal(SIGINT, SIG_IGN);
 intr()
 {
        signal(SIGINT, SIG_IGN);