⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rset.c

📁 harvest是一个下载html网页得机器人
💻 C
字号:
/* $Id: rset.c,v 1.17 2002/08/02 19:26:57 adam Exp $   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002   Index Data ApsThis file is part of the Zebra server.Zebra is free software; you can redistribute it and/or modify it underthe terms of the GNU General Public License as published by the FreeSoftware Foundation; either version 2, or (at your option) any laterversion.Zebra is distributed in the hope that it will be useful, but WITHOUT ANYWARRANTY; without even the implied warranty of MERCHANTABILITY orFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public Licensefor more details.You should have received a copy of the GNU General Public Licensealong with Zebra; see the file LICENSE.zebra.  If not, write to theFree Software Foundation, 59 Temple Place - Suite 330, Boston, MA02111-1307, USA.*/#include <stdio.h>#include <string.h>#include <zebrautl.h>#include <rset.h>RSET rset_create(const struct rset_control *sel, void *parms){    RSET rnew;    int i;    logf (LOG_DEBUG, "rs_create(%s)", sel->desc);    rnew = (RSET) xmalloc(sizeof(*rnew));    rnew->control = sel;    rnew->flags = 0;    rnew->count = 1;    rnew->rset_terms = NULL;    rnew->no_rset_terms = 0;    rnew->buf = (*sel->f_create)(rnew, sel, parms);    logf (LOG_DEBUG, "no_rset_terms: %d", rnew->no_rset_terms);    for (i = 0; i<rnew->no_rset_terms; i++)	logf (LOG_DEBUG, " %s", rnew->rset_terms[i]->name);    return rnew;}void rset_delete (RSET rs){    (rs->count)--;    if (!rs->count)    {	(*rs->control->f_delete)(rs);	xfree(rs);    }}RSET rset_dup (RSET rs){    (rs->count)++;    return rs;}RSET_TERM *rset_terms(RSET rs, int *no){    *no = rs->no_rset_terms;    return rs->rset_terms;}RSET_TERM rset_term_create (const char *name, int length, const char *flags,                            int type){    RSET_TERM t = (RSET_TERM) xmalloc (sizeof(*t));    if (!name)	t->name = NULL;    else if (length == -1)	t->name = xstrdup (name);    else    {	t->name = (char*) xmalloc (length+1);	memcpy (t->name, name, length);	t->name[length] = '\0';    }    if (!flags)	t->flags = NULL;    else	t->flags = xstrdup (flags);    t->nn = -1;    t->count = 0;    t->type = type;    return t;}void rset_term_destroy (RSET_TERM t){    xfree (t->name);    xfree (t->flags);    xfree (t);}RSET_TERM rset_term_dup (RSET_TERM t){    RSET_TERM nt = (RSET_TERM) xmalloc (sizeof(*nt));    if (t->name)	nt->name = xstrdup (t->name);    else	nt->name = NULL;    if (t->flags)	nt->flags = xstrdup (t->flags);    else	nt->flags = NULL;    nt->nn = t->nn;    return nt;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -