commit bd958637f3f30c59c36a2462cad857fb1e8baebb
parent c1cb9f7e79d6caf90a71fe2e186b8697f273dc5a
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Wed, 6 Jan 2021 15:26:08 -0800
Reduce limits
Reduce limits to be more realistic. Also, remove unused MY_FILTER_MAX.
In recvtxt() simply use `MY_LINE_MAX` rather than erronously using
`MAX(MY_LINE_MAX, MY_CHUNK_MAX)`.
Diffstat:
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/gawk.h b/gawk.h
@@ -5,22 +5,23 @@
#define MAX(A,B) (A > B ? A : B)
/* arbitrary limits */
-#define MY_ARGV_MAX 12
+#define MY_ARGV_MAX 8
#define MY_CHUNK_MAX 512 /* for slurping data, not recursive */
-#define MY_FILTER_MAX 4
-#define MY_INPUT_MAX 128
-#define MY_LINE_MAX 256
+#define MY_INPUT_MAX 64
+#define MY_LINE_MAX 256 /* only used for gopher items currently */
#define MY_PATH_MAX 128
-#define MY_PIPE_MAX 12
+#define MY_PIPE_MAX 4
#define MY_PROMPT_MAX 64
-#define MY_URL_MAX 72
+#define MY_URL_MAX 64
-/* NOTE: don't change address order (see itemtoaddr, sgoto and all commands) */
+/* array ordering */
+/* NOTE: before changing address order see itemtoaddr and sgoto */
enum address { AR_PATH, AR_HOST, AR_PORT, AR_NULL };
enum gphitem { GI_INFO, GI_PATH, GI_HOST, GI_PORT, GI_PLUS, GI_NULL };
-enum cstatus { ERROR = -1, OK, UNWIND }; /* command status */
-enum pstatus { NEXT = -2, FAIL, PASS }; /* pipe status */
+/* command and pipeline status */
+enum cstatus { ERROR = -1, OK, UNWIND };
+enum pstatus { NEXT = -2, FAIL, PASS };
typedef int (command)(int, char **, int, char **);
diff --git a/main.c b/main.c
@@ -162,8 +162,7 @@ recvtxt(int s, FILE *output)
{
FILE *input;
char *bufp;
- /* NOTE: this buffer should be bigger than your average line */
- char buf[MAX(MY_LINE_MAX, MY_CHUNK_MAX)];
+ char buf[MY_LINE_MAX];
input = fdopen(s, "r");
if (input == NULL) {