home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume25 / tcsh-6.01 / part05 / tc.vers.c < prev   
C/C++ Source or Header  |  1991-12-19  |  12KB  |  481 lines

  1. /* $Header: /home/hyperion/mu/christos/src/sys/tcsh-6.01/RCS/tc.vers.c,v 3.12 1991/12/19 22:34:14 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.12 1991/12/19 22:34:14 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 = str2short(HOSTTYPE);
  51. #else
  52. # if defined(vax) || defined(__vax)
  53. #  define _havehosttype_
  54.     hosttype = str2short("vax");
  55. # endif /* vax || __vax */
  56.  
  57. # ifdef hp9000 /* hp9000 running MORE/bsd */
  58. #  ifdef hp300
  59. #   define _havehosttype_
  60.     hosttype = str2short("hp300");
  61. #  endif 
  62. #  ifdef hp800
  63. #   define _havehosttype_
  64.     hosttype = str2short("hp800");
  65. #  endif 
  66. #  ifndef _havehosttype_
  67. #   define _havehosttype_
  68.     hosttype = str2short("hp9000");    
  69. #  endif 
  70. # endif /* hp9000 */
  71.  
  72. # ifdef sun
  73. #  ifdef mc68010
  74. #   define _havehosttype_
  75.     hosttype = str2short("sun2");
  76. #  endif /* mc68010 */
  77. #  ifdef mc68020
  78. #   define _havehosttype_
  79.     hosttype = str2short("sun3");
  80. #  endif /* mc68020 */
  81. #  ifdef sparc
  82. #   define _havehosttype_
  83.     hosttype = str2short("sun4");
  84. #  endif /* sparc */
  85. #  ifdef i386
  86. #   define _havehosttype_
  87.     hosttype = str2short("sun386i");
  88. #  endif /* i386 */
  89. #  ifndef _havehosttype_
  90. #   define _havehosttype_
  91.     hosttype = str2short("sun");    
  92. #  endif 
  93. # endif /* sun */
  94.  
  95. # ifdef pyr /* pyramid */
  96. #  define _havehosttype_
  97.     hosttype = str2short("pyramid");
  98. # endif /* pyr */
  99.  
  100. # ifdef ibm032 /* from Jak Kirman */
  101. #  define _havehosttype_
  102.     hosttype = str2short("rt");
  103. # endif /* ibm032 */
  104.  
  105. # ifdef aiws /* not to be confused with the above */
  106. #  define _havehosttype_
  107.     hosttype = str2short("rtpc");
  108. # endif /* aiws */
  109.  
  110. # ifdef _AIX370
  111. #  define _havehosttype_
  112.     hosttype = str2short("aix370");
  113. # endif /* _AIX370 */
  114.  
  115. # ifdef _IBMESA
  116. #  define _havehosttype_
  117.     hosttype = str2short("aixESA");
  118. # endif /* _IBMESA */
  119.  
  120. # ifdef _IBMR2
  121. #  define _havehosttype_
  122.     hosttype = str2short("rs6000");
  123. # endif /* _IBMR2 */
  124.  
  125. # ifdef _AIXPS2 /* AIX on a PS/2 */
  126. #  define _havehosttype_
  127.     hosttype = str2short("ps2");
  128. # endif /* _AIXPS2 */
  129.  
  130. # ifdef OREO
  131. #  define _havehosttype_
  132.     hosttype = str2short("mac2");
  133. # endif /* OREO */
  134.  
  135. # ifdef hpux
  136. #  if defined(__hp9000s700) && !defined(_havehosttype_)
  137. #   define _havehosttype_
  138.    hosttype = str2short("hp9000s700");
  139. #  endif /* __hp9000s700 */
  140. #  if defined(hp9000s800) && !defined(_havehosttype_)
  141. #   define _havehosttype_
  142.    hosttype = str2short("hp9000s800");    /* maybe "spectrum" */
  143. #  endif /* hp9000s800 */
  144. #  if defined(hp9000s300) && !defined(_havehosttype_)
  145. #   define _havehosttype_
  146.    hosttype = str2short("hp9000s300");
  147. #  endif /* hp9000s300 */
  148. # if defined(hp9000s500) && !defined(_havehosttype_)
  149. #  define _havehosttype_
  150.    hosttype = str2short("hp9000s500");
  151. # endif /* hp9000s500 */
  152. #  ifndef _havehosttype_
  153. #   define _havehosttype_
  154.    hosttype = str2short("hp");
  155. #  endif /* _havehosttype_ */
  156. # endif /* hpux */
  157.  
  158. # ifdef apollo
  159. #  define _havehosttype_
  160.     hosttype = str2short("apollo");
  161. # endif 
  162.  
  163. # ifdef u3b20d
  164. #  define _havehosttype_
  165.     hosttype = str2short("att3b20");
  166. # endif /* u3b20d */
  167.  
  168. # ifdef u3b15
  169. #  define _havehosttype_
  170.     hosttype = str2short("att3b15");
  171. # endif /* u3b15 */
  172.  
  173. # ifdef u3b5
  174. #  define _havehosttype_
  175.     hosttype = str2short("att3b5");
  176. # endif /* u3b5 */
  177.  
  178. # ifdef u3b2
  179. #  define _havehosttype_
  180.     hosttype = str2short("att3b2");
  181. # endif /* u3b2 */
  182.  
  183. #ifdef _MINIX
  184. # define _havehosttype_
  185. # ifdef i386
  186.     hosttype = str2short("minix386");
  187. # else /* minix ? amoeba or mac? */
  188.     hosttype = str2short("minix");
  189. # endif /* i386 */
  190. #endif /* _MINIX */
  191.  
  192. # if defined(i386) && SVID > 0
  193.  
  194. #  if !defined(_havehosttype_) && (defined(ISC) || defined(ISC202))
  195. #   define _havehosttype_
  196.     hosttype = str2short("isc386");
  197. #  endif /* !_havehosttype_ && (ISC || ISC202) */
  198.  
  199. #  if !defined(_havehosttype_) && defined(SCO)
  200. #   define _havehosttype_
  201.     hosttype = str2short("sco386");
  202. #  endif /* !_havehosttype_ && SCO */
  203.  
  204. #  if !defined(_havehosttype_) && defined(INTEL)
  205. #   define _havehosttype_
  206.     hosttype = str2short("intel386");
  207. #  endif /* !_havehosttype_ && INTEL */
  208.  
  209. #  ifndef _havehosttype_
  210. #   define _havehosttype_
  211.     hosttype = str2short("i386");
  212. #  endif /* _havehosttype_ */
  213.  
  214. # endif 
  215.  
  216. #ifdef UNIXPC
  217. # define _havehosttype_
  218.     hosttype = str2short("unixpc");
  219. #endif /* UNIXPC/att3b1/att7300 */
  220.  
  221. # ifdef alliant
  222. #  define _havehosttype_
  223.     hosttype = str2short("alliant");    /* for Alliant FX Series */
  224. # endif 
  225.  
  226. # if defined(i386) && defined(MACH)
  227. #  define _havehosttype_
  228.     hosttype = str2short("i386-mach");
  229. # endif 
  230.  
  231. # if defined(sequent) || defined(_SEQUENT_)
  232. #  define _havehosttype_
  233. #  ifdef i386
  234. #   ifdef sequent
  235.     hosttype = str2short("symmetry");    /* Sequent Symmetry Dynix/3 */
  236. #    ifndef LOCALSTR
  237. #     define LOCALSTR    " (Dynix/3)"
  238. #    endif /* LOCALSTR */
  239. #   else
  240.     hosttype = str2short("ptx");    /* Sequent Symmetry Dynix/ptx */
  241. #    ifndef LOCALSTR
  242. #     define LOCALSTR    " (Dynix/ptx)"
  243. #    endif /* LOCALSTR */
  244. #   endif 
  245. #  else
  246.     hosttype = str2short("balance");    /* for Sequent Balance Series */
  247. #   ifndef LOCALSTR
  248. #    define LOCALSTR    " (Dynix/3)"
  249. #   endif /* LOCALSTR */
  250. #  endif 
  251. # else /* !sequent */
  252. #  ifdef ns32000
  253. #   define _havehosttype_
  254. #   ifdef CMUCS            /* hack for Mach (in the true spirit of CMU) */
  255.     hosttype = str2short("multimax");
  256. #   else /* CMUCS */
  257.     hosttype = str2short((!access("/Umax.image", F_OK) ? 
  258.              "multimax" : "ns32000"));
  259. #   endif /* CMUCS */
  260. #  endif /* ns32000 */
  261. # endif /* sequent */
  262.  
  263. # if defined(convex) || defined(__convex__)
  264. #  define _havehosttype_
  265.     /* From: Brian Allison <uiucdcs!convex!allison@RUTGERS.EDU> */
  266.     hosttype = str2short("convex");
  267. # endif /* convex */
  268.  
  269. # ifdef butterfly
  270. #  define _havehosttype_
  271.     /* this will work _until_ the bfly with 88000s comes out */
  272.     hosttype = str2short("butterfly");    /* BBN Butterfly 1000 */
  273. # endif /* butterfly */
  274.  
  275. # ifdef NeXT
  276. #  define _havehosttype_
  277.     hosttype = str2short("next");
  278. # endif /* NeXT */
  279.  
  280. /* From Kazuhiro Honda <honda@mt.cs.keio.ac.jp> */
  281. # ifdef sony_news
  282. #  define _havehosttype_
  283. #  ifdef mips /* Sony NEWS based on a r3000 */
  284.     hosttype = str2short("news_mips");
  285. #  else
  286.     hosttype = str2short("news");
  287. #  endif 
  288. # endif /* sony_news */
  289.  
  290. # if defined(mips) || defined(__mips)
  291. #  define _havehosttype_
  292. #  if defined(MIPSEL) || defined(__MIPSEL)
  293. #   if defined(ultrix) || defined(__ultrix)
  294.     hosttype = str2short("decstation");
  295. #   else
  296.     hosttype = str2short("mips");
  297. #   endif /* ultrix || __ultrix */
  298. #  endif /* MIPSEL || __MIPSEL */
  299. #  if defined(MIPSEB) || defined(__MIPSEB)
  300. #   if defined(ultrix) || defined(__ultrix)
  301.     hosttype = str2short("decmips");
  302. #   else
  303. #    ifdef sgi /* sgi iris 4d */
  304.     hosttype = str2short("iris4d");
  305. #    else
  306. #     ifdef sony_news
  307.     hosttype = str2short("news_mips");
  308. #     else
  309.     hosttype = str2short("mips");
  310. #     endif /* sony_news */
  311. #    endif /* sgi */
  312. #   endif /* ultrix || __ultrix */
  313. #  endif /* MIPSEB || __MIPSEB */
  314. # endif /* mips || __mips */
  315.  
  316. # ifdef m88k
  317. #  define _havehosttype_
  318.     hosttype = str2short("m88k");    /* Motorola 88100 system */
  319. # endif 
  320.  
  321. # ifdef masscomp            /* Added, DAS DEC-90. */
  322. #  define _havehosttype_
  323.     hosttype = str2short("masscomp");/* masscomp == concurrent */
  324. # endif /* masscomp */
  325.  
  326. # ifdef GOULD_NP1
  327. #  define _havehosttype_
  328.     hosttype = str2short("gould_np1");
  329. # endif /* GOULD_NP1 */
  330.  
  331. # ifdef SXA
  332. #  define _havehosttype_
  333.     hosttype = str2short("pfa50");
  334. #  ifdef  _BSDX_
  335. #   ifndef LOCALSTR
  336. #    define LOCALSTR    " (SX/A E60+BSDX)"
  337. #   endif /* LOCALSTR */
  338. #  else
  339. #   ifndef LOCALSTR
  340. #    define LOCALSTR    " (SX/A E60)"
  341. #   endif /* LOCALSTR */
  342. #  endif 
  343. # endif /* PFU/Fujitsu A-xx computer */
  344.  
  345. # ifdef titan
  346. #  define _havehosttype_
  347.     /* Ken Laprade <laprade@trantor.harris-atd.com> */
  348.     hosttype = str2short("titan");
  349. # endif /* titan */
  350.  
  351. # ifdef stellar
  352. #  define _havehosttype_
  353.     hosttype = str2short("stellar");
  354. # endif /* stellar */
  355.  
  356. # ifdef sgi
  357. /* Iris 4D is in the mips section; these are the 68k machines. */
  358. #  ifdef m68000
  359. #   define _havehosttype_
  360.     /* Vince Del Vecchio <vd09@andrew.cmu.edu> */
  361.     hosttype = str2short("iris3d");
  362. #  endif
  363. # endif /* sgi */
  364.  
  365. # ifdef uts
  366. #  define _havehosttype_
  367.     hosttype = str2short("amdahl");
  368. # endif /* uts */
  369.   
  370. # ifdef OPUS
  371. #  define _havehosttype_
  372.     hosttype = str2short("opus");
  373. # endif /* OPUS */
  374.  
  375. # ifdef eta10
  376. #  define _havehosttype_
  377.    /* Bruce Woodcock <woodcock@mentor.cc.purdue.edu> */
  378.    hosttype = str2short("eta10");
  379. # endif /* eta10 */
  380.  
  381. # ifdef cray
  382. #  define _havehosttype_
  383.    hosttype = str2short("cray");
  384. # endif /* cray */
  385.  
  386. # ifdef NDIX
  387. #  define _havehosttype_
  388.    /* B|rje Josefsson <bj@dc.luth.se> */
  389.    hosttype = str2short("nd500");
  390. # endif /* NDIX */
  391.  
  392. # ifndef _havehosttype_
  393. #  define _havehosttype_
  394.     /* Default to something reasonable */
  395.     hosttype = str2short("unknown");
  396. # endif 
  397. # undef _havehosttype_
  398. #endif /* HOSTTYPE */
  399.     return hosttype;
  400. } /* end gethosttype */
  401.  
  402.  
  403. /* fix_version():
  404.  *    Print a reasonable version string, printing all compile time
  405.  *    options that might affect the user.
  406.  */
  407. void
  408. fix_version()
  409. {
  410.     char    version[BUFSIZE];
  411.  
  412. #ifdef SHORT_STRINGS
  413. # define SSSTR "8b"
  414. #else
  415. # define SSSTR "7b"
  416. #endif 
  417. #ifdef NLS
  418. # define NLSSTR ",nls"
  419. #else
  420. # define NLSSTR ""
  421. #endif 
  422. #ifdef LOGINFIRST
  423. # define LFSTR ",lf"
  424. #else
  425. # define LFSTR ""
  426. #endif 
  427. #ifdef DOTLAST
  428. # define DLSTR ",dl"
  429. #else
  430. # define DLSTR ""
  431. #endif 
  432. #ifdef VIDEFAULT
  433. # define VISTR ",vi"
  434. #else
  435. # define VISTR ""
  436. #endif 
  437. #ifdef TESLA
  438. # define DTRSTR ",dtr"
  439. #else
  440. # define DTRSTR ""
  441. #endif 
  442. #ifdef KAI
  443. # define BYESTR ",bye"
  444. #else
  445. # define BYESTR ""
  446. #endif 
  447. #ifdef AUTOLOGOUT
  448. # define ALSTR ",al"
  449. #else
  450. # define ALSTR ""
  451. #endif 
  452. #ifdef CSHDIRS
  453. # define DIRSTR ",dir"
  454. #else
  455. # define DIRSTR ""
  456. #endif 
  457. #ifdef KANJI
  458. # define KANSTR ",kan"
  459. #else
  460. # define KANSTR ""
  461. #endif 
  462. #ifdef SYSMALLOC
  463. # define SMSTR    ",sm"
  464. #else
  465. # define SMSTR  ""
  466. #endif 
  467. /* if you want your local version to say something */
  468. #ifndef LOCALSTR
  469. # define LOCALSTR ""
  470. #endif /* LOCALSTR */
  471.  
  472.     xsprintf(version,
  473.            "tcsh %d.%.2d.%.2d (%s) %s options %s%s%s%s%s%s%s%s%s%s%s%s",
  474.            REV, VERS, PATCHLEVEL, ORIGIN, DATE,
  475.            SSSTR, NLSSTR, LFSTR, DLSTR, VISTR, DTRSTR,
  476.            BYESTR, ALSTR, DIRSTR, KANSTR, SMSTR, LOCALSTR);
  477.     set(STRversion, SAVE(version));
  478.     xsprintf(version, "%d.%.2d.%.2d", REV, VERS, PATCHLEVEL);
  479.     set(STRtcsh, SAVE(version));
  480. }
  481.