home *** CD-ROM | disk | FTP | other *** search
- /*
- find_prev_value: given an old command structure, look through the
- prior output for the output for name of type type. Return it in the
- union pointed to by value or NULL if not found.
-
- Kenneth Ingham
-
- Copyright (C) 1987 The University of New Mexico
- */
-
- #include "defs.h"
-
- find_prev_value(cmd, field_name, key_val, value)
- struct old_cmd_st *cmd;
- char *field_name, *key_val;
- union all_u **value;
- {
- struct val_st *vp;
- struct key_st *kp;
-
- *value = NULL;
-
- if (cmd == NULL)
- return;
- if (cmd->keys == NULL)
- return;
-
- /* find the correct keyword */
- for (kp=cmd->keys; kp != NULL; kp=kp->next) {
- if (strcmp(kp->key_value, key_val) == 0)
- break;
- }
-
- if (kp == NULL)
- return;
- if (kp->vals == NULL)
- return;
-
- /* find the value under the keyword */
- for (vp=kp->vals; vp != NULL; vp=vp->next) {
- if (strcmp(vp->name, field_name) == 0) {
- *value = &(vp->val);
- return;
- }
- }
- }
-