]>
git.saurik.com Git - wxWidgets.git/blob - src/tiff/mkversion.c
4 * Copyright (c) 1995-1997 Sam Leffler
5 * Copyright (c) 1995-1997 Silicon Graphics, Inc.
7 * Permission to use, copy, modify, distribute, and sell this software and
8 * its documentation for any purpose is hereby granted without fee, provided
9 * that (i) the above copyright notices and this permission notice appear in
10 * all copies of the software and related documentation, and (ii) the names of
11 * Sam Leffler and Silicon Graphics may not be used in any advertising or
12 * publicity relating to the software without the specific, prior written
13 * permission of Sam Leffler and Silicon Graphics.
15 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
17 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
20 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
21 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
22 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
28 * Generate a library version string for systems that
29 * do not have a shell (by default this is done with
30 * awk and echo from the Makefile).
32 * This was written by Peter Greenham for Acorn systems.
34 * Syntax: mkversion [-v version-file] [<outfile>]
44 "usage: mkversion [-v version-file]\n"
45 " [-r releasedate-file] [outfile]\n");
50 openFile(char* filename
)
52 FILE* fd
= fopen(filename
, "r");
54 fprintf(stderr
, "mkversion: %s: Could not open for reading.\n",
62 main(int argc
, char* argv
[])
64 char* versionFile
= "../VERSION";
65 char* releaseDateFile
= "../RELEASE-DATE";
67 char rawReleaseDate
[128];
68 char tiffLibVersion
[128];
73 while (argc
> 0 && argv
[0][0] == '-') {
74 if (strcmp(argv
[0], "-v") == 0) {
78 versionFile
= argv
[0];
79 } else if (strcmp(argv
[0], "-r") == 0) {
83 releaseDateFile
= argv
[0];
90 * Read the VERSION file.
92 fd
= openFile(versionFile
);
93 if (fgets(version
, sizeof (version
)-1, fd
) == NULL
) {
94 fprintf(stderr
, "mkversion: No version information in %s.\n",
98 cp
= strchr(version
, '\n');
104 * Read the RELEASE-DATE, and translate format to emit TIFFLIB_VERSION.
106 fd
= openFile(releaseDateFile
);
107 if (fgets(rawReleaseDate
, sizeof (rawReleaseDate
)-1, fd
) == NULL
) {
108 fprintf(stderr
, "mkversion: No release date information in %s.\n",
114 sprintf( tiffLibVersion
, "#define TIFFLIB_VERSION %4.4s%2.2s%2.2s",
120 * Emit the tiffvers.h file.
123 fd
= fopen(argv
[0], "w");
125 fprintf(stderr
, "mkversion: %s: Could not open for writing.\n",
131 fprintf(fd
, "#define TIFFLIB_VERSION_STR \"LIBTIFF, Version %s\\n", version
);
132 fprintf(fd
, "Copyright (c) 1988-1996 Sam Leffler\\n");
133 fprintf(fd
, "Copyright (c) 1991-1996 Silicon Graphics, Inc.\"\n");
137 " * This define can be used in code that requires\n"
138 " * compilation-related definitions specific to a\n"
139 " * version or versions of the library. Runtime\n"
140 " * version checking should be done based on the\n"
141 " * string returned by TIFFGetVersion.\n"
143 fprintf(fd
, "%s\n", tiffLibVersion
);