`>=' and `<=' was silently ignored in previous version,
but causes an warning in file 5.04. Add support for these
two operators as a feature extension, however, users should
not rely on them.

8/17/2010 - created by Qing He <qing.he@intel.com>

diff --git a/src/apprentice.c b/src/apprentice.c
index 3d4c3cf..a2b86ed 100644
--- a/src/apprentice.c
+++ b/src/apprentice.c
@@ -1396,11 +1396,10 @@ parse(struct magic_set *ms, struct magic_entry **mentryp, uint32_t *nmentryp,
   		m->reln = *l;
   		++l;
 		if (*l == '=') {
-			if (ms->flags & MAGIC_CHECK) {
-				file_magwarn(ms, "%c= not supported",
-				    m->reln);
-				return -1;
-			}
+		    if (m->reln == '>')
+			m->reln = 'g';
+		    else if (m->reln == '<')
+			m->reln = 'l';
 		   ++l;
 		}
 		break;
diff --git a/src/softmagic.c b/src/softmagic.c
index d8a5675..1648e43 100644
--- a/src/softmagic.c
+++ b/src/softmagic.c
@@ -1955,6 +1955,38 @@ magiccheck(struct magic_set *ms, struct magic *m)
 		}
 		break;
 
+	case 'g':
+		if (m->flag & UNSIGNED) {
+			matched = v >= l;
+			if ((ms->flags & MAGIC_DEBUG) != 0)
+				(void) fprintf(stderr, "%llu >= %llu = %d\n",
+				    (unsigned long long)v,
+				    (unsigned long long)l, matched);
+		}
+		else {
+			matched = (int64_t) v >= (int64_t) l;
+			if ((ms->flags & MAGIC_DEBUG) != 0)
+				(void) fprintf(stderr, "%lld >= %lld = %d\n",
+				    (long long)v, (long long)l, matched);
+		}
+		break;
+
+	case 'l':
+		if (m->flag & UNSIGNED) {
+			matched = v <= l;
+			if ((ms->flags & MAGIC_DEBUG) != 0)
+				(void) fprintf(stderr, "%llu <= %llu = %d\n",
+				    (unsigned long long)v,
+				    (unsigned long long)l, matched);
+		}
+		else {
+			matched = (int64_t) v <= (int64_t) l;
+			if ((ms->flags & MAGIC_DEBUG) != 0)
+				(void) fprintf(stderr, "%lld <= %lld = %d\n",
+				       (long long)v, (long long)l, matched);
+		}
+		break;
+
 	case '&':
 		matched = (v & l) == l;
 		if ((ms->flags & MAGIC_DEBUG) != 0)
