tc.vers.c (145479) | tc.vers.c (167465) |
---|---|
1/* $Header: /src/pub/tcsh/tc.vers.c,v 3.50 2004/08/04 17:12:31 christos Exp $ */ | 1/* $Header: /p/tcsh/cvsroot/tcsh/tc.vers.c,v 3.54 2006/03/02 18:46:45 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 --- 18 unchanged lines hidden (view full) --- 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33#include "sh.h" 34#include "tw.h" 35 | 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 --- 18 unchanged lines hidden (view full) --- 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33#include "sh.h" 34#include "tw.h" 35 |
36RCSID("$Id: tc.vers.c,v 3.50 2004/08/04 17:12:31 christos Exp $") | 36RCSID("$tcsh: tc.vers.c,v 3.54 2006/03/02 18:46:45 christos Exp $") |
37 38#include "patchlevel.h" 39 40 41/* fix_version(): 42 * Print a reasonable version string, printing all compile time 43 * options that might affect the user. 44 */ 45void | 37 38#include "patchlevel.h" 39 40 41/* fix_version(): 42 * Print a reasonable version string, printing all compile time 43 * options that might affect the user. 44 */ 45void |
46fix_version() | 46fix_version(void) |
47{ 48#ifdef WIDE_STRINGS 49# define SSSTR "wide" 50#elif defined (SHORT_STRINGS) 51# define SSSTR "8b" 52#else 53# define SSSTR "7b" 54#endif --- 86 unchanged lines hidden (view full) --- 141# define FILECSTR ",filec" 142#else 143# define FILECSTR "" 144#endif 145/* if you want your local version to say something */ 146#ifndef LOCALSTR 147# define LOCALSTR "" 148#endif /* LOCALSTR */ | 47{ 48#ifdef WIDE_STRINGS 49# define SSSTR "wide" 50#elif defined (SHORT_STRINGS) 51# define SSSTR "8b" 52#else 53# define SSSTR "7b" 54#endif --- 86 unchanged lines hidden (view full) --- 141# define FILECSTR ",filec" 142#else 143# define FILECSTR "" 144#endif 145/* if you want your local version to say something */ 146#ifndef LOCALSTR 147# define LOCALSTR "" 148#endif /* LOCALSTR */ |
149 char version[BUFSIZE]; 150 Char *machtype = tgetenv(STRMACHTYPE); 151 Char *vendor = tgetenv(STRVENDOR); 152 Char *ostype = tgetenv(STROSTYPE); | 149 char *version; 150 const Char *machtype = tgetenv(STRMACHTYPE); 151 const Char *vendor = tgetenv(STRVENDOR); 152 const Char *ostype = tgetenv(STROSTYPE); |
153 154 if (vendor == NULL) 155 vendor = STRunknown; 156 if (machtype == NULL) 157 machtype = STRunknown; 158 if (ostype == NULL) 159 ostype = STRunknown; 160 161 | 153 154 if (vendor == NULL) 155 vendor = STRunknown; 156 if (machtype == NULL) 157 machtype = STRunknown; 158 if (ostype == NULL) 159 ostype = STRunknown; 160 161 |
162 (void) xsnprintf(version, sizeof(version), | 162 version = xasprintf( |
163"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", 164 REV, VERS, PATCHLEVEL, ORIGIN, DATE, machtype, vendor, ostype, 165 SSSTR, NLSSTR, LFSTR, DLSTR, VISTR, DTRSTR, BYESTR, 166 ALSTR, KANSTR, SMSTR, HBSTR, NGSTR, RHSTR, AFSSTR, NDSTR, 167 COLORSTR, DSPMSTR, CCATSTR, FILECSTR, LOCALSTR); | 163"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", 164 REV, VERS, PATCHLEVEL, ORIGIN, DATE, machtype, vendor, ostype, 165 SSSTR, NLSSTR, LFSTR, DLSTR, VISTR, DTRSTR, BYESTR, 166 ALSTR, KANSTR, SMSTR, HBSTR, NGSTR, RHSTR, AFSSTR, NDSTR, 167 COLORSTR, DSPMSTR, CCATSTR, FILECSTR, LOCALSTR); |
168 set(STRversion, SAVE(version), VAR_READWRITE); 169 (void) xsnprintf(version, sizeof(version), "%d.%.2d.%.2d", 170 REV, VERS, PATCHLEVEL); 171 set(STRtcsh, SAVE(version), VAR_READWRITE); | 168 cleanup_push(version, xfree); 169 setcopy(STRversion, str2short(version), VAR_READWRITE); 170 cleanup_until(version); 171 version = xasprintf("%d.%.2d.%.2d", REV, VERS, PATCHLEVEL); 172 cleanup_push(version, xfree); 173 setcopy(STRtcsh, str2short(version), VAR_READWRITE); 174 cleanup_until(version); |
172} | 175} |