Mail Archives: cygwin/2004/04/06/15:20:16
Advocacy: Remove irrelevant, i.e. not objective and 100% prooved, "safety
code".
> From: Dave Korn
> > From: cygwin-owner On Behalf Of fergus
> > Sent: 06 April 2004 14:10
>
> > >> GNU grep detects binary files by looking for a '\0' byte.
> >
> > I know this is not strictly Cygwin-specific but it _is_
> > generated by the
> > preceding relevant recent comment in a busy thread:
> >
> > Please can you tell me how to grep for an ASCII 00
>
> grep .* filename | grep "Binary file .* matches"
>
> will kinda do that!
FWIW:
This works for _counting_ any single character:
$ cat Projects/hw/hw.cc | tr -c -d '\012' | wc -c
17
WRT earlier discussion regarding "safety" coding. I think you (Dave K) put
it wery well in this paragraph:
> OTOH there's a reason why I use a command line interface, and it's
> because what I give my computer are commands, not suggestions, and I
> expect them to be obeyed. Anything less is mutiny! (I'll overlook
> the occasional "Are you sure (y/n)?" as minor insubordination).
> I don't like my computer to second-guess me. I particularly don't
> like it to second guess me with an inaccurate heuristic. And I
> particularly particularly don't like it to second-guess me,
> get it wrong, and then silently bail without any kind of
> error message, warning or explanation.
ICNHSIB! (Pronounced: AJKUNHASIB ;-)
Or rather; I would have to write in Swedish to better that.
I do OTOH consider things saying "Are you sure (y/n)?" to be half
disfunctional.
Trying to bypass these safety checks -under fully "legal" circumstances- is
a pure pain.
WRT: "... y/n?" - Ever tried to create a DISKETTE formatting script that
puts DISK-NUMBERS in the label, increasing it for every disk, using DOS
commands? I've done that /IRONIC=on/it were "great" times! /IRONIC=off/
And NO, I did want the formatting be _as "standard" as possible_, so
writing my own disk formatter was out of the question (I've tried/seen awful
format replacements).
/Hannu E K Nevalainen, B.Sc. EE - 59+16.37'N, 17+12.60'E
** on a mailing list; please keep replies on that particular list **
-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--END OF MESSAGE--
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -