12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- /* Copyright Yann Weber <asmsh@yannweb.net>
- This file is part of asmsh.
-
- asmsh is free software: you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation, either version 3 of the License, or any later version.
-
- asmsh is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- details.
-
- You should have received a copy of the GNU General Public License along
- with asmsh. If not, see <https://www.gnu.org/licenses/>.
- */
- #ifndef ASMSH_SHELL_ENV_H
- #define ASMSH_SHELL_ENV_H
- #include "config.h"
-
- #include <unistd.h>
- #include <stdlib.h>
- #include <string.h>
-
- #define ASMSH_VARNAME_MAX 31
- #define ASMSH_SYMALLOC 64
-
- typedef struct asmsh_sym_s asmsh_sym_t;
- typedef struct asmsh_symtable_s asmsh_symtable_t;
-
- struct asmsh_sym_s
- {
- char name[ASMSH_VARNAME_MAX + 1];
- void *val;
- };
-
- struct asmsh_symtable_s
- {
- short freeval;
- asmsh_sym_t *syms;
- size_t syms_sz;
- size_t alloc;
- };
-
- /** if freeval value given to add are freed on clean */
- int asmsh_symtable_init(asmsh_symtable_t *table, short freeval);
- void asmsh_symtable_clean(asmsh_symtable_t *table);
-
- int asmsh_symtable_add(asmsh_symtable_t *table, const char *name, void *val);
- int asmsh_symtable_del(asmsh_symtable_t *table, const char *name);
- const asmsh_sym_t *asmsh_symtable_get(asmsh_symtable_t *table, const char *name);
-
-
- #include "shell.h"
-
- #endif
|