#include #include #include "datafile.h" #include "config.h" #include "error.h" #include "cdbslib.h" #include "getref.h" /* MKANCHOR -- Build an anchor to run getref thru the cgi interface * * i: info info displayed to user in anchor * i: root observation name root * i: reffile reference file name * i: text text output desired? (yes or no) */ char * mkanchor (char *info, char *root, char *reffile, char *text) { int nc; static char buffer[SZ_PARAM+1]; /* Build the different pieces of the anchor */ /* The URL of the CGI task */ safecopy (buffer, "", SZ_PARAM); /* Add the info the user sees. If info is blank, calling function * will supply the rest of the anchor */ if (info[0] != EOS) { safecat (buffer, info, SZ_PARAM); safecat (buffer, "", SZ_PARAM); } /* Check for buffer overflow */ nc = strlen (buffer); if (buffer[nc-1] != '>') { buffer[40] = EOS; safecat (buffer, "...", SZ_PARAM); cdbs_error (TOOLONG, "%s", buffer); } return (buffer); }