1/*
2 * Copyright (C) 1984-2007 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information about less, or for information on how to
8 * contact the author, see the README file.
--- 468 unchanged lines hidden (view full) ---
477 if (!seekable(f))
478 return (0);
479 if (lseek(f, (off_t)0, 0) == BAD_LSEEK)
480 return (0);
481 n = read(f, data, sizeof(data));
482 for (i = 0; i < n; i++)
483 {
484 char c = data[i];
485 if (ctldisp == OPT_ONPLUS && IS_CSI_START(c))
486 {
487 while (++i < n && is_ansi_middle(data[i]))
488 continue;
489 } else if (binary_char(c))
490 bin_count++;
491 }
492 /*
493 * Call it a binary file if there are more than 5 binary characters
--- 555 unchanged lines hidden ---
2 * Copyright (C) 1984-2007 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information about less, or for information on how to
8 * contact the author, see the README file.
--- 468 unchanged lines hidden (view full) ---
477 if (!seekable(f))
478 return (0);
479 if (lseek(f, (off_t)0, 0) == BAD_LSEEK)
480 return (0);
481 n = read(f, data, sizeof(data));
482 for (i = 0; i < n; i++)
483 {
484 char c = data[i];
485 if (ctldisp == OPT_ONPLUS && IS_CSI_START(c))
486 {
487 while (++i < n && is_ansi_middle(data[i]))
488 continue;
489 } else if (binary_char(c))
490 bin_count++;
491 }
492 /*
493 * Call it a binary file if there are more than 5 binary characters
--- 555 unchanged lines hidden ---