sources-request@mirror.UUCP (02/18/87)
Submitted by: Larry Auton <lda@clyde.att.com> Mod.sources: Volume 8, Issue 69 Archive-name: smail2/Part03 #! /bin/sh # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # If all goes well, you will see the message "End of shell archive." # Contents: doc/rfc920.txt src/alias.c src/defs.h src/getopt.c # src/getpath.c src/lcasep.c src/pathproc.sh # Wrapped by rs@mirror on Mon Feb 9 17:10:04 1987 PATH=/bin:/usr/bin:/usr/ucb; export PATH echo shar: extracting "'doc/rfc920.txt'" '(27863 characters)' if test -f 'doc/rfc920.txt' ; then echo shar: will not over-write existing file "'doc/rfc920.txt'" else sed 's/^X//' >doc/rfc920.txt <<'@//E*O*F doc/rfc920.txt//' X X XNetwork Working Group J. Postel XRequest for Comments: 920 J. Reynolds X ISI X October 1984 X X Domain Requirements X X XStatus of this Memo X X This memo is a policy statement on the requirements of establishing a X new domain in the ARPA-Internet and the DARPA research community. X This is an official policy statement of the IAB and the DARPA. X Distribution of this memo is unlimited. X XIntroduction X X This memo restates and refines the requirements on establishing a X Domain first described in RFC-881 [1]. It adds considerable detail X to that discussion, and introduces the limited set of top level X domains. X XThe Purpose of Domains X X Domains are administrative entities. The purpose and expected use of X domains is to divide the name management required of a central X administration and assign it to sub-administrations. There are no X geographical, topological, or technological constraints on a domain. X The hosts in a domain need not have common hardware or software, nor X even common protocols. Most of the requirements and limitations on X domains are designed to ensure responsible administration. X X The domain system is a tree-structured global name space that has a X few top level domains. The top level domains are subdivided into X second level domains. The second level domains may be subdivided X into third level domains, and so on. X X The administration of a domain requires controlling the assignment of X names within that domain and providing access to the names and name X related information (such as addresses) to users both inside and X outside the domain. X X X X X X X X X X X X XPostel & Reynolds [Page 1] X X X XRFC 920 October 1984 XDomain Requirements X X XGeneral Purpose Domains X X While the initial domain name "ARPA" arises from the history of the X development of this system and environment, in the future most of the X top level names will be very general categories like "government", X "education", or "commercial". The motivation is to provide an X organization name that is free of undesirable semantics. X X After a short period of initial experimentation, all current X ARPA-Internet hosts will select some domain other than ARPA for their X future use. The use of ARPA as a top level domain will eventually X cease. X XInitial Set of Top Level Domains X X The initial top level domain names are: X X Temporary X X ARPA = The current ARPA-Internet hosts. X X Categories X X GOV = Government, any government related domains meeting the X second level requirements. X X EDU = Education, any education related domains meeting the X second level requirements. X X COM = Commercial, any commercial related domains meeting the X second level requirements. X X MIL = Military, any military related domains meeting the X second level requirements. X X ORG = Organization, any other domains meeting the second X level requirements. X X Countries X X The English two letter code (alpha-2) identifying a country X according the the ISO Standard for "Codes for the X Representation of Names of Countries" [5]. X X X X X X XPostel & Reynolds [Page 2] X X X XRFC 920 October 1984 XDomain Requirements X X X Multiorganizations X X A multiorganization may be a top level domain if it is large, X and is composed of other organizations; particularly if the X multiorganization can not be easily classified into one of the X categories and is international in scope. X XPossible Examples of Domains X X The following examples are fictions of the authors' creation, any X similarity to the real world is coincidental. X X The UC Domain X X It might be that a large state wide university with, say, nine X campuses and several laboratories may want to form a domain. Each X campus or major off-campus laboratory might then be a subdomain, X and within each subdomain, each department could be further X distinguished. This university might be a second level domain in X the education category. X X One might see domain style names for hosts in this domain like X these: X X LOCUS.CS.LA.UC.EDU X CCN.OAC.LA.UC.EDU X ERNIE.CS.CAL.UC.EDU X A.S1.LLNL.UC.EDU X A.LAND.LANL.UC.EDU X NMM.LBL.CAL.UC.EDU X X The MIT Domain X X Another large university may have many hosts using a variety of X machine types, some even using several families of protocols. X However, the administrators at this university may see no need for X the outside world to be aware of these internal differences. This X university might be a second level domain in the education X category. X X One might see domain style names for hosts in this domain like X these: X X APIARY-1.MIT.EDU X BABY-BLUE.MIT.EDU X CEZANNE.MIT.EDU X DASH.MIT.EDU X X XPostel & Reynolds [Page 3] X X X XRFC 920 October 1984 XDomain Requirements X X X MULTICS.MIT.EDU X TAC.MIT.EDU X XX.MIT.EDU X X The CSNET Domain X X There may be a consortium of universities and industry research X laboratories called, say, "CSNET". This CSNET is not a network X per se, but rather a computer mail exchange using a variety of X protocols and network systems. Therefore, CSNET is not a network X in the sense of the ARPANET, or an Ethernet, or even the X ARPA-Internet, but rather a community. Yet it does, in fact, have X the key property needed to form a domain; it has a responsible X administration. This consortium might be large enough and might X have membership that cuts across the categories in such a way that X it qualifies under the "multiorganization rule" to be a top level X domain. X X One might see domain style names for hosts in this domain like X these: X X CIC.CSNET X EMORY.CSNET X GATECH.CSNET X HP-LABS.CSNET X SJ.IBM.CSNET X UDEL.CSNET X UWISC.CSNET X XGeneral Requirements on a Domain X X There are several requirements that must be met to establish a X domain. In general, it must be responsibly managed. There must be a X responsible person to serve as an authoritative coordinator for X domain related questions. There must be a robust domain name lookup X service, it must be of at least a minimum size, and the domain must X be registered with the central domain administrator (the Network X Information Center (NIC) Domain Registrar). X X Responsible Person: X X An individual must be identified who has authority for the X administration of the names within the domain, and who seriously X takes on the responsibility for the behavior of the hosts in the X domain, plus their interactions with hosts outside the domain. X This person must have some technical expertise and the authority X within the domain to see that problems are fixed. X X XPostel & Reynolds [Page 4] X X X XRFC 920 October 1984 XDomain Requirements X X X If a host in a given domain somehow misbehaves in its interactions X with hosts outside the domain (e.g., consistently violates X protocols), the responsible person for the domain must be X competent and available to receive reports of problems, take X action on the reported problems, and follow through to eliminate X the problems. X X Domain Servers: X X A robust and reliable domain server must be provided. One way of X meeting this requirement is to provide at least two independent X domain servers for the domain. The database can, of course, be X the same. The database can be prepared and copied to each domain X server. But, the servers should be in separate machines on X independent power supplies, et cetera; basically as physically X independent as can be. They should have no common point of X failure. X X Some domains may find that providing a robust domain service can X most easily be done by cooperating with another domain where each X domain provides an additional server for the other. X X In other situations, it may be desirable for a domain to arrange X for domain service to be provided by a third party, perhaps on X hosts located outside the domain. X X One of the difficult problems in operating a domain server is the X acquisition and maintenance of the data. In this case, the data X are the host names and addresses. In some environments this X information changes fairly rapidly and keeping up-to-date data may X be difficult. This is one motivation for sub-domains. One may X wish to create sub-domains until the rate of change of the data in X a sub-domain domain server database is easily managed. X X In the technical language of the domain server implementation the X data is divided into zones. Domains and zones are not necessarily X one-to-one. It may be reasonable for two or more domains to X combine their data in a single zone. X X The responsible person or an identified technical assistant must X understand in detail the procedures for operating a domain server, X including the management of master files and zones. X X The operation of a domain server should not be taken on lightly. X There are some difficult problems in providing an adequate X service, primarily the problems in keeping the database up to X date, and keeping the service operating. X X XPostel & Reynolds [Page 5] X X X XRFC 920 October 1984 XDomain Requirements X X X The concepts and implementation details of the domain server are X given in RFC-882 [2] and RFC-883 [3]. X X Minimum Size: X X The domain must be of at least a minimum size. There is no X requirement to form a domain because some set of hosts is above X the minimum size. X X Top level domains must be specially authorized. In general, they X will only be authorized for domains expected to have over 500 X hosts. X X The general guideline for a second level domain is that it have X over 50 hosts. This is a very soft "requirement". It makes sense X that any major organization, such as a university or corporation, X be allowed as a second level domain -- even if it has just a few X hosts. X X Registration: X X Top level domains must be specially authorized and registered with X the NIC domain registrar. X X The administrator of a level N domain must register with the X registrar (or responsible person) of the level N-1 domain. This X upper level authority must be satisfied that the requirements are X met before authorization for the domain is granted. X X The registration procedure involves answering specific questions X about the prospective domain. A prototype of what the NIC Domain X Registrar may ask for the registration of a second level domain is X shown below. These questions may change from time to time. It is X the responsibility of domain administrators to keep this X information current. X X The administrator of a domain is required to make sure that host X and sub-domain names within that jurisdiction conform to the X standard name conventions and are unique within that domain. X X If sub-domains are set up, the administrator may wish to pass X along some of his authority and responsibility to a sub-domain X administrator. Even if sub-domains are established, the X responsible person for the top-level domain is ultimately X responsible for the whole tree of sub-domains and hosts. X X This does not mean that a domain administrator has to know the X X XPostel & Reynolds [Page 6] X X X XRFC 920 October 1984 XDomain Requirements X X X details of all the sub-domains and hosts to the Nth degree, but X simply that if a problem occurs he can get it fixed by calling on X the administrator of the sub-domain containing the problem. X XTop Level Domain Requirements X X There are very few top level domains, each of these may have many X second level domains. X X An initial set of top level names has been identified. Each of these X has an administrator and an agent. X X The top level domains: X X ARPA = The ARPA-Internet *** TEMPORARY *** X X Administrator: DARPA X Agent: The Network Information Center X Mailbox: HOSTMASTER@SRI-NIC.ARPA X X GOV = Government X X Administrator: DARPA X Agent: The Network Information Center X Mailbox: HOSTMASTER@SRI-NIC.ARPA X X EDU = Education X X Administrator: DARPA X Agent: The Network Information Center X Mailbox: HOSTMASTER@SRI-NIC.ARPA X X COM = Commercial X X Administrator: DARPA X Agent: The Network Information Center X Mailbox: HOSTMASTER@SRI-NIC.ARPA X X MIL = Military X X Administrator: DDN-PMO X Agent: The Network Information Center X Mailbox: HOSTMASTER@SRI-NIC.ARPA X X X X X X XPostel & Reynolds [Page 7] X X X XRFC 920 October 1984 XDomain Requirements X X X ORG = Organization X X Administrator: DARPA X Agent: The Network Information Center X Mailbox: HOSTMASTER@SRI-NIC.ARPA X X Countries X X The English two letter code (alpha-2) identifying a country X according the the ISO Standard for "Codes for the X Representation of Names of Countries" [5]. X X As yet no country domains have been established. As they are X established information about the administrators and agents X will be made public, and will be listed in subsequent editions X of this memo. X X Multiorganizations X X A multiorganization may be a top level domain if it is large, X and is composed of other organizations; particularly if the X multiorganization can not be easily classified into one of the X categories and is international in scope. X X As yet no multiorganization domains have been established. As X they are established information about the administrators and X agents will be made public, and will be listed in subsequent X editions of this memo. X X Note: The NIC is listed as the agent and registrar for all the X currently allowed top level domains. If there are other entities X that would be more appropriate agents and registrars for some or X all of these domains then it would be desirable to reassign the X responsibility. X XSecond Level Domain Requirements X X Each top level domain may have many second level domains. Every X second level domain must meet the general requirements on a domain X specified above, and be registered with a top level domain X administrator. X X X X X X X X XPostel & Reynolds [Page 8] X X X XRFC 920 October 1984 XDomain Requirements X X XThird through Nth Level Domain Requirements X X Each second level domain may have many third level domains, etc. X Every third level domain (through Nth level domain) must meet the X requirements set by the administrator of the immediately higher level X domain. Note that these may be more or less strict than the general X requirements. One would expect the minimum size requirements to X decrease at each level. X XThe ARPA Domain X X At the time the implementation of the domain concept was begun it was X thought that the set of hosts under the administrative authority of X DARPA would make up a domain. Thus the initial domain selected was X called ARPA. Now it is seen that there is no strong motivation for X there to be a top level ARPA domain. The plan is for the current X ARPA domain to go out of business as soon as possible. Hosts that X are currently members of the ARPA domain should make arrangements to X join another domain. It is likely that for experimental purposes X there will be a second level domain called ARPA in the ORG domain X (i.e., there will probably be an ARPA.ORG domain). X XThe DDN Hosts X X DDN hosts that do not desire to participate in this domain naming X system will continue to use the HOSTS.TXT data file maintained by the X NIC for name to address translations. This file will be kept up to X date for the DDN hosts. However, all DDN hosts will change their X names from "host.ARPA" to (for example) "host.DDN.MIL" some time in X the future. The schedule for changes required in DDN hosts will be X established by the DDN-PMO. X XImpact on Hosts X X What is a host administrator to do about all this? X X For existing hosts already operating in the ARPA-Internet, the X best advice is to sit tight for now. Take a few months to X consider the options, then select a domain to join. Plan X carefully for the impact that changing your host name will have on X both your local users and on their remote correspondents. X X For a new host, careful thought should be given (as discussed X below). Some guidance can be obtained by comparing notes on what X other hosts with similar administrative properties have done. X X The owner of a host may decide which domain to join, and the X X XPostel & Reynolds [Page 9] X X X XRFC 920 October 1984 XDomain Requirements X X X administrator of a domain may decide which hosts to accept into his X domain. Thus the owner of a host and a domain administrator must X come to an understanding about the host being in the domain. This is X the foundation of responsible administration. X X For example, a host "XYZ" at MIT might possible be considered as a X candidate for becoming any of XYZ.ARPA.ORG, XYZ.CSNET, or X XYZ.MIT.EDU. X X The owner of host XYZ may choose which domain to join, X depending on which domain administrators are willing to have X him. X X The domain is part of the host name. Thus if USC-ISIA.ARPA changes X its domain affiliation to DDN.MIL to become USC-ISIA.DDN.MIL, it has X changed its name. This means that any previous references to X USC-ISIA.ARPA are now out of date. Such old references may include X private host name to address tables, and any recorded information X about mailboxes such as mailing lists, the headers of old messages, X printed directories, and peoples' memories. X X The experience of the DARPA community suggests that changing the name X of a host is somewhat painful. It is recommended that careful X thought be given to choosing a new name for a host - which includes X selecting its place in the domain hierarchy. X XThe Roles of the Network Information Center X X The NIC plays two types of roles in the administration of domains. X First, the NIC is the registrar of all top level domains. Second X the NIC is the administrator of several top level domains (and the X registrar for second level domains in these). X X Top Level Domain Registrar X X As the registrar for top level domains, the NIC is the contact X point for investigating the possibility of establishing a new top X level domain. X X Top Level Domain Administrator X X For the top level domains designated so far, the NIC is the X administrator of each of these domains. This means the NIC is X responsible for the management of these domains and the X registration of the second level domains or hosts (if at the X second level) in these domains. X X X XPostel & Reynolds [Page 10] X X X XRFC 920 October 1984 XDomain Requirements X X X It may be reasonable for the administration of some of these X domains to be taken on by other authorities in the future. It is X certainly not desired that the NIC be the administrator of all top X level domains forever. X XPrototypical Questions X X To establish a domain, the following information must be provided to X the NIC Domain Registrar (HOSTMASTER@SRI-NIC.ARPA): X X Note: The key people must have computer mail mailboxes and X NIC-Idents. If they do not at present, please remedy the X situation at once. A NIC-Ident may be established by contacting X NIC@SRI-NIC.ARPA. X X 1) The name of the top level domain to join. X X For example: EDU X X 2) The name, title, mailing address, phone number, and organization X of the administrative head of the organization. This is the contact X point for administrative and policy questions about the domain. In X the case of a research project, this should be the Principal X Investigator. The online mailbox and NIC-Ident of this person should X also be included. X X For example: X X Administrator X X Organization USC/Information Sciences Institute X Name Keith Uncapher X Title Executive Director X Mail Address USC/ISI X 4676 Admiralty Way, Suite 1001 X Marina del Rey, CA. 90292-6695 X Phone Number 213-822-1511 X Net Mailbox Uncapher@USC-ISIB.ARPA X NIC-Ident KU X X 3) The name, title, mailing address, phone number, and organization X of the domain technical contact. The online mailbox and NIC-Ident of X the domain technical contact should also be included. This is the X contact point for problems with the domain and for updating X information about the domain. Also, the domain technical contact may X be responsible for hosts in this domain. X X X XPostel & Reynolds [Page 11] X X X XRFC 920 October 1984 XDomain Requirements X X X For example: X X Technical Contact X X Organization USC/Information Sciences Institute X Name Craig Milo Rogers X Title Researcher X Mail Address USC/ISI X 4676 Admiralty Way, Suite 1001 X Marina del Rey, CA. 90292-6695 X Phone Number 213-822-1511 X Net Mailbox Rogers@USC-ISIB.ARPA X NIC-Ident CMR X X 4) The name, title, mailing address, phone number, and organization X of the zone technical contact. The online mailbox and NIC-Ident of X the zone technical contact should also be included. This is the X contact point for problems with the zone and for updating information X about the zone. In many cases the zone technical contact and the X domain technical contact will be the same person. X X For example: X X Technical Contact X X Organization USC/Information Sciences Institute X Name Craig Milo Rogers X Title Researcher X Mail Address USC/ISI X 4676 Admiralty Way, Suite 1001 X Marina del Rey, CA. 90292-6695 X Phone Number 213-822-1511 X Net Mailbox Rogers@USC-ISIB.ARPA X NIC-Ident CMR X X 5) The name of the domain (up to 12 characters). This is the name X that will be used in tables and lists associating the domain and the X domain server addresses. [While technically domain names can be X quite long (programmers beware), shorter names are easier for people X to cope with.] X X For example: ALPHA-BETA X X 6) A description of the servers that provides the domain service for X translating name to address for hosts in this domain, and the date X they will be operational. X X X XPostel & Reynolds [Page 12] X X X XRFC 920 October 1984 XDomain Requirements X X X A good way to answer this question is to say "Our server is X supplied by person or company X and does whatever their standard X issue server does". X X For example: Our server is a copy of the server operated by X the NIC, and will be installed and made operational on X 1-November-84. X X 7) A description of the server machines, including: X X (a) hardware and software (using keywords from the Assigned X Numbers) X X (b) addresses (what host on what net for each connected net) X X For example: X X (a) hardware and software X X VAX-11/750 and UNIX, or X IBM-PC and MS-DOS, or X DEC-1090 and TOPS-20 X X (b) address X X 10.9.0.193 on ARPANET X X 8) An estimate of the number of hosts that will be in the domain. X X (a) initially, X (b) within one year, X (c) two years, and X (d) five years. X X For example: X X (a) initially = 50 X (b) one year = 100 X (c) two years = 200 X (d) five years = 500 X X X X X X X X X XPostel & Reynolds [Page 13] X X X XRFC 920 October 1984 XDomain Requirements X X XAcknowledgment X X We would like to thank the many people who contributed to this memo, X including the participants in the Namedroppers Group, the ICCB, the X PCCB, and especially the staff of the Network Information Center, X particularly J. Feinler and K. Harrenstien. X XReferences X X [1] Postel, J., "The Domain Names Plan and Schedule", RFC-881, USC X Information Sciences Institute, November 1983. X X [2] Mockapetris, P., "Domain Names - Concepts and Facilities", X RFC-882, USC Information Sciences Institute, November 1983. X X [3] Mockapetris, P., "Domain Names - Implementation and X Specification", RFC-883, USC Information Sciences Institute, X November 1983. X X [4] Postel, J., "Domain Name System Implementation Schedule", X RFC-897, USC Information Sciences Institute, February 1984. X X [5] ISO, "Codes for the Representation of Names of Countries", X ISO-3166, International Standards Organization, May 1981. X X [6] Postel, J., "Domain Name System Implementation Schedule - X Revised", RFC-921, USC Information Sciences Institute, October X 1984. X X [7] Mockapetris, P., "The Domain Name System", Proceedings of the X IFIP 6.5 Working Conference on Computer Message Services, X Nottingham, England, May 1984. Also as ISI/RS-84-133, X June 1984. X X [8] Mockapetris, P., J. Postel, and P. Kirton, "Name Server Design X for Distributed Systems", Proceedings of the Seventh X International Conference on Computer Communication, October 30 X to November 3 1984, Sidney, Australia. Also as ISI/RS-84-132, X June 1984. X X X X X X X X X X XPostel & Reynolds [Page 14] X X# X# @(#)rfc920.txt 2.1 smail 12/14/86 X# @//E*O*F doc/rfc920.txt// if test 27863 -ne "`wc -c <'doc/rfc920.txt'`"; then echo shar: error transmitting "'doc/rfc920.txt'" '(should have been 27863 characters)' fi fi # end of overwriting check echo shar: extracting "'src/alias.c'" '(10178 characters)' if test -f 'src/alias.c' ; then echo shar: will not over-write existing file "'src/alias.c'" else sed 's/^X//' >src/alias.c <<'@//E*O*F src/alias.c//' X#ifndef lint Xstatic char *sccsid = "@(#)alias.c 2.3 (smail) 1/28/87"; X#endif X X#include <stdio.h> X#include <sys/types.h> X#include <sys/stat.h> X#include <pwd.h> X#include "defs.h" X#ifdef BSD X#include <strings.h> X#else X#include <string.h> X#endif X Xextern enum edebug debug; /* verbose and debug modes */ Xextern char hostdomain[]; Xextern char hostname[]; Xextern char *aliasfile; X X#ifdef SENDMAIL Xchar ** Xalias(pargc, argv) Xint *pargc; Xchar **argv; X{ X int i; X/* X** aliasing was done by sendmail - so don't do anything here X** except to possibly truncate the argument count to MAXARGS. X*/ X if(MAXARGS < *pargc) { X for(i = MAXARGS ; i < *pargc ; i++) { X ADVISE("too many recipents - skipping %s\n", argv[i]); X } X *pargc = MAXARGS; X } X return(argv); X} X#else X X/* X** X** Picture of the alias graph structure X** X** head X** | X** v X** maps -> mark -> gjm -> mel -> NNULL X** | X** v X** sys -> root -> ron -> NNULL X** | | X** | +-----+ X** | | X** v v X** root -> mark -> chris -> lda -> NNULL X** | X** v X** NNULL X*/ X Xtypedef struct alias_node node; X Xstatic struct alias_node { X char *string; X node *horz; X node *vert; X}; X Xstatic node aliases = {"", 0, 0}; /* this is the 'dummy header' */ X X/* X** lint free forms of NULL X*/ X X#define NNULL ((node *) 0) X#define CNULL ('\0') X X/* X** string parsing macros X*/ X#define SKIPWORD(Z) while(*Z!=' ' && *Z!='\t' && *Z!='\n' && *Z!=',') Z++; X#define SKIPSPACE(Z) while(*Z==' ' || *Z=='\t' || *Z=='\n' || *Z==',') Z++; X Xstatic int nargc = 0; Xstatic char *nargv[MAXARGS]; X Xvoid add_horz(); Xvoid load_alias(), strip_comments(); Xnode *vsearch(), *hsearch(), *pop(); Xint recipients(); Xchar *tilde(); X X/* our horizontal linked list looks like a stack */ X#define push add_horz X X#define escape(s) ((*s != '\\') ? (s) : (s+1)) X Xchar ** Xalias(pargc, argv) Xint *pargc; Xchar **argv; X{ X/* X** alias the addresses X*/ X FILE *fp; X int i, aliased; X char domain[SMLBUF], ubuf[SMLBUF], *user; X char *home, buf[SMLBUF]; X node *addr, addrstk; X node *flist, fliststk; X node *u, *a; X struct stat st; X X addr = &addrstk; X flist = &fliststk; X user = ubuf; X X addr->horz = NNULL; X flist->horz = NNULL; X X /* X ** push all of the addresses onto a stack X */ X for(i=0; i < *pargc; i++) { X push(addr, argv[i]); X } X X /* X ** for each adress, check for included files, aliases and .forward files X */ X while((nargc < MAXARGS) && ((u = pop(addr)) != NNULL)) { X if(strncmpic(u->string, ":include:", 9) == 0) { X /* X ** make sure it's a full path name X ** don't allow multiple sourcing X ** of a given include file X */ X char *p = u->string + 9; X X if((*p == '/') X && (hsearch(flist, p) == NULL)) { X push(flist, p); X if((stat(p, &st) >= 0) X &&((st.st_mode & S_IFMT) == S_IFREG) X &&((fp = fopen(p, "r")) != NULL)) { X while(fgets(buf, sizeof buf, fp)) { X recipients(addr, buf); X } X fclose(fp); X } X } X continue; X } X X /* X ** parse the arg to see if it's to be aliased X */ X X if(islocal(u->string, domain, ubuf) == 0) { X goto aliasing_complete; X } X X /* X ** local form - try to alias user X ** aliases file takes precedence over ~user/.forward X ** since that's the way that sendmail does it. X */ X X user = escape(ubuf); X if((a = vsearch(user)) != NNULL) { X /* X ** check for alias X */ X node *t = a; X for(a = a->horz; a != NNULL; a=a->horz) { X push(addr, a->string); X } X t->horz = NNULL; X continue; X } X X if((home = tilde(user)) != NULL) { X /* don't allow multiple sourcing X ** of a given .forward file X */ X X if((hsearch(flist, home) != NULL)) { X continue; X } X push(flist, home); X X /* X ** check for ~user/.forward file X ** must be a regular, readable file X */ X X sprintf(buf, "%s/%s", home, ".forward"); X if((stat(buf, &st) >= 0) X &&((st.st_mode & S_IFMT) == S_IFREG) X &&((fp = fopen(buf, "r")) != NULL)) { X aliased = 0; X while(fgets(buf, sizeof buf, fp)) { X aliased |= recipients(addr, buf); X } X fclose(fp); X if(aliased) { X continue; X } X } X } Xaliasing_complete: X user = escape(u->string); X for(i=0; i < nargc; i++) { X if(strcmpic(nargv[i], user) == 0) { X break; X } X } X X if(i == nargc) { X nargv[nargc++] = user; X } X } X *pargc = nargc; X return(nargv); X} X X/* X** vsearch X** given an string, look for its alias in X** the 'vertical' linked list of aliases. X*/ Xnode * Xvsearch(user) Xchar *user; X{ X node *head; X node *a; X static int loaded = 0; X X head = &aliases; X if(loaded == 0) { X load_alias(head, aliasfile); X loaded = 1; X } X X for(a = head->vert; a != NNULL; a = a->vert) { X#ifdef CASEALIAS X if(strcmp(a->string, user) == 0) X#else X if(strcmpic(a->string, user) == 0) X#endif X { X break; X } X } X if((a == NNULL) /* not in graph */ X || (a->horz == NNULL)) { /* null list (poss. prev. aliased) */ X return(NNULL); X } X return(a); X} X X/* X** hsearch X** given an string, look for it in X** a 'horizontal' linked list of strings. X*/ Xnode * Xhsearch(head, str) Xnode *head; Xchar *str; X{ X node *a; X for(a = head->horz; a != NNULL; a = a->horz) { X#ifdef CASEALIAS X if(strcmp(a->string, str) == 0) X#else X if(strcmpic(a->string, str) == 0) X#endif X { X break; X } X } X return(a); X} X X/* X** load_alias X** parse an 'aliases' file and add the aliases to the alias graph. X** Handle inclusion of other 'aliases' files. X*/ X Xvoid Xload_alias(head, filename) Xnode *head; Xchar *filename; X{ X FILE *fp; X node *h, *add_vert(); X char domain[SMLBUF], user[SMLBUF]; X char *p, *b, buf[SMLBUF]; X X if((fp = fopen(filename,"r")) == NULL) { XDEBUG("load_alias open('%s') failed\n", filename); X return; X } X X while(fgets(buf, sizeof buf, fp) != NULL) { X p = buf; X if((*p == '#') || (*p == '\n')) { X continue; X } X X /* X ** include another file of aliases X */ X X if(strncmp(p, ":include:", 9) == 0) { X char *nl; X p += 9; X if((nl = index(p, '\n')) != NULL) { X *nl = CNULL; X } XDEBUG("load_alias '%s' includes file '%s'\n", filename, p); X load_alias(head, p); X continue; X } X X /* X ** if the first char on the line is a space or tab X ** then it's a continuation line. Otherwise, X ** we start a new alias. X */ X if(*p != ' ' && *p != '\t') { X b = p; X SKIPWORD(p); X *p++ = CNULL; X /* X ** be sure that the alias is in local form X */ X if(islocal(b, domain, user) == 0) { X /* X ** non-local alias format - skip it X */ X continue; X } X /* X ** add the alias to the (vertical) list of aliases X */ X if((h = add_vert(head, user)) == NNULL) { XDEBUG("load_alias for '%s' failed\n", b); X return; X } X } X /* X ** Next on the line is the list of recipents. X ** Strip out each word and add it to the X ** horizontal linked list. X */ X recipients(h, p); X } X (void) fclose(fp); X} X X/* X** add each word in a string (*p) of recipients X** to the (horizontal) linked list associated with 'h' X*/ X Xrecipients(h, p) Xnode *h; Xchar *p; X{ X X char *b; X int ret = 0; X X strip_comments(p); /* strip out stuff in ()'s */ X X SKIPSPACE(p); /* skip leading whitespace on line */ X X while((*p != NULL) && (*p != '#')) { X b = p; X if(*b == '"') { X if((p = index(++b, '"')) == NULL) { X /* syntax error - no matching quote */ X /* skip the rest of the line */ X return(ret); X } X } else { X SKIPWORD(p); X } X X if(*p != CNULL) { X *p++ = CNULL; X } X X add_horz(h, b); X ret = 1; X SKIPSPACE(p); X } X return(ret); X} X X/* X** some aliases may have comments on the line like: X** X** moderators moderator@somehost.domain (Moderator's Name) X** moderator@anotherhost.domain (Another Moderator's Name) X** X** strip out the stuff in ()'s X** X*/ X Xvoid Xstrip_comments(p) Xchar *p; X{ X char *b; X while((p = index(p, '(')) != NULL) { X b = p++; /* X ** save pointer to open parenthesis X */ X if((p = index(p, ')')) != NULL) {/* look for close paren */ X (void) strcpy(b, ++p); /* slide string left */ X } else { X *b = CNULL; /* no paren, skip rest of line */ X break; X } X } X} X X/* X** add_vert - add a (vertical) link to the chain of aliases. X*/ X Xnode * Xadd_vert(head, str) Xnode *head; Xchar *str; X{ X char *p, *malloc(); X void free(); X node *new; X X /* X ** strip colons off the end of alias names X */ X if((p = index(str, ':')) != NULL) { X *p = CNULL; X } X if((new = (node *) malloc(sizeof(node))) != NNULL) { X if((new->string = malloc((unsigned) strlen(str)+1)) == NULL) { X free(new); X new = NNULL; X } else { X (void) strcpy(new->string, str); X new->vert = head->vert; X new->horz = NNULL; X head->vert = new; X/*DEBUG("add_vert %s->%s\n", head->string, new->string);/* */ X } X } X return(new); X} X X/* X** add_horz - add a (horizontal) link to the chain of recipients. X*/ X Xvoid Xadd_horz(head, str) Xnode *head; Xchar *str; X{ X char *malloc(); X node *new; X X if((new = (node *) malloc(sizeof(node))) != NNULL) { X if((new->string = malloc((unsigned) strlen(str)+1)) == NULL) { X free(new); X new = NNULL; X } else { X (void) strcpy(new->string, str); X new->horz = head->horz; X new->vert = NNULL; X head->horz = new; X } X/*DEBUG("add_horz %s->%s\n", head->string, new->string);/* */ X } X} X Xchar * Xtilde(user) Xchar *user; X{ X struct passwd *getpwent(), *pw; X static node pwdstk; X static int pw_eof = 0; X X node *a, *pwd; X X char buf[SMLBUF]; X int i; X X pwd = &pwdstk; X X /* X ** check for previously cached user X */ X X if((a = hsearch(pwd, user)) != NNULL) { X return(a->string + strlen(a->string) + 1); X } X X /* X ** cache previous username and home directory X ** this bit of code is quite implementation dependent. X ** The kludge here is that the string login:home is X ** pushed onto a linked list, and then the ':' is X ** replaced with a null character. This lets us X ** search the list without the hassel of index()'ing X ** on the ':' and doing strncmp(). X */ X X while((pw_eof == 0) && ((pw = getpwent()) != NULL)) { X strcpy(buf, pw->pw_name); X i = strlen(buf); X buf[i] = ':'; X strcpy(&buf[i+1], pw->pw_dir); X push(pwd, buf); X a = pwd->horz; X a->string[i] = '\0'; X if(strcmp(user, pw->pw_name) == 0) { X return(a->string + strlen(a->string) + 1); X } X } X pw_eof = 1; X return(NULL); X} X Xnode * Xpop(head) Xnode *head; X{ X node *ret = NNULL; X X if(head != NNULL) { X ret = head->horz; X if(ret != NNULL) { X head->horz = ret->horz; X } X } X return(ret); X} X#endif @//E*O*F src/alias.c// if test 10178 -ne "`wc -c <'src/alias.c'`"; then echo shar: error transmitting "'src/alias.c'" '(should have been 10178 characters)' fi fi # end of overwriting check echo shar: extracting "'src/defs.h'" '(7752 characters)' if test -f 'src/defs.h' ; then echo shar: will not over-write existing file "'src/defs.h'" else sed 's/^X//' >src/defs.h <<'@//E*O*F src/defs.h//' X/* X** X** Defs.h: header file for rmail/smail. X** X** Configuration options for rmail/smail. X** full domain name is 'hostname.uucp' (get registered!) X** path file is /usr/lib/uucp/paths. X** no log, no record, use sendmail. X** X** You can change these in the next few blocks. X** X*/ X X/* X** @(#)defs.h 2.3 (smail) 1/26/87 X*/ X X#ifndef VERSION X#define VERSION "smail2.3" X#endif X X/*# define BSD /* if system is a Berkeley system */ X X# define SENDMAIL "/usr/lib/sendmail" /* Turn off to use /bin/(l)mail only */ X X/* X** The ALIAS definitions are used only if SENDMAIL is NOT defined. X** Sites using sendmail have to let sendmail do the aliasing. X** ALIAS, must be defined, however, even if not used. X*/ X X# ifdef SENDMAIL X# define ALIAS "not_used" X# else X# define ALIAS "/usr/lib/aliases" /* location of mail aliases */ X/*# define CASEALIAS /* make aliases case sensitive */ X# endif X X X# ifdef BSD X# define GETHOSTNAME /* use gethostname() */ X# else X# define UNAME /* use uname() */ X# endif X X/* if defined, HOSTNAME overrides UNAME and GETHOSTNAME */ X/* # define HOSTNAME "host" /* literal name */ X X/*# define HOSTDOMAIN "host.dom" /* replacement for HOSTNAME.MYDOM */ X X/* X * .UUCP here is just for testing, GET REGISTERED in COM, EDU, etc. X * See INFO.REGISTRY for details. X */ X# define MYDOM ".UUCP" /* literal domain suffix */ X X/* X * HIDDENHOSTS allows hosts that serve as domain gateways to hide X * the subdomains beneath them. Mail that originates at any of X * the hosts in the subdomain will appear to come from the gateway host. X * Hence, mail from X * X * anything.hostdomain!user X * X * will appear to come from X * X * hostdomain!user X * X * A consequence is that return mail to hostdomain!user would need to X * be forwarded to the proper subdomain via aliases or other forwarding X * facilities. X * X * If you're using sendmail, then if defined here, X * it should be used in ruleset 4 of the sendmail.cf, too. X */ X X/*#define HIDDENHOSTS /* hide subdomains of hostdomain */ X X/* X * Mail that would otherwise be undeliverable will be passed to the X * aliased SMARTHOST for potential delivery. X * X * Be sure that the host you specify in your pathalias input knows that you're X * using it as a relay, or you might upset somebody when they find out some X * other way. If you're using 'foovax' as your relay, and below you have X * #define SMARTHOST "smart-host", then the pathalias alias would be: X * X * smart-host = foovax X */ X X# define SMARTHOST "smart-host" /* pathalias alias for relay host */ X X/* X** Locations of files: X** PATHS is where the pathalias output is. This is mandatory. X** Define LOG if you want a log of mail. This can be handy for X** debugging and traffic analysis. X** Define RECORD for a copy of all mail. This uses much time and X** space and is only used for extreme debugging cases. X*/ X X#ifndef PATHS X# define PATHS "/usr/lib/uucp/paths" /* location of the path database */ X#endif X X/*# define LOG "/usr/spool/uucp/mail.log" /* log of uucp mail */ X/*# define RECORD "/tmp/mail.log" /* record of uucp mail */ X X/* X** Mailer options: X** RMAIL is the command to invoke rmail on machine sys. X** RARG is how to insulate metacharacters from RMAIL. X** LMAIL is the command to invoke the local mail transfer agent. X** LARG is how to insulate metacharacters from LMAIL. X** RLARG is LARG with host! on the front - to pass a uux addr to sendmail. X** SENDMAIL selects one of two sets of defines below for either X** using sendmail or /bin/lmail. X*/ X X#ifndef UUX X# define UUX "/usr/bin/uux" /* location of uux command */ X#endif X X#ifndef SMAIL X# define SMAIL "/bin/smail" /* location of smail command */ X#endif X X/* X** command used to retry failed mail, flag is used to set the routing level. X*/ X# define VFLAG ((debug == VERBOSE)?"-v":"") X# define RETRY(flag) "%s %s %s -f %s ", SMAIL, VFLAG, flag, spoolfile X X# define RMAIL(flags,from,sys) "%s %s - %s!rmail",UUX,flags,sys X# define RARG(user) " '(%s)'",user X# define RFROM(frm,now,host) "From %s %.24s remote from %s\n",frm,now,host X X#ifdef SENDMAIL X X# define HANDLE JUSTUUCP /* see HANDLE definition below */ X# define ROUTING JUSTDOMAIN /* see ROUTING definition below */ X X# define LMAIL(frm,sys) "%s -em -f%s",SENDMAIL,frm X# define LARG(user) " '%s'",postmaster(user) X# define RLARG(sys,frm) " '%s!%s'",sys,frm X# define LFROM(frm,now,host) "From %s %.24s\n",frm,now X X#else X X# define HANDLE ALL X# define ROUTING JUSTDOMAIN X X#ifdef BSD X# define LMAIL(frm,sys) "/bin/mail" /* BSD local delivery agent */ X#else X# define LMAIL(frm,sys) "/bin/lmail" /* SV local delivery agent */ X#endif X X# define LARG(user) " '%s'",postmaster(user) X# define RLARG(sys,frm) " '%s!%s'",sys,frm X# define LFROM(frm,now,host) "From %s %.24s\n",frm,now X X#endif X X/* X** The following definitions affect the queueing algorithm for uux. X** X** DEFQUEUE if defined the default is to queue uux mail X** X** QUEUECOST remote mail with a cost of less than QUEUECOST X** will be handed to uux for immediate delivery. X** X** MAXNOQUEUE don't allow more than 'n' immediate delivery X** jobs to be started on a single invocation of smail. X** X*/ X X# define DEFQUEUE /* default is to queue uux jobs */ X X# define QUEUECOST 100 /* deliver immediately if the cost X /* is DEDICATED+LOW or better */ X X# define MAXNOQUEUE 2 /* max UUX_NOQUEUE jobs */ X X# define UUX_QUEUE "-r" /* uux flag for queueing */ X# define UUX_NOQUEUE "" /* uux with immediate delivery */ X X/* X** Normally, all mail destined for the local host is delivered with a single X** call to the local mailer, and all remote mail is delivered with one call X** to the remote mailer for each remote host. This kind of 'batching' saves X** on the cpu overhead. X** X** MAXCLEN is used to limit the length of commands that are exec'd by smail. X** This is done to keep other program's buffers from overflowing, or to X** allow for less intelligent commands which can take only one argument X** at a time (e.g., 4.1 /bin/mail). To disable the batching, set MAXCLEN X** a small value (like 0). X*/ X X# define MAXCLEN 128 /* longest command allowed (approx.) X /* this is to keep other's buffers X ** from overflowing X */ X X/* X** PLEASE DON'T TOUCH THE REST X*/ X X# define SMLBUF 512 /* small buffer (handle one item) */ X# define BIGBUF 4096 /* handle lots of items */ X X# define MAXPATH 32 /* number of elements in ! path */ X# define MAXDOMS 16 /* number of subdomains in . domain */ X# define MAXARGS 500 /* number of arguments */ X#ifndef NULL X# define NULL 0 X#endif X X# define DEBUG if (debug==YES) (void) printf X# define ADVISE if (debug!=NO) (void) printf X# define error(stat,msg,a) { (void) fprintf(stderr, msg, a); exit(stat); } X# define lower(c) ( isupper(c) ? c-'A'+'a' : c ) X X Xenum eform { /* format of addresses */ X ERROR, /* bad or invalidated format */ X LOCAL, /* just a local name */ X DOMAIN, /* user@domain or domain!user */ X UUCP, /* host!address */ X ROUTE, /* intermediate form - to be routed */ X SENT /* sent to a mailer on a previous pass */ X}; X Xenum ehandle { /* what addresses can we handle? (don't kick to LMAIL) */ X ALL, /* UUCP and DOMAIN addresses */ X JUSTUUCP, /* UUCP only; set by -l */ X NONE /* all mail is LOCAL; set by -L */ X}; X Xenum erouting { /* when to route A!B!C!D */ X JUSTDOMAIN, /* route A if A is a domain */ X ALWAYS, /* route A always; set by -r */ X REROUTE /* route C, B, or A (whichever works); set by -R */ X}; X Xenum edebug { /* debug modes */ X NO, /* normal deliver */ X VERBOSE, /* talk alot */ X YES /* talk and don't deliver */ X}; X X# ifdef BSD X X# include <sysexits.h> X# include <strings.h> X X# else X X# include "sysexits.h" X# include <string.h> X# define index strchr X# define rindex strrchr X X# endif Xextern void exit(), perror(); Xextern unsigned sleep(); @//E*O*F src/defs.h// if test 7752 -ne "`wc -c <'src/defs.h'`"; then echo shar: error transmitting "'src/defs.h'" '(should have been 7752 characters)' fi fi # end of overwriting check echo shar: extracting "'src/getopt.c'" '(2533 characters)' if test -f 'src/getopt.c' ; then echo shar: will not over-write existing file "'src/getopt.c'" else sed 's/^X//' >src/getopt.c <<'@//E*O*F src/getopt.c//' X/* X** @(#)getopt.c 2.2 (smail) 1/26/87 X*/ X X/* X * Here's something you've all been waiting for: the AT&T public domain X * source for getopt(3). It is the code which was given out at the 1985 X * UNIFORUM conference in Dallas. I obtained it by electronic mail X * directly from AT&T. The people there assure me that it is indeed X * in the public domain. X * X * There is no manual page. That is because the one they gave out at X * UNIFORUM was slightly different from the current System V Release 2 X * manual page. The difference apparently involved a note about the X * famous rules 5 and 6, recommending using white space between an option X * and its first argument, and not grouping options that have arguments. X * Getopt itself is currently lenient about both of these things White X * space is allowed, but not mandatory, and the last option in a group can X * have an argument. That particular version of the man page evidently X * has no official existence, and my source at AT&T did not send a copy. X * The current SVR2 man page reflects the actual behavor of this getopt. X * However, I am not about to post a copy of anything licensed by AT&T. X */ X X/* This include is needed only to get "index" defined as "strchr" on Sys V. */ X#include "defs.h" X#ifdef BSD X#include <strings.h> X#else X#include <string.h> X#endif X X/*LINTLIBRARY*/ X#define NULL 0 X#define EOF (-1) X#define ERR(s, c) if(opterr){\ X extern int write();\ X char errbuf[2];\ X errbuf[0] = c; errbuf[1] = '\n';\ X (void) write(2, argv[0], (unsigned)strlen(argv[0]));\ X (void) write(2, s, (unsigned)strlen(s));\ X (void) write(2, errbuf, 2);} X Xextern char *index(); X Xint opterr = 1; Xint optind = 1; Xint optopt; Xchar *optarg; X Xint Xgetopt(argc, argv, opts) Xint argc; Xchar **argv, *opts; X{ X static int sp = 1; X register int c; X register char *cp; X X if(sp == 1) X if(optind >= argc || X argv[optind][0] != '-' || argv[optind][1] == '\0') X return(EOF); X else if(strcmp(argv[optind], "--") == NULL) { X optind++; X return(EOF); X } X optopt = c = argv[optind][sp]; X if(c == ':' || (cp=index(opts, c)) == NULL) { X ERR(": illegal option -- ", c); X if(argv[optind][++sp] == '\0') { X optind++; X sp = 1; X } X return('?'); X } X if(*++cp == ':') { X if(argv[optind][sp+1] != '\0') X optarg = &argv[optind++][sp+1]; X else if(++optind >= argc) { X ERR(": option requires an argument -- ", c); X sp = 1; X return('?'); X } else X optarg = argv[optind++]; X sp = 1; X } else { X if(argv[optind][++sp] == '\0') { X sp = 1; X optind++; X } X optarg = NULL; X } X return(c); X} @//E*O*F src/getopt.c// if test 2533 -ne "`wc -c <'src/getopt.c'`"; then echo shar: error transmitting "'src/getopt.c'" '(should have been 2533 characters)' fi fi # end of overwriting check echo shar: extracting "'src/getpath.c'" '(2218 characters)' if test -f 'src/getpath.c' ; then echo shar: will not over-write existing file "'src/getpath.c'" else sed 's/^X//' >src/getpath.c <<'@//E*O*F src/getpath.c//' X#ifndef lint Xstatic char *sccsid="@(#)getpath.c 2.2 (smail) 1/26/87"; X#endif X X# include <stdio.h> X# include <sys/types.h> X# include <ctype.h> X# include "defs.h" X#ifdef BSD X#include <strings.h> X#else X#include <string.h> X#endif X Xextern enum edebug debug; /* how verbose we are */ Xextern char *pathfile; /* location of path database */ X X/* X** X** getpath(): look up key in ascii sorted path database. X** X*/ X Xgetpath( key, path , cost) Xchar *key; /* what we are looking for */ Xchar *path; /* where the path results go */ Xint *cost; /* where the cost results go */ X{ X long pos, middle, hi, lo; X static long pathlength = 0; X register char *s; X int c; X static FILE *file; X int flag; X XDEBUG("getpath: looking for '%s'\n", key); X X if( !pathlength ) /* open file on first use */ X { X if( ( file=fopen( pathfile, "r" ) ) == NULL ) X { X (void) printf( "can't access %s.\n", pathfile ); X pathlength = -1; X } else { X (void) fseek( file, 0L, 2 ); /* find length */ X pathlength = ftell( file ); X } X } X if( pathlength == -1 ) X return( EX_OSFILE ); X X lo = 0; X hi = pathlength; X (void) strcpy( path, key ); X (void) strcat( path, "\t" ); X/* X** "Binary search routines are never written right the first time around." X** - Robert G. Sheldon. X*/ X for( ;; ) { X pos = middle = ( hi+lo+1 )/2; X (void) fseek( file, pos, 0 ); /* find midpoint */ X if (pos != 0) /* to beginning of next line */ X while( ( c=getc( file ) ) != EOF && c != '\n' ); X for( flag = 0, s = path; flag == 0; s++ ) { /* match??? */ X if ( *s == '\0' ) { X goto solved; X } X c = getc( file ); X flag = lower( c ) - lower( *s ); X } X if ( lo>=middle ) /* failure? */ X return( EX_NOHOST ); X if ( c != EOF && flag < 0 ) /* close window */ X lo = middle; X else X hi = middle - 1; X } X/* X** Now just copy the result. X*/ Xsolved: X while(((c = getc(file)) != EOF) && (c != '\t') && (c != '\n')) { X *path++ = c; X } X *path = '\0'; X/* X** See if the next field on the line is numeric. X** If so, use it as the cost for the route. X*/ X if(c == '\t') { X int tcost = -1; X while(((c = getc(file)) != EOF) && isdigit(c)) { X if(tcost < 0) tcost = 0; X tcost *= 10; X tcost += c - '0'; X } X if(tcost >= 0) *cost = tcost; X } X return ( EX_OK ); X} @//E*O*F src/getpath.c// if test 2218 -ne "`wc -c <'src/getpath.c'`"; then echo shar: error transmitting "'src/getpath.c'" '(should have been 2218 characters)' fi fi # end of overwriting check echo shar: extracting "'src/lcasep.c'" '(1129 characters)' if test -f 'src/lcasep.c' ; then echo shar: will not over-write existing file "'src/lcasep.c'" else sed 's/^X//' >src/lcasep.c <<'@//E*O*F src/lcasep.c//' X/* X** convert the host name on a pathalias line to lower case X*/ X X#ifndef lint Xstatic char *sccsid="@(#)lcasep.c 2.1 (smail) 12/14/86"; X#endif X X#include <stdio.h> X#include <ctype.h> X X# define lower(c) ( isupper(c) ? c-'A'+'a' : c ) X Xmain(argc, argv) Xint argc; Xchar *argv[]; X{ X FILE *ifp, *ofp; X char buf[BUFSIZ]; X register char *p; X int c; X X extern int optind; X extern char *optarg; X X ifp = stdin; X ofp = stdout; X X while((c = getopt(argc, argv, "f:o:")) != EOF) { X switch(c) { X case 'f': X if((ifp = fopen(optarg, "r")) == NULL) { X (void) fprintf(stderr, "%s: can't open %s: ", X argv[0], optarg); X perror(""); X exit(1); X } X break; X case 'o': X if((ofp = fopen(optarg, "w+")) == NULL) { X (void) fprintf(stderr, "%s: can't open %s: ", X argv[0], optarg); X perror(""); X exit(1); X } X break; X default: X (void) fprintf(stderr, X "usage: %s [-f file] [-o outfile]\n", argv[0]); X exit(1); X /* NOTREACHED */ X break; X } X } X X while(fgets(buf, sizeof(buf), ifp) != NULL) { X for(p = buf; *p != '\t' && *p != '\0' ; p++) { X (void) fputc(lower(*p), ofp); X } X (void) fputs(p, ofp); X } X} @//E*O*F src/lcasep.c// if test 1129 -ne "`wc -c <'src/lcasep.c'`"; then echo shar: error transmitting "'src/lcasep.c'" '(should have been 1129 characters)' fi fi # end of overwriting check echo shar: extracting "'src/pathproc.sh'" '(776 characters)' if test -f 'src/pathproc.sh' ; then echo shar: will not over-write existing file "'src/pathproc.sh'" else sed 's/^X//' >src/pathproc.sh <<'@//E*O*F src/pathproc.sh//' X#! /bin/sh X# X# @(#)pathproc.sh 2.1 (smail) 12/14/86 X# X# This script will do all that's necessary for X# transforming the output of pathalias -c into X# the format of a 'paths' file for smail. X# X# format of the pathalias -c output is X# cost host route X# X# format of a 'paths' file for smail is X# host route first_hop_cost X# X# first sort lines on increasing cost X# Xsort -n | X# X# print cost of first hop in the chain in format X# host route cost X# Xawk ' X{ X nhops = split($3, hops, "!"); X if(nhops == 1) { X tcost = 0; X } else if(nhops == 2) { X if(cost[hops[1]] == 0) { X cost[hops[1]] = $1; X } X tcost = cost[hops[1]]; X } else { X tcost = cost[hops[1]]; X } X printf("%s\t%s\t%d\n", $2, $3, tcost); X}' | X# X# next convert host name to lower case and sort the output X# Xlcasep | sort @//E*O*F src/pathproc.sh// if test 776 -ne "`wc -c <'src/pathproc.sh'`"; then echo shar: error transmitting "'src/pathproc.sh'" '(should have been 776 characters)' fi fi # end of overwriting check echo shar: "End of shell archive." exit 0