aboutsummaryrefslogtreecommitdiff
path: root/contrib/file/ascmagic.c
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2002-09-16 05:54:26 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2002-09-16 05:54:26 +0000
commit8ed12636aad7edd7749d0919bea8dfde66053505 (patch)
tree8091d43397b387d416d65b5edd878732d6879347 /contrib/file/ascmagic.c
parent649d615c25f64d6f740ad79df7d6d25d98c9a88b (diff)
downloadsrc-8ed12636aad7edd7749d0919bea8dfde66053505.tar.gz
src-8ed12636aad7edd7749d0919bea8dfde66053505.zip
Virgin import of Christos Zoulas's FILE 3.39.
Notes
Notes: svn path=/vendor/file/dist/; revision=103373
Diffstat (limited to 'contrib/file/ascmagic.c')
-rw-r--r--contrib/file/ascmagic.c62
1 files changed, 17 insertions, 45 deletions
diff --git a/contrib/file/ascmagic.c b/contrib/file/ascmagic.c
index c2a2f95fa1ed..cbbcbe831abb 100644
--- a/contrib/file/ascmagic.c
+++ b/contrib/file/ascmagic.c
@@ -35,7 +35,6 @@
*/
#include "file.h"
-#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <ctype.h>
@@ -46,7 +45,7 @@
#include "names.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: ascmagic.c,v 1.30 2001/07/26 13:15:49 christos Exp $")
+FILE_RCSID("@(#)$Id: ascmagic.c,v 1.32 2002/07/03 18:26:37 christos Exp $")
#endif /* lint */
typedef unsigned long unichar;
@@ -55,18 +54,17 @@ typedef unsigned long unichar;
#define ISSPC(x) ((x) == ' ' || (x) == '\t' || (x) == '\r' || (x) == '\n' \
|| (x) == 0x85 || (x) == '\f')
-static int looks_ascii __P((const unsigned char *, int, unichar *, int *));
-static int looks_utf8 __P((const unsigned char *, int, unichar *, int *));
-static int looks_unicode __P((const unsigned char *, int, unichar *, int *));
-static int looks_latin1 __P((const unsigned char *, int, unichar *, int *));
-static int looks_extended __P((const unsigned char *, int, unichar *, int *));
-static void from_ebcdic __P((const unsigned char *, int, unsigned char *));
-static int ascmatch __P((const unsigned char *, const unichar *, int));
+static int looks_ascii(const unsigned char *, int, unichar *, int *);
+static int looks_utf8(const unsigned char *, int, unichar *, int *);
+static int looks_unicode(const unsigned char *, int, unichar *, int *);
+static int looks_latin1(const unsigned char *, int, unichar *, int *);
+static int looks_extended(const unsigned char *, int, unichar *, int *);
+static void from_ebcdic(const unsigned char *, int, unsigned char *);
+static int ascmatch(const unsigned char *, const unichar *, int);
+/* int nbytes: size actually read */
int
-ascmagic(buf, nbytes)
- unsigned char *buf;
- int nbytes; /* size actually read */
+ascmagic(unsigned char *buf, int nbytes)
{
int i;
char nbuf[HOWMANY+1]; /* one extra for terminating '\0' */
@@ -322,10 +320,7 @@ subtype_identified:
}
static int
-ascmatch(s, us, ulen)
- const unsigned char *s;
- const unichar *us;
- int ulen;
+ascmatch(const unsigned char *s, const unichar *us, int ulen)
{
size_t i;
@@ -420,11 +415,7 @@ static char text_chars[256] = {
};
static int
-looks_ascii(buf, nbytes, ubuf, ulen)
- const unsigned char *buf;
- int nbytes;
- unichar *ubuf;
- int *ulen;
+looks_ascii(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
{
int i;
@@ -443,11 +434,7 @@ looks_ascii(buf, nbytes, ubuf, ulen)
}
static int
-looks_latin1(buf, nbytes, ubuf, ulen)
- const unsigned char *buf;
- int nbytes;
- unichar *ubuf;
- int *ulen;
+looks_latin1(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
{
int i;
@@ -466,11 +453,7 @@ looks_latin1(buf, nbytes, ubuf, ulen)
}
static int
-looks_extended(buf, nbytes, ubuf, ulen)
- const unsigned char *buf;
- int nbytes;
- unichar *ubuf;
- int *ulen;
+looks_extended(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
{
int i;
@@ -489,11 +472,7 @@ looks_extended(buf, nbytes, ubuf, ulen)
}
int
-looks_utf8(buf, nbytes, ubuf, ulen)
- const unsigned char *buf;
- int nbytes;
- unichar *ubuf;
- int *ulen;
+looks_utf8(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
{
int i, n;
unichar c;
@@ -555,11 +534,7 @@ done:
}
static int
-looks_unicode(buf, nbytes, ubuf, ulen)
- const unsigned char *buf;
- int nbytes;
- unichar *ubuf;
- int *ulen;
+looks_unicode(const unsigned char *buf, int nbytes, unichar *ubuf, int *ulen)
{
int bigend;
int i;
@@ -676,10 +651,7 @@ unsigned char ebcdic_1047_to_8859[] = {
* Copy buf[0 ... nbytes-1] into out[], translating EBCDIC to ASCII.
*/
static void
-from_ebcdic(buf, nbytes, out)
- const unsigned char *buf;
- int nbytes;
- unsigned char *out;
+from_ebcdic(const unsigned char *buf, int nbytes, unsigned char *out)
{
int i;