How long is long for the Unix 'file' command?

Solution 1:

From ascmagic.c in the file source package on Ubuntu:

#include "names.h"

#define MAXLINELEN 300  /* longest sane line length */
#define ISSPC(x) ((x) == ' ' || (x) == '\t' || (x) == '\r' || (x) == '\n' \
          || (x) == 0x85 || (x) == '\f')

Seems like a line needs to be more than 300 characters to be considered "very long".

Solution 2:

Over 300 chacracters, according to lines 52 and 214-215 in ascmagic.c in the source code.

The source code can be found here (link fetched from the Debian man page for file): ftp://ftp.astron.com/pub/file/

Solution 3:

Brute force (plus this is a program, right? so it makes it programming related?):

$ for i in {1..301}; do printf "%${i}s" "." | file - | grep very && echo $i; done
/dev/stdin: very short file (no magic)
1
/dev/stdin: ASCII text, with very long lines, with no line terminators
301