aboutsummaryrefslogtreecommitdiffstats
path: root/libfdisk/src/script.c
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2014-09-09 15:51:19 +0200
committerKarel Zak <kzak@redhat.com>2014-10-07 14:55:31 +0200
commit3186f4a92719ac97c6a1a12ef3a2a417a0cd9bf0 (patch)
tree13016391f6f3567a7bb52968efa6d4b42244aef9 /libfdisk/src/script.c
parentd5bee4bb59b4e78cdc85800b75f15d70def79c4a (diff)
downloadutil-linux-3186f4a92719ac97c6a1a12ef3a2a417a0cd9bf0.tar.gz
sfdisk: improve UI
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/script.c')
-rw-r--r--libfdisk/src/script.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c
index ebfaf61a53..cafe471fbd 100644
--- a/libfdisk/src/script.c
+++ b/libfdisk/src/script.c
@@ -292,6 +292,18 @@ static struct fdisk_label *script_get_label(struct fdisk_script *dp)
}
/**
+ * fdisk_script_get_nlines:
+ * @dp: script
+ *
+ * Returns: number of parsed lines or <0 on error.
+ */
+int fdisk_script_get_nlines(struct fdisk_script *dp)
+{
+ assert(dp);
+ return dp->nlines;
+}
+
+/**
* fdisk_script_read_context:
* @dp: script
* @cxt: context
@@ -637,7 +649,8 @@ static int parse_script_line(struct fdisk_script *dp, char *s)
} else if (!strncasecmp(p, "type=", 5) ||
!strncasecmp(p, "Id=", 3)) { /* backward compatiility */
char *type;
- p += 5;
+
+ p += (*p == 'I' ? 3 : 5); /* "Id=" or "type=" */
rc = next_string(&p, &type);
if (rc)