tc.vers.c revision 59243
159243Sobrien/* $Header: /src/pub/tcsh/tc.vers.c,v 3.46 1999/05/11 13:07:54 christos Exp $ */ 259243Sobrien/* 359243Sobrien * tc.vers.c: Version dependent stuff 459243Sobrien */ 559243Sobrien/*- 659243Sobrien * Copyright (c) 1980, 1991 The Regents of the University of California. 759243Sobrien * All rights reserved. 859243Sobrien * 959243Sobrien * Redistribution and use in source and binary forms, with or without 1059243Sobrien * modification, are permitted provided that the following conditions 1159243Sobrien * are met: 1259243Sobrien * 1. Redistributions of source code must retain the above copyright 1359243Sobrien * notice, this list of conditions and the following disclaimer. 1459243Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1559243Sobrien * notice, this list of conditions and the following disclaimer in the 1659243Sobrien * documentation and/or other materials provided with the distribution. 1759243Sobrien * 3. All advertising materials mentioning features or use of this software 1859243Sobrien * must display the following acknowledgement: 1959243Sobrien * This product includes software developed by the University of 2059243Sobrien * California, Berkeley and its contributors. 2159243Sobrien * 4. Neither the name of the University nor the names of its contributors 2259243Sobrien * may be used to endorse or promote products derived from this software 2359243Sobrien * without specific prior written permission. 2459243Sobrien * 2559243Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2659243Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2759243Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2859243Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2959243Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3059243Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3159243Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3259243Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3359243Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3459243Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3559243Sobrien * SUCH DAMAGE. 3659243Sobrien */ 3759243Sobrien#include "sh.h" 3859243Sobrien#include "tw.h" 3959243Sobrien 4059243SobrienRCSID("$Id: tc.vers.c,v 3.46 1999/05/11 13:07:54 christos Exp $") 4159243Sobrien 4259243Sobrien#include "patchlevel.h" 4359243Sobrien 4459243Sobrien 4559243Sobrien/* fix_version(): 4659243Sobrien * Print a reasonable version string, printing all compile time 4759243Sobrien * options that might affect the user. 4859243Sobrien */ 4959243Sobrienvoid 5059243Sobrienfix_version() 5159243Sobrien{ 5259243Sobrien#ifdef SHORT_STRINGS 5359243Sobrien# define SSSTR "8b" 5459243Sobrien#else 5559243Sobrien# define SSSTR "7b" 5659243Sobrien#endif 5759243Sobrien#ifdef NLS 5859243Sobrien# define NLSSTR ",nls" 5959243Sobrien#else 6059243Sobrien# define NLSSTR "" 6159243Sobrien#endif 6259243Sobrien#ifdef LOGINFIRST 6359243Sobrien# define LFSTR ",lf" 6459243Sobrien#else 6559243Sobrien# define LFSTR "" 6659243Sobrien#endif 6759243Sobrien#ifdef DOTLAST 6859243Sobrien# define DLSTR ",dl" 6959243Sobrien#else 7059243Sobrien# define DLSTR "" 7159243Sobrien#endif 7259243Sobrien#ifdef VIDEFAULT 7359243Sobrien# define VISTR ",vi" 7459243Sobrien#else 7559243Sobrien# define VISTR "" 7659243Sobrien#endif 7759243Sobrien#ifdef TESLA 7859243Sobrien# define DTRSTR ",dtr" 7959243Sobrien#else 8059243Sobrien# define DTRSTR "" 8159243Sobrien#endif 8259243Sobrien#ifdef KAI 8359243Sobrien# define BYESTR ",bye" 8459243Sobrien#else 8559243Sobrien# define BYESTR "" 8659243Sobrien#endif 8759243Sobrien#ifdef AUTOLOGOUT 8859243Sobrien# define ALSTR ",al" 8959243Sobrien#else 9059243Sobrien# define ALSTR "" 9159243Sobrien#endif 9259243Sobrien#ifdef KANJI 9359243Sobrien# define KANSTR ",kan" 9459243Sobrien#else 9559243Sobrien# define KANSTR "" 9659243Sobrien#endif 9759243Sobrien#ifdef SYSMALLOC 9859243Sobrien# define SMSTR ",sm" 9959243Sobrien#else 10059243Sobrien# define SMSTR "" 10159243Sobrien#endif 10259243Sobrien#ifdef HASHBANG 10359243Sobrien# define HBSTR ",hb" 10459243Sobrien#else 10559243Sobrien# define HBSTR "" 10659243Sobrien#endif 10759243Sobrien#ifdef NEWGRP 10859243Sobrien# define NGSTR ",ng" 10959243Sobrien#else 11059243Sobrien# define NGSTR "" 11159243Sobrien#endif 11259243Sobrien#ifdef REMOTEHOST 11359243Sobrien# define RHSTR ",rh" 11459243Sobrien#else 11559243Sobrien# define RHSTR "" 11659243Sobrien#endif 11759243Sobrien#ifdef AFS 11859243Sobrien# define AFSSTR ",afs" 11959243Sobrien#else 12059243Sobrien# define AFSSTR "" 12159243Sobrien#endif 12259243Sobrien#ifdef NODOT 12359243Sobrien# define NDSTR ",nd" 12459243Sobrien#else 12559243Sobrien# define NDSTR "" 12659243Sobrien#endif 12759243Sobrien#ifdef COLOR_LS_F 12859243Sobrien# define COLORSTR ",color" 12959243Sobrien#else /* ifndef COLOR_LS_F */ 13059243Sobrien# define COLORSTR "" 13159243Sobrien#endif /* COLOR_LS_F */ 13259243Sobrien#ifdef DSPMBYTE 13359243Sobrien# define DSPMSTR ",dspm" 13459243Sobrien#else 13559243Sobrien# define DSPMSTR "" 13659243Sobrien#endif 13759243Sobrien#ifdef COLORCAT 13859243Sobrien# define CCATSTR ",ccat" 13959243Sobrien#else 14059243Sobrien# define CCATSTR "" 14159243Sobrien#endif 14259243Sobrien/* if you want your local version to say something */ 14359243Sobrien#ifndef LOCALSTR 14459243Sobrien# define LOCALSTR "" 14559243Sobrien#endif /* LOCALSTR */ 14659243Sobrien char version[BUFSIZE]; 14759243Sobrien Char *machtype = tgetenv(STRMACHTYPE); 14859243Sobrien Char *vendor = tgetenv(STRVENDOR); 14959243Sobrien Char *ostype = tgetenv(STROSTYPE); 15059243Sobrien 15159243Sobrien if (vendor == NULL) 15259243Sobrien vendor = STRunknown; 15359243Sobrien if (machtype == NULL) 15459243Sobrien machtype = STRunknown; 15559243Sobrien if (ostype == NULL) 15659243Sobrien ostype = STRunknown; 15759243Sobrien 15859243Sobrien 15959243Sobrien (void) xsnprintf(version, sizeof(version), 16059243Sobrien"tcsh %d.%.2d.%.2d (%s) %s (%S-%S-%S) options %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", 16159243Sobrien REV, VERS, PATCHLEVEL, ORIGIN, DATE, machtype, vendor, ostype, 16259243Sobrien SSSTR, NLSSTR, LFSTR, DLSTR, VISTR, DTRSTR, BYESTR, 16359243Sobrien ALSTR, KANSTR, SMSTR, HBSTR, NGSTR, RHSTR, AFSSTR, NDSTR, 16459243Sobrien COLORSTR, DSPMSTR, CCATSTR, LOCALSTR); 16559243Sobrien set(STRversion, SAVE(version), VAR_READWRITE); 16659243Sobrien (void) xsnprintf(version, sizeof(version), "%d.%.2d.%.2d", 16759243Sobrien REV, VERS, PATCHLEVEL); 16859243Sobrien set(STRtcsh, SAVE(version), VAR_READWRITE); 16959243Sobrien} 170