1: /* $Header: /home/hyperion/mu/christos/src/sys/tcsh-6.00/RCS/tc.vers.c,v 3.0 1991/07/04 21:49:28 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 "config.h" 38: #if !defined(lint) && !defined(pdp11) 39: static char *rcsid() 40: { return "$Id: tc.vers.c,v 3.0 1991/07/04 21:49:28 christos Exp $"; } 41: #endif 42: 43: #include "sh.h" 44: #include "patchlevel.h" 45: 46: 47: Char * 48: GetHostType() 49: { 50: Char *hosttype; 51: 52: #ifdef vax 53: # define _havehosttype_ 54: hosttype = str2short("vax"); 55: #endif /* vax */ 56: 57: #ifdef pdp11 58: # define _havehosttype_ 59: hosttype = str2short("pdp11"); 60: #endif /* pdp */ 61: 62: #ifdef hp9000 /* hp9000 running MORE/bsd */ 63: # ifdef hp300 64: # define _havehosttype_ 65: hosttype = str2short("hp300"); 66: # endif 67: # ifdef hp800 68: # define _havehosttype_ 69: hosttype = str2short("hp800"); 70: # endif 71: # ifndef _havehosttype_ 72: # define _havehosttype_ 73: hosttype = str2short("hp9000"); 74: # endif 75: #endif /* hp9000 */ 76: 77: #ifdef sun 78: # ifdef mc68010 79: # define _havehosttype_ 80: hosttype = str2short("sun2"); 81: # endif /* mc68010 */ 82: # ifdef mc68020 83: # define _havehosttype_ 84: hosttype = str2short("sun3"); 85: # endif /* mc68020 */ 86: # ifdef sparc 87: # define _havehosttype_ 88: hosttype = str2short("sun4"); 89: # endif /* sparc */ 90: # ifdef i386 91: # define _havehosttype_ 92: hosttype = str2short("sun386i"); 93: # endif /* i386 */ 94: # ifndef _havehosttype_ 95: # define _havehosttype_ 96: hosttype = str2short("sun"); 97: # endif 98: #endif /* sun */ 99: 100: #ifdef pyr /* pyramid */ 101: # define _havehosttype_ 102: hosttype = str2short("pyramid"); 103: #endif /* pyr */ 104: 105: #ifdef ibm032 /* from Jak Kirman 106: * <jak%cs.brown.edu@RELAY.CS.NET>. */ 107: # define _havehosttype_ 108: hosttype = str2short("rt"); 109: #endif /* ibm032 */ 110: 111: #ifdef aiws /* not to be confused with the above */ 112: # define _havehosttype_ 113: hosttype = str2short("rtpc"); 114: #endif /* aiws */ 115: 116: #ifdef _AIX370 117: # define _havehosttype_ 118: hosttype = str2short("aix370"); 119: #endif /* _AIX370 */ 120: 121: #ifdef _IBMR2 122: # define _havehosttype_ 123: hosttype = str2short("rs6000"); 124: #endif /* _IBMR2 */ 125: 126: #ifdef _AIXPS2 /* AIX on a PS/2 */ 127: # define _havehosttype_ 128: hosttype = str2short("ps2"); 129: #endif /* _AIXPS2 */ 130: 131: #ifdef OREO 132: # define _havehosttype_ 133: hosttype = str2short("mac2"); 134: #endif /* OREO */ 135: 136: #ifdef hpux 137: # if defined(__hp9000s700) && !defined(_havehosttype_) 138: # define _havehosttype_ 139: hosttype = str2short("hp9000s700"); 140: # endif /* __hp9000s700 */ 141: # if defined(hp9000s800) && !defined(_havehosttype_) 142: # define _havehosttype_ 143: hosttype = str2short("hp9000s800"); /* maybe "spectrum" */ 144: # endif /* hp9000s800 */ 145: # if defined(hp9000s300) && !defined(_havehosttype_) 146: # define _havehosttype_ 147: hosttype = str2short("hp9000s300"); 148: # endif /* hp9000s300 */ 149: # ifndef _havehosttype_ 150: # define _havehosttype_ 151: hosttype = str2short("hp"); 152: # endif /* _havehosttype_ */ 153: #endif /* hpux */ 154: 155: #ifdef apollo 156: # define _havehosttype_ 157: hosttype = str2short("apollo"); 158: #endif 159: 160: #ifdef u3b20d 161: # define _havehosttype_ 162: hosttype = str2short("att3b20"); 163: #endif /* u3b20d */ 164: 165: #ifdef u3b15 166: # define _havehosttype_ 167: hosttype = str2short("att3b15"); 168: #endif /* u3b15 */ 169: 170: #ifdef u3b5 171: # define _havehosttype_ 172: hosttype = str2short("att3b5"); 173: #endif /* u3b5 */ 174: 175: #ifdef u3b2 176: # define _havehosttype_ 177: hosttype = str2short("att3b2"); 178: #endif /* u3b2 */ 179: 180: #if defined(i386) && SVID > 0 181: # define _havehosttype_ 182: hosttype = str2short("iAPX386"); 183: #endif 184: 185: #ifdef alliant 186: # define _havehosttype_ 187: hosttype = str2short("alliant"); /* for Alliant FX Series */ 188: #endif 189: 190: #if defined(i386) && defined(MACH) 191: # define _havehosttype_ 192: hosttype = str2short("i386-mach"); 193: #endif 194: 195: #if defined(sequent) || defined(_SEQUENT_) 196: # define _havehosttype_ 197: # ifdef i386 198: # ifdef sequent 199: hosttype = str2short("symmetry");/* Sequent Symmetry Dynix/3 */ 200: # ifndef LOCALSTR 201: # define LOCALSTR " (Dynix/3)" 202: # endif /* LOCALSTR */ 203: # else 204: hosttype = str2short("ptx"); /* Sequent Symmetry Dynix/ptx */ 205: # ifndef LOCALSTR 206: # define LOCALSTR " (Dynix/ptx)" 207: # endif /* LOCALSTR */ 208: # endif 209: # else 210: hosttype = str2short("balance"); /* for Sequent Balance Series */ 211: # ifndef LOCALSTR 212: # define LOCALSTR " (Dynix/3)" 213: # endif /* LOCALSTR */ 214: # endif 215: #else /* !sequent */ 216: # ifdef ns32000 217: # ifdef CMUCS /* hack for Mach (in the true spirit of CMU) */ 218: hosttype = str2short("multimax"); 219: # else /* CMUCS */ 220: hosttype = str2short((!access("/Umax.image", F_OK) ? "multimax" : "ns32000")); 221: # endif /* CMUCS */ 222: # endif /* ns32000 */ 223: #endif /* sequent */ 224: 225: #if defined(convex) || defined(__convex__) 226: # define _havehosttype_ 227: /* From: Brian Allison <uiucdcs!convex!allison@RUTGERS.EDU> */ 228: hosttype = str2short("convex"); 229: #endif /* convex */ 230: 231: #ifdef butterfly 232: # define _havehosttype_ 233: /* this will work _until_ the bfly with 88000s comes out */ 234: hosttype = str2short("butterfly"); /* BBN Butterfly 1000 */ 235: #endif /* butterfly */ 236: 237: #ifdef NeXT 238: # define _havehosttype_ 239: hosttype = str2short("next"); 240: #endif /* NeXT */ 241: 242: /* From Kazuhiro Honda <honda@mt.cs.keio.ac.jp> */ 243: #ifdef sony_news 244: # define _havehosttype_ 245: # ifdef mips /* Sony NEWS based on a r3000 */ 246: hosttype = str2short("news_mips"); 247: # else 248: hosttype = str2short("news"); 249: # endif 250: #endif /* sony_news */ 251: 252: #ifdef mips 253: # define _havehosttype_ 254: # ifdef MIPSEL 255: # ifdef ultrix 256: /* decstation XXXX */ 257: hosttype = str2short("decstation"); 258: # else 259: hosttype = str2short("mips"); 260: # endif /* ultrix */ 261: # endif /* MIPSEL */ 262: # ifdef MIPSEB 263: # ifdef sgi /* sgi iris 4d */ 264: hosttype = str2short("iris4d"); 265: # else 266: # ifdef sony_news 267: hosttype = str2short("news_mips"); 268: # else 269: hosttype = str2short("mips"); 270: # endif /* sony_news */ 271: # endif /* sgi */ 272: # endif /* MIPSEB */ 273: #endif /* mips */ 274: 275: #ifdef m88k 276: # define _havehosttype_ 277: hosttype = str2short("m88k"); /* Motorola 88100 system */ 278: #endif 279: 280: #ifdef masscomp /* Added, DAS DEC-90. */ 281: # define _havehosttype_ 282: hosttype = str2short("masscomp");/* masscomp == concurrent */ 283: #endif /* masscomp */ 284: 285: #ifdef GOULD_NP1 286: # define _havehosttype_ 287: hosttype = str2short("gould_np1"); 288: #endif /* GOULD_NP1 */ 289: 290: #ifdef SXA 291: # define _havehosttype_ 292: hosttype = str2short("pfa50"); 293: # ifdef _BSDX_ 294: # ifndef LOCALSTR 295: # define LOCALSTR " (SX/A E60+BSDX)" 296: # endif /* LOCALSTR */ 297: # else 298: # ifndef LOCALSTR 299: # define LOCALSTR " (SX/A E60)" 300: # endif /* LOCALSTR */ 301: # endif 302: #endif /* PFU/Fujitsu A-xx computer */ 303: 304: #ifdef titan 305: # define _havehosttype_ 306: /* Ken Laprade <laprade@trantor.harris-atd.com> */ 307: hosttype = str2short("titan"); 308: #endif /* titan */ 309: 310: #ifndef _havehosttype_ 311: # define _havehosttype_ 312: /* Default to something reasonable */ 313: hosttype = str2short("unknown"); 314: #endif 315: #undef _havehosttype_ 316: return hosttype; 317: } /* end GetHostType */ 318: 319: 320: /* fix_version(): 321: * Print a reasonable version string, printing all comp_ time 322: * options that might affect the user. 323: */ 324: void 325: fix_version() 326: { 327: char version[BUFSIZ]; 328: 329: #ifdef SHORT_STRINGS 330: # define SSSTR "8b" 331: #else 332: # define SSSTR "7b" 333: #endif 334: #ifdef NLS 335: # define NLSSTR ",nls" 336: #else 337: # define NLSSTR "" 338: #endif 339: #ifdef LOGINFIRST 340: # define LFSTR ",lf" 341: #else 342: # define LFSTR "" 343: #endif 344: #ifdef DOTLAST 345: # define DLSTR ",dl" 346: #else 347: # define DLSTR "" 348: #endif 349: #ifdef VIDEFAULT 350: # define VISTR ",vi" 351: #else 352: # define VISTR "" 353: #endif 354: #ifdef TESLA 355: # define DTRSTR ",dtr" 356: #else 357: # define DTRSTR "" 358: #endif 359: #ifdef KAI 360: # define BYESTR ",bye" 361: #else 362: # define BYESTR "" 363: #endif 364: #ifdef AUTOLOGOUT 365: # define ALSTR ",al" 366: #else 367: # define ALSTR "" 368: #endif 369: #ifdef CSHDIRS 370: # define DIRSTR ",dir" 371: #else 372: # define DIRSTR "" 373: #endif 374: #ifdef KANJI 375: # define KANSTR ",kan" 376: #else 377: # define KANSTR "" 378: #endif 379: #ifdef SYSMALLOC 380: # define SMSTR ",sm" 381: #else 382: # define SMSTR "" 383: #endif 384: /* if you want your local version to say something */ 385: #ifndef LOCALSTR 386: # define LOCALSTR "" 387: #endif /* LOCALSTR */ 388: 389: xsprintf(version, 390: "tcsh %d.%.2d.%.2d (%s) %s options %s%s%s%s%s%s%s%s%s%s%s%s", 391: REV, VERS, PATCHLEVEL, ORIGIN, DATE, 392: SSSTR, NLSSTR, LFSTR, DLSTR, VISTR, DTRSTR, 393: BYESTR, ALSTR, DIRSTR, KANSTR, SMSTR, LOCALSTR); 394: set(STRversion, SAVE(version)); 395: xsprintf(version, "%d.%.2d.%.2d", REV, VERS, PATCHLEVEL); 396: set(STRtcsh, SAVE(version)); 397: }