~ubuntu-branches/debian/jessie/arcboot/jessie

« back to all changes in this revision

Viewing changes to e2fslib/version.c

  • Committer: Bazaar Package Importer
  • Author(s): Guido Guenther
  • Date: 2004-03-02 12:01:14 UTC
  • Revision ID: james.westby@ubuntu.com-20040302120114-0pukal9hlpt3k0l7
Tags: 0.3.8.1
correct subarch detection for IP32

Show diffs side-by-side

added added

removed removed

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