Lines Matching refs:name

18  * information: Portions Copyright [yyyy] [name of copyright owner]
37 * Network name modification routines.
44 static char *arpafix(char name[], char from[]);
46 static char *makeremote(char name[], char from[]);
47 static int mstash(char name[], int attnet);
54 static struct xtrahash *xlocate(char name[]);
60 static void optim(char net[], char name[]);
61 static void optim1(char netstr[], char name[]);
62 static int optimex(char net[], char name[]);
63 static int optimimp(char net[], char name[]);
64 static void prefer(char name[]);
69 * Map a name into the correct network "view" of the
70 * name. This is done by prepending the name with the
76 netmap(char name[], char from[])
81 if (debug) fprintf(stderr, "netmap(name '%s', from '%s')\n", name, from);
83 return(name); /* "from" is empty - can't do anything */
85 if (strcmp(from, name) == 0)
86 return(name); /* "from" and "name" are the same, do nothing */
89 * If the name contains an "@" or a "%", remove it and the host
92 if (any('@', name) || any('%', name))
93 return(arpafix(name, from));
96 * If the sender contains a "@" or a "%", make "name" into an
98 * really have read "name@from" when we received the message
99 * rather than just "name".
102 return(unuucp(makeremote(name, from)));
103 if (value("onehop") && (cp = strchr(name, '!')) && cp > name) {
106 * hop away (fat chance, in this day and age), and "name"
107 * is a UUCP path rather than just a name. Leave it alone.
109 nstrcpy(nbuf, sizeof (nbuf), name);
113 name = tackon(lasthost(from), name);
114 while (((cp = lasthost(from)) != 0) && ishost(cp, name)) {
115 oname = name;
116 name = strchr(name, '!') + 1;
119 if (value("mustbang") && !strchr(name, '!'))
120 name = oname;
121 return(unuucp(name));
127 snprintf(nbuf, sizeof (nbuf), "%s!%s", from, name);
129 if (debug) fprintf(stderr, "before optim, nbuf '%s'\n", name);
140 if (debug) fprintf(stderr, "wind up with '%s'\n", name);
141 if (!icequal(name, cp))
143 return(unuucp(name));
185 * Optionally translate an old format uucp name into a new one, e.g.
194 unuucp(char *name)
202 return name;
203 if (debug) fprintf(stderr, "unuucp(%s)\n", name);
204 nstrcpy(tname, sizeof (tname), name);
207 return name;
219 if (debug) fprintf(stderr, "host %s, name %s\n", hp, np);
226 * Turn a network machine name into a unique character
254 * Look for usual name
270 * Turn a network unique character identifier into a network name.
289 * name contains an "@" or "%". Look up the machine after it in
290 * the hash table. If it isn't found, return name unmolested.
291 * If ???, return name unmolested.
293 * name, and return the new string.
296 arpafix(char name[], char from[])
303 fprintf(stderr, "arpafix(%s, %s)\n", name, from);
305 cp = strrchr(name, '@');
307 cp = strrchr(name, '%');
311 return(name);
322 cp, name);
323 return(name);
328 cp, name);
329 return(name);
331 nstrcpy(newname, sizeof (newname), name);
341 * We have name with no @'s in it, and from with @'s.
342 * Assume that name is meaningful only on the site in from,
343 * and return "name@site_in_from".
346 makeremote(char name[], char from[])
352 return(name);
353 if (debug) fprintf(stderr, "makeremote(%s, %s) returns ", name, from);
357 snprintf(rbuf, sizeof (rbuf), "%s%s", name, cp);
393 static struct xtrahash *xtab[XHSIZE]; /* F: mid-->machine name */
417 * Stash a net name in the extra host hash table.
425 mstash(char name[], int attnet)
430 xp = xlocate(name);
441 xp->xh_name = savestr(name);
453 * Search for the given name in the hash table
461 xlocate(char name[])
467 for (h = 0, cp = name; *cp; h = (h << 2) + *cp++)
472 cp = name;
492 * Return the name from the extra host hash table corresponding
533 * Take a network name and optimize it. This gloriously messy
534 * operation takes place as follows: the name with machine names
535 * in it is tokenized by mapping each machine name into a single
538 * name is stripped off and assumed to be the destination user name --
540 * name "res!vax!res!uvax!bill" becomes, tokenized,
543 * machine names and tack the user name on the end.
545 * The result of this is copied into the parameter "name"
549 optim(char net[], char name[])
555 if (debug) fprintf(stderr, "optim(%s, %s) called\n", net, name);
568 * the destination user name. Go off and optimize
576 nstrcpy(name, BUFSIZ, net);
579 stradd(name, BUFSIZ, c);
580 stradd(name, BUFSIZ, *cp++);
589 printf(gettext("net name syntax\n"));
601 *name = '\0';
604 printf(gettext("Made up bad net name\n"));
610 nstrcat(name, BUFSIZ, cp2);
611 stradd(name, BUFSIZ, *cp++);
613 nstrcat(name, BUFSIZ, netcomp);
614 if (debug) fprintf(stderr, "optim returns %s in name\n", name);
625 optim1(char netstr[], char name[])
633 *name = '\0';
663 stradd(name, BUFSIZ, *cp2);
664 stradd(name, BUFSIZ, nc);
667 optiboth(name);
668 prefer(name);
710 * Do name optimization for an explicitly routed network (eg uucp).
714 optimex(char net[], char name[])
719 nstrcpy(name, STSIZ, net);
720 cp = name;
724 name[0] = 0;
727 for (cp = name; *cp; cp++) {
737 * Do name optimization for implicitly routed network (eg, arpanet).
741 optimimp(char net[], char name[])
751 *name = '\0';
754 name[0] = m;
755 name[1] = 0;
812 prefer(char name[])
818 for (cp = name; *cp; cp += 2) {
863 * Reverse all of the arpa net addresses in the given name to
874 if (name())
883 * name:
887 * term '@' name
888 * term '%' name
895 name(void)
913 if (name())
936 * Initialize the network name scanner.