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 #ifdef SHORT_FILENAMES
14 #include "patchlevel.h"
17 /* #define BETA_INFO "" */ /* "[ beta n]" */
19 /* fill buffer with short version (so caller can avoid including date.h) */
24 return strcpy(buf, VERSION_STRING);
27 /* fill and return the given buffer with the long nethack version string */
32 Strcpy(buf, VERSION_ID);
33 #if defined(BETA) && defined(BETA_INFO)
34 Sprintf(eos(buf), " %s", BETA_INFO);
36 #if defined(RUNTIME_PORT_ID)
47 pline("%s", getversionstring(buf));
54 display_file(OPTIONS_USED, TRUE);
63 return((boolean)(filetime < BUILD_TIME));
68 check_version(version_data, filename, complain)
69 struct version_info *version_data;
74 #ifdef VERSION_COMPATIBILITY
75 version_data->incarnation < VERSION_COMPATIBILITY ||
76 version_data->incarnation > VERSION_NUMBER
78 version_data->incarnation != VERSION_NUMBER
82 pline("Version mismatch for file \"%s\".", filename);
85 #ifndef IGNORED_FEATURES
86 version_data->feature_set != VERSION_FEATURES ||
88 (version_data->feature_set & ~IGNORED_FEATURES) !=
89 (VERSION_FEATURES & ~IGNORED_FEATURES) ||
91 version_data->entity_count != VERSION_SANITY1 ||
92 version_data->struct_sizes != VERSION_SANITY2) {
94 pline("Configuration incompatibility for file \"%s\".",
101 /* this used to be based on file date and somewhat OS-dependant,
102 but now examines the initial part of the file's contents */
109 struct version_info vers_info;
110 boolean verbose = name ? TRUE : FALSE;
112 rlen = read(fd, (genericptr_t) &vers_info, sizeof vers_info);
113 minit(); /* ZEROCOMP */
116 pline("File \"%s\" is empty?", name);
121 if (!check_version(&vers_info, name, verbose)) {
122 if (verbose) wait_synch();
132 const static struct version_info version_data = {
133 VERSION_NUMBER, VERSION_FEATURES,
134 VERSION_SANITY1, VERSION_SANITY2
138 /* bwrite() before bufon() uses plain write() */
139 bwrite(fd,(genericptr_t)&version_data,(unsigned)(sizeof version_data));
145 const char amiga_version_string[] = AMIGA_VERSION_STRING;
149 get_feature_notice_ver(str)
153 int ver_maj, ver_min, patch;
158 str = strcpy(buf, str);
166 } else if (index("0123456789", *str) != 0) {
171 if (j != 2) return 0L;
172 ver_maj = atoi(istr[0]);
173 ver_min = atoi(istr[1]);
174 patch = atoi(istr[2]);
175 return FEATURE_NOTICE_VER(ver_maj,ver_min,patch);
176 /* macro from hack.h */
180 get_current_feature_ver()
182 return FEATURE_NOTICE_VER(VERSION_MAJOR,VERSION_MINOR,PATCHLEVEL);