home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Unix / Shells / tcsh / Source / tc.vers.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-21  |  13.5 KB  |  573 lines

  1. /* $Header: /u/christos/src/tcsh-6.03/RCS/tc.vers.c,v 3.25 1992/10/14 20:19:19 christos Exp $ */
  2. /*
  3.  * tc.vers.c: Version dependent stuff
  4.  */
  5. /*-
  6.  * Copyright (c) 1980, 1991 The Regents of the University of California.
  7.  * All rights reserved.
  8.  *
  9.  * Redistribution and use in source and binary forms, with or without
  10.  * modification, are permitted provided that the following conditions
  11.  * are met:
  12.  * 1. Redistributions of source code must retain the above copyright
  13.  *    notice, this list of conditions and the following disclaimer.
  14.  * 2. Redistributions in binary form must reproduce the above copyright
  15.  *    notice, this list of conditions and the following disclaimer in the
  16.  *    documentation and/or other materials provided with the distribution.
  17.  * 3. All advertising materials mentioning features or use of this software
  18.  *    must display the following acknowledgement:
  19.  *    This product includes software developed by the University of
  20.  *    California, Berkeley and its contributors.
  21.  * 4. Neither the name of the University nor the names of its contributors
  22.  *    may be used to endorse or promote products derived from this software
  23.  *    without specific prior written permission.
  24.  *
  25.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  26.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  29.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  30.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  31.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  32.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  33.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  34.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  35.  * SUCH DAMAGE.
  36.  */
  37. #include "sh.h"
  38.  
  39. RCSID("$Id: tc.vers.c,v 3.25 1992/10/14 20:19:19 christos Exp $")
  40.  
  41. #include "patchlevel.h"
  42.  
  43.  
  44. char *
  45. gethosttype()
  46. {
  47.     char *hosttype;
  48.     
  49. #ifdef HOSTTYPE    /* Override any system determined hosttypes */
  50.     hosttype = HOSTTYPE;
  51. #else
  52.  
  53. # ifdef AMIX /* Amiga UNIX */
  54. #  define _havehosttype_
  55.     hosttype = "amiga";
  56. # endif /* AMIX */
  57.  
  58. # ifdef _VMS_POSIX
  59. #  define _havehosttype_
  60.    hosttype = "VMS-POSIX";
  61. # endif /* _VMS_POSIX */
  62.  
  63. # if (defined(vax) || defined(__vax)) && !defined(_havehosttype_)
  64. #  define _havehosttype_
  65.     hosttype = "vax";
  66. # endif /* vax || __vax && !_havehosttype_ */
  67.  
  68. # ifdef hp9000 /* hp9000 running MORE/bsd */
  69. #  ifdef hp300
  70. #   define _havehosttype_
  71.     hosttype = "hp300";
  72. #  endif 
  73. #  ifdef hp800
  74. #   define _havehosttype_
  75.     hosttype = "hp800";
  76. #  endif 
  77. #  ifndef _havehosttype_
  78. #   define _havehosttype_
  79.     hosttype = "hp9000";    
  80. #  endif 
  81. # endif /* hp9000 */
  82.  
  83. # if defined(sun) || defined(__sun__)
  84. #  if defined(mc68010) || defined(__mc68010__)
  85. #   define _havehosttype_
  86.     hosttype = "sun2";
  87. #  endif /* mc68010 */
  88. #  if defined(mc68020) || defined(__mc68010__)
  89. #   define _havehosttype_
  90.     hosttype = "sun3";
  91. #  endif /* mc68020 */
  92. #  if defined(sparc) || defined(__sparc__)
  93. #   define _havehosttype_
  94.     hosttype = "sun4";
  95. #  endif /* sparc */
  96. #  if defined(i386) || defined(__i386__)
  97. #   define _havehosttype_
  98.     hosttype = "sun386i";
  99. #  endif /* i386 */
  100. #  ifndef _havehosttype_
  101. #   define _havehosttype_
  102.     hosttype = "sun";    
  103. #  endif 
  104. # endif /* sun */
  105.  
  106. # ifdef pyr /* pyramid */
  107. #  define _havehosttype_
  108.     hosttype = "pyramid";
  109. # endif /* pyr */
  110.  
  111. # ifdef tahoe /* tahoe */
  112. #  define _havehosttype_
  113.     hosttype = "tahoe";
  114. # endif /* tahoe */
  115.  
  116. # ifdef ibm032 /* from Jak Kirman */
  117. #  define _havehosttype_
  118.     hosttype = "rt";
  119. # endif /* ibm032 */
  120.  
  121. # ifdef aiws /* not to be confused with the above */
  122. #  define _havehosttype_
  123.     hosttype = "rtpc";
  124. # endif /* aiws */
  125.  
  126. # ifdef _AIX370
  127. #  define _havehosttype_
  128.     hosttype = "aix370";
  129. # endif /* _AIX370 */
  130.  
  131. # ifdef _IBMESA
  132. #  define _havehosttype_
  133.     hosttype = "aixESA";
  134. # endif /* _IBMESA */
  135.  
  136. # ifdef _IBMR2
  137. #  define _havehosttype_
  138.     hosttype = "rs6000";
  139. # endif /* _IBMR2 */
  140.  
  141. # ifdef _AIXPS2 /* AIX on a PS/2 */
  142. #  define _havehosttype_
  143.     hosttype = "ps2";
  144. # endif /* _AIXPS2 */
  145.  
  146. # ifdef OREO
  147. #  define _havehosttype_
  148.     hosttype = "mac2";
  149. # endif /* OREO */
  150.  
  151. # ifdef hpux
  152. #  if defined(__hp9000s700) && !defined(_havehosttype_)
  153. #   define _havehosttype_
  154.    hosttype = "hp9000s700";
  155. #  endif /* __hp9000s700 */
  156. #  if (defined(__hp9000s800) || defined(hp9000s800)) && !defined(_havehosttype_)
  157. #   define _havehosttype_
  158.    hosttype = "hp9000s800";    /* maybe "spectrum" */
  159. #  endif /* __hp9000s800 || hp9000s800 */
  160. #  if (defined(__hp9000s300) || defined(hp9000s300)) && !defined(_havehosttype_)
  161. #   define _havehosttype_
  162.    hosttype = "hp9000s300";
  163. #  endif /* __hp9000s800 || hp9000s300 */
  164. # if defined(hp9000s500) && !defined(_havehosttype_)
  165. #  define _havehosttype_
  166.    hosttype = "hp9000s500";
  167. # endif /* hp9000s500 */
  168. #  ifndef _havehosttype_
  169. #   define _havehosttype_
  170.    hosttype = "hp";
  171. #  endif /* _havehosttype_ */
  172. # endif /* hpux */
  173.  
  174. # ifdef apollo
  175. #  define _havehosttype_
  176.     hosttype = "apollo";
  177. # endif 
  178.  
  179. # ifdef u3b20d
  180. #  define _havehosttype_
  181.     hosttype = "att3b20";
  182. # endif /* u3b20d */
  183.  
  184. # ifdef u3b15
  185. #  define _havehosttype_
  186.     hosttype = "att3b15";
  187. # endif /* u3b15 */
  188.  
  189. # ifdef u3b5
  190. #  define _havehosttype_
  191.     hosttype = "att3b5";
  192. # endif /* u3b5 */
  193.  
  194. # ifdef u3b2
  195. #  define _havehosttype_
  196.     hosttype = "att3b2";
  197. # endif /* u3b2 */
  198.  
  199. #ifdef _MINIX
  200. # define _havehosttype_
  201. # ifdef i386
  202.     hosttype = "minix386";
  203. # else /* minix ? amoeba or mac? */
  204.     hosttype = "minix";
  205. # endif /* i386 */
  206. #endif /* _MINIX */
  207.  
  208. #if defined(i386) && defined(linux)
  209. # define _havehosttype_
  210.     hosttype = "i386-linux";
  211. #endif
  212.  
  213. #if defined(i386) && defined(__EMX__)
  214. # define _havehosttype_
  215.     hosttype = "i386-emx";
  216. #endif /* i386 && __EMX__ */
  217.  
  218. # ifdef __386BSD__
  219. # define _havehosttype_
  220.     hosttype = "386BSD";
  221. # endif /* __386BSD__ */
  222.  
  223. # if defined(i386) && defined(bsdi)
  224. #  define _havehosttype_
  225.    hosttype = "bsd386"; /* BSD/386*/
  226. # endif /* i386 && bsdi */
  227.  
  228. # ifdef COHERENT
  229. #  define _havehosttype_
  230. #  ifdef _I386
  231.     hosttype = "coh386";
  232. #  else
  233.     hosttype = "coherent";
  234. #  endif /* _I386 */
  235. # endif /* COHERENT */
  236.  
  237. # if defined(i386) && SYSVREL > 0
  238.  
  239. #  if !defined(_havehosttype_) && (defined(ISC) || defined(ISC202))
  240. #   define _havehosttype_
  241.     hosttype = "isc386";
  242. #  endif /* !_havehosttype_ && (ISC || ISC202) */
  243.  
  244. #  if !defined(_havehosttype_) && defined(SCO)
  245. #   define _havehosttype_
  246.     hosttype = "sco386";
  247. #  endif /* !_havehosttype_ && SCO */
  248.  
  249. #  if !defined(_havehosttype_) && defined(INTEL)
  250. #   define _havehosttype_
  251.     hosttype = "intel386";
  252. #  endif /* !_havehosttype_ && INTEL */
  253.  
  254. #  ifndef _havehosttype_
  255. #   define _havehosttype_
  256.     hosttype = "i386";
  257. #  endif /* _havehosttype_ */
  258.  
  259. # endif 
  260.  
  261. #ifdef UNIXPC
  262. # define _havehosttype_
  263.     hosttype = "unixpc";
  264. #endif /* UNIXPC/att3b1/att7300 */
  265.  
  266. #ifdef alliant
  267. # ifdef mc68000
  268. #  define _havehosttype_
  269.     hosttype = "alliant-fx80";
  270. # endif /* mc68000 */
  271. # ifdef i860 
  272. #  define _havehosttype_
  273.     hosttype = "alliant-fx2800";
  274. # endif /* i860 */
  275. # ifndef _havehosttype_
  276. #  define _havehosttype_
  277.     hosttype = "alliant";    /* for Alliant FX Series */
  278. # endif /* _havehosttype_ */
  279. #endif  /* alliant */
  280.  
  281. # if defined(i386) && defined(MACH)
  282. #  define _havehosttype_
  283.     hosttype = "i386-mach";
  284. # endif 
  285.  
  286. # if defined(sequent) || defined(_SEQUENT_)
  287. #  define _havehosttype_
  288. #  ifdef i386
  289. #   ifdef sequent
  290.     hosttype = "symmetry";    /* Sequent Symmetry Dynix/3 */
  291. #    ifndef LOCALSTR
  292. #     define LOCALSTR    " (Dynix/3)"
  293. #    endif /* LOCALSTR */
  294. #   else
  295.     hosttype = "ptx";    /* Sequent Symmetry Dynix/ptx */
  296. #    ifndef LOCALSTR
  297. #     define LOCALSTR    " (Dynix/ptx)"
  298. #    endif /* LOCALSTR */
  299. #   endif 
  300. #  else
  301.     hosttype = "balance";    /* for Sequent Balance Series */
  302. #   ifndef LOCALSTR
  303. #    define LOCALSTR    " (Dynix/3)"
  304. #   endif /* LOCALSTR */
  305. #  endif 
  306. # else /* !sequent */
  307. #  ifdef ns32000
  308. #   define _havehosttype_
  309. #   ifdef CMUCS            /* hack for Mach (in the true spirit of CMU) */
  310.     hosttype = "multimax";
  311. #   else /* CMUCS */
  312.     hosttype = !access("/Umax.image", F_OK) ? "multimax" : "ns32000";
  313. #   endif /* CMUCS */
  314. #  endif /* ns32000 */
  315. # endif /* sequent */
  316.  
  317. # ifdef convex
  318. #  define _havehosttype_
  319.     /* From: Brian Allison <uiucdcs!convex!allison@RUTGERS.EDU> */
  320.     hosttype = "convex";
  321. # endif /* convex */
  322.  
  323. # ifdef butterfly
  324. #  define _havehosttype_
  325.     /* this will work _until_ the bfly with 88000s comes out */
  326.     hosttype = "butterfly";    /* BBN Butterfly 1000 */
  327. # endif /* butterfly */
  328.  
  329. # ifdef NeXT
  330. #  define _havehosttype_
  331.     hosttype = "next";
  332. # endif /* NeXT */
  333.  
  334. /* From Kazuhiro Honda <honda@mt.cs.keio.ac.jp> */
  335. # ifdef sony_news
  336. #  define _havehosttype_
  337. #  ifdef mips /* Sony NEWS based on a r3000 */
  338.     hosttype = "news_mips";
  339. #  else
  340.     hosttype = "news";
  341. #  endif 
  342. # endif /* sony_news */
  343.  
  344. # if defined(mips) || defined(__mips)
  345. #  define _havehosttype_
  346. #  if defined(MIPSEL) || defined(__MIPSEL)
  347. #   if defined(ultrix) || defined(__ultrix)
  348.     hosttype = "decstation";
  349. #   else
  350.     hosttype = "mips";
  351. #   endif /* ultrix || __ultrix */
  352. #  endif /* MIPSEL || __MIPSEL */
  353. #  if defined(MIPSEB) || defined(__MIPSEB)
  354. #   if defined(ultrix) || defined(__ultrix)
  355.     hosttype = "decmips";
  356. #   else
  357. #    ifdef sgi /* sgi iris 4d */
  358.     hosttype = "iris4d";
  359. #    else
  360. #     ifdef sony_news
  361.     hosttype = "news_mips";
  362. #     else
  363.     hosttype = "mips";
  364. #     endif /* sony_news */
  365. #    endif /* sgi */
  366. #   endif /* ultrix || __ultrix */
  367. #  endif /* MIPSEB || __MIPSEB */
  368. # endif /* mips || __mips */
  369.  
  370. #if defined(__alpha)
  371. #  define _havehosttype_
  372.     hosttype = "alpha";
  373. #endif
  374.  
  375. # if defined(m88k) || defined(__m88k__)
  376. #  define _havehosttype_
  377.     hosttype = "m88k";    /* Motorola 88100 system */
  378. # endif 
  379.  
  380. # ifdef masscomp            /* Added, DAS DEC-90. */
  381. #  define _havehosttype_
  382.     hosttype = "masscomp";/* masscomp == concurrent */
  383. # endif /* masscomp */
  384.  
  385. # ifdef GOULD_NP1
  386. #  define _havehosttype_
  387.     hosttype = "gould_np1";
  388. # endif /* GOULD_NP1 */
  389.  
  390. # ifdef SXA
  391. #  define _havehosttype_
  392.     hosttype = "pfa50";
  393. #  ifdef  _BSDX_
  394. #   ifndef LOCALSTR
  395. #    define LOCALSTR    " (SX/A E60+BSDX)"
  396. #   endif /* LOCALSTR */
  397. #  else
  398. #   ifndef LOCALSTR
  399. #    define LOCALSTR    " (SX/A E60)"
  400. #   endif /* LOCALSTR */
  401. #  endif 
  402. # endif /* PFU/Fujitsu A-xx computer */
  403.  
  404. # ifdef titan
  405. #  define _havehosttype_
  406.     /* Ken Laprade <laprade@trantor.harris-atd.com> */
  407.     hosttype = "titan";
  408. # endif /* titan */
  409.  
  410. # ifdef stellar
  411. #  define _havehosttype_
  412.     hosttype = "stellar";
  413. # endif /* stellar */
  414.  
  415. # ifdef sgi
  416. /* Iris 4D is in the mips section; these are the 68k machines. */
  417. #  ifdef m68000
  418. #   define _havehosttype_
  419.     /* Vince Del Vecchio <vd09@andrew.cmu.edu> */
  420.     hosttype = "iris3d";
  421. #  endif
  422. # endif /* sgi */
  423.  
  424. # ifdef uts
  425. #  define _havehosttype_
  426.     hosttype = "amdahl";
  427. # endif /* uts */
  428.  
  429. # ifdef UTek
  430. #  define _havehosttype_
  431.     hosttype = "tek4300";
  432. # endif /* UTek */
  433.  
  434. # ifdef UTekV
  435. #  define _havehosttype_
  436.     hosttype = "tekXD88";
  437. # endif /* UTekV */
  438.  
  439. # ifdef OPUS
  440. #  define _havehosttype_
  441.     hosttype = "opus";
  442. # endif /* OPUS */
  443.  
  444. # ifdef eta10
  445. #  define _havehosttype_
  446.    /* Bruce Woodcock <woodcock@mentor.cc.purdue.edu> */
  447.    hosttype = "eta10";
  448. # endif /* eta10 */
  449.  
  450. # ifdef cray
  451. #  define _havehosttype_
  452.    hosttype = "cray";
  453. # endif /* cray */
  454.  
  455. # ifdef NDIX
  456. #  define _havehosttype_
  457.    /* B|rje Josefsson <bj@dc.luth.se> */
  458.    hosttype = "nd500";
  459. # endif /* NDIX */
  460.  
  461. # if defined(sysV68)
  462. #  define _havehosttype_
  463.     hosttype = "sysV68";
  464. # endif /* sysV68 */
  465.  
  466. # if defined(sysV88)
  467. #  define _havehosttype_
  468.     hosttype = "sysV88";
  469. # endif /* sysV88 */
  470.  
  471. # if defined(i860) && !defined(_havehosttype_)
  472. #  define _havehosttype_
  473.    /* Tasos Kotsikonas <tasos@avs.com> */
  474.    hosttype = "vistra800"; /* Stardent Vistra */
  475. # endif /* i860  && !_havehosttype_ */
  476.  
  477. # ifndef _havehosttype_
  478. #  if defined(mc68000) || defined(__mc68000__) || defined(mc68k32)
  479. #   define _havehosttype_
  480.      hosttype = "m68k";    /* Motorola 68000 system */
  481. #  endif 
  482. # endif
  483.  
  484. # ifndef _havehosttype_
  485. #  define _havehosttype_
  486.     /* Default to something reasonable */
  487.     hosttype = "unknown";
  488. # endif 
  489. # undef _havehosttype_
  490. #endif /* HOSTTYPE */
  491.     return hosttype;
  492. } /* end gethosttype */
  493.  
  494.  
  495. /* fix_version():
  496.  *    Print a reasonable version string, printing all compile time
  497.  *    options that might affect the user.
  498.  */
  499. void
  500. fix_version()
  501. {
  502.     char    version[BUFSIZE];
  503.  
  504. #ifdef SHORT_STRINGS
  505. # define SSSTR "8b"
  506. #else
  507. # define SSSTR "7b"
  508. #endif 
  509. #ifdef NLS
  510. # define NLSSTR ",nls"
  511. #else
  512. # define NLSSTR ""
  513. #endif 
  514. #ifdef LOGINFIRST
  515. # define LFSTR ",lf"
  516. #else
  517. # define LFSTR ""
  518. #endif 
  519. #ifdef DOTLAST
  520. # define DLSTR ",dl"
  521. #else
  522. # define DLSTR ""
  523. #endif 
  524. #ifdef VIDEFAULT
  525. # define VISTR ",vi"
  526. #else
  527. # define VISTR ""
  528. #endif 
  529. #ifdef TESLA
  530. # define DTRSTR ",dtr"
  531. #else
  532. # define DTRSTR ""
  533. #endif 
  534. #ifdef KAI
  535. # define BYESTR ",bye"
  536. #else
  537. # define BYESTR ""
  538. #endif 
  539. #ifdef AUTOLOGOUT
  540. # define ALSTR ",al"
  541. #else
  542. # define ALSTR ""
  543. #endif 
  544. #ifdef KANJI
  545. # define KANSTR ",kan"
  546. #else
  547. # define KANSTR ""
  548. #endif 
  549. #ifdef SYSMALLOC
  550. # define SMSTR    ",sm"
  551. #else
  552. # define SMSTR  ""
  553. #endif 
  554. #ifdef HASHBANG
  555. # define HBSTR    ",hb"
  556. #else
  557. # define HBSTR  ""
  558. #endif 
  559. /* if you want your local version to say something */
  560. #ifndef LOCALSTR
  561. # define LOCALSTR ""
  562. #endif /* LOCALSTR */
  563.  
  564.     xsprintf(version,
  565.          "tcsh %d.%.2d.%.2d (%s) %s (%s) options %s%s%s%s%s%s%s%s%s%s%s%s",
  566.          REV, VERS, PATCHLEVEL, ORIGIN, DATE, gethosttype(),
  567.          SSSTR, NLSSTR, LFSTR, DLSTR, VISTR, DTRSTR,
  568.          BYESTR, ALSTR, KANSTR, SMSTR, HBSTR, LOCALSTR);
  569.     set(STRversion, SAVE(version));
  570.     xsprintf(version, "%d.%.2d.%.2d", REV, VERS, PATCHLEVEL);
  571.     set(STRtcsh, SAVE(version));
  572. }
  573.