nrtl_strdup

Synopsis

    #include "nortlib.h"
    char *nrtl_strdup(const char *s);
    char *nl_strdup(const char *s);
    

Description

nrtl_strdup() and nl_strdup() both provide the functionality of the semi-standard strdup() function with the exception that if memory allocation fails, it will cause a fatal error. As such, both functions are guaranteed to return a newly-allocated copy of the passed string.

nrtl_strdup() is the function that is included in the nortlib library. nl_strdup() is implemented as a macro in nortlib.h only if memlib.h has not been included, since the name conflicts with a routine in that library.

Returns

Returns a newly allocated copy of the argument string. If memory allocation fails, the program will terminate via nl_error(3).

See Also

nl_response, new_memory().

Source File

/usr/local/src/nortlib/strdup.c

Alphabetical List
Subject List
Return to Manuals Page
webmaster@huarp.harvard.edu
Copyright 2001 by the President and Fellows of Harvard College