Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: How to copy a string safely and efficiently in C? Date: Thu, 15 Sep 2016 16:04:35 -0700 Organization: None to speak of Lines: 19 Message-ID: References: <0b30b0cc-f7c5-4928-8acb-56bf2364797b@googlegroups.com> <2439e64e-39d5-4982-a5d6-625f68acf636@googlegroups.com> <849f0366-4440-43f0-8936-f0d9b5a71e88@googlegroups.com> <1boa3olwcq.fsf@pfeifferfamily.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="24704"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hwAPizywFUxaXXx87BAL3" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:WEYTAMz8ELmUAkSwkf0U4LFWL8U= sha1:gKjeWHv1q3etQNVbfA2dPILlysQ= Xref: csiph.com comp.lang.c:93579 Joe Pfeiffer writes: [...] > The better question would be why something whose definition was so > idiosyncratic and whose use was so specialized was ever in the standard > library in the first place. [referring to strncpy] One possibility is that it's because early Unix systems used a fixed-width character array to store file names in directory entries, and strncpy() was useful for manipulating them. It's not clear that that's the actual rationale, but it's plausible. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"