changeset 15311:b00b16a1ef05

Error out when invalid format is specified
author reimar
date Sun, 01 May 2005 09:02:25 +0000
parents b01679500a5e
children 0313ef8b0730
files libaf/af_format.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libaf/af_format.c	Sun May 01 08:33:35 2005 +0000
+++ b/libaf/af_format.c	Sun May 01 09:02:25 2005 +0000
@@ -139,6 +139,10 @@
   }
   case AF_CONTROL_COMMAND_LINE:{
     int format = af_str2fmt_short(arg);
+    if (format == -1) {
+      af_msg(AF_MSG_ERROR, "[format] %s is not a valid format\n", (char *)arg);
+      return AF_ERROR;
+    }
     if(AF_OK != af->control(af,AF_CONTROL_FORMAT_FMT | AF_CONTROL_SET,&format))
       return AF_ERROR;
     return AF_OK;