summaryrefslogtreecommitdiff
path: root/dhcpctl
diff options
context:
space:
mode:
authorTed Lemon <source@isc.org>1999-09-09 21:05:57 +0000
committerTed Lemon <source@isc.org>1999-09-09 21:05:57 +0000
commit472c048aa165321a77d8a1a24199e49c8b05e2eb (patch)
tree0bea2fc4a8ce6c0477d5b4b4552f81bb0d9659b8 /dhcpctl
parent3d8153099ac01ce239c82c81d176297205240a98 (diff)
downloadisc-dhcp-472c048aa165321a77d8a1a24199e49c8b05e2eb.tar.gz
Demonstrate opening an existing object and getting a value from it.
Diffstat (limited to 'dhcpctl')
-rw-r--r--dhcpctl/test.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/dhcpctl/test.c b/dhcpctl/test.c
index 6bde4610..c2aa598c 100644
--- a/dhcpctl/test.c
+++ b/dhcpctl/test.c
@@ -32,6 +32,7 @@ int main (argc, argv)
dhcpctl_handle connection;
dhcpctl_handle host_handle;
dhcpctl_data_string cid;
+ dhcpctl_data_string result;
status = dhcpctl_initialize ();
if (status != ISC_R_SUCCESS) {
@@ -97,14 +98,41 @@ int main (argc, argv)
status = dhcpctl_wait_for_completion (host_handle, &waitstatus);
if (status != ISC_R_SUCCESS) {
fprintf (stderr, "dhcpctl_wait_for_completion: %s\n",
- isc_result_totext (status));
+ isc_result_totext (waitstatus));
exit (1);
}
if (waitstatus != ISC_R_SUCCESS) {
- fprintf (stderr, "dhcpctl_wait_for_completion: %s\n",
- isc_result_totext (waitstatus));
+ status = dhcpctl_open_object (host_handle, connection, 0);
+ if (status != ISC_R_SUCCESS) {
+ fprintf (stderr, "dhcpctl_open_object: %s\n",
+ isc_result_totext (status));
+ exit (1);
+ }
+ status = dhcpctl_wait_for_completion (host_handle,
+ &waitstatus);
+ if (status != ISC_R_SUCCESS) {
+ fprintf (stderr, "dhcpctl_wait_for_completion: %s\n",
+ isc_result_totext (status));
+ exit (1);
+ }
+ if (waitstatus != ISC_R_SUCCESS) {
+ fprintf (stderr, "dhcpctl_wait_for_completion: %s\n",
+ isc_result_totext (status));
+ exit (1);
+ }
+ }
+
+ memset (&result, 0, sizeof result);
+ status = dhcpctl_get_value (&result, host_handle, "name");
+ if (status != ISC_R_SUCCESS) {
+ fprintf (stderr, "dhcpctl_get_value: %s\n",
+ isc_result_totext (status));
exit (1);
}
+
+ printf ("host name = %*.*s\n", result -> len, result -> len,
+ result -> value);
+
exit (0);
}