diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-04-05 09:20:02 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-04-05 09:20:02 +0000 |
commit | 5de3404e7c48edae1fa6b2ffc03bc8ed20d32be3 (patch) | |
tree | 126164d2794a7aa97ecd7a23c00b3ee9a3b200b6 /Src | |
parent | ff53f1cfb6a7a513f39603ff14e0656f228927f1 (diff) | |
download | zsh-5de3404e7c48edae1fa6b2ffc03bc8ed20d32be3.tar.gz zsh-5de3404e7c48edae1fa6b2ffc03bc8ed20d32be3.tar.xz zsh-5de3404e7c48edae1fa6b2ffc03bc8ed20d32be3.zip |
make zwc files use the magic number as their verios, report zsh-version in error messages
Diffstat (limited to 'Src')
-rw-r--r-- | Src/parse.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/Src/parse.c b/Src/parse.c index 63ea01486..f3908e2e3 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -2197,7 +2197,10 @@ init_eprog(void) * the version string in a field of 40 characters and the descriptions * for the functions in the dump file. * - * NOTE: this layout has to be kept; everything after it may be changed. + * NOTES: + * - This layout has to be kept; everything after it may be changed. + * - When incompatible changes are made, the FD_MAGIC and FD_OMAGIC + * numbers have to be changed. * * Each description consists of a struct fdhead followed by the name, * aligned to sizeof(wordcode) (i.e. 4 bytes). @@ -2358,11 +2361,17 @@ load_dump_header(char *nam, char *name, int err) } if (read(fd, buf, (FD_PRELEN + 1) * sizeof(wordcode)) != ((FD_PRELEN + 1) * sizeof(wordcode)) || - (fdmagic(buf) != FD_MAGIC && fdmagic(buf) != FD_OMAGIC) || - (v = strcmp(ZSH_VERSION, fdversion(buf)))) { - if (err) - zwarnnam(nam, (v ? "invalid zwc file, wrong version: %s" : - "invalid zwc file: %s") , name, 0); + (v = (fdmagic(buf) != FD_MAGIC && fdmagic(buf) != FD_OMAGIC))) { + if (err) { + if (v) { + char msg[80]; + + sprintf(msg, "zwc file has wrong version (zsh-%s): %%s", + fdversion(buf)); + zwarnnam(nam, msg , name, 0); + } else + zwarnnam(nam, "invalid zwc file: %s" , name, 0); + } close(fd); return NULL; } else { |