26 lines
333 B
C
26 lines
333 B
C
|
#include "headers.h"
|
||
|
|
||
|
const char REQ_GOPH[] =
|
||
|
{
|
||
|
"%s\n"
|
||
|
};
|
||
|
|
||
|
|
||
|
int reqgen_gopher(const char *path, char **nbuf)
|
||
|
{
|
||
|
int buflen;
|
||
|
|
||
|
buflen = (strlen(REQ_GOPH) + strlen(path) + 1);
|
||
|
|
||
|
if( !(*nbuf = malloc(buflen)))
|
||
|
{
|
||
|
return(ERRMEM);
|
||
|
}
|
||
|
memset(*nbuf, 0, buflen);
|
||
|
|
||
|
sprintf(*nbuf, REQ_GOPH, path);
|
||
|
|
||
|
|
||
|
return(0);
|
||
|
}
|