#include <stdlib.h>

/**strdup() - Duplicate a string.
 * 
 * Returns a pointer to a new string which is a duplicate of the
 * string to which s1 points.  The space for the new string is
 * obtained using the calloc() function (see calloc(3C)).
 *
 * Parameters:
 *      [1] inStr - String to duplicate.
 * Returns:
 *      Pointer to duplicated string; or NULL if an error occurred.
 **/
char *strdup(const char *inStr)
{
    char *outStr;
    if (NULL == inStr)
    {
        outStr = NULL;
    }
    else
    {
        outStr = calloc((strlen(inStr) + 1), sizeof(char));
        if (NULL != outStr)
        {
            strcpy(outStr, inStr);
        }
    }
    return outStr;
}
