home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume8 / smail2 / part03 < prev    next >
Encoding:
Internet Message Format  |  1987-02-16  |  56.6 KB

  1. Subject:  v08i069:  Smail, release 2.3, Part03/03
  2. Newsgroups: mod.sources
  3. Approved: mirror!rs
  4.  
  5. Submitted by:  Larry Auton <lda@clyde.att.com>
  6. Mod.sources: Volume 8, Issue 69
  7. Archive-name: smail2/Part03
  8.  
  9. #! /bin/sh
  10. # This is a shell archive.  Remove anything before this line,
  11. # then unpack it by saving it in a file and typing "sh file".
  12. # If all goes well, you will see the message "End of shell archive."
  13. # Contents:  doc/rfc920.txt src/alias.c src/defs.h src/getopt.c
  14. #   src/getpath.c src/lcasep.c src/pathproc.sh
  15. # Wrapped by rs@mirror on Mon Feb  9 17:10:04 1987
  16. PATH=/bin:/usr/bin:/usr/ucb; export PATH
  17. echo shar: extracting "'doc/rfc920.txt'" '(27863 characters)'
  18. if test -f 'doc/rfc920.txt' ; then 
  19.   echo shar: will not over-write existing file "'doc/rfc920.txt'"
  20. else
  21. sed 's/^X//' >doc/rfc920.txt <<'@//E*O*F doc/rfc920.txt//'
  22. X
  23. X
  24. XNetwork Working Group                                          J. Postel
  25. XRequest for Comments: 920                                    J. Reynolds
  26. X                                                                     ISI
  27. X                                                            October 1984
  28. X
  29. X                          Domain Requirements
  30. X
  31. X
  32. XStatus of this Memo
  33. X
  34. X   This memo is a policy statement on the requirements of establishing a
  35. X   new domain in the ARPA-Internet and the DARPA research community.
  36. X   This is an official policy statement of the IAB and the DARPA.
  37. X   Distribution of this memo is unlimited.
  38. X
  39. XIntroduction
  40. X
  41. X   This memo restates and refines the requirements on establishing a
  42. X   Domain first described in RFC-881 [1].  It adds considerable detail
  43. X   to that discussion, and introduces the limited set of top level
  44. X   domains.
  45. X
  46. XThe Purpose of Domains
  47. X
  48. X   Domains are administrative entities.  The purpose and expected use of
  49. X   domains is to divide the name management required of a central
  50. X   administration and assign it to sub-administrations.  There are no
  51. X   geographical, topological, or technological constraints on a domain.
  52. X   The hosts in a domain need not have common hardware or software, nor
  53. X   even common protocols.  Most of the requirements and limitations on
  54. X   domains are designed to ensure responsible administration.
  55. X
  56. X   The domain system is a tree-structured global name space that has a
  57. X   few top level domains.  The top level domains are subdivided into
  58. X   second level domains.  The second level domains may be subdivided
  59. X   into third level domains, and so on.
  60. X
  61. X   The administration of a domain requires controlling the assignment of
  62. X   names within that domain and providing access to the names and name
  63. X   related information (such as addresses) to users both inside and
  64. X   outside the domain.
  65. X
  66. X
  67. X
  68. X
  69. X
  70. X
  71. X
  72. X
  73. X
  74. X
  75. X
  76. X
  77. XPostel & Reynolds                                               [Page 1]
  78. X
  79. X
  80. X
  81. XRFC 920                                                     October 1984
  82. XDomain Requirements
  83. X
  84. X
  85. XGeneral Purpose Domains
  86. X
  87. X   While the initial domain name "ARPA" arises from the history of the
  88. X   development of this system and environment, in the future most of the
  89. X   top level names will be very general categories like "government",
  90. X   "education", or "commercial".  The motivation is to provide an
  91. X   organization name that is free of undesirable semantics.
  92. X
  93. X   After a short period of initial experimentation, all current
  94. X   ARPA-Internet hosts will select some domain other than ARPA for their
  95. X   future use.  The use of ARPA as a top level domain will eventually
  96. X   cease.
  97. X
  98. XInitial Set of Top Level Domains
  99. X
  100. X   The initial top level domain names are:
  101. X
  102. X      Temporary
  103. X
  104. X         ARPA  =  The current ARPA-Internet hosts.
  105. X
  106. X      Categories
  107. X
  108. X         GOV  =  Government, any government related domains meeting the
  109. X                 second level requirements.
  110. X
  111. X         EDU  =  Education, any education related domains meeting the
  112. X                 second level requirements.
  113. X
  114. X         COM  =  Commercial, any commercial related domains meeting the
  115. X                 second level requirements.
  116. X
  117. X         MIL  =  Military, any military related domains meeting the
  118. X                 second level requirements.
  119. X
  120. X         ORG  =  Organization, any other domains meeting the second
  121. X                 level requirements.
  122. X
  123. X      Countries
  124. X
  125. X         The English two letter code (alpha-2) identifying a country
  126. X         according the the ISO Standard for "Codes for the
  127. X         Representation of Names of Countries" [5].
  128. X
  129. X
  130. X
  131. X
  132. X
  133. X
  134. XPostel & Reynolds                                               [Page 2]
  135. X
  136. X
  137. X
  138. XRFC 920                                                     October 1984
  139. XDomain Requirements
  140. X
  141. X
  142. X      Multiorganizations
  143. X
  144. X         A multiorganization may be a top level domain if it is large,
  145. X         and is composed of other organizations; particularly if the
  146. X         multiorganization can not be easily classified into one of the
  147. X         categories and is international in scope.
  148. X
  149. XPossible Examples of Domains
  150. X
  151. X   The following examples are fictions of the authors' creation, any
  152. X   similarity to the real world is coincidental.
  153. X
  154. X   The UC Domain
  155. X
  156. X      It might be that a large state wide university with, say, nine
  157. X      campuses and several laboratories may want to form a domain.  Each
  158. X      campus or major off-campus laboratory might then be a subdomain,
  159. X      and within each subdomain, each department could be further
  160. X      distinguished.  This university might be a second level domain in
  161. X      the education category.
  162. X
  163. X      One might see domain style names for hosts in this domain like
  164. X      these:
  165. X
  166. X         LOCUS.CS.LA.UC.EDU
  167. X         CCN.OAC.LA.UC.EDU
  168. X         ERNIE.CS.CAL.UC.EDU
  169. X         A.S1.LLNL.UC.EDU
  170. X         A.LAND.LANL.UC.EDU
  171. X         NMM.LBL.CAL.UC.EDU
  172. X
  173. X   The MIT Domain
  174. X
  175. X      Another large university may have many hosts using a variety of
  176. X      machine types, some even using several families of protocols.
  177. X      However, the administrators at this university may see no need for
  178. X      the outside world to be aware of these internal differences.  This
  179. X      university might be a second level domain in the education
  180. X      category.
  181. X
  182. X      One might see domain style names for hosts in this domain like
  183. X      these:
  184. X
  185. X         APIARY-1.MIT.EDU
  186. X         BABY-BLUE.MIT.EDU
  187. X         CEZANNE.MIT.EDU
  188. X         DASH.MIT.EDU
  189. X
  190. X
  191. XPostel & Reynolds                                               [Page 3]
  192. X
  193. X
  194. X
  195. XRFC 920                                                     October 1984
  196. XDomain Requirements
  197. X
  198. X
  199. X         MULTICS.MIT.EDU
  200. X         TAC.MIT.EDU
  201. X         XX.MIT.EDU
  202. X
  203. X   The CSNET Domain
  204. X
  205. X      There may be a consortium of universities and industry research
  206. X      laboratories called, say, "CSNET".  This CSNET is not a network
  207. X      per se, but rather a computer mail exchange using a variety of
  208. X      protocols and network systems.  Therefore, CSNET is not a network
  209. X      in the sense of the ARPANET, or an Ethernet, or even the
  210. X      ARPA-Internet, but rather a community.  Yet it does, in fact, have
  211. X      the key property needed to form a domain; it has a responsible
  212. X      administration.  This consortium might be large enough and might
  213. X      have membership that cuts across the categories in such a way that
  214. X      it qualifies under the "multiorganization rule" to be a top level
  215. X      domain.
  216. X
  217. X      One might see domain style names for hosts in this domain like
  218. X      these:
  219. X
  220. X         CIC.CSNET
  221. X         EMORY.CSNET
  222. X         GATECH.CSNET
  223. X         HP-LABS.CSNET
  224. X         SJ.IBM.CSNET
  225. X         UDEL.CSNET
  226. X         UWISC.CSNET
  227. X
  228. XGeneral Requirements on a Domain
  229. X
  230. X   There are several requirements that must be met to establish a
  231. X   domain.  In general, it must be responsibly managed.  There must be a
  232. X   responsible person to serve as an authoritative coordinator for
  233. X   domain related questions.  There must be a robust domain name lookup
  234. X   service, it must be of at least a minimum size, and the domain must
  235. X   be registered with the central domain administrator (the Network
  236. X   Information Center (NIC) Domain Registrar).
  237. X
  238. X   Responsible Person:
  239. X
  240. X      An individual must be identified who has authority for the
  241. X      administration of the names within the domain, and who seriously
  242. X      takes on the responsibility for the behavior of the hosts in the
  243. X      domain, plus their interactions with hosts outside the domain.
  244. X      This person must have some technical expertise and the authority
  245. X      within the domain to see that problems are fixed.
  246. X
  247. X
  248. XPostel & Reynolds                                               [Page 4]
  249. X
  250. X
  251. X
  252. XRFC 920                                                     October 1984
  253. XDomain Requirements
  254. X
  255. X
  256. X      If a host in a given domain somehow misbehaves in its interactions
  257. X      with hosts outside the domain (e.g., consistently violates
  258. X      protocols), the responsible person for the domain must be
  259. X      competent and available to receive reports of problems, take
  260. X      action on the reported problems, and follow through to eliminate
  261. X      the problems.
  262. X
  263. X   Domain Servers:
  264. X
  265. X      A robust and reliable domain server must be provided.  One way of
  266. X      meeting this requirement is to provide at least two independent
  267. X      domain servers for the domain.  The database can, of course, be
  268. X      the same.  The database can be prepared and copied to each domain
  269. X      server.  But, the servers should be in separate machines on
  270. X      independent power supplies, et cetera; basically as physically
  271. X      independent as can be.  They should have no common point of
  272. X      failure.
  273. X
  274. X      Some domains may find that providing a robust domain service can
  275. X      most easily be done by cooperating with another domain where each
  276. X      domain provides an additional server for the other.
  277. X
  278. X      In other situations, it may be desirable for a domain to arrange
  279. X      for domain service to be provided by a third party, perhaps on
  280. X      hosts located outside the domain.
  281. X
  282. X      One of the difficult problems in operating a domain server is the
  283. X      acquisition and maintenance of the data.  In this case, the data
  284. X      are the host names and addresses.  In some environments this
  285. X      information changes fairly rapidly and keeping up-to-date data may
  286. X      be difficult.  This is one motivation for sub-domains.  One may
  287. X      wish to create sub-domains until the rate of change of the data in
  288. X      a sub-domain domain server database is easily managed.
  289. X
  290. X      In the technical language of the domain server implementation the
  291. X      data is divided into zones.  Domains and zones are not necessarily
  292. X      one-to-one.  It may be reasonable for two or more domains to
  293. X      combine their data in a single zone.
  294. X
  295. X      The responsible person or an identified technical assistant must
  296. X      understand in detail the procedures for operating a domain server,
  297. X      including the management of master files and zones.
  298. X
  299. X      The operation of a domain server should not be taken on lightly.
  300. X      There are some difficult problems in providing an adequate
  301. X      service, primarily the problems in keeping the database up to
  302. X      date, and keeping the service operating.
  303. X
  304. X
  305. XPostel & Reynolds                                               [Page 5]
  306. X
  307. X
  308. X
  309. XRFC 920                                                     October 1984
  310. XDomain Requirements
  311. X
  312. X
  313. X      The concepts and implementation details of the domain server are
  314. X      given in RFC-882 [2] and RFC-883 [3].
  315. X
  316. X   Minimum Size:
  317. X
  318. X      The domain must be of at least a minimum size.  There is no
  319. X      requirement to form a domain because some set of hosts is above
  320. X      the minimum size.
  321. X
  322. X      Top level domains must be specially authorized.  In general, they
  323. X      will only be authorized for domains expected to have over 500
  324. X      hosts.
  325. X
  326. X      The general guideline for a second level domain is that it have
  327. X      over 50 hosts.  This is a very soft "requirement".  It makes sense
  328. X      that any major organization, such as a university or corporation,
  329. X      be allowed as a second level domain -- even if it has just a few
  330. X      hosts.
  331. X
  332. X   Registration:
  333. X
  334. X      Top level domains must be specially authorized and registered with
  335. X      the NIC domain registrar.
  336. X
  337. X      The administrator of a level N domain must register with the
  338. X      registrar (or responsible person) of the level N-1 domain.  This
  339. X      upper level authority must be satisfied that the requirements are
  340. X      met before authorization for the domain is granted.
  341. X
  342. X      The registration procedure involves answering specific questions
  343. X      about the prospective domain.  A prototype of what the NIC Domain
  344. X      Registrar may ask for the registration of a second level domain is
  345. X      shown below.  These questions may change from time to time.  It is
  346. X      the responsibility of domain administrators to keep this
  347. X      information current.
  348. X
  349. X      The administrator of a domain is required to make sure that host
  350. X      and sub-domain names within that jurisdiction conform to the
  351. X      standard name conventions and are unique within that domain.
  352. X
  353. X      If sub-domains are set up, the administrator may wish to pass
  354. X      along some of his authority and responsibility to a sub-domain
  355. X      administrator.  Even if sub-domains are established, the
  356. X      responsible person for the top-level domain is ultimately
  357. X      responsible for the whole tree of sub-domains and hosts.
  358. X
  359. X      This does not mean that a domain administrator has to know the
  360. X
  361. X
  362. XPostel & Reynolds                                               [Page 6]
  363. X
  364. X
  365. X
  366. XRFC 920                                                     October 1984
  367. XDomain Requirements
  368. X
  369. X
  370. X      details of all the sub-domains and hosts to the Nth degree, but
  371. X      simply that if a problem occurs he can get it fixed by calling on
  372. X      the administrator of the sub-domain containing the problem.
  373. X
  374. XTop Level Domain Requirements
  375. X
  376. X   There are very few top level domains, each of these may have many
  377. X   second level domains.
  378. X
  379. X   An initial set of top level names has been identified.  Each of these
  380. X   has an administrator and an agent.
  381. X
  382. X   The top level domains:
  383. X
  384. X      ARPA =  The ARPA-Internet   *** TEMPORARY ***
  385. X
  386. X         Administrator:  DARPA
  387. X         Agent:          The Network Information Center
  388. X         Mailbox:        HOSTMASTER@SRI-NIC.ARPA
  389. X
  390. X      GOV  =  Government
  391. X
  392. X         Administrator:  DARPA
  393. X         Agent:          The Network Information Center
  394. X         Mailbox:        HOSTMASTER@SRI-NIC.ARPA
  395. X
  396. X      EDU  =  Education
  397. X
  398. X         Administrator:  DARPA
  399. X         Agent:          The Network Information Center
  400. X         Mailbox:        HOSTMASTER@SRI-NIC.ARPA
  401. X
  402. X      COM  =  Commercial
  403. X
  404. X         Administrator:  DARPA
  405. X         Agent:          The Network Information Center
  406. X         Mailbox:        HOSTMASTER@SRI-NIC.ARPA
  407. X
  408. X      MIL  =  Military
  409. X
  410. X         Administrator:  DDN-PMO
  411. X         Agent:          The Network Information Center
  412. X         Mailbox:        HOSTMASTER@SRI-NIC.ARPA
  413. X
  414. X
  415. X
  416. X
  417. X
  418. X
  419. XPostel & Reynolds                                               [Page 7]
  420. X
  421. X
  422. X
  423. XRFC 920                                                     October 1984
  424. XDomain Requirements
  425. X
  426. X
  427. X      ORG  =  Organization
  428. X
  429. X         Administrator:  DARPA
  430. X         Agent:          The Network Information Center
  431. X         Mailbox:        HOSTMASTER@SRI-NIC.ARPA
  432. X
  433. X      Countries
  434. X
  435. X         The English two letter code (alpha-2) identifying a country
  436. X         according the the ISO Standard for "Codes for the
  437. X         Representation of Names of Countries" [5].
  438. X
  439. X         As yet no country domains have been established.  As they are
  440. X         established information about the administrators and agents
  441. X         will be made public, and will be listed in subsequent editions
  442. X         of this memo.
  443. X
  444. X      Multiorganizations
  445. X
  446. X         A multiorganization may be a top level domain if it is large,
  447. X         and is composed of other organizations; particularly if the
  448. X         multiorganization can not be easily classified into one of the
  449. X         categories and is international in scope.
  450. X
  451. X         As yet no multiorganization domains have been established.  As
  452. X         they are established information about the administrators and
  453. X         agents will be made public, and will be listed in subsequent
  454. X         editions of this memo.
  455. X
  456. X      Note:  The NIC is listed as the agent and registrar for all the
  457. X      currently allowed top level domains.  If there are other entities
  458. X      that would be more appropriate agents and registrars for some or
  459. X      all of these domains then it would be desirable to reassign the
  460. X      responsibility.
  461. X
  462. XSecond Level Domain Requirements
  463. X
  464. X   Each top level domain may have many second level domains.  Every
  465. X   second level domain must meet the general requirements on a domain
  466. X   specified above, and be registered with a top level domain
  467. X   administrator.
  468. X
  469. X
  470. X
  471. X
  472. X
  473. X
  474. X
  475. X
  476. XPostel & Reynolds                                               [Page 8]
  477. X
  478. X
  479. X
  480. XRFC 920                                                     October 1984
  481. XDomain Requirements
  482. X
  483. X
  484. XThird through Nth Level Domain Requirements
  485. X
  486. X   Each second level domain may have many third level domains, etc.
  487. X   Every third level domain (through Nth level domain) must meet the
  488. X   requirements set by the administrator of the immediately higher level
  489. X   domain.  Note that these may be more or less strict than the general
  490. X   requirements.  One would expect the minimum size requirements to
  491. X   decrease at each level.
  492. X
  493. XThe ARPA Domain
  494. X
  495. X   At the time the implementation of the domain concept was begun it was
  496. X   thought that the set of hosts under the administrative authority of
  497. X   DARPA would make up a domain.  Thus the initial domain selected was
  498. X   called ARPA.  Now it is seen that there is no strong motivation for
  499. X   there to be a top level ARPA domain.  The plan is for the current
  500. X   ARPA domain to go out of business as soon as possible.  Hosts that
  501. X   are currently members of the ARPA domain should make arrangements to
  502. X   join another domain.  It is likely that for experimental purposes
  503. X   there will be a second level domain called ARPA in the ORG domain
  504. X   (i.e., there will probably be an ARPA.ORG domain).
  505. X
  506. XThe DDN Hosts
  507. X
  508. X   DDN hosts that do not desire to participate in this domain naming
  509. X   system will continue to use the HOSTS.TXT data file maintained by the
  510. X   NIC for name to address translations.  This file will be kept up to
  511. X   date for the DDN hosts.  However, all DDN hosts will change their
  512. X   names from "host.ARPA" to (for example) "host.DDN.MIL" some time in
  513. X   the future.  The schedule for changes required in DDN hosts will be
  514. X   established by the DDN-PMO.
  515. X
  516. XImpact on Hosts
  517. X
  518. X   What is a host administrator to do about all this?
  519. X
  520. X      For existing hosts already operating in the ARPA-Internet, the
  521. X      best advice is to sit tight for now.  Take a few months to
  522. X      consider the options, then select a domain to join.  Plan
  523. X      carefully for the impact that changing your host name will have on
  524. X      both your local users and on their remote correspondents.
  525. X
  526. X      For a new host, careful thought should be given (as discussed
  527. X      below).  Some guidance can be obtained by comparing notes on what
  528. X      other hosts with similar administrative properties have done.
  529. X
  530. X   The owner of a host may decide which domain to join, and the
  531. X
  532. X
  533. XPostel & Reynolds                                               [Page 9]
  534. X
  535. X
  536. X
  537. XRFC 920                                                     October 1984
  538. XDomain Requirements
  539. X
  540. X
  541. X   administrator of a domain may decide which hosts to accept into his
  542. X   domain.  Thus the owner of a host and a domain administrator must
  543. X   come to an understanding about the host being in the domain.  This is
  544. X   the foundation of responsible administration.
  545. X
  546. X      For example, a host "XYZ" at MIT might possible be considered as a
  547. X      candidate for becoming any of XYZ.ARPA.ORG, XYZ.CSNET, or
  548. X      XYZ.MIT.EDU.
  549. X
  550. X         The owner of host XYZ may choose which domain to join,
  551. X         depending on which domain administrators are willing to have
  552. X         him.
  553. X
  554. X   The domain is part of the host name.  Thus if USC-ISIA.ARPA changes
  555. X   its domain affiliation to DDN.MIL to become USC-ISIA.DDN.MIL, it has
  556. X   changed its name.  This means that any previous references to
  557. X   USC-ISIA.ARPA are now out of date.  Such old references may include
  558. X   private host name to address tables, and any recorded information
  559. X   about mailboxes such as mailing lists, the headers of old messages,
  560. X   printed directories, and peoples' memories.
  561. X
  562. X   The experience of the DARPA community suggests that changing the name
  563. X   of a host is somewhat painful.  It is recommended that careful
  564. X   thought be given to choosing a new name for a host - which includes
  565. X   selecting its place in the domain hierarchy.
  566. X
  567. XThe Roles of the Network Information Center
  568. X
  569. X   The NIC plays two types of roles in the administration of domains.
  570. X   First,  the NIC is the registrar of all top level domains.  Second
  571. X   the NIC is the administrator of several top level domains (and the
  572. X   registrar for second level domains in these).
  573. X
  574. X   Top Level Domain Registrar
  575. X
  576. X      As the registrar for top level domains, the NIC is the contact
  577. X      point for investigating the possibility of establishing a new top
  578. X      level domain.
  579. X
  580. X   Top Level Domain Administrator
  581. X
  582. X      For the top level domains designated so far, the NIC is the
  583. X      administrator of each of these domains.  This means the NIC is
  584. X      responsible for the management of these domains and the
  585. X      registration of the second level domains or hosts (if at the
  586. X      second level) in these domains.
  587. X
  588. X
  589. X
  590. XPostel & Reynolds                                              [Page 10]
  591. X
  592. X
  593. X
  594. XRFC 920                                                     October 1984
  595. XDomain Requirements
  596. X
  597. X
  598. X      It may be reasonable for the administration of some of these
  599. X      domains to be taken on by other authorities in the future.  It is
  600. X      certainly not desired that the NIC be the administrator of all top
  601. X      level domains forever.
  602. X
  603. XPrototypical Questions
  604. X
  605. X   To establish a domain, the following information must be provided to
  606. X   the NIC Domain Registrar (HOSTMASTER@SRI-NIC.ARPA):
  607. X
  608. X      Note:  The key people must have computer mail mailboxes and
  609. X      NIC-Idents.  If they do not at present, please remedy the
  610. X      situation at once.  A NIC-Ident may be established by contacting
  611. X      NIC@SRI-NIC.ARPA.
  612. X
  613. X   1)  The name of the top level domain to join.
  614. X
  615. X      For example:  EDU
  616. X
  617. X   2)  The name, title, mailing address, phone number, and organization
  618. X   of the administrative head of the organization.  This is the contact
  619. X   point for administrative and policy questions about the domain.  In
  620. X   the case of a research project, this should be the Principal
  621. X   Investigator.  The online mailbox and NIC-Ident of this person should
  622. X   also be included.
  623. X
  624. X      For example:
  625. X
  626. X         Administrator
  627. X
  628. X            Organization  USC/Information Sciences Institute
  629. X            Name          Keith Uncapher
  630. X            Title         Executive Director
  631. X            Mail Address  USC/ISI
  632. X                          4676 Admiralty Way, Suite 1001
  633. X                          Marina del Rey, CA. 90292-6695
  634. X            Phone Number  213-822-1511
  635. X            Net Mailbox   Uncapher@USC-ISIB.ARPA
  636. X            NIC-Ident     KU
  637. X
  638. X   3)  The name, title, mailing address, phone number, and organization
  639. X   of the domain technical contact.  The online mailbox and NIC-Ident of
  640. X   the domain technical contact should also be included.  This is the
  641. X   contact point for problems with the domain and for updating
  642. X   information about the domain.  Also, the domain technical contact may
  643. X   be responsible for hosts in this domain.
  644. X
  645. X
  646. X
  647. XPostel & Reynolds                                              [Page 11]
  648. X
  649. X
  650. X
  651. XRFC 920                                                     October 1984
  652. XDomain Requirements
  653. X
  654. X
  655. X      For example:
  656. X
  657. X         Technical Contact
  658. X
  659. X            Organization  USC/Information Sciences Institute
  660. X            Name          Craig Milo Rogers
  661. X            Title         Researcher
  662. X            Mail Address  USC/ISI
  663. X                          4676 Admiralty Way, Suite 1001
  664. X                          Marina del Rey, CA. 90292-6695
  665. X            Phone Number  213-822-1511
  666. X            Net Mailbox   Rogers@USC-ISIB.ARPA
  667. X            NIC-Ident     CMR
  668. X
  669. X   4)  The name, title, mailing address, phone number, and organization
  670. X   of the zone technical contact.  The online mailbox and NIC-Ident of
  671. X   the zone technical contact should also be included.  This is the
  672. X   contact point for problems with the zone and for updating information
  673. X   about the zone.  In many cases the zone technical contact and the
  674. X   domain technical contact will be the same person.
  675. X
  676. X      For example:
  677. X
  678. X         Technical Contact
  679. X
  680. X            Organization  USC/Information Sciences Institute
  681. X            Name          Craig Milo Rogers
  682. X            Title         Researcher
  683. X            Mail Address  USC/ISI
  684. X                          4676 Admiralty Way, Suite 1001
  685. X                          Marina del Rey, CA. 90292-6695
  686. X            Phone Number  213-822-1511
  687. X            Net Mailbox   Rogers@USC-ISIB.ARPA
  688. X            NIC-Ident     CMR
  689. X
  690. X   5)  The name of the domain (up to 12 characters).  This is the name
  691. X   that will be used in tables and lists associating the domain and the
  692. X   domain server addresses.  [While technically domain names can be
  693. X   quite long (programmers beware), shorter names are easier for people
  694. X   to cope with.]
  695. X
  696. X      For example:  ALPHA-BETA
  697. X
  698. X   6)  A description of the servers that provides the domain service for
  699. X   translating name to address for hosts in this domain, and the date
  700. X   they will be operational.
  701. X
  702. X
  703. X
  704. XPostel & Reynolds                                              [Page 12]
  705. X
  706. X
  707. X
  708. XRFC 920                                                     October 1984
  709. XDomain Requirements
  710. X
  711. X
  712. X      A good way to answer this question is to say "Our server is
  713. X      supplied by person or company X and does whatever their standard
  714. X      issue server does".
  715. X
  716. X         For example:  Our server is a copy of the server operated by
  717. X         the NIC, and will be installed and made operational on
  718. X         1-November-84.
  719. X
  720. X   7)  A description of the server machines, including:
  721. X
  722. X      (a) hardware and software (using keywords from the Assigned
  723. X      Numbers)
  724. X
  725. X      (b) addresses (what host on what net for each connected net)
  726. X
  727. X      For example:
  728. X
  729. X         (a) hardware and software
  730. X
  731. X            VAX-11/750  and  UNIX,    or
  732. X            IBM-PC      and  MS-DOS,  or
  733. X            DEC-1090    and  TOPS-20
  734. X
  735. X         (b) address
  736. X
  737. X            10.9.0.193 on ARPANET
  738. X
  739. X   8)  An estimate of the number of hosts that will be in the domain.
  740. X
  741. X      (a) initially,
  742. X      (b) within one year,
  743. X      (c) two years, and
  744. X      (d) five years.
  745. X
  746. X      For example:
  747. X
  748. X         (a) initially  =   50
  749. X         (b) one year   =  100
  750. X         (c) two years  =  200
  751. X         (d) five years =  500
  752. X
  753. X
  754. X
  755. X
  756. X
  757. X
  758. X
  759. X
  760. X
  761. XPostel & Reynolds                                              [Page 13]
  762. X
  763. X
  764. X
  765. XRFC 920                                                     October 1984
  766. XDomain Requirements
  767. X
  768. X
  769. XAcknowledgment
  770. X
  771. X   We would like to thank the many people who contributed to this memo,
  772. X   including the participants in the Namedroppers Group, the ICCB, the
  773. X   PCCB, and especially the staff of the Network Information Center,
  774. X   particularly J. Feinler and K. Harrenstien.
  775. X
  776. XReferences
  777. X
  778. X   [1]  Postel, J., "The Domain Names Plan and Schedule", RFC-881, USC
  779. X        Information Sciences Institute, November 1983.
  780. X
  781. X   [2]  Mockapetris, P., "Domain Names - Concepts and Facilities",
  782. X        RFC-882, USC Information Sciences Institute, November 1983.
  783. X
  784. X   [3]  Mockapetris, P., "Domain Names - Implementation and
  785. X        Specification", RFC-883, USC Information Sciences Institute,
  786. X        November 1983.
  787. X
  788. X   [4]  Postel, J., "Domain Name System Implementation Schedule",
  789. X        RFC-897, USC Information Sciences Institute, February 1984.
  790. X
  791. X   [5]  ISO, "Codes for the Representation of Names of Countries",
  792. X        ISO-3166, International Standards Organization, May 1981.
  793. X
  794. X   [6]  Postel, J., "Domain Name System Implementation Schedule -
  795. X        Revised", RFC-921, USC Information Sciences Institute, October
  796. X        1984.
  797. X
  798. X   [7]  Mockapetris, P., "The Domain Name System", Proceedings of the
  799. X        IFIP 6.5 Working Conference on Computer Message Services,
  800. X        Nottingham, England, May 1984.  Also as ISI/RS-84-133,
  801. X        June 1984.
  802. X
  803. X   [8]  Mockapetris, P., J. Postel, and P. Kirton, "Name Server Design
  804. X        for Distributed Systems", Proceedings of the Seventh
  805. X        International Conference on Computer Communication, October 30
  806. X        to November 3 1984, Sidney, Australia.  Also as ISI/RS-84-132,
  807. X        June 1984.
  808. X
  809. X
  810. X
  811. X
  812. X
  813. X
  814. X
  815. X
  816. X
  817. X
  818. XPostel & Reynolds                                              [Page 14]
  819. X
  820. X#
  821. X# @(#)rfc920.txt    2.1 smail 12/14/86
  822. X#
  823. @//E*O*F doc/rfc920.txt//
  824. if test 27863 -ne "`wc -c <'doc/rfc920.txt'`"; then
  825.     echo shar: error transmitting "'doc/rfc920.txt'" '(should have been 27863 characters)'
  826. fi
  827. fi # end of overwriting check
  828. echo shar: extracting "'src/alias.c'" '(10178 characters)'
  829. if test -f 'src/alias.c' ; then 
  830.   echo shar: will not over-write existing file "'src/alias.c'"
  831. else
  832. sed 's/^X//' >src/alias.c <<'@//E*O*F src/alias.c//'
  833. X#ifndef lint
  834. Xstatic char *sccsid = "@(#)alias.c    2.3 (smail) 1/28/87";
  835. X#endif
  836. X
  837. X#include <stdio.h>
  838. X#include <sys/types.h>
  839. X#include <sys/stat.h>
  840. X#include <pwd.h>
  841. X#include "defs.h"
  842. X#ifdef BSD
  843. X#include <strings.h>
  844. X#else
  845. X#include <string.h>
  846. X#endif
  847. X
  848. Xextern enum edebug debug;    /* verbose and debug modes        */
  849. Xextern char hostdomain[];
  850. Xextern char hostname[];
  851. Xextern char *aliasfile;
  852. X
  853. X#ifdef SENDMAIL
  854. Xchar **
  855. Xalias(pargc, argv)
  856. Xint *pargc;
  857. Xchar **argv;
  858. X{
  859. X    int i;
  860. X/*
  861. X**  aliasing was done by sendmail - so don't do anything here
  862. X**  except to possibly truncate the argument count to MAXARGS.
  863. X*/
  864. X    if(MAXARGS < *pargc) {
  865. X        for(i = MAXARGS ; i < *pargc ; i++) {
  866. X            ADVISE("too many recipents - skipping %s\n", argv[i]);
  867. X        }
  868. X        *pargc = MAXARGS;
  869. X    }
  870. X    return(argv);
  871. X}
  872. X#else
  873. X
  874. X/*
  875. X**
  876. X** Picture of the alias graph structure
  877. X**
  878. X**    head
  879. X**       |
  880. X**       v
  881. X**    maps -> mark -> gjm -> mel -> NNULL
  882. X**       |
  883. X**       v
  884. X**    sys ->  root -> ron -> NNULL
  885. X**       |       |
  886. X**       | +-----+
  887. X**       | |
  888. X**       v v
  889. X**    root -> mark -> chris -> lda -> NNULL
  890. X**       |
  891. X**       v
  892. X**      NNULL
  893. X*/
  894. X
  895. Xtypedef struct alias_node node;
  896. X
  897. Xstatic struct alias_node {
  898. X    char *string;
  899. X    node *horz;
  900. X    node *vert;
  901. X};
  902. X
  903. Xstatic node aliases = {"", 0, 0}; /* this is the 'dummy header' */
  904. X
  905. X/*
  906. X** lint free forms of NULL
  907. X*/
  908. X
  909. X#define NNULL    ((node  *) 0)
  910. X#define CNULL    ('\0')
  911. X
  912. X/*
  913. X** string parsing macros
  914. X*/
  915. X#define SKIPWORD(Z)  while(*Z!=' ' && *Z!='\t' && *Z!='\n' && *Z!=',') Z++;
  916. X#define SKIPSPACE(Z) while(*Z==' ' || *Z=='\t' || *Z=='\n' || *Z==',') Z++;
  917. X
  918. Xstatic int nargc = 0;
  919. Xstatic char *nargv[MAXARGS];
  920. X
  921. Xvoid    add_horz();
  922. Xvoid    load_alias(), strip_comments();
  923. Xnode    *vsearch(), *hsearch(), *pop();
  924. Xint    recipients();
  925. Xchar    *tilde();
  926. X
  927. X/* our horizontal linked list looks like a stack */
  928. X#define push        add_horz
  929. X
  930. X#define escape(s)    ((*s != '\\') ? (s) : (s+1))
  931. X
  932. Xchar **
  933. Xalias(pargc, argv)
  934. Xint *pargc;
  935. Xchar **argv;
  936. X{
  937. X/*
  938. X**  alias the addresses
  939. X*/
  940. X    FILE    *fp;
  941. X    int    i, aliased;
  942. X    char    domain[SMLBUF], ubuf[SMLBUF], *user;
  943. X    char    *home, buf[SMLBUF];
  944. X    node    *addr, addrstk;
  945. X    node    *flist,  fliststk;
  946. X    node    *u, *a;
  947. X    struct    stat st;
  948. X
  949. X    addr  = &addrstk;
  950. X    flist = &fliststk;
  951. X    user  = ubuf;
  952. X
  953. X    addr->horz = NNULL;
  954. X    flist->horz  = NNULL;
  955. X
  956. X    /*
  957. X    ** push all of the addresses onto a stack
  958. X    */
  959. X    for(i=0; i < *pargc; i++) {
  960. X        push(addr, argv[i]);
  961. X    }
  962. X
  963. X    /*
  964. X    ** for each adress, check for included files, aliases and .forward files
  965. X    */
  966. X    while((nargc < MAXARGS) && ((u = pop(addr)) != NNULL)) {
  967. X        if(strncmpic(u->string, ":include:", 9) == 0) {
  968. X            /*
  969. X            ** make sure it's a full path name
  970. X            ** don't allow multiple sourcing
  971. X            ** of a given include file
  972. X            */
  973. X            char *p = u->string + 9;
  974. X
  975. X            if((*p == '/')
  976. X            && (hsearch(flist, p) == NULL)) {
  977. X                push(flist, p);
  978. X                if((stat(p, &st) >= 0)
  979. X                &&((st.st_mode & S_IFMT) == S_IFREG)
  980. X                &&((fp = fopen(p, "r")) != NULL)) {
  981. X                    while(fgets(buf, sizeof buf, fp)) {
  982. X                        recipients(addr, buf);
  983. X                    }
  984. X                    fclose(fp);
  985. X                }
  986. X            }
  987. X            continue;
  988. X        }
  989. X
  990. X        /*
  991. X        ** parse the arg to see if it's to be aliased
  992. X        */
  993. X
  994. X        if(islocal(u->string, domain, ubuf) == 0) {
  995. X            goto aliasing_complete;
  996. X        }
  997. X
  998. X        /*
  999. X        ** local form - try to alias user
  1000. X        ** aliases file takes precedence over ~user/.forward
  1001. X        ** since that's the way that sendmail does it.
  1002. X        */
  1003. X
  1004. X        user = escape(ubuf);
  1005. X        if((a = vsearch(user)) != NNULL) {
  1006. X        /*
  1007. X        ** check for alias
  1008. X        */
  1009. X            node *t = a;
  1010. X            for(a = a->horz; a != NNULL; a=a->horz) {
  1011. X                push(addr, a->string);
  1012. X            }
  1013. X            t->horz = NNULL;
  1014. X            continue;
  1015. X        }
  1016. X
  1017. X        if((home = tilde(user)) != NULL) {
  1018. X            /* don't allow multiple sourcing
  1019. X            ** of a given .forward file
  1020. X            */
  1021. X
  1022. X            if((hsearch(flist, home) != NULL)) {
  1023. X                continue;
  1024. X            }
  1025. X            push(flist, home);
  1026. X
  1027. X            /*
  1028. X            ** check for ~user/.forward file
  1029. X            ** must be a regular, readable file
  1030. X            */
  1031. X
  1032. X            sprintf(buf, "%s/%s", home, ".forward");
  1033. X            if((stat(buf, &st) >= 0)
  1034. X            &&((st.st_mode & S_IFMT) == S_IFREG)
  1035. X            &&((fp = fopen(buf, "r")) != NULL)) {
  1036. X                aliased = 0;
  1037. X                while(fgets(buf, sizeof buf, fp)) {
  1038. X                    aliased |= recipients(addr, buf);
  1039. X                }
  1040. X                fclose(fp);
  1041. X                if(aliased) {
  1042. X                    continue;
  1043. X                }
  1044. X            }
  1045. X        }
  1046. Xaliasing_complete:
  1047. X        user = escape(u->string);
  1048. X        for(i=0; i < nargc; i++) {
  1049. X            if(strcmpic(nargv[i], user) == 0) {
  1050. X                break;
  1051. X            }
  1052. X        }
  1053. X
  1054. X        if(i == nargc) {
  1055. X            nargv[nargc++] = user;
  1056. X        }
  1057. X    }
  1058. X    *pargc     = nargc;
  1059. X    return(nargv);
  1060. X}
  1061. X
  1062. X/*
  1063. X** vsearch
  1064. X**    given an string, look for its alias in
  1065. X**    the 'vertical' linked list of aliases.
  1066. X*/
  1067. Xnode *
  1068. Xvsearch(user)
  1069. Xchar *user;
  1070. X{
  1071. X    node *head;
  1072. X    node *a;
  1073. X    static int loaded = 0;
  1074. X
  1075. X    head = &aliases;
  1076. X    if(loaded == 0) {
  1077. X        load_alias(head, aliasfile);
  1078. X        loaded = 1;
  1079. X    }
  1080. X
  1081. X    for(a = head->vert; a != NNULL; a = a->vert) {
  1082. X#ifdef CASEALIAS
  1083. X        if(strcmp(a->string, user) == 0)
  1084. X#else
  1085. X        if(strcmpic(a->string, user) == 0)
  1086. X#endif
  1087. X        {
  1088. X            break;
  1089. X        }
  1090. X    }
  1091. X    if((a == NNULL)            /* not in graph */
  1092. X    || (a->horz == NNULL)) {    /* null list (poss. prev. aliased) */
  1093. X        return(NNULL);
  1094. X    }
  1095. X    return(a);
  1096. X}
  1097. X
  1098. X/*
  1099. X** hsearch
  1100. X**    given an string, look for it in
  1101. X**    a 'horizontal' linked list of strings.
  1102. X*/
  1103. Xnode *
  1104. Xhsearch(head, str)
  1105. Xnode *head;
  1106. Xchar *str;
  1107. X{
  1108. X    node *a;
  1109. X    for(a = head->horz; a != NNULL; a = a->horz) {
  1110. X#ifdef CASEALIAS
  1111. X        if(strcmp(a->string, str) == 0)
  1112. X#else
  1113. X        if(strcmpic(a->string, str) == 0)
  1114. X#endif
  1115. X        {
  1116. X            break;
  1117. X        }
  1118. X    }
  1119. X    return(a);
  1120. X}
  1121. X
  1122. X/*
  1123. X** load_alias
  1124. X**    parse an 'aliases' file and add the aliases to the alias graph.
  1125. X**    Handle inclusion of other 'aliases' files.
  1126. X*/
  1127. X
  1128. Xvoid
  1129. Xload_alias(head, filename)
  1130. Xnode *head;
  1131. Xchar *filename;
  1132. X{
  1133. X    FILE *fp;
  1134. X    node *h, *add_vert();
  1135. X    char domain[SMLBUF], user[SMLBUF];
  1136. X    char *p, *b, buf[SMLBUF];
  1137. X
  1138. X    if((fp = fopen(filename,"r")) == NULL) {
  1139. XDEBUG("load_alias open('%s') failed\n", filename);
  1140. X        return;
  1141. X    }
  1142. X
  1143. X    while(fgets(buf, sizeof buf, fp) != NULL) {
  1144. X        p = buf;
  1145. X        if((*p == '#') || (*p == '\n')) {
  1146. X            continue;
  1147. X        }
  1148. X
  1149. X        /*
  1150. X        ** include another file of aliases
  1151. X        */
  1152. X
  1153. X        if(strncmp(p, ":include:", 9) == 0) {
  1154. X            char *nl;
  1155. X            p += 9;
  1156. X            if((nl = index(p, '\n')) != NULL) {
  1157. X                *nl = CNULL;
  1158. X            }
  1159. XDEBUG("load_alias '%s' includes file '%s'\n", filename, p);
  1160. X            load_alias(head, p);
  1161. X            continue;
  1162. X        }
  1163. X
  1164. X        /*
  1165. X        **  if the first char on the line is a space or tab
  1166. X        **  then it's a continuation line.  Otherwise,
  1167. X        **  we start a new alias.
  1168. X        */
  1169. X        if(*p != ' ' && *p != '\t') {
  1170. X            b = p;
  1171. X            SKIPWORD(p);
  1172. X            *p++ = CNULL;
  1173. X            /*
  1174. X            ** be sure that the alias is in local form
  1175. X            */
  1176. X            if(islocal(b, domain, user) == 0) {
  1177. X                /*
  1178. X                ** non-local alias format - skip it
  1179. X                */
  1180. X                continue;
  1181. X            }
  1182. X            /*
  1183. X            ** add the alias to the (vertical) list of aliases
  1184. X            */
  1185. X            if((h = add_vert(head, user)) == NNULL) {
  1186. XDEBUG("load_alias for '%s' failed\n", b);
  1187. X                return;
  1188. X            }
  1189. X        }
  1190. X        /*
  1191. X        **  Next on the line is the list of recipents.
  1192. X        **  Strip out each word and add it to the
  1193. X        **  horizontal linked list.
  1194. X        */
  1195. X        recipients(h, p);
  1196. X    }
  1197. X    (void) fclose(fp);
  1198. X}
  1199. X
  1200. X/*
  1201. X** add each word in a string (*p) of recipients
  1202. X** to the (horizontal) linked list associated with 'h'
  1203. X*/
  1204. X
  1205. Xrecipients(h, p)
  1206. Xnode *h;
  1207. Xchar *p;
  1208. X{
  1209. X
  1210. X    char *b;
  1211. X    int ret = 0;
  1212. X
  1213. X    strip_comments(p);    /* strip out stuff in ()'s */
  1214. X
  1215. X    SKIPSPACE(p);        /* skip leading whitespace on line */
  1216. X
  1217. X    while((*p != NULL) && (*p != '#')) {
  1218. X        b = p;
  1219. X        if(*b == '"') {
  1220. X            if((p = index(++b, '"')) == NULL) {
  1221. X                /* syntax error - no matching quote */
  1222. X                /* skip the rest of the line */
  1223. X                return(ret);
  1224. X            }
  1225. X        } else {
  1226. X            SKIPWORD(p);
  1227. X        }
  1228. X
  1229. X        if(*p != CNULL) {
  1230. X            *p++ = CNULL;
  1231. X        }
  1232. X
  1233. X        add_horz(h, b);
  1234. X        ret = 1;
  1235. X        SKIPSPACE(p);
  1236. X    }
  1237. X    return(ret);
  1238. X}
  1239. X
  1240. X/*
  1241. X** some aliases may have comments on the line like:
  1242. X**
  1243. X** moderators    moderator@somehost.domain    (Moderator's Name)
  1244. X**        moderator@anotherhost.domain    (Another Moderator's Name)
  1245. X**
  1246. X** strip out the stuff in ()'s
  1247. X**
  1248. X*/
  1249. X
  1250. Xvoid
  1251. Xstrip_comments(p)
  1252. Xchar *p;
  1253. X{
  1254. X    char *b;
  1255. X    while((p = index(p, '(')) != NULL) {
  1256. X        b = p++;    /*
  1257. X                ** save pointer to open parenthesis
  1258. X                */
  1259. X        if((p = index(p, ')')) != NULL) {/* look for close paren */
  1260. X            (void) strcpy(b, ++p);     /* slide string left    */
  1261. X        } else {
  1262. X            *b = CNULL;    /* no paren, skip rest of line  */
  1263. X            break;
  1264. X        }
  1265. X    }
  1266. X}
  1267. X
  1268. X/*
  1269. X** add_vert - add a (vertical) link to the chain of aliases.
  1270. X*/
  1271. X
  1272. Xnode *
  1273. Xadd_vert(head, str)
  1274. Xnode *head;
  1275. Xchar *str;
  1276. X{
  1277. X    char *p, *malloc();
  1278. X    void free();
  1279. X    node *new;
  1280. X
  1281. X    /*
  1282. X    ** strip colons off the end of alias names
  1283. X    */
  1284. X    if((p = index(str, ':')) != NULL) {
  1285. X        *p = CNULL;
  1286. X    }
  1287. X    if((new = (node *) malloc(sizeof(node))) != NNULL) {
  1288. X        if((new->string = malloc((unsigned) strlen(str)+1)) == NULL) {
  1289. X            free(new);
  1290. X            new = NNULL;
  1291. X        } else {
  1292. X            (void) strcpy(new->string, str);
  1293. X            new->vert   = head->vert;
  1294. X            new->horz   = NNULL;
  1295. X            head->vert  = new;
  1296. X/*DEBUG("add_vert %s->%s\n", head->string, new->string);/* */
  1297. X        }
  1298. X    }
  1299. X    return(new);
  1300. X}
  1301. X
  1302. X/*
  1303. X** add_horz - add a (horizontal) link to the chain of recipients.
  1304. X*/
  1305. X
  1306. Xvoid
  1307. Xadd_horz(head, str)
  1308. Xnode *head;
  1309. Xchar *str;
  1310. X{
  1311. X    char *malloc();
  1312. X    node *new;
  1313. X
  1314. X    if((new = (node *) malloc(sizeof(node))) != NNULL) {
  1315. X        if((new->string = malloc((unsigned) strlen(str)+1)) == NULL) {
  1316. X            free(new);
  1317. X            new = NNULL;
  1318. X        } else {
  1319. X            (void) strcpy(new->string, str);
  1320. X            new->horz  = head->horz;
  1321. X            new->vert  = NNULL;
  1322. X            head->horz = new;
  1323. X        }
  1324. X/*DEBUG("add_horz %s->%s\n", head->string, new->string);/* */
  1325. X    }
  1326. X}
  1327. X
  1328. Xchar *
  1329. Xtilde(user)
  1330. Xchar *user;
  1331. X{
  1332. X    struct passwd *getpwent(), *pw;
  1333. X    static node pwdstk;
  1334. X    static int pw_eof = 0;
  1335. X
  1336. X    node *a, *pwd;
  1337. X
  1338. X    char buf[SMLBUF];
  1339. X    int i;
  1340. X
  1341. X    pwd = &pwdstk;
  1342. X
  1343. X    /*
  1344. X    ** check for previously cached user
  1345. X    */
  1346. X
  1347. X    if((a = hsearch(pwd, user)) != NNULL) {
  1348. X        return(a->string + strlen(a->string) + 1);
  1349. X    }
  1350. X
  1351. X    /*
  1352. X    ** cache previous username and home directory
  1353. X    ** this bit of code is quite implementation dependent.
  1354. X    ** The kludge here is that the string login:home is
  1355. X    ** pushed onto a linked list, and then the ':' is
  1356. X    ** replaced with a null character.  This lets us
  1357. X    ** search the list without the hassel of index()'ing
  1358. X    ** on the ':' and doing strncmp().
  1359. X    */
  1360. X
  1361. X    while((pw_eof == 0) && ((pw = getpwent()) != NULL)) {
  1362. X        strcpy(buf, pw->pw_name);
  1363. X        i = strlen(buf);
  1364. X        buf[i] = ':';
  1365. X        strcpy(&buf[i+1], pw->pw_dir);
  1366. X        push(pwd, buf);
  1367. X        a = pwd->horz;
  1368. X        a->string[i] = '\0';
  1369. X        if(strcmp(user, pw->pw_name) == 0) {
  1370. X            return(a->string + strlen(a->string) + 1);
  1371. X        }
  1372. X    }
  1373. X    pw_eof = 1;
  1374. X    return(NULL);
  1375. X}
  1376. X
  1377. Xnode *
  1378. Xpop(head)
  1379. Xnode *head;
  1380. X{
  1381. X    node *ret = NNULL;
  1382. X
  1383. X    if(head != NNULL) {
  1384. X        ret = head->horz;
  1385. X        if(ret != NNULL) {
  1386. X            head->horz = ret->horz;
  1387. X        }
  1388. X    }
  1389. X    return(ret);
  1390. X}
  1391. X#endif
  1392. @//E*O*F src/alias.c//
  1393. if test 10178 -ne "`wc -c <'src/alias.c'`"; then
  1394.     echo shar: error transmitting "'src/alias.c'" '(should have been 10178 characters)'
  1395. fi
  1396. fi # end of overwriting check
  1397. echo shar: extracting "'src/defs.h'" '(7752 characters)'
  1398. if test -f 'src/defs.h' ; then 
  1399.   echo shar: will not over-write existing file "'src/defs.h'"
  1400. else
  1401. sed 's/^X//' >src/defs.h <<'@//E*O*F src/defs.h//'
  1402. X/*
  1403. X**
  1404. X**  Defs.h:  header file for rmail/smail.
  1405. X**
  1406. X**  Configuration options for rmail/smail.
  1407. X**    full domain name is 'hostname.uucp' (get registered!)
  1408. X**    path file is /usr/lib/uucp/paths.
  1409. X**    no log, no record, use sendmail.
  1410. X** 
  1411. X**  You can change these in the next few blocks.
  1412. X**
  1413. X*/
  1414. X
  1415. X/*
  1416. X**    @(#)defs.h    2.3 (smail) 1/26/87
  1417. X*/
  1418. X
  1419. X#ifndef VERSION
  1420. X#define    VERSION    "smail2.3"
  1421. X#endif
  1422. X
  1423. X/*# define BSD                /* if system is a Berkeley system */
  1424. X
  1425. X# define SENDMAIL "/usr/lib/sendmail"    /* Turn off to use /bin/(l)mail only */
  1426. X
  1427. X/*
  1428. X**  The ALIAS definitions are used only if SENDMAIL is NOT defined.
  1429. X**  Sites using sendmail have to let sendmail do the aliasing.
  1430. X**  ALIAS, must be defined, however, even if not used.
  1431. X*/
  1432. X
  1433. X# ifdef SENDMAIL
  1434. X# define ALIAS    "not_used"
  1435. X# else
  1436. X# define ALIAS    "/usr/lib/aliases"    /* location of mail aliases    */
  1437. X/*# define CASEALIAS            /* make aliases case sensitive */
  1438. X# endif
  1439. X
  1440. X
  1441. X# ifdef BSD
  1442. X# define GETHOSTNAME            /* use gethostname() */
  1443. X# else
  1444. X# define UNAME                 /* use uname() */
  1445. X# endif
  1446. X
  1447. X/* if defined, HOSTNAME overrides UNAME and GETHOSTNAME */
  1448. X/* # define HOSTNAME   "host"        /* literal name */
  1449. X
  1450. X/*# define HOSTDOMAIN "host.dom"    /* replacement for HOSTNAME.MYDOM */
  1451. X
  1452. X/*
  1453. X * .UUCP here is just for testing, GET REGISTERED in COM, EDU, etc.
  1454. X * See INFO.REGISTRY for details.
  1455. X */
  1456. X# define MYDOM        ".UUCP"        /* literal domain suffix */
  1457. X
  1458. X/*
  1459. X * HIDDENHOSTS allows hosts that serve as domain gateways to hide
  1460. X * the subdomains beneath them.  Mail that originates at any of
  1461. X * the hosts in the subdomain will appear to come from the gateway host.
  1462. X * Hence, mail from
  1463. X *
  1464. X *         anything.hostdomain!user
  1465. X *
  1466. X * will appear to come from 
  1467. X *
  1468. X *         hostdomain!user
  1469. X *
  1470. X * A consequence is that return mail to hostdomain!user would need to
  1471. X * be forwarded to the proper subdomain via aliases or other forwarding
  1472. X * facilities.
  1473. X *
  1474. X * If you're using sendmail, then if defined here,
  1475. X * it should be used in ruleset 4 of the sendmail.cf, too.
  1476. X */
  1477. X
  1478. X/*#define HIDDENHOSTS            /* hide subdomains of hostdomain */
  1479. X
  1480. X/*
  1481. X * Mail that would otherwise be undeliverable will be passed to the
  1482. X * aliased SMARTHOST for potential delivery.
  1483. X *
  1484. X * Be sure that the host you specify in your pathalias input knows that you're
  1485. X * using it as a relay, or you might upset somebody when they find out some
  1486. X * other way.  If you're using 'foovax' as your relay, and below you have
  1487. X * #define SMARTHOST "smart-host", then the pathalias alias would be:
  1488. X *
  1489. X *    smart-host = foovax
  1490. X */
  1491. X
  1492. X# define SMARTHOST  "smart-host"    /* pathalias alias for relay host */
  1493. X
  1494. X/*
  1495. X**  Locations of files:
  1496. X**    PATHS is where the pathalias output is.  This is mandatory.
  1497. X**    Define LOG if you want a log of mail.  This can be handy for
  1498. X**    debugging and traffic analysis.
  1499. X**    Define RECORD for a copy of all mail.  This uses much time and
  1500. X**    space and is only used for extreme debugging cases.
  1501. X*/
  1502. X
  1503. X#ifndef PATHS
  1504. X# define PATHS    "/usr/lib/uucp/paths"    /* location of the path database */
  1505. X#endif
  1506. X
  1507. X/*# define LOG     "/usr/spool/uucp/mail.log"    /* log of uucp mail */
  1508. X/*# define RECORD    "/tmp/mail.log"        /* record of uucp mail */
  1509. X
  1510. X/*
  1511. X**  Mailer options:
  1512. X**    RMAIL is the command to invoke rmail on machine sys.
  1513. X**    RARG is how to insulate metacharacters from RMAIL. 
  1514. X**    LMAIL is the command to invoke the local mail transfer agent.
  1515. X**    LARG is how to insulate metacharacters from LMAIL. 
  1516. X**    RLARG is LARG with host! on the front - to pass a uux addr to sendmail.
  1517. X**    SENDMAIL selects one of two sets of defines below for either
  1518. X**    using sendmail or /bin/lmail.
  1519. X*/    
  1520. X
  1521. X#ifndef UUX
  1522. X# define UUX            "/usr/bin/uux"    /* location of uux command   */
  1523. X#endif
  1524. X
  1525. X#ifndef SMAIL
  1526. X# define SMAIL            "/bin/smail"    /* location of smail command */
  1527. X#endif
  1528. X
  1529. X/*
  1530. X** command used to retry failed mail, flag is used to set the routing level.
  1531. X*/
  1532. X# define VFLAG        ((debug == VERBOSE)?"-v":"")
  1533. X# define RETRY(flag)    "%s %s %s -f %s ", SMAIL, VFLAG, flag, spoolfile
  1534. X
  1535. X# define RMAIL(flags,from,sys)    "%s %s - %s!rmail",UUX,flags,sys
  1536. X# define RARG(user)        " '(%s)'",user
  1537. X# define RFROM(frm,now,host)     "From %s  %.24s remote from %s\n",frm,now,host
  1538. X
  1539. X#ifdef SENDMAIL
  1540. X
  1541. X# define HANDLE    JUSTUUCP    /* see HANDLE definition below */
  1542. X# define ROUTING JUSTDOMAIN    /* see ROUTING definition below */
  1543. X
  1544. X# define LMAIL(frm,sys)     "%s -em -f%s",SENDMAIL,frm
  1545. X# define LARG(user)        " '%s'",postmaster(user)
  1546. X# define RLARG(sys,frm)        " '%s!%s'",sys,frm
  1547. X# define LFROM(frm,now,host)    "From %s %.24s\n",frm,now
  1548. X
  1549. X#else
  1550. X
  1551. X# define HANDLE    ALL
  1552. X# define ROUTING JUSTDOMAIN
  1553. X
  1554. X#ifdef BSD
  1555. X# define LMAIL(frm,sys)        "/bin/mail"    /* BSD local delivery agent */
  1556. X#else
  1557. X# define LMAIL(frm,sys)        "/bin/lmail"    /* SV  local delivery agent */
  1558. X#endif
  1559. X
  1560. X# define LARG(user)        " '%s'",postmaster(user)
  1561. X# define RLARG(sys,frm)        " '%s!%s'",sys,frm
  1562. X# define LFROM(frm,now,host)    "From %s %.24s\n",frm,now
  1563. X
  1564. X#endif
  1565. X
  1566. X/*
  1567. X**    The following definitions affect the queueing algorithm for uux.
  1568. X**
  1569. X**    DEFQUEUE    if defined the default is to queue uux mail
  1570. X**
  1571. X**    QUEUECOST    remote mail with a cost of less than QUEUECOST
  1572. X**            will be handed to uux for immediate delivery.
  1573. X**
  1574. X**    MAXNOQUEUE    don't allow more than 'n' immediate delivery
  1575. X**            jobs to be started on a single invocation of smail.
  1576. X**    
  1577. X*/
  1578. X
  1579. X# define DEFQUEUE            /* default is to queue uux jobs */
  1580. X
  1581. X# define QUEUECOST        100    /* deliver immediately if the cost
  1582. X                    /* is DEDICATED+LOW or better */
  1583. X
  1584. X# define MAXNOQUEUE        2    /* max UUX_NOQUEUE jobs         */
  1585. X
  1586. X# define UUX_QUEUE        "-r"    /* uux flag for queueing    */
  1587. X# define UUX_NOQUEUE        ""    /* uux with immediate delivery    */
  1588. X
  1589. X/*
  1590. X** Normally, all mail destined for the local host is delivered with a single
  1591. X** call to the local mailer, and all remote mail is delivered with one call
  1592. X** to the remote mailer for each remote host.  This kind of 'batching' saves
  1593. X** on the cpu overhead.
  1594. X**
  1595. X** MAXCLEN is used to limit the length of commands that are exec'd by smail.
  1596. X** This is done to keep other program's buffers from overflowing, or to
  1597. X** allow for less intelligent commands which can take only one argument
  1598. X** at a time (e.g., 4.1 /bin/mail).  To disable the batching, set MAXCLEN
  1599. X** a small value (like 0).
  1600. X*/
  1601. X
  1602. X# define MAXCLEN        128    /* longest command allowed (approx.)
  1603. X                    /* this is to keep other's buffers
  1604. X                    ** from overflowing
  1605. X                    */
  1606. X
  1607. X/*
  1608. X** PLEASE DON'T TOUCH THE REST
  1609. X*/
  1610. X
  1611. X# define SMLBUF        512    /* small buffer (handle one item) */
  1612. X# define BIGBUF        4096    /* handle lots of items */
  1613. X# define MAXPATH    32    /* number of elements in ! path */
  1614. X# define MAXDOMS    16    /* number of subdomains in . domain */
  1615. X# define MAXARGS    500    /* number of arguments */
  1616. X#ifndef NULL
  1617. X# define NULL    0
  1618. X#endif
  1619. X
  1620. X# define DEBUG             if (debug==YES) (void) printf
  1621. X# define ADVISE         if (debug!=NO) (void) printf
  1622. X# define error(stat,msg,a)    { (void) fprintf(stderr, msg, a); exit(stat); }
  1623. X# define lower(c)         ( isupper(c) ? c-'A'+'a' : c )
  1624. X
  1625. X
  1626. Xenum eform {    /* format of addresses */
  1627. X    ERROR,         /* bad or invalidated format */
  1628. X    LOCAL,         /* just a local name */
  1629. X    DOMAIN,     /* user@domain or domain!user */
  1630. X    UUCP,        /* host!address */
  1631. X    ROUTE,        /* intermediate form - to be routed */
  1632. X    SENT        /* sent to a mailer on a previous pass */
  1633. X};
  1634. X
  1635. Xenum ehandle {     /* what addresses can we handle? (don't kick to LMAIL) */
  1636. X    ALL,        /* UUCP and DOMAIN addresses */
  1637. X    JUSTUUCP,    /* UUCP only; set by -l  */
  1638. X    NONE        /* all mail is LOCAL; set by -L */
  1639. X};
  1640. X
  1641. Xenum erouting {    /* when to route A!B!C!D */
  1642. X    JUSTDOMAIN,    /* route A if A is a domain */
  1643. X    ALWAYS,        /* route A always; set by -r */
  1644. X    REROUTE        /* route C, B, or A (whichever works); set by -R */
  1645. X};
  1646. X
  1647. Xenum edebug {    /* debug modes */
  1648. X    NO,        /* normal deliver */
  1649. X    VERBOSE,    /* talk alot */
  1650. X    YES        /* talk and don't deliver */
  1651. X};
  1652. X
  1653. X# ifdef BSD
  1654. X
  1655. X# include    <sysexits.h>
  1656. X# include    <strings.h>
  1657. X
  1658. X# else
  1659. X
  1660. X# include    "sysexits.h"
  1661. X# include    <string.h>
  1662. X# define    index    strchr
  1663. X# define    rindex    strrchr
  1664. X
  1665. X# endif
  1666. Xextern void exit(), perror();
  1667. Xextern unsigned sleep();
  1668. @//E*O*F src/defs.h//
  1669. if test 7752 -ne "`wc -c <'src/defs.h'`"; then
  1670.     echo shar: error transmitting "'src/defs.h'" '(should have been 7752 characters)'
  1671. fi
  1672. fi # end of overwriting check
  1673. echo shar: extracting "'src/getopt.c'" '(2533 characters)'
  1674. if test -f 'src/getopt.c' ; then 
  1675.   echo shar: will not over-write existing file "'src/getopt.c'"
  1676. else
  1677. sed 's/^X//' >src/getopt.c <<'@//E*O*F src/getopt.c//'
  1678. X/*
  1679. X**    @(#)getopt.c    2.2 (smail) 1/26/87
  1680. X*/
  1681. X
  1682. X/*
  1683. X * Here's something you've all been waiting for:  the AT&T public domain
  1684. X * source for getopt(3).  It is the code which was given out at the 1985
  1685. X * UNIFORUM conference in Dallas.  I obtained it by electronic mail
  1686. X * directly from AT&T.  The people there assure me that it is indeed
  1687. X * in the public domain.
  1688. X * 
  1689. X * There is no manual page.  That is because the one they gave out at
  1690. X * UNIFORUM was slightly different from the current System V Release 2
  1691. X * manual page.  The difference apparently involved a note about the
  1692. X * famous rules 5 and 6, recommending using white space between an option
  1693. X * and its first argument, and not grouping options that have arguments.
  1694. X * Getopt itself is currently lenient about both of these things White
  1695. X * space is allowed, but not mandatory, and the last option in a group can
  1696. X * have an argument.  That particular version of the man page evidently
  1697. X * has no official existence, and my source at AT&T did not send a copy.
  1698. X * The current SVR2 man page reflects the actual behavor of this getopt.
  1699. X * However, I am not about to post a copy of anything licensed by AT&T.
  1700. X */
  1701. X
  1702. X/* This include is needed only to get "index" defined as "strchr" on Sys V. */
  1703. X#include "defs.h"
  1704. X#ifdef BSD
  1705. X#include <strings.h>
  1706. X#else
  1707. X#include <string.h>
  1708. X#endif
  1709. X
  1710. X/*LINTLIBRARY*/
  1711. X#define NULL    0
  1712. X#define EOF    (-1)
  1713. X#define ERR(s, c)    if(opterr){\
  1714. X    extern int write();\
  1715. X    char errbuf[2];\
  1716. X    errbuf[0] = c; errbuf[1] = '\n';\
  1717. X    (void) write(2, argv[0], (unsigned)strlen(argv[0]));\
  1718. X    (void) write(2, s, (unsigned)strlen(s));\
  1719. X    (void) write(2, errbuf, 2);}
  1720. X
  1721. Xextern char *index();
  1722. X
  1723. Xint    opterr = 1;
  1724. Xint    optind = 1;
  1725. Xint    optopt;
  1726. Xchar    *optarg;
  1727. X
  1728. Xint
  1729. Xgetopt(argc, argv, opts)
  1730. Xint    argc;
  1731. Xchar    **argv, *opts;
  1732. X{
  1733. X    static int sp = 1;
  1734. X    register int c;
  1735. X    register char *cp;
  1736. X
  1737. X    if(sp == 1)
  1738. X        if(optind >= argc ||
  1739. X           argv[optind][0] != '-' || argv[optind][1] == '\0')
  1740. X            return(EOF);
  1741. X        else if(strcmp(argv[optind], "--") == NULL) {
  1742. X            optind++;
  1743. X            return(EOF);
  1744. X        }
  1745. X    optopt = c = argv[optind][sp];
  1746. X    if(c == ':' || (cp=index(opts, c)) == NULL) {
  1747. X        ERR(": illegal option -- ", c);
  1748. X        if(argv[optind][++sp] == '\0') {
  1749. X            optind++;
  1750. X            sp = 1;
  1751. X        }
  1752. X        return('?');
  1753. X    }
  1754. X    if(*++cp == ':') {
  1755. X        if(argv[optind][sp+1] != '\0')
  1756. X            optarg = &argv[optind++][sp+1];
  1757. X        else if(++optind >= argc) {
  1758. X            ERR(": option requires an argument -- ", c);
  1759. X            sp = 1;
  1760. X            return('?');
  1761. X        } else
  1762. X            optarg = argv[optind++];
  1763. X        sp = 1;
  1764. X    } else {
  1765. X        if(argv[optind][++sp] == '\0') {
  1766. X            sp = 1;
  1767. X            optind++;
  1768. X        }
  1769. X        optarg = NULL;
  1770. X    }
  1771. X    return(c);
  1772. X}
  1773. @//E*O*F src/getopt.c//
  1774. if test 2533 -ne "`wc -c <'src/getopt.c'`"; then
  1775.     echo shar: error transmitting "'src/getopt.c'" '(should have been 2533 characters)'
  1776. fi
  1777. fi # end of overwriting check
  1778. echo shar: extracting "'src/getpath.c'" '(2218 characters)'
  1779. if test -f 'src/getpath.c' ; then 
  1780.   echo shar: will not over-write existing file "'src/getpath.c'"
  1781. else
  1782. sed 's/^X//' >src/getpath.c <<'@//E*O*F src/getpath.c//'
  1783. X#ifndef lint
  1784. Xstatic char     *sccsid="@(#)getpath.c    2.2 (smail) 1/26/87";
  1785. X#endif
  1786. X
  1787. X# include    <stdio.h>
  1788. X# include    <sys/types.h>
  1789. X# include    <ctype.h>
  1790. X# include    "defs.h"
  1791. X#ifdef BSD
  1792. X#include <strings.h>
  1793. X#else
  1794. X#include <string.h>
  1795. X#endif
  1796. X
  1797. Xextern enum edebug debug;    /* how verbose we are         */ 
  1798. Xextern char *pathfile;        /* location of path database    */
  1799. X
  1800. X/*
  1801. X**
  1802. X** getpath(): look up key in ascii sorted path database.
  1803. X**
  1804. X*/
  1805. X
  1806. Xgetpath( key, path , cost)
  1807. Xchar *key;        /* what we are looking for */
  1808. Xchar *path;        /* where the path results go */
  1809. Xint *cost;        /* where the cost results go */
  1810. X{
  1811. X    long pos, middle, hi, lo;
  1812. X    static long pathlength = 0;
  1813. X    register char *s;
  1814. X    int c;
  1815. X    static FILE *file;
  1816. X    int flag;
  1817. X
  1818. XDEBUG("getpath: looking for '%s'\n", key);
  1819. X
  1820. X    if( !pathlength )    /* open file on first use */
  1821. X    {
  1822. X        if( ( file=fopen( pathfile, "r" ) ) == NULL )
  1823. X        {
  1824. X            (void) printf( "can't access %s.\n", pathfile );
  1825. X            pathlength = -1;
  1826. X        } else {
  1827. X            (void) fseek( file, 0L, 2 );        /* find length */
  1828. X            pathlength = ftell( file );
  1829. X        }
  1830. X    }
  1831. X    if( pathlength == -1 )
  1832. X        return( EX_OSFILE );
  1833. X
  1834. X    lo = 0;
  1835. X    hi = pathlength;
  1836. X    (void) strcpy( path, key );
  1837. X    (void) strcat( path, "\t" );
  1838. X/*
  1839. X** "Binary search routines are never written right the first time around."
  1840. X** - Robert G. Sheldon.
  1841. X*/
  1842. X    for( ;; ) {
  1843. X        pos = middle = ( hi+lo+1 )/2;
  1844. X        (void) fseek( file, pos, 0 );    /* find midpoint */
  1845. X        if (pos != 0)        /* to beginning of next line */
  1846. X            while( ( c=getc( file ) ) != EOF && c != '\n' );
  1847. X        for( flag = 0, s = path; flag == 0; s++ ) { /* match??? */
  1848. X            if ( *s == '\0' ) {
  1849. X                goto solved;
  1850. X            }
  1851. X            c = getc( file );
  1852. X            flag = lower( c ) - lower( *s );
  1853. X        } 
  1854. X        if ( lo>=middle )        /* failure? */
  1855. X            return( EX_NOHOST );
  1856. X        if ( c != EOF && flag < 0 )    /* close window */
  1857. X            lo = middle;
  1858. X        else 
  1859. X            hi = middle - 1;
  1860. X    }
  1861. X/* 
  1862. X** Now just copy the result.
  1863. X*/
  1864. Xsolved:
  1865. X    while(((c  = getc(file)) != EOF) && (c != '\t') && (c != '\n')) {
  1866. X        *path++ = c;
  1867. X    }
  1868. X    *path = '\0';
  1869. X/*
  1870. X** See if the next field on the line is numeric.
  1871. X** If so, use it as the cost for the route.
  1872. X*/
  1873. X    if(c == '\t') {
  1874. X        int tcost = -1;
  1875. X        while(((c = getc(file)) != EOF) && isdigit(c)) {
  1876. X            if(tcost < 0) tcost = 0;
  1877. X            tcost *= 10;
  1878. X            tcost += c - '0';
  1879. X        }
  1880. X        if(tcost >= 0) *cost = tcost;
  1881. X    }
  1882. X    return ( EX_OK );
  1883. X}
  1884. @//E*O*F src/getpath.c//
  1885. if test 2218 -ne "`wc -c <'src/getpath.c'`"; then
  1886.     echo shar: error transmitting "'src/getpath.c'" '(should have been 2218 characters)'
  1887. fi
  1888. fi # end of overwriting check
  1889. echo shar: extracting "'src/lcasep.c'" '(1129 characters)'
  1890. if test -f 'src/lcasep.c' ; then 
  1891.   echo shar: will not over-write existing file "'src/lcasep.c'"
  1892. else
  1893. sed 's/^X//' >src/lcasep.c <<'@//E*O*F src/lcasep.c//'
  1894. X/*
  1895. X** convert the host name on a pathalias line to lower case
  1896. X*/
  1897. X
  1898. X#ifndef lint
  1899. Xstatic char     *sccsid="@(#)lcasep.c    2.1 (smail) 12/14/86";
  1900. X#endif
  1901. X
  1902. X#include <stdio.h>
  1903. X#include <ctype.h>
  1904. X
  1905. X# define lower(c)         ( isupper(c) ? c-'A'+'a' : c )
  1906. X
  1907. Xmain(argc, argv)
  1908. Xint argc;
  1909. Xchar *argv[];
  1910. X{
  1911. X    FILE *ifp, *ofp;
  1912. X    char buf[BUFSIZ];
  1913. X    register char *p;
  1914. X    int c;
  1915. X
  1916. X    extern int optind;
  1917. X    extern char *optarg;
  1918. X
  1919. X    ifp = stdin;
  1920. X    ofp = stdout;
  1921. X
  1922. X    while((c = getopt(argc, argv, "f:o:")) != EOF) {
  1923. X        switch(c) {
  1924. X        case 'f':
  1925. X            if((ifp = fopen(optarg, "r")) == NULL) {
  1926. X                (void) fprintf(stderr, "%s: can't open %s: ",
  1927. X                    argv[0], optarg);
  1928. X                perror("");
  1929. X                exit(1);
  1930. X            }
  1931. X            break;
  1932. X        case 'o':
  1933. X            if((ofp = fopen(optarg, "w+")) == NULL) {
  1934. X                (void) fprintf(stderr, "%s: can't open %s: ",
  1935. X                    argv[0], optarg);
  1936. X                perror("");
  1937. X                exit(1);
  1938. X            }
  1939. X            break;
  1940. X        default:
  1941. X            (void) fprintf(stderr,
  1942. X                "usage: %s [-f file] [-o outfile]\n", argv[0]);
  1943. X            exit(1);
  1944. X            /* NOTREACHED */
  1945. X            break;
  1946. X        }
  1947. X    }
  1948. X
  1949. X    while(fgets(buf, sizeof(buf), ifp) != NULL) {
  1950. X        for(p = buf; *p != '\t' && *p != '\0' ; p++) {
  1951. X            (void) fputc(lower(*p), ofp);
  1952. X        }
  1953. X        (void) fputs(p, ofp);
  1954. X    }
  1955. X}
  1956. @//E*O*F src/lcasep.c//
  1957. if test 1129 -ne "`wc -c <'src/lcasep.c'`"; then
  1958.     echo shar: error transmitting "'src/lcasep.c'" '(should have been 1129 characters)'
  1959. fi
  1960. fi # end of overwriting check
  1961. echo shar: extracting "'src/pathproc.sh'" '(776 characters)'
  1962. if test -f 'src/pathproc.sh' ; then 
  1963.   echo shar: will not over-write existing file "'src/pathproc.sh'"
  1964. else
  1965. sed 's/^X//' >src/pathproc.sh <<'@//E*O*F src/pathproc.sh//'
  1966. X#! /bin/sh
  1967. X#
  1968. X#    @(#)pathproc.sh    2.1 (smail) 12/14/86
  1969. X#
  1970. X# This script will do all that's necessary for
  1971. X# transforming the output of pathalias -c into
  1972. X# the format of a 'paths' file for smail.
  1973. X#
  1974. X# format of the pathalias -c output is
  1975. X# cost    host    route
  1976. X#
  1977. X# format of a 'paths' file for smail is
  1978. X# host    route    first_hop_cost
  1979. X#
  1980. X# first sort lines on increasing cost
  1981. X#
  1982. Xsort -n |
  1983. X#
  1984. X# print cost of first hop in the chain in format
  1985. X# host    route    cost
  1986. X#
  1987. Xawk '
  1988. X{
  1989. X    nhops = split($3, hops, "!");
  1990. X    if(nhops == 1) {
  1991. X        tcost = 0;
  1992. X    } else if(nhops == 2) {
  1993. X        if(cost[hops[1]] == 0) {
  1994. X            cost[hops[1]] = $1;
  1995. X        }
  1996. X        tcost = cost[hops[1]];
  1997. X    } else {
  1998. X        tcost = cost[hops[1]];
  1999. X    }
  2000. X    printf("%s\t%s\t%d\n", $2, $3, tcost);
  2001. X}' |
  2002. X#
  2003. X# next convert host name to lower case and sort the output
  2004. X#
  2005. Xlcasep | sort
  2006. @//E*O*F src/pathproc.sh//
  2007. if test 776 -ne "`wc -c <'src/pathproc.sh'`"; then
  2008.     echo shar: error transmitting "'src/pathproc.sh'" '(should have been 776 characters)'
  2009. fi
  2010. fi # end of overwriting check
  2011. echo shar: "End of shell archive."
  2012. exit 0
  2013.