version.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* version.c --- Version handling.
  2. * Copyright (C) 2002, 2003, 2004, 2006, 2007 Simon Josefsson
  3. *
  4. * This file is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * This file is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this file; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  17. *
  18. */
  19. #ifdef HAVE_CONFIG_H
  20. # include "idn_config.h"
  21. #endif
  22. #include "stringprep.h"
  23. #include <strverscmp.h>
  24. /**
  25. * stringprep_check_version - check for library version
  26. * @req_version: Required version number, or NULL.
  27. *
  28. * Check that the the version of the library is at minimum the requested one
  29. * and return the version string; return NULL if the condition is not
  30. * satisfied. If a NULL is passed to this function, no check is done,
  31. * but the version string is simply returned.
  32. *
  33. * See %STRINGPREP_VERSION for a suitable @req_version string.
  34. *
  35. * Return value: Version string of run-time library, or NULL if the
  36. * run-time library does not meet the required version number.
  37. */
  38. const char *
  39. stringprep_check_version (const char *req_version)
  40. {
  41. if (!req_version || strverscmp (req_version, PACKAGE_VERSION) <= 0)
  42. return PACKAGE_VERSION;
  43. return NULL;
  44. }