about summary refs log tree commit diff
path: root/blaze822.c
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-26 22:15:30 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-26 22:15:30 +0200
commit3d0c2f8b47b381a0303df699aa9db0593fc5e4eb (patch)
treef2d038ff0ac236e705959bc83b4f1cb5f5cff0db /blaze822.c
parent0a53f92e06f15b427bee868ee30e3c87fbf8db6d (diff)
downloadmblaze-3d0c2f8b47b381a0303df699aa9db0593fc5e4eb.tar.gz
mblaze-3d0c2f8b47b381a0303df699aa9db0593fc5e4eb.tar.xz
mblaze-3d0c2f8b47b381a0303df699aa9db0593fc5e4eb.zip
cleanups
Diffstat (limited to 'blaze822.c')
-rw-r--r--blaze822.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/blaze822.c b/blaze822.c
index ef28383..f8b5812 100644
--- a/blaze822.c
+++ b/blaze822.c
@@ -24,12 +24,10 @@ parse_posint(char **s, size_t minn, size_t maxn)
 
         errno = 0;
         n = strtol(*s, &end, 10);
-        if (errno) {
-//                perror("strtol");
+        if (errno)
 		return -1;
-        }
         if (n < (long)minn || n > (long)maxn) {
-//                fprintf(stderr, "number outside %zd <= n < %zd\n", minn, maxn);
+		errno = ERANGE;
 		return -1;
         }
         *s = end;
@@ -41,17 +39,6 @@ blaze822_date(char *s) {
 	struct tm tm;
 	int c;
 
-#if 0
-#define i4(m) (s[0] && (s[0]|0x20) == m[0] && \
-               s[1] && (s[1]|0x20) == m[1] && \
-               s[2] && (s[2]|0x20) == m[2] && \
-               s[3] && (s[3]|0x20) == m[3] && (s = s+4) )
-
-#define i3(m) (s[0] && (s[0]|0x20) == m[0] && \
-               s[1] && (s[1]|0x20) == m[1] && \
-               s[2] && (s[2]|0x20) == m[2] && (s = s+3) )
-#endif
-
 #define i4(m) (((uint32_t) m[0]<<24 | m[1]<<16 | m[2]<<8 | m[3]) == \
 	       ((uint32_t) s[0]<<24 | s[1]<<16 | s[2]<<8 | s[3] | 0x20202020) \
 	       && (s += 4))
@@ -87,6 +74,9 @@ blaze822_date(char *s) {
 	else if (i3("dec")) tm.tm_mon = 11;
 	else goto fail;
 
+#undef i3
+#undef i4
+
 	while (iswsp(*s))
 		s++;
 	
@@ -308,7 +298,6 @@ blaze822(char *file)
 
 	fd = open(file, O_RDONLY);
 	if (fd < 0) {
-//		perror("open");
 		free(mesg);
 		return 0;
 	}