From 96393257a43ac52f2b911594d106741245dec5f0 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 4 Dec 2020 15:20:28 -0500 Subject: - Started work on writing the new version of the assembler. - Did alot of stuff in the emulator. - Did alot of stuff in the SuB Suite. --- lexer/misc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lexer/misc.c (limited to 'lexer/misc.c') diff --git a/lexer/misc.c b/lexer/misc.c new file mode 100644 index 0000000..9014421 --- /dev/null +++ b/lexer/misc.c @@ -0,0 +1,14 @@ +/* Name: cnvstr() + * Desc: Converts a pointer, and length pair into a null-terminated string. + * Args: + * s: Pointer to convert. + * len: Length to convert. + * Return value: Returns a null-terminated string. + */ + +char *cnvstr(char *s, int len) { + char *p = malloc(len+1); + memcpy(p, s, len); + p[len] = '\0'; + return p; +} -- cgit v1.2.3-13-gbd6f