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

📄 autosub.c

📁 早期freebsd实现
💻 C
字号:
/* $Id: autosub.c,v 3.0 1992/02/01 03:09:32 davison Trn $ *//* This software is Copyright 1991 by Stan Barber.  * * Permission is hereby granted to copy, reproduce, redistribute or otherwise * use this software as long as: there is no monetary profit gained * specifically from the use or reproduction of this software, it is not * sold, rented, traded or otherwise marketed, and this copyright notice is * included prominently in any copy made.  * * The author make no claims as to the fitness or correctness of this software * for any use whatsoever, and it is provided as is. Any use of this software * is at the user's own risk.  */#include "EXTERN.h"#include "common.h"#include "search.h"#include "ngsrch.h"#include "util.h"#include "final.h"#include "INTERN.h"#include "autosub.h"/* Consider the newsgroup specified, and return:	*//* : if we should autosubscribe to it			*//* ! if we should autounsubscribe to it			*//* \0 if we should ask the user.			*/intauto_subscribe(ng)char *ng;{    char *s;    if((s = getval("AUTOSUBSCRIBE", (char *)NULL))	&& matchlist(s, ng)) return ':';    if((s = getval("AUTOUNSUBSCRIBE", (char *)NULL))	&& matchlist(s, ng)) return '!';    return 0;}boolmatchlist(patlist, s)char *patlist;char *s;{    COMPEX ilcompex;    char *p;    char *err;    bool result;    bool tmpresult;    result = FALSE;    init_compex(&ilcompex);    while(patlist && *patlist) {	if(*patlist == '!') {		patlist++;		tmpresult = FALSE;	} else tmpresult = TRUE;	if(p = index(patlist, ',')) *p = '\0';        /* compile regular expression */	err = ng_comp(&ilcompex,patlist,TRUE,TRUE);	if(p) *p++ = ',';	if(err != Nullch) {	    printf("\n%s\n", err) FLUSH;	    finalize(1);	}		if (execute(&ilcompex,s) != Nullch)	    result = tmpresult;	patlist = p;    }    free_compex(&ilcompex);    return result;}

⌨️ 快捷键说明

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