ascmagic.c (267897) | ascmagic.c (275698) |
---|---|
1/* 2 * Copyright (c) Ian F. Darwin 1986-1995. 3 * Software written by Ian F. Darwin and others; 4 * maintained 1995-present by Christos Zoulas and others. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 21 unchanged lines hidden (view full) --- 30 * 31 * Extensively modified by Eric Fischer <enf@pobox.com> in July, 2000, 32 * to handle character codes other than ASCII on a unified basis. 33 */ 34 35#include "file.h" 36 37#ifndef lint | 1/* 2 * Copyright (c) Ian F. Darwin 1986-1995. 3 * Software written by Ian F. Darwin and others; 4 * maintained 1995-present by Christos Zoulas and others. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 21 unchanged lines hidden (view full) --- 30 * 31 * Extensively modified by Eric Fischer <enf@pobox.com> in July, 2000, 32 * to handle character codes other than ASCII on a unified basis. 33 */ 34 35#include "file.h" 36 37#ifndef lint |
38FILE_RCSID("@(#)$File: ascmagic.c,v 1.88 2014/02/12 23:20:53 christos Exp $") | 38FILE_RCSID("@(#)$File: ascmagic.c,v 1.91 2014/11/28 02:46:39 christos Exp $") |
39#endif /* lint */ 40 41#include "magic.h" 42#include <string.h> 43#include <memory.h> 44#include <ctype.h> 45#include <stdlib.h> 46#ifdef HAVE_UNISTD_H --- 95 unchanged lines hidden (view full) --- 142 if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) { 143 file_oomem(ms, mlen); 144 goto done; 145 } 146 if ((utf8_end = encode_utf8(utf8_buf, mlen, ubuf, ulen)) 147 == NULL) 148 goto done; 149 if ((rv = file_softmagic(ms, utf8_buf, | 39#endif /* lint */ 40 41#include "magic.h" 42#include <string.h> 43#include <memory.h> 44#include <ctype.h> 45#include <stdlib.h> 46#ifdef HAVE_UNISTD_H --- 95 unchanged lines hidden (view full) --- 142 if ((utf8_buf = CAST(unsigned char *, malloc(mlen))) == NULL) { 143 file_oomem(ms, mlen); 144 goto done; 145 } 146 if ((utf8_end = encode_utf8(utf8_buf, mlen, ubuf, ulen)) 147 == NULL) 148 goto done; 149 if ((rv = file_softmagic(ms, utf8_buf, |
150 (size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0) | 150 (size_t)(utf8_end - utf8_buf), 0, NULL, 151 TEXTTEST, text)) == 0) |
151 rv = -1; 152 } 153 154 /* Now try to discover other details about the file. */ 155 for (i = 0; i < ulen; i++) { 156 if (ubuf[i] == '\n') { 157 if (seen_cr) 158 n_crlf++; --- 202 unchanged lines hidden --- | 152 rv = -1; 153 } 154 155 /* Now try to discover other details about the file. */ 156 for (i = 0; i < ulen; i++) { 157 if (ubuf[i] == '\n') { 158 if (seen_cr) 159 n_crlf++; --- 202 unchanged lines hidden --- |