Ok, I'm diving in... but I'm already lost ;) I thought maybe the code in vlimits.c would be simple enough to use, but I don't understand how it could work... Maybe it doesn't yet ;)
Anyways, here's an excerpt: /* * vlimits.c * handle domain limits in both file format * Brian Kolaci <[EMAIL PROTECTED]> */ ... #define TOKENS " :\t\n\r" ... /* find/read the .qmailadmin-limits file */ int vget_limits(const char *domain, struct vlimits *limits) { ... /* open file */ if ((fs = fopen(dir, "r")) != NULL) { while (fgets(buf, sizeof(buf), fs) != NULL) { if ((s1 = strtok(buf, TOKENS)) == NULL) continue; if (!strcmp(s1, "maxpopaccounts")) { if ((s2 = strtok(NULL, TOKENS)) == NULL) continue; limits->maxpopaccounts = atoi(s2); } if (!strcmp(s1, "maxaliases")) { if ((s2 = strtok(NULL, TOKENS)) == NULL) continue; limits->maxaliases = atoi(s2); } Ok... so I assume the .qmailadmin-limits file looks like: maxpopaccounts 12 maxaliases 44 I'm trying to understand this.. while not EOF.. if not empty.. so first s1 should be "maxpopacccounts" because fgets ends at \n But I don't get the strtok(). How can s2 be anything if NULL is being split up by \t\n\r ?