| 1 | /* | 
|---|
| 2 | *+ | 
|---|
| 3 | *  Name: | 
|---|
| 4 | *     palVers | 
|---|
| 5 |  | 
|---|
| 6 | *  Purpose: | 
|---|
| 7 | *     Obtain PAL version number | 
|---|
| 8 |  | 
|---|
| 9 | *  Language: | 
|---|
| 10 | *     Starlink ANSI C | 
|---|
| 11 |  | 
|---|
| 12 | *  Type of Module: | 
|---|
| 13 | *     Library routine | 
|---|
| 14 |  | 
|---|
| 15 | *  Invocation: | 
|---|
| 16 | *     int palVers( char *verstring, size_t verlen ); | 
|---|
| 17 |  | 
|---|
| 18 | *  Arguments: | 
|---|
| 19 | *     verstring = char * (Returned) | 
|---|
| 20 | *        Buffer to receive version string of the form "A.B.C". Can be NULL. | 
|---|
| 21 | *     verlen = size_t (Given) | 
|---|
| 22 | *        Allocated size of "verstring" including nul. Version string | 
|---|
| 23 | *        will be truncated if it does not fit in buffer. | 
|---|
| 24 |  | 
|---|
| 25 | *  Returned Value: | 
|---|
| 26 | *     vernum = int (Returned) | 
|---|
| 27 | *        Version number as an integer. | 
|---|
| 28 |  | 
|---|
| 29 | *  Description: | 
|---|
| 30 | *     Retrieve the PAL version number as a string in the form "A.B.C" | 
|---|
| 31 | *     and as an integer (major*1e6+minor*1e3+release). | 
|---|
| 32 |  | 
|---|
| 33 | *  Authors: | 
|---|
| 34 | *     TIMJ: Tim Jenness (Cornell) | 
|---|
| 35 | *     {enter_new_authors_here} | 
|---|
| 36 |  | 
|---|
| 37 | *  Notes: | 
|---|
| 38 | *     - Note that this API does not match the slaVers API. | 
|---|
| 39 |  | 
|---|
| 40 | *  History: | 
|---|
| 41 | *     2014-08-27 (TIMJ): | 
|---|
| 42 | *        Initial version | 
|---|
| 43 | *     {enter_further_changes_here} | 
|---|
| 44 |  | 
|---|
| 45 | *  Copyright: | 
|---|
| 46 | *     Copyright (C) 2014 Cornell University | 
|---|
| 47 | *     All Rights Reserved. | 
|---|
| 48 |  | 
|---|
| 49 | *  Licence: | 
|---|
| 50 | *     This program is free software; you can redistribute it and/or | 
|---|
| 51 | *     modify it under the terms of the GNU General Public License as | 
|---|
| 52 | *     published by the Free Software Foundation; either version 3 of | 
|---|
| 53 | *     the License, or (at your option) any later version. | 
|---|
| 54 | * | 
|---|
| 55 | *     This program is distributed in the hope that it will be | 
|---|
| 56 | *     useful, but WITHOUT ANY WARRANTY; without even the implied | 
|---|
| 57 | *     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | 
|---|
| 58 | *     PURPOSE. See the GNU General Public License for more details. | 
|---|
| 59 | * | 
|---|
| 60 | *     You should have received a copy of the GNU General Public License | 
|---|
| 61 | *     along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
|---|
| 62 |  | 
|---|
| 63 | *  Bugs: | 
|---|
| 64 | *     {note_any_bugs_here} | 
|---|
| 65 | *- | 
|---|
| 66 | */ | 
|---|
| 67 |  | 
|---|
| 68 | #if HAVE_CONFIG_H | 
|---|
| 69 | # include <config.h> | 
|---|
| 70 | #endif | 
|---|
| 71 |  | 
|---|
| 72 | #ifdef HAVE_BSD_STRING_H | 
|---|
| 73 | #include <bsd/string.h> | 
|---|
| 74 | #endif | 
|---|
| 75 |  | 
|---|
| 76 | #include <string.h> | 
|---|
| 77 |  | 
|---|
| 78 | /* This version is just a straight copy without putting ellipsis on the end. */ | 
|---|
| 79 | static void my__strlcpy( char * dest, const char * src, size_t size ) { | 
|---|
| 80 | # if HAVE_STRLCPY | 
|---|
| 81 | strlcpy( dest, src, size ); | 
|---|
| 82 | # else | 
|---|
| 83 | strncpy( dest, src, size ); | 
|---|
| 84 | dest[size-1] = '\0'; | 
|---|
| 85 | # endif | 
|---|
| 86 | } | 
|---|
| 87 |  | 
|---|
| 88 | int | 
|---|
| 89 | palVers( char *verstring, size_t verlen ) { | 
|---|
| 90 | if (verstring) my__strlcpy( verstring, PACKAGE_VERSION, verlen ); | 
|---|
| 91 | return PACKAGE_VERSION_INTEGER; | 
|---|
| 92 | } | 
|---|