diff options
author | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2004-02-01 19:37:40 +0000 |
---|---|---|
committer | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2004-02-01 19:37:40 +0000 |
commit | bd18f40ab4b208bbe3dfc1ac31c10236a6e46ee1 (patch) | |
tree | ee7946e5d5b4abcc9a3287f21818d934978aa1fc /layout.c | |
parent | 92b42b9fa4a085cf62728379c144ccd6583895d6 (diff) | |
download | lcd4linux-bd18f40ab4b208bbe3dfc1ac31c10236a6e46ee1.tar.gz |
[lcd4linux @ 2004-02-01 19:37:40 by reinelt]
got rid of every strtok() incarnation.
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@352 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-rw-r--r-- | layout.c | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -1,4 +1,4 @@ -/* $Id: layout.c,v 1.8 2004/02/01 18:08:50 reinelt Exp $ +/* $Id: layout.c,v 1.9 2004/02/01 19:37:40 reinelt Exp $ * * new layouter framework * @@ -23,6 +23,9 @@ * * * $Log: layout.c,v $ + * Revision 1.9 2004/02/01 19:37:40 reinelt + * got rid of every strtok() incarnation. + * * Revision 1.8 2004/02/01 18:08:50 reinelt * removed strtok() from layout processing (took me hours to find this bug) * further strtok() removind should be done! @@ -111,20 +114,22 @@ int layout_init (char *layout) // map to lower char for scanf() for (l=list; *l!='\0'; l++) *l=tolower(*l); - while (list!=NULL) { - char *pipe; + l=list; + while (l!=NULL) { + char *p; int i, n; // list is delimited by | - if ((pipe=strchr(list, '|'))!=NULL) *pipe='\0'; - i=sscanf (list, "row%d.col%d%n", &row, &col, &n); - if (i==2 && list[n]=='\0') { - widget=cfg_get(section, list, NULL); + while (*l=='|') l++; + if ((p=strchr(l, '|'))!=NULL) *p='\0'; + i=sscanf (l, "row%d.col%d%n", &row, &col, &n); + if (i==2 && l[n]=='\0') { + widget=cfg_get(section, l, NULL); if (widget!=NULL && *widget!='\0') { layout_addItem (widget, row, col); } } // next field - list=pipe?pipe+1:NULL; + l=p?p+1:NULL; } free (list); |