1 /* SCCS Id: @(#)version.c 3.4 2003/12/06 */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
8 * All the references to the contents of patchlevel.h have been moved
11 #include "patchlevel.h"
13 /* #define BETA_INFO "" */ /* "[ beta n]" */
15 /* fill buffer with short version (so caller can avoid including date.h) */
20 return strcpy(buf
, VERSION_STRING
);
23 /* fill and return the given buffer with the long nethack version string */
28 strcpy(buf
, VERSION_ID
);
29 #if defined(BETA) && defined(BETA_INFO)
30 sprintf(eos(buf
), " %s", BETA_INFO
);
32 #if defined(RUNTIME_PORT_ID)
43 pline("%s", getversionstring(buf
));
50 display_file_area(NH_OPTIONS_USED_AREA
, NH_OPTIONS_USED
, TRUE
);
59 return((boolean
)(filetime
< BUILD_TIME
));
64 check_version(version_data
, filename
, complain
)
65 struct version_info
*version_data
;
70 #ifdef VERSION_COMPATIBILITY
71 version_data
->incarnation
< VERSION_COMPATIBILITY
||
72 version_data
->incarnation
> VERSION_NUMBER
74 version_data
->incarnation
!= VERSION_NUMBER
78 pline("Version mismatch for file \"%s\".", filename
);
81 #ifndef IGNORED_FEATURES
82 version_data
->feature_set
!= VERSION_FEATURES
||
84 (version_data
->feature_set
& ~IGNORED_FEATURES
) !=
85 (VERSION_FEATURES
& ~IGNORED_FEATURES
) ||
87 version_data
->entity_count
!= VERSION_SANITY1
||
88 version_data
->struct_sizes
!= VERSION_SANITY2
) {
90 pline("Configuration incompatibility for file \"%s\".",
97 /* this used to be based on file date and somewhat OS-dependant,
98 but now examines the initial part of the file's contents */
105 struct version_info vers_info
;
106 boolean verbose
= name
? TRUE
: FALSE
;
108 rlen
= read(fd
, (void *) &vers_info
, sizeof vers_info
);
109 minit(); /* ZEROCOMP */
112 pline("File \"%s\" is empty?", name
);
117 if (!check_version(&vers_info
, name
, verbose
)) {
118 if (verbose
) wait_synch();
128 const static struct version_info version_data
= {
129 VERSION_NUMBER
, VERSION_FEATURES
,
130 VERSION_SANITY1
, VERSION_SANITY2
134 /* bwrite() before bufon() uses plain write() */
135 bwrite(fd
,(void *)&version_data
,(unsigned)(sizeof version_data
));
141 const char amiga_version_string
[] = AMIGA_VERSION_STRING
;
145 get_feature_notice_ver(str
)
149 int ver_maj
, ver_min
, patch
;
154 str
= strcpy(buf
, str
);
162 } else if (index("0123456789", *str
) != 0) {
167 if (j
!= 2) return 0L;
168 ver_maj
= atoi(istr
[0]);
169 ver_min
= atoi(istr
[1]);
170 patch
= atoi(istr
[2]);
171 return FEATURE_NOTICE_VER(ver_maj
,ver_min
,patch
);
172 /* macro from hack.h */
176 get_current_feature_ver()
178 return FEATURE_NOTICE_VER(VERSION_MAJOR
,VERSION_MINOR
,PATCHLEVEL
);