-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.c
More file actions
42 lines (37 loc) · 905 Bytes
/
debug.c
File metadata and controls
42 lines (37 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "shell.h"
/**
* dump_local_symtab - Dump the local symbol table
*
* Return: void
*/
void dump_local_symtab(void)
{
ST_strc *symtab = symtab_stack.local_symtab;
struct symtab_entry_s *entry;
int i = 0;
int indent = symtab->level * 4;
char *name1 = "PATH";
char *name2 = "LS_COLORS";
fprintf(stderr,
"%*sSymbol table [Level %d]:\r\n",
indent, " ",
symtab->level);
fprintf(stderr, "%*s================\r\n",
indent,
" ");
fprintf(stderr, "%*s No Symbol Val\r\n", indent, " ");
fprintf(stderr, "%*s------ ------------\r\n", indent, " ");
entry = symtab->first;
while (entry)
{
if (entry->name == name1 || entry->name == name2)
{
entry = entry->next;
continue;
}
fprintf(stderr, "%*s[%04d] %-32s '%s'\r\n", indent, " ",
i++, entry->name, entry->val);
entry = entry->next;
}
fprintf(stderr, "%*s------ ------------\r\n", indent, " ");
}