Changeset 32 for trunk/test
- Timestamp:
- 07/16/05 19:16:17 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/lib-regfio.c
r31 r32 74 74 } 75 75 76 /* Cut trailing slash */ 77 if(buf[buf_len-buf_left-2] == '/') 78 buf[buf_len-buf_left-2] = '\0'; 79 76 80 return buf; 77 81 } 78 82 79 83 80 void printKeyTree(REGF_FILE* f, void_stack* nk_stack) 84 void printKeyList(REGF_NK_REC* nk, char* prefix) 85 { 86 unsigned int i; 87 const char* str_type; 88 89 for(i=0; i < nk->num_values; i++) 90 { 91 str_type = type_val2str(nk->values[i].type); 92 printf("%s/%s:%s=\n", prefix, nk->values[i].valuename, str_type); 93 } 94 } 95 96 97 void printKeyTree(REGF_FILE* f, void_stack* nk_stack) 81 98 { 82 99 REGF_NK_REC* cur; … … 84 101 char* path; 85 102 86 while((cur = (REGF_NK_REC*)void_stack_cur(nk_stack)) != NULL)103 if((cur = (REGF_NK_REC*)void_stack_cur(nk_stack)) != NULL) 87 104 { 88 if((sub = regfio_fetch_subkey(f, cur)) != NULL) 105 printf("%s:KEY\n", cur->keyname); 106 while((cur = (REGF_NK_REC*)void_stack_cur(nk_stack)) != NULL) 89 107 { 90 path = getStackPath(nk_stack); 91 if(path != NULL) 108 if((sub = regfio_fetch_subkey(f, cur)) != NULL) 92 109 { 93 printf("%s%s:KEY\n", path, sub->keyname); 94 free(path); 110 void_stack_push(nk_stack, sub); 111 path = getStackPath(nk_stack); 112 if(path != NULL) 113 { 114 printKeyList(cur, path); 115 printf("%s:KEY\n", path); 116 free(path); 117 } 95 118 } 96 void_stack_push(nk_stack, sub); 97 } 98 else 99 { 100 cur = void_stack_pop(nk_stack); 101 /* XXX: This is just a shallow free. Need to write deep free 102 * routines to replace the Samba code for this. 103 */ 104 if(cur != NULL) 105 free(cur); 119 else 120 { 121 cur = void_stack_pop(nk_stack); 122 /* XXX: This is just a shallow free. Need to write deep free 123 * routines to replace the Samba code for this. 124 */ 125 if(cur != NULL) 126 free(cur); 127 } 106 128 } 107 129 }
Note: See TracChangeset
for help on using the changeset viewer.