• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/router/busybox-1.x/e2fsprogs/old_e2fsprogs/ext2fs/
1/* vi: set sw=4 ts=4: */
2/*
3 * version.c --- Return the version of the ext2 library
4 *
5 * Copyright (C) 1997 Theodore Ts'o.
6 *
7 * %Begin-Header%
8 * This file may be redistributed under the terms of the GNU Public
9 * License.
10 * %End-Header%
11 */
12
13#if HAVE_UNISTD_H
14#include <unistd.h>
15#endif
16#include <string.h>
17#include <stdio.h>
18#include <ctype.h>
19
20#include "ext2_fs.h"
21#include "ext2fs.h"
22
23static const char *lib_version = E2FSPROGS_VERSION;
24static const char *lib_date = E2FSPROGS_DATE;
25
26int ext2fs_parse_version_string(const char *ver_string)
27{
28	const char *cp;
29	int version = 0;
30
31	for (cp = ver_string; *cp; cp++) {
32		if (*cp == '.')
33			continue;
34		if (!isdigit(*cp))
35			break;
36		version = (version * 10) + (*cp - '0');
37	}
38	return version;
39}
40
41
42int ext2fs_get_library_version(const char **ver_string,
43			       const char **date_string)
44{
45	if (ver_string)
46		*ver_string = lib_version;
47	if (date_string)
48		*date_string = lib_date;
49
50	return ext2fs_parse_version_string(lib_version);
51}
52