1: /* @(#)syskludge.c	4.1 (Berkeley) 1/1/83 */
   2: 
   3: #include <sys/param.h>
   4: 
   5: /*
   6:  * Prefix table.
   7:  * If a prefix is "xyz", for example,
   8:  * then any file Spool/xyz... is mapped to Spool/xyz/xyz... .
   9:  * The first prefix found is used, so D.foo should preceed D. in table.
  10:  * Should be tuned on a per-system basis.
  11:  *
  12:  * Each prefix must be a subdirectory of Spool, owned by uucp!
  13:  */
  14: 
  15: static char *prefix[] = {
  16:     "D.decvax",
  17:     "D.ucsfcgl",
  18:     "D.npois",
  19:     "D.ihnss",
  20:     "D.cbosgd",
  21:     "D.cbosg",
  22:     "D.ucbvaxB",
  23:     "D.ucbvax",
  24:     "D.ucb",
  25:     "LOG.",
  26:     "LTMP.",
  27:     "STST.",
  28:     "D.",       /* "D." subdirectory (remember the "."!) */
  29:     "C.",       /* "C." subdirectory */
  30:     "X.",
  31:     0
  32: };
  33: 
  34: /*
  35:  * filename mapping kludges to put uucp work files in other directories.
  36:  */
  37: 
  38: char    fn1[MAXPATHLEN], fn2[MAXPATHLEN];   /* remapped filename areas */
  39: char    sfn[MAXPATHLEN];    /* most recent filename passed to chdir */
  40: 
  41: extern  char *Spool;
  42: 
  43: char    *strcpy(), *strcat();
  44: 
  45: /*
  46:  * return (possibly) remapped string s,
  47:  * using buffer area t if necessary.
  48:  */
  49: static char *
  50: _dofix(s, t)
  51: register char *s, *t;
  52: {
  53:     register char **p;
  54:     register int n;
  55:     char *os;
  56: 
  57:     os = s;
  58:     t[0] = '\0';
  59: 
  60:     /* if s begins with Spool/, copy that to t and advance s */
  61:     if (strncmp(s, Spool, n = strlen(Spool)) == 0 && s[n] == '/') {
  62:         strcpy(t, Spool);
  63:         strcat(t, "/");
  64:         s += n + 1;
  65:     }
  66:     else
  67:         if (strcmp(sfn, Spool))
  68:             return(os);
  69: 
  70:     /* look for first prefix which matches, and make subdirectory */
  71:     for (p = &prefix[0]; *p; p++) {
  72:         if (strncmp(s, *p, n = strlen(*p))==0 && s[n] && s[n] != '/') {
  73:             strcat(t, *p);
  74:             strcat(t, "/");
  75:             strcat(t, s);
  76:             return(t);
  77:         }
  78:     }
  79:     return(os);
  80: }
  81: 
  82: char *
  83: _fixf(s)
  84: char *s;
  85: {
  86:     return(_dofix(s, fn1));
  87: }
  88: 
  89: char *
  90: _fixf2(s)
  91: char *s;
  92: {
  93:     return(_dofix(s, fn2));
  94: }
  95: 
  96: 
  97: /*
  98:  * save away filename
  99:  */
 100: char *
 101: _savfile(s)
 102: char *s;
 103: {
 104:     return(strcpy(sfn, s));
 105: }

Defined functions

_dofix defined in line 49; used 2 times
_fixf defined in line 82; used 2 times
_fixf2 defined in line 89; used 2 times
_savfile defined in line 100; used 1 times

Defined variables

fn1 defined in line 38; used 1 times
  • in line 86
fn2 defined in line 38; used 1 times
  • in line 93
prefix defined in line 15; used 1 times
  • in line 71
sfn defined in line 39; used 2 times
Last modified: 1983-01-02
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 690
Valid CSS Valid XHTML 1.0 Strict