Mercurial > hg > toybox
comparison lib/getmountlist.c @ 1460:94f7ec50ef50 draft
Debugging pass on mount. Not quite done yet, but the basics seem to work now.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 07 Sep 2014 14:42:51 -0500 |
parents | 487716951287 |
children | 321e9d5032c1 |
comparison
equal
deleted
inserted
replaced
1459:240bd13db413 | 1460:94f7ec50ef50 |
---|---|
29 // advances *list to start of next entry | 29 // advances *list to start of next entry |
30 char *comma_iterate(char **list, int *len) | 30 char *comma_iterate(char **list, int *len) |
31 { | 31 { |
32 char *start = *list, *end; | 32 char *start = *list, *end; |
33 | 33 |
34 if (!*list) return 0; | 34 if (!*list || !**list) return 0; |
35 | 35 |
36 if (!(end = strchr(*list, ','))) { | 36 if (!(end = strchr(*list, ','))) { |
37 *len = strlen(*list); | 37 *len = strlen(*list); |
38 *list = 0; | 38 *list = 0; |
39 } else *list += (*len = end-start)+1; | 39 } else *list += (*len = end-start)+1; |
74 if (optlist) for (;;) { | 74 if (optlist) for (;;) { |
75 char *s = comma_iterate(&optlist, &len); | 75 char *s = comma_iterate(&optlist, &len); |
76 | 76 |
77 if (!s) break; | 77 if (!s) break; |
78 no = 2*(*s == 'n' && s[1] == 'o'); | 78 no = 2*(*s == 'n' && s[1] == 'o'); |
79 if (optlen == len+no && !strcmp(opt, s+no)) got = !no; | 79 if (optlen == len+no && !strcmp(opt, s+no)) { |
80 if (clean) memmove(s, optlist, strlen(optlist)+1); | 80 got = !no; |
81 if (clean) memmove(s, optlist, strlen(optlist)+1); | |
82 } | |
81 } | 83 } |
82 | 84 |
83 return got; | 85 return got; |
84 } | 86 } |
85 | 87 |