#include "dk.h"
#include "dkmem.h"
#include "dktypes.h"
#include "dksto.h"
#include "dkstr.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
Data Structures | |
struct | Person |
Description of a person. More... | |
Functions | |
static void | read_file (FILE *in) |
Read input file. | |
unsigned long | age_fct (void *p, int cr) |
Retrieve age from pointer. | |
int | compare_fct (void *p1, void *p2, int cr) |
Compare object against other object or text. | |
static void | print_prompt (void) |
Print a prompt. | |
static void | print_person (Person *pers, FILE *fout) |
Print one persons record. | |
static void | print_it (dk_storage_iterator_t *i, FILE *fout) |
Print persons record from an iterators current position until the end of the container. | |
void | print_node (dk_storage_node_t *n, int num, FILE *f, char c) |
Print storage tree node including subtree. | |
void | print_tree (dk_storage_t *s, FILE *f) |
Print the tree structure. | |
static void | free_person (Person *pers) |
Free a persons record (release memory. | |
static void | handle_cmd_1 (char *str) |
Handle command without arguments. | |
static void | handle_cmd_2 (char *cmd, char *arg1) |
Handle command with one argument. | |
static void | handle_cmd_3 (char *cmd, char *arg1, char *arg2) |
Handle command with 2 arguments. | |
static void | handle_cmd_4 (char *cmd, char *arg1, char *arg2, char *arg3) |
Handle command with 3 arguments. | |
int | main (int argc, char *argv[]) |
Main program. | |
Variables | |
static dk_storage_t * | s1 |
Storage, persons sorted by family name. | |
static dk_storage_t * | s2 |
Storage, persons sorted by surname. | |
static dk_storage_t * | s3 |
Storage, persons sorted by age. | |
static dk_storage_t * | s4 |
Storage, persons unsorted. | |
static int | can_continue |
Flag, input processing can be continued. | |
static int | stdin_is_tty = 1 |
Flag, stdin is connected to terminal. | |
static char | sccs_id [] |
SCCS string. | |
static dk_storage_iterator_t * | i1 |
Storage iterators. | |
static dk_storage_iterator_t * | i2 |
static dk_storage_iterator_t * | i3 |
static dk_storage_iterator_t * | i4 |
unsigned long age_fct | ( | void * | p, | |
int | cr | |||
) |
Retrieve age from pointer.
The function retrieves an age evaluation of a pointer. The pointer target is either a struct Person or an unsigned long.
p | Pointer to person or unsigned long. | |
cr | Pointer object type:
|
int compare_fct | ( | void * | p1, | |
void * | p2, | |||
int | cr | |||
) |
Compare object against other object or text.
p1 | Left pointer (from storage). | |
p2 | Right pointer (from dksto_it_find_like()). | |
cr | Comparison criteria:
|
static void free_person | ( | Person * | pers | ) | [static] |
Free a persons record (release memory.
)
pers | Pointer to record to release. |
static void handle_cmd_1 | ( | char * | str | ) | [static] |
Handle command without arguments.
str | Command (first text in input line). |
static void handle_cmd_2 | ( | char * | cmd, | |
char * | arg1 | |||
) | [static] |
Handle command with one argument.
cmd | Command to handle. | |
arg1 | Command argument. |
static void handle_cmd_3 | ( | char * | cmd, | |
char * | arg1, | |||
char * | arg2 | |||
) | [static] |
Handle command with 2 arguments.
cmd | Command to handle. | |
arg1 | Command argument 1. | |
arg2 | Command argument 2. |
static void handle_cmd_4 | ( | char * | cmd, | |
char * | arg1, | |||
char * | arg2, | |||
char * | arg3 | |||
) | [static] |
Handle command with 3 arguments.
cmd | Command to handle. | |
arg1 | Command argument 1. | |
arg2 | Command argument 2. | |
arg3 | Command argument 3. |
void print_node | ( | dk_storage_node_t * | n, | |
int | num, | |||
FILE * | f, | |||
char | c | |||
) |
Print storage tree node including subtree.
This function is used to show the tree structure. In your applications you should not access the internal members of a dk_storage_t or dk_storage_node_t directly.
void print_tree | ( | dk_storage_t * | s, | |
FILE * | f | |||
) |
Print the tree structure.
In your applications you should not access the internal members of a dk_storage_t or dk_storage_node_t directly.
void read_file | ( | FILE * | in | ) | [static] |
int can_continue [static] |
dk_storage_iterator_t* i1 [static] |
dk_storage_t* s1 [static] |
dk_storage_t* s2 [static] |
dk_storage_t* s3 [static] |
dk_storage_t* s4 [static] |
char sccs_id[] [static] |
Initial value:
{
"@(#)stotest.ctr 1.19 02/03/09\t(krause) - dksto demo program"
}
int stdin_is_tty = 1 [static] |