home *** CD-ROM | disk | FTP | other *** search
- /*
- clean_hist: free up all memory used by the history structure. The
- main purpose of this is to use the range checking of malloc to check
- for pointer problems. If you don't have source, this is of dubious
- value.
-
- Kenneth Ingham
-
- Copyright (C) 1987 The University of New Mexico
- */
-
- #include "defs.h"
-
- clean_hist()
- {
- extern struct old_cmd_st *chead;
- struct old_cmd_st *bcp;
- struct val_st *vp, *bvp;
- struct key_st *kp, *bkp;
-
- while (chead != NULL) {
- printf("freeing '%s'\n",chead->pipeline);
- free(chead->pipeline);
- kp = chead->keys;
- while (kp != NULL) {
- printf("\tfreeing '%s'\n",kp->key_value);
- free(kp->key_value);
- vp = kp->vals;
- while (vp != NULL) {
- printf("\tfreeing '%s'\n",kp->vals->name);
- free(vp->name);
- bvp = vp;
- vp = vp->next;
- free(bvp);
- }
- bkp = kp;
- kp = kp->next;
- free(bkp);
- }
- bcp = chead;
- chead = chead->next;
- free(bcp);
- }
- printf("\nThe world is now free again! Aren't you glad?\n");
- }
-