From b1f5fffddaf31835515f88859f8a4670b6252deb Mon Sep 17 00:00:00 2001 From: reinelt <> Date: Tue, 9 Sep 2003 06:54:43 +0000 Subject: [lcd4linux @ 2003-09-09 06:54:43 by reinelt] new function 'cfg_number()' --- M50530.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'M50530.c') diff --git a/M50530.c b/M50530.c index 1544a25..0fa506d 100644 --- a/M50530.c +++ b/M50530.c @@ -1,4 +1,4 @@ -/* $Id: M50530.c,v 1.12 2003/08/24 05:17:58 reinelt Exp $ +/* $Id: M50530.c,v 1.13 2003/09/09 06:54:43 reinelt Exp $ * * driver for display modules based on the M50530 chip * @@ -20,6 +20,9 @@ * * * $Log: M50530.c,v $ + * Revision 1.13 2003/09/09 06:54:43 reinelt + * new function 'cfg_number()' + * * Revision 1.12 2003/08/24 05:17:58 reinelt * liblcd4linux patch from Patrick Schemitz * @@ -179,7 +182,7 @@ int M5_clear (int full) int M5_init (LCD *Self) { int rows=-1, cols=-1, gpos=-1; - char *s, *e; + char *s; s=cfg_get("Size",NULL); if (s==NULL || *s=='\0') { @@ -191,16 +194,7 @@ int M5_init (LCD *Self) return -1; } - s=cfg_get ("GPOs",NULL); - if (s==NULL) { - gpos=0; - } else { - gpos=strtol(s, &e, 0); - if (*e!='\0' || gpos<0 || gpos>8) { - error ("M50530: bad GPOs '%s' in %s", s, cfg_source()); - return -1; - } - } + if (cfg_number("GPOs", 0, 0, 8, &gpos)<0) return -1; Self->rows=rows; Self->cols=cols; -- cgit v1.2.3