summaryrefslogtreecommitdiff
path: root/lexer/misc.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-12-04 15:20:28 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2020-12-04 15:20:28 -0500
commit96393257a43ac52f2b911594d106741245dec5f0 (patch)
tree6b9d11c50ed3cd1920444c4dd0ee4027814ef4bd /lexer/misc.c
parent83ce1151ee1f06ae6b1c5c1018cc2489494e5ea4 (diff)
- 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.
Diffstat (limited to 'lexer/misc.c')
-rw-r--r--lexer/misc.c14
1 files changed, 14 insertions, 0 deletions
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;
+}