groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C string function history (was: Italics in SS)


From: G. Branden Robinson
Subject: C string function history (was: Italics in SS)
Date: Tue, 13 Dec 2022 15:32:36 -0600

Hi Alex,

At 2022-12-13T21:35:59+0100, Alejandro Colomar wrote:
> > 5.  Not all is joy and roses.  When you do things like embed font
> >      selection escape sequences in a heading, internally groff creates
> >      data structures called "nodes" that are not straightforwardly
> >      encodable in the device control escape sequences that are used to
> >      embed "PDFMark" data in the formatted document.  In the past this
> >      has led to what I nominate as groff's most horribly inscrutable
> >      diagnostic message.
> 
> Does it truncate expectations to have single-volume Linux man-pages if
> I use \f?

Not at all.  You can even use it in (sub)section headings.  The nodes,
unrepresentable as characters, will be silently discarded, leaving you
with ISO Basic Latin characters in your PDF bookmarks.

> I'll pick the merry; I did enough radical stuff recently, and need to
> balance the karma.  ;).
> 
> BTW, I'm reconsidering again releasing.  The rewritten strcpy(3) page
> is sooo necessary!  Shipping it in Bookworm would be a nice dream.
> After some discussion with Martin Sebor, I think I need to rewrite
> strlen(3) too, covering strnlen(3) in the same page.

It's worth having a quick look at just how _small_ the original string.h
header file was.  It was born in the twilight between 7th Edition Unix
(1979) and 8th Edition Research Unix (1985); because the latter took so
long to eventuate, it seems that these functions forked almost as soon
as they were born, into USG and BSD flavors.

/*      @(#)string.h    1.1     */
extern char
        *strcpy(),
        *strncpy(),
        *strcat(),
        *strncat(),
        *strchr(),
        *strrchr(),
        *strpbrk(),
        *strtok();
extern long
        strtol();

https://minnie.tuhs.org/cgi-bin/utree.pl?file=pdp11v/usr/include/string.h

By 8th Edition Research Unix, it had grown strcmp(), strncmp(),
strlen(), strspn(), and strcspn(), but dropped strtol().  I wonder if
there is a story there.

https://minnie.tuhs.org/cgi-bin/utree.pl?file=V8/usr/include/string.h

Here's strings.h (note the plural) from 4.2BSD (1983).

/*      string.h        4.1     83/05/26        */

/*
 * External function definitions
 * for routines described in string(3).
 */
char    *strcat();
char    *strncat();
int     strcmp();
int     strncmp();
char    *strcpy();
char    *strncpy();
int     strlen();
char    *index();
char    *rindex();

https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/include/strings.h

> I'll invite Doug to have some review.  I'm curious about his opinion.
> He probably has some insight of the design of some of those functions
> that we don't.

According to an email of Doug's, Nils-Peter Nelson was the "originator"
of the initial batch of public C string-handling functions.

https://minnie.tuhs.org/pipermail/tuhs/2020-January/020235.html

To my surprise, I've never been able to turn up any interviews with him
as a Bell Labs veteran, inviting him to reminisce about his role in the
creation of some of the most widely used functions in all of
programming.

Given the pain that has attached to use of them over the years, and the
steadily growing amount of literature documenting just how dangerous
they can be to use, perhaps he refuses interview requests for fear of
the encounter turning into a Struggle Session.  😈

Maybe he had enough of C, and if so, I can't blame him.  What I did find
seems to be Lisp-related.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]