15 printUser(Storage users,
const char * key,
size_t nkey)
17 User user =
new(User, NULL);
19 user->email = (
char *)key,
22 if (NULL == userLoad(user, users)) {
23 fprintf(stderr,
"can't find user: %s\n", key);
27 puts(user->firstname);
37 const char * email,
size_t nemail,
38 const char * firstname,
size_t nfirstname,
39 const char * surname,
size_t nsurname)
41 User insert =
new(User,
43 firstname, nfirstname,
46 userSave(insert, users);
51 main(
int argc,
char * argv[])
53 Storage users =
new(Storage,
CSTRA(
"./users.db"));
56 fprintf(stderr,
"%s\n", gdbm_strerror(gdbm_errno));
57 fprintf(stderr,
"%s\n", strerror(errno));
68 CSTRA(
"georg@steffers.org"),
73 CSTRA(
"drachenfrau1982@gmx.net"),
85 users =
new(Storage,
CSTRA(
"./users.db"));
89 CSTRA(
"drachenfrau1982@gmx.net"),
int main(int argc, char *argv[])
#define CSTRA(val)
Const STRing Argument.
void insertUser(Storage users, const char *email, size_t nemail, const char *firstname, size_t nfirstname, const char *surname, size_t nsurname)
void printUser(Storage users, const char *key, size_t nkey)