aboutsummaryrefslogtreecommitdiff
path: root/src/source.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/source.c')
-rw-r--r--src/source.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/source.c b/src/source.c
index 813e9f5..bf6655c 100644
--- a/src/source.c
+++ b/src/source.c
@@ -12,7 +12,7 @@ char* source_get_from_fpath(char* path) {
char* src;
f = fopen(path, "rb");
- if (!f) { die("source file not found: %s", path); }
+ if (!f) { DIEF("source file not found: %s", path); }
fseek(f, 0L, SEEK_END);
f_size = ftell(f);
@@ -23,7 +23,7 @@ char* source_get_from_fpath(char* path) {
if ((fread(src, f_size, 1, f) != 1) || !src) {
fclose(f);
free(src);
- die("could not read source file: %s", path);
+ DIEF("could not read source file: %s", path);
}
return src;
@@ -34,16 +34,21 @@ char* source_get_from_stdin() {
char* src;
size_t l;
+#if 0
l = 0;
src = ecalloc(16, sizeof(char));
while ((s = fgets(src + l, 20, stdin))) {
- l = MIN(16, l + strlen(src + l));
+ l = MIN(15, l + strlen(src + l));
}
/* This works, I guess. */
s && src[l - 1] == '\n' && (src[l - 1] = '\0');
+#endif
- return src;
+ src = ecalloc(256, sizeof(char));
+ fgets(src, 256, stdin);
+
+ return src;
}