From 149855f3744354726d12be1a15f4eb6e009e6314 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 14 Aug 2005 14:39:47 +0000 Subject: [PATCH] Allow typed configuration items. (This is the only way to get constructs like `96d' parsed properly.) --- lib/shell/config.c | 104 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 92 insertions(+), 12 deletions(-) diff --git a/lib/shell/config.c b/lib/shell/config.c index 6257fd51..95ddce11 100644 --- a/lib/shell/config.c +++ b/lib/shell/config.c @@ -1,7 +1,7 @@ /* * UCW Library -- Shell Interface to Configuration Files * - * (c) 2002 Martin Mares + * (c) 2002--2005 Martin Mares * * Once we were using this beautiful Shell version, but it turned out * that it doesn't work with nested config files: @@ -26,19 +26,74 @@ static struct cfitem *items; static byte *flags; +enum flag { + F_STRING = 0, + F_INT = 1, + F_DOUBLE = 2, + F_INT64 = 3, + F_TYPE_MASK = 7, + F_ARRAY = 0x80, +}; + static void help(void) { - die("Usage: config [-C] [-S
.