www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/08/10/06:14:10

Date: Thu, 10 Aug 1995 12:28:45 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "Dr. Norman Fahrer" <fano AT norcov DOT com>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: 'file' util for dos

On Wed, 9 Aug 1995, Dr. Norman Fahrer wrote:

> I use the DOS ported awk and want to make sure
> that the file it works on is NOT a binary but
> a TEXT file, so not to run into the 'out of memory'
> problem that occures when the record which is read
> in is the entire file.
> 
> What would be a good way to prevent that the awk
> is fed with a NOT-text file (under DOS) ? 

Your best bet is to write a small program which reads the first, say 4KB 
of the file, then for non-text characters in that block.  If it finds 
them, let it return a non-zero status to DOS, which you can test for 
either in a batch file or from inside Awk.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019