* Copyright (C) 1997 Theodore Ts'o.
*
* %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
* %End-Header%
*/
-#include <et/com_err.h>
+#include "config.h"
+#if HAVE_UNISTD_H
#include <unistd.h>
-#include <stdlib.h>
+#endif
#include <string.h>
#include <stdio.h>
#include <ctype.h>
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#include <linux/ext2_fs.h>
+#include "ext2_fs.h"
#include "ext2fs.h"
#include "../../version.h"
int ext2fs_parse_version_string(const char *ver_string)
{
const char *cp;
- int version = 0;
+ int version = 0, dot_count = 0;
for (cp = ver_string; *cp; cp++) {
+ if (*cp == '.') {
+ if (dot_count++)
+ break;
+ else
+ continue;
+ }
if (!isdigit(*cp))
- continue;
+ break;
version = (version * 10) + (*cp - '0');
}
return version;