hdup - duplicates a handle
int hdup(int h);
Duplicates a handle. The new handle will refer to the same underlying object.
Each duplicate of a handle requires its own call to hclose. The underlying object is deallocated when all handles pointing to it have been closed.
Returns the new handle duplicate on success. On error, -1 is returned and errno is set to one of the following values.
int ch1 = chmake(sizeof(int)); int ch2 = hdup(ch1); hclose(ch2); hclose(ch1);