1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
|
/* $Header: /p/tcsh/cvsroot/tcsh/tc.vers.c,v 3.54 2006/03/02 18:46:45 christos Exp $ */
/*
* tc.vers.c: Version dependent stuff
*/
/*-
* Copyright (c) 1980, 1991 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "sh.h"
#include "tw.h"
RCSID("$tcsh: tc.vers.c,v 3.54 2006/03/02 18:46:45 christos Exp $")
#ifdef CATCH_EXEC
# include "version.h"
#endif
#include "patchlevel.h"
/* fix_version():
* Print a reasonable version string, printing all compile time
* options that might affect the user.
*/
void
fix_version(void)
{
#ifdef WIDE_STRINGS
# define SSSTR "wide"
#elif defined (SHORT_STRINGS)
# define SSSTR "8b"
#else
# define SSSTR "7b"
#endif
#ifdef NLS
# define NLSSTR ",nls"
#else
# define NLSSTR ""
#endif
#ifdef LOGINFIRST
# define LFSTR ",lf"
#else
# define LFSTR ""
#endif
#ifdef DOTLAST
# define DLSTR ",dl"
#else
# define DLSTR ""
#endif
#ifdef VIDEFAULT
# define VISTR ",vi"
#else
# define VISTR ""
#endif
#ifdef TESLA
# define DTRSTR ",dtr"
#else
# define DTRSTR ""
#endif
#ifdef KAI
# define BYESTR ",bye"
#else
# define BYESTR ""
#endif
#ifdef AUTOLOGOUT
# define ALSTR ",al"
#else
# define ALSTR ""
#endif
#ifdef KANJI
# define KANSTR ",kan"
#else
# define KANSTR ""
#endif
#ifdef SYSMALLOC
# define SMSTR ",sm"
#else
# define SMSTR ""
#endif
#ifdef HASHBANG
# define HBSTR ",hb"
#else
# define HBSTR ""
#endif
#ifdef NEWGRP
# define NGSTR ",ng"
#else
# define NGSTR ""
#endif
#ifdef REMOTEHOST
# define RHSTR ",rh"
#else
# define RHSTR ""
#endif
#ifdef AFS
# define AFSSTR ",afs"
#else
# define AFSSTR ""
#endif
#ifdef NODOT
# define NDSTR ",nd"
#else
# define NDSTR ""
#endif
#ifdef COLOR_LS_F
# define COLORSTR ",color"
#else /* ifndef COLOR_LS_F */
# define COLORSTR ""
#endif /* COLOR_LS_F */
#ifdef DSPMBYTE
# define DSPMSTR ",dspm"
#else
# define DSPMSTR ""
#endif
#ifdef COLORCAT
# define CCATSTR ",ccat"
#else
# define CCATSTR ""
#endif
#if defined(FILEC) && defined(TIOCSTI)
# define FILECSTR ",filec"
#else
# define FILECSTR ""
#endif
/* if you want your local version to say something */
#ifndef LOCALSTR
# define LOCALSTR ""
#endif /* LOCALSTR */
char *version;
const Char *machtype = tgetenv(STRMACHTYPE);
const Char *vendor = tgetenv(STRVENDOR);
const Char *ostype = tgetenv(STROSTYPE);
if (vendor == NULL)
vendor = STRunknown;
if (machtype == NULL)
machtype = STRunknown;
if (ostype == NULL)
ostype = STRunknown;
version = xasprintf(
"%s"
#ifdef CATCH_EXEC
"(%s)"
#endif
" %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%s", PROG_NAME,
#ifdef CATCH_EXEC
GDI_VERSION,
#endif
REV, VERS, PATCHLEVEL, ORIGIN, DATE, machtype, vendor, ostype,
SSSTR, NLSSTR, LFSTR, DLSTR, VISTR, DTRSTR, BYESTR,
ALSTR, KANSTR, SMSTR, HBSTR, NGSTR, RHSTR, AFSSTR, NDSTR,
COLORSTR, DSPMSTR, CCATSTR, FILECSTR, LOCALSTR);
cleanup_push(version, xfree);
setcopy(STRversion, str2short(version), VAR_READWRITE);
cleanup_until(version);
version = xasprintf("%d.%.2d.%.2d", REV, VERS, PATCHLEVEL);
cleanup_push(version, xfree);
setcopy(STRtcsh, str2short(version), VAR_READWRITE);
cleanup_until(version);
}
|