#include "sh.h"
#include "tw.h"
RCSID("$Id: tc.vers.c,v 3.50 2004/08/04 17:12:31 christos Exp $")
#include "patchlevel.h"
void
fix_version()
{
#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
# define COLORSTR ""
#endif
#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
#ifndef LOCALSTR
# define LOCALSTR ""
#endif
char version[BUFSIZE];
Char *machtype = tgetenv(STRMACHTYPE);
Char *vendor = tgetenv(STRVENDOR);
Char *ostype = tgetenv(STROSTYPE);
if (vendor == NULL)
vendor = STRunknown;
if (machtype == NULL)
machtype = STRunknown;
if (ostype == NULL)
ostype = STRunknown;
(void) xsnprintf(version, sizeof(version),
"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%s",
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);
set(STRversion, SAVE(version), VAR_READWRITE);
(void) xsnprintf(version, sizeof(version), "%d.%.2d.%.2d",
REV, VERS, PATCHLEVEL);
set(STRtcsh, SAVE(version), VAR_READWRITE);
}