Newsgroups: comp.std.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: strncat is insufficient
Message-ID: <1990Aug26.023859.12298@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <17418@haddock.ima.isc.com> <13598@smoke.BRL.MIL> <1990Aug23.132400.3654@zorch.SF-Bay.ORG> <587@array.UUCP> <620.26d6d0cd@iccgcc.decnet.ab.com>
Date: Sun, 26 Aug 90 02:38:59 GMT

In article <620.26d6d0cd@iccgcc.decnet.ab.com> browns@iccgcc.decnet.ab.com (Stan Brown, Oak Road Systems) writes:
>Can Karl, or someone else who knows, explain why strncpy was standardized
>to copy n characters even at the expense of a zero byte...

Because that is the way strncpy() behaved in existing implementations,
and there was code that depended on it.

> or why no
>alternative that always terminates the string was provided...

Because there was no such alternative that had been implemented and used.

ANSI C standardized -- by and large -- an existing language.  This is a
feature, not a bug.
-- 
Committees do harm merely by existing. | Henry Spencer at U of Toronto Zoology
                       -Freeman Dyson  |  henry@zoo.toronto.edu   utzoo!henry
