--- gnokii.c 2004-07-16 17:17:07.000000000 +0200 +++ mygnokii.c 2004-07-16 17:14:10.000000000 +0200 @@ -3180,6 +3180,7 @@ return dest; } + /* Get requested range of memory storage entries and output to stdout in easy-to-parse format */ static int getphonebook(int argc, char *argv[]) @@ -3196,6 +3197,7 @@ 3 - LDIF */ bool all = false; + gn_memory_status memstat; if (argc < 2) { usage(stderr, -1); @@ -3229,10 +3231,23 @@ usage(stderr, -1); break; } + + memstat.memory_type = entry.memory_type; + data.memory_status = &memstat; + error = gn_sm_functions(GN_OP_GetMemoryStatus, &data, &state); + + if (error != GN_ERR_NONE) { + fprintf(stderr, _("Error: %s\n"), gn_error_print(error)); + return error; + } + + if (all) { + end_entry = memstat.used; + } /* Now retrieve the requested entries. */ count = start_entry; - while (all || count <= end_entry) { + while (count <= end_entry) { entry.location = count; data.phonebook_entry = &entry;