BSD 4_4 release
[unix-history] / usr / src / usr.bin / uucp / libuu / subdir.c
index e4539dc..9cfac8d 100644 (file)
@@ -1,8 +1,20 @@
+/*-
+ * Copyright (c) 1985, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * 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[] = "@(#)subdir.c   5.3 (Berkeley) %G%";
-#endif
+static char sccsid[] = "@(#)subdir.c   8.1 (Berkeley) 6/6/93";
+#endif /* not lint */
 
 #include "uucp.h"
 
 #include "uucp.h"
+
+/*LINTLIBRARY*/
+
 /*
  * By Tom Truscott, March 1983
  *
 /*
  * By Tom Truscott, March 1983
  *
@@ -16,7 +28,7 @@ static char sccsid[] = "@(#)subdir.c  5.3 (Berkeley) %G%";
  * and check them manually every now and then.  Beware complacency!
  */
 
  * and check them manually every now and then.  Beware complacency!
  */
 
-static char *prefix[] = {
+static char *dprefix[] = {
        DLocalX,        /* Outbound 'xqt' request files */
        DLocal,         /* Outbound data files */
        "D.",           /* Other "D." files (remember the "."!) */
        DLocalX,        /* Outbound 'xqt' request files */
        DLocal,         /* Outbound data files */
        "D.",           /* Other "D." files (remember the "."!) */
@@ -68,7 +80,7 @@ char *as;
                        return as;
 
        /* look for first prefix which matches, and make subdirectory */
                        return as;
 
        /* look for first prefix which matches, and make subdirectory */
-       for (p = &prefix[0]; *p; p++) {
+       for (p = &dprefix[0]; *p; p++) {
                if (strncmp(s, *p, n = strlen(*p))==0 && s[n] && s[n] != '/') {
                        strcat(tptr, *p);
                        strcat(tptr, "/");
                if (strncmp(s, *p, n = strlen(*p))==0 && s[n] && s[n] != '/') {
                        strcat(tptr, *p);
                        strcat(tptr, "/");
@@ -92,6 +104,7 @@ register char *s;
 /*
  * return possibly corrected directory for searching
  */
 /*
  * return possibly corrected directory for searching
  */
+static char xdir[BUFSIZ];
 char *
 subdir(d, pre)
 register char *d, pre;
 char *
 subdir(d, pre)
 register char *d, pre;
@@ -99,7 +112,11 @@ register char *d, pre;
        if (strcmp(d, Spool) == 0)
                if (pre == CMDPRE)
                        return CMDSDIR;
        if (strcmp(d, Spool) == 0)
                if (pre == CMDPRE)
                        return CMDSDIR;
-               else if (pre == XQTPRE)
-                       return XEQTDIR;
+               else if (pre == XQTPRE) {
+                       if (xdir[0] == '\0')
+                               sprintf(xdir,"%s/X.",Spool);
+                       return xdir;
+
+               }
        return d;
 }
        return d;
 }