Input Line Editing
Gregg Wonderly
gregg at a.cs.okstate.edu
Wed Jul 20 07:03:51 AEST 1988
>? From: Gregg Wonderly <gregg at a.cs.okstate.edu>
>
>? I just solved that problem here by writing a KSH style history and
>? command line editor subroutine that is called gets().
>
>As you no doubt already know, there is already a function named gets().
>How about choosing another name?
By calling it gets(), I can just link it with existing applications.
Since it IOCTL's fd 0 to turn on 'cbreak' mode, it can detect non-terminal
input streams when the IOCTL fails, and then switch to normal gets() processing.
Normally, I refrain from calling functions the same as library routines, but
when they mimick them exactly, and there is nothing outwardly visible to
the code (i.e. external variables or support function calls) then I see
no reason not to. Exactly is, I guess, a sorta relative word, but I just
hate to do a bunch of editing that might break a program, or otherwise
make it out of sync with source distributions.
The tons of different malloc(3)'s are a great example of why someone might
name a routine the same as a library routine when it does the same thing,
just differently...
Gregg Wonderly
Department of Computing and Information Sciences
Oklahoma State University
UUCP: {cbosgd, ihnp4, rutgers}!okstate!gregg
Internet: gregg at A.CS.OKSTATE.EDU
More information about the Comp.unix.wizards
mailing list