static void simple_cs_copy_data(CHARSET_INFO *to, CHARSET_INFO *from) { to->number= from->number ? from->number : to->number; to->state|= from->state; if (from->csname) to->csname= strdup(from->csname); if (from->name) to->name= strdup(from->name); if (from->ctype) to->ctype= (uchar*) mdup((char*) from->ctype, MY_CS_CTYPE_TABLE_SIZE); if (from->to_lower) to->to_lower= (uchar*) mdup((char*) from->to_lower, MY_CS_TO_LOWER_TABLE_SIZE); if (from->to_upper) to->to_upper= (uchar*) mdup((char*) from->to_upper, MY_CS_TO_UPPER_TABLE_SIZE); if (from->sort_order) { to->sort_order= (uchar*) mdup((char*) from->sort_order, MY_CS_SORT_ORDER_TABLE_SIZE); /* set_max_sort_char(to); */ } if (from->tab_to_uni) { uint sz= MY_CS_TO_UNI_TABLE_SIZE*sizeof(uint16); to->tab_to_uni= (uint16*) mdup((char*)from->tab_to_uni, sz); /* create_fromuni(to); */ } }
static void inithelp (struct help *hp) { register struct helptab *p; register n, fd; register char **q; char filename [60]; char buf [1024]; if (! findhelpfile (filename, hp->name, LCLHELPDIR)) findhelpfile (filename, hp->name, HELPDIR); fd = open (filename, 0); if (fd >= 0) { n = read (fd, buf, sizeof (buf) - 1); if (n > 0) { buf [n] = 0; initnewhelp (hp->mesg, mdup (buf)); } close (fd); } q = hp->mesg; for (p=hp->htab; p->row && *q; ++p, ++q) p->str = *q; }
bool Msg7::inject ( TcpSocket *s , HttpRequest *r , void *state , void (*callback)(void *state)) { // save socket // socket is responsible for free the HTTP request, which contains // the POSTed content, so if he gets destroyed we have to make sure // we no longer reference that content. m_socket = s; long contentLen; // get the junk char *coll = r->getString ( "c" , NULL , NULL /*default*/); if ( ! coll ) coll = "main"; bool quickReply = r->getLong ( "quick" , 0 ); //char *pwd = r->getString ( "pwd" , NULL ); char *url = r->getString ( "u" , NULL , NULL /*default*/); bool recycleContent = r->getLong ( "recycle",0); char *ips = r->getString ( "ip" , NULL , NULL ); //char *username = g_users.getUsername(r); long firstIndexed = r->getLongLong("firstindexed",0LL); long lastSpidered = r->getLongLong("lastspidered",0LL); long hopCount = r->getLong("hopcount",-1); long newOnly = r->getLong("newonly",0); long charset = r->getLong("charset",-1); long deleteIt = r->getLong("delete",0); char hasMime = r->getLong("hasmime",0); // do consistency testing? bool doConsistencyTesting = r->getLong("dct",0); // default spiderlinks to no for injects long spiderLinks = r->getLong("spiderlinks",0); long forcedIp = 0; if ( ips ) forcedIp = atoip ( ips , gbstrlen(ips) ); char *content = r->getString ( "content" , &contentLen , NULL ); // mark doesn't like to url-encode his content if ( ! content ) { content = r->getUnencodedContent (); contentLen = r->getUnencodedContentLen (); //contentIsEncoded = false; } // we do not want the parser every holding up a query really long niceness = 1; // tell xmldoc to download the doc if ( contentLen == 0 ) content = NULL; // the http request gets freed if this blocks, so we have to // copy the content!!! if ( content ) { m_contentAllocSize = contentLen + 1; m_content = mdup ( content , contentLen + 1 , "injcont" ); } else { m_content = NULL; m_contentAllocSize = 0; } return inject ( url, forcedIp, m_content, contentLen, recycleContent, CT_HTML, // contentType, coll, quickReply , NULL,//username , NULL,//pwd, niceness, state, callback, firstIndexed, lastSpidered, hopCount, newOnly, charset, spiderLinks, deleteIt, hasMime, doConsistencyTesting); }
char *sdup(struct page *page, const char *src) { return mdup(page, src, strlen(src) + 1); } /* sdup() */