Commit 306bc8aa11a10bd8352b48a98df1931634195668

Authored by Perry Werneck
1 parent 4e52a160

Giving up on strange segfault getting the build timestamp on libv3270

and replacing the version info by a dynamic allocated string.
src/core/util.c
... ... @@ -365,9 +365,9 @@ LIB3270_EXPORT const char * lib3270_get_revision(void)
365 365 return RPQ_REVISION;
366 366 }
367 367  
368   -LIB3270_EXPORT const char * lib3270_get_build_rpq_timestamp(void)
  368 +LIB3270_EXPORT char * lib3270_get_version_info(void)
369 369 {
370   - return RPQ_TIMESTAMP_VALUE;
  370 + return lib3270_strdup_printf("%s version %s-%d build %s",PACKAGE_NAME,PACKAGE_VERSION,PACKAGE_RELEASE,RPQ_REVISION);
371 371 }
372 372  
373 373 void lib3270_popup_an_errno(H3270 *hSession, int errn, const char *fmt, ...)
... ...
src/include/lib3270/properties.h
... ... @@ -221,11 +221,11 @@
221 221 LIB3270_EXPORT void lib3270_disable_crl_download(H3270 *hSession);
222 222  
223 223 /**
224   - * @brief Get lib3270 build timestamp.
  224 + * @brief Get lib3270 version info.
225 225 *
226   - * @return String with lib3270 build timestamp.
  226 + * @return String with lib3270 version info (release it with lib3270_free).
227 227 */
228   - LIB3270_EXPORT const char * lib3270_get_build_rpq_timestamp(void);
  228 + LIB3270_EXPORT char * lib3270_get_version_info(void);
229 229  
230 230  
231 231 #ifdef __cplusplus
... ...
src/testprogram/testprogram.c
... ... @@ -40,7 +40,7 @@ int main(int argc, char *argv[])
40 40 setlocale( LC_ALL, "" );
41 41 #endif
42 42  
43   - textdomain("pw3270");
  43 + textdomain("lib3270");
44 44  
45 45 // #pragma GCC diagnostic push
46 46 // #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
... ... @@ -57,7 +57,8 @@ int main(int argc, char *argv[])
57 57 H3270 * h = lib3270_session_new("");
58 58 int rc = 0;
59 59  
60   - printf("3270 session %p created\n]",h);
  60 + lib3270_autoptr(char) version_info = lib3270_get_version_info();
  61 + printf("3270 session %p created\n%s\n]",h,version_info);
61 62  
62 63 #ifdef HAVE_LDAP
63 64 lib3270_crl_set_preferred_protocol(h,"ldap");
... ...