Compaq AA-RH99A-TE Remote Starter User Manual


 
Example 3–3: Template Extensions Using Arrays (cont.)
}
}
1 The help string is output by the check_args function if the user enters
the help extension_name command at the kdbx prompt. The first
line of the help string should be a one-line description of the extension.
The rest should be a complete description of the arguments. Also, each
line should end with the string \\\n\.
2 Every structure field to be extracted needs an entry. The first field is
the name of the next extracted field; the second field is the type. The
last two fields are for output and initialize to NULL.
3 Specifies the type of the element in the array.
4 Specifies the variable containing the beginning address of the array.
5 Specifies the variable containing the size of the array. Note that reading
variables is only one way to access this information. Other methods
include the following:
Defining the array size with a #define macro call. If you use this
method, you need to include the appropriate header file and use the
macro in the extension.
Querying dbx for the array size as follows:
dbx("print sizeof(array//sizeof(array[0]")
Hard coding the array size.
6 Specifies the string to be displayed as the table header.
7 Extracts, formats, and prints the field information.
Example 3–4: Extension That Uses Arrays: file.c
#include <stdio.h>
#include <sys/fcntl.h>
#include <kdbx.h>
#include <nlist.h>
#define SHOW_UTT
#include <sys/user.h>
#define KERNEL_FILE
#include <sys/file.h>
#include <sys/proc.h>
static char *help_string =
"file - print out the file table \\\n\
Usage : file [addresses...] \\\n\
If no arguments are present, all file entries with non-zero reference \\\n\
counts are printed. Otherwise, the file entries named by the addresses\\\n\
are printed. \\\n\
";
3–28 Writing Extensions to the kdbx Debugger