-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
-misc-no-recursion,
-concurrency-mt-unsafe,
- -clang-analyzer-unix.Malloc,
+ -hicpp-signed-bitwise,
+ -misc-include-cleaner,
-modernize-macro-to-enum,
- -hicpp-signed-bitwise
+ -hicpp-uppercase-literal-suffix,readability-uppercase-literal-suffix,
+ -readability-uppercase-literal-suffix,
+ -hicpp-function-size,
+ -readability-function-size,
+ -cert-env33-c
"
WarningsAsErrors: ''
HeaderFilterRegex: ''
FormatStyle: None
+
+
+
--- /dev/null
+Diagnostics:
+ UnusedIncludes: None
compile_commands.json
.cache/
.clang_complete
-.clangd
+# .clangd
.session
* register with -w syntax
*/
-#define ULAS_NAME "ulas"
-#define ULAS_VER "0.0.1"
-
-// args without value
-#define ULAS_OPTS "hvVpdA"
-
-// args with value
-#define ULAS_OPTS_ARG "o:l:s:i:w:a:S:"
-
-#define ULAS_HELP(a, desc) printf("\t-%s\t%s\n", (a), desc);
-
-#define ULAS_INCPATHSMAX 256
-
-char *incpaths[ULAS_INCPATHSMAX];
-unsigned long incpathslen = 0;
-
-void ulas_help(void) {
- printf("%s\n", ULAS_NAME);
- printf("Usage %s [-%s] [-o=path] [-i=path] [-l=path] [-a=initial-address] [-S=ulas|mlb] "
- "[input]\n\n",
- ULAS_NAME, ULAS_OPTS);
- ULAS_HELP("h", "display this help and exit");
- ULAS_HELP("V", "display version info and exit");
- ULAS_HELP("v", "verbose output");
- ULAS_HELP("p", "Stop after preprocessor");
- ULAS_HELP("o=path", "Output file");
- ULAS_HELP("l=path", "Listing file");
- ULAS_HELP("s=path", "Symbols file");
- ULAS_HELP("i=path", "Add include search path");
- ULAS_HELP("a=initial-address", "Initial starting address");
- ULAS_HELP("A", "Print addresses in disassembler mode");
- ULAS_HELP("d", "Disassemble a file");
- ULAS_HELP("S", "Set the symbol format");
- ULAS_HELP("w=warning", "Toggle warnings: a=all, o=overflow");
-}
-
-void ulas_version(void) { printf("%s version %s\n", ULAS_NAME, ULAS_VER); }
void ulas_getopt(int argc, char **argv, struct ulas_config *cfg) {
int warnings[255];
#include "ulas.h"
#include <stdio.h>
#include <assert.h>
+#include <unistd.h>
+
+#define ULAS_TEST_OPTS "hV"
+#define ULAS_TEST_OPTS_ARG ""
#define ULAS_TOKMAX 64
#define TESTBEGIN(name) printf("[test %s]\n", (name));
TESTEND("testfulldasm");
}
-int main(int arc, char **argv) {
+void test_help(void) {
+ printf("%s tests\n", ULAS_NAME);
+ printf("Usage %s [%s]\n\n", ULAS_NAME, ULAS_TEST_OPTS);
+ ULAS_HELP("h", "display this help and exit");
+ ULAS_HELP("V", "display version info and exit");
+}
+
+void test_getopt(int argc, char **argv, struct ulas_config *cfg) {
+ int c = 0;
+ while ((c = getopt(argc, argv, ULAS_TEST_OPTS ULAS_TEST_OPTS_ARG)) != -1) {
+ switch (c) {
+ case 'h':
+ test_help();
+ exit(0);
+ break;
+ case 'V':
+ ulas_version();
+ exit(0);
+ break;
+ case '?':
+ break;
+ default:
+ printf("%s: invalid option '%c'\nTry '%s -h' for more information.\n",
+ ULAS_NAME, c, ULAS_NAME);
+ exit(-1);
+ break;
+ }
+ }
+}
+
+int main(int argc, char **argv) {
TESTBEGIN("ulas test");
+ test_getopt(argc, argv, &ulascfg);
ulas_init(ulas_cfg_from_env());
/*if (!ulascfg.verbose) {
struct ulas_config ulascfg;
struct ulas ulas;
+char *incpaths[ULAS_INCPATHSMAX];
+unsigned long incpathslen = 0;
+
+void ulas_help(void) {
+ printf("%s\n", ULAS_NAME);
+ printf("Usage %s [-%s] [-o=path] [-i=path] [-l=path] [-a=initial-address] [-S=ulas|mlb] "
+ "[input]\n\n",
+ ULAS_NAME, ULAS_OPTS);
+ ULAS_HELP("h", "display this help and exit");
+ ULAS_HELP("V", "display version info and exit");
+ ULAS_HELP("v", "verbose output");
+ ULAS_HELP("p", "Stop after preprocessor");
+ ULAS_HELP("o=path", "Output file");
+ ULAS_HELP("l=path", "Listing file");
+ ULAS_HELP("s=path", "Symbols file");
+ ULAS_HELP("i=path", "Add include search path");
+ ULAS_HELP("a=initial-address", "Initial starting address");
+ ULAS_HELP("A", "Print addresses in disassembler mode");
+ ULAS_HELP("d", "Disassemble a file");
+ ULAS_HELP("S", "Set the symbol format");
+ ULAS_HELP("w=warning", "Toggle warnings: a=all, o=overflow");
+}
+
+void ulas_version(void) { printf("%s version %s\n", ULAS_NAME, ULAS_VER); }
+
+
void ulas_init(struct ulas_config cfg) {
// init global cfg
if (ulasin == NULL) {
#include <string.h>
#include "archs.h"
+#define ULAS_NAME "ulas"
+#define ULAS_VER "0.0.1"
+
+// args without value
+#define ULAS_OPTS "hvVpdA"
+
+// args with value
+#define ULAS_OPTS_ARG "o:l:s:i:w:a:S:"
+
+#define ULAS_HELP(a, desc) printf("\t-%s\t%s\n", (a), desc);
+
+#define ULAS_INCPATHSMAX 256
+
+extern char *incpaths[ULAS_INCPATHSMAX];
+extern unsigned long incpathslen;
+
// if this is used as a path use stdin or stdout instead
#define ULAS_STDFILEPATH "-"
#define ULAS_PATHSEP "/"
int ulas_intexpr(const char **line, unsigned long n, int *rc);
char *ulas_strexpr(const char **line, unsigned long n, int *rc);
+void ulas_help(void);
+void ulas_version(void);
+
#endif