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

📄 trn.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 2 页
字号:
			goto reask_newsgroup;		    case NGS_FOUND:			special = TRUE;	/* don't skip it if toread==0 */			break;		    case NGS_NOTFOUND:#ifdef VERBOSE			IF(verbose)			    fputs("\n\nNot found -- use a or g to add newsgroups\n",				stdout) FLUSH;			ELSE#endif#ifdef TERSE			    fputs("\n\nNot found\n",stdout) FLUSH;#endif			goto reask_newsgroup;		    }#else		    notincl("/");#endif		    break;		case 'm':#ifndef RELOCATE		    notincl("m");		    break;#endif		    		case 'g':	/* goto named newsgroup */		    if (!finish_command(FALSE))					/* if they didn't finish command */			goto reinp_newsgroup;	/* go try something else */		    for (s = buf+1; *s == ' '; s++);					/* skip leading spaces */#ifdef RELOCATE		    if (!*s && *buf == 'm' && ngname && ng < nextrcline)			strcpy(s,ngname);#endif		    if (isalnum(*s)) {		        char *_s;			for (_s=s; isdigit(*_s); _s++)			    ;		        if (*_s && !isspace(*_s))			    /* found non-digit before hitting end */			    set_ngname(s);			else {			    int rcnum;			    rcnum = atoi(s);			    if (rcnum < nextrcline)				set_ngname(rcline[rcnum]);			    else {				printf("\nOnly %d groups. Try again.\n",					nextrcline) FLUSH;				goto reask_newsgroup;			    }			}		    } else {			printf("\nPlease specify a newsgroup.\n") FLUSH;			goto reask_newsgroup;		    }		    /* try to find newsgroup */#ifdef RELOCATE		    if (!get_ng(ngname,(*buf=='m'?GNG_RELOC:0) | GNG_FUZZY))#else		    if (!get_ng(ngname,GNG_FUZZY))#endif			ng = current_ng;/* if not found, go nowhere */		    special = TRUE;	/* don't skip it if toread==0 */		    break;#ifdef DEBUG		case 'D':		    printf("\nTries: %d Hits: %d\n",			softtries,softtries-softmisses) FLUSH;		    goto reask_newsgroup;#endif		case '!':		/* shell escape */		    if (escapade())	 /* do command */			goto reinp_newsgroup;					/* if rubbed out, re input */		    goto reask_newsgroup;		case Ctl('k'):		/* edit global KILL file */		    edit_kfile();		    goto reask_newsgroup;		case 'c':		/* catch up */#ifdef CATCHUP		    if (ng < nextrcline)			ask_catchup();		    ng++;#else		    notincl("c");#endif		    break;		case 't':		    if (!use_threads)			printf("\n\nNot running in thread mode.\n");		    else if (ng < nextrcline && toread[ng] >= TR_NONE) {			bool read_unthreaded = (rcchar[ng] == ':');			rcchar[ng] = (read_unthreaded ? '0' : ':');			printf("\n\n%s will be read %sthreaded.\n",			    rcline[ng], read_unthreaded? "un" : "") FLUSH;			set_toread(ng);		    }		    special = TRUE;	/* don't skip it if toread==0 */		    break;		case 'u':		/* unsubscribe */		    if (ng < nextrcline && toread[ng] >= TR_NONE) {					/* unsubscribable? */			printf(unsubto,rcline[ng]) FLUSH;			rcchar[ng] = NEGCHAR;					/* unsubscribe to (from?) it */			toread[ng] = TR_UNSUB;					/* and make line invisible */			ng++;		/* do an automatic 'n' */		    }		    break;		case 'h': {		/* help */		    int cmd;		    if ((cmd = help_ng()) > 0)			pushchar(cmd);		    goto reask_newsgroup;		}		case 'A':		    if (ng >= nextrcline)			break;reask_abandon:#ifdef VERBOSE		    IF(verbose)			in_char("\nAbandon changes to current newsgroup? [yn] ", 'B');		    ELSE#endif#ifdef TERSE			in_char("\nAbandon? [ynh] ", 'B');#endif		    setdef(buf,"y");#ifdef VERIFY		    printcmd();#endif		    putchar('\n') FLUSH;		    if (*buf == 'h') {#ifdef VERBOSE			printf("Type y or SP to abandon the changes to this group since you started trn.\n");			printf("Type n to leave the group as it is.\n");#else			printf("y or SP to abandon changes to this group.\n");			printf("n to forget it.\n");#endif			goto reask_abandon;		    } else if (*buf != 'y' && *buf != 'n' && *buf != 'q') {			printf(hforhelp);			settle_down();			goto reask_abandon;		    } else if (*buf == 'y')			abandon_ng(ng);		    special = TRUE;	/* don't skip it if toread==0 */		    break;		case 'a':#ifndef FINDNEWNG		    notincl("a");		    goto reask_newsgroup;#else		    /* FALL THROUGH */#endif		case 'o':#ifdef ONLY		{#ifdef FINDNEWNG		    bool doscan = (*buf == 'a');#endif		    if (!finish_command(TRUE)) /* get rest of command */			goto reinp_newsgroup;	/* if rubbed out, try something else */		    end_only();		    if (buf[1]) {			bool minusd = instr(buf+1,"-d", TRUE) != Nullch;			sw_list(buf+1);			if (minusd)			    cwd_check();			putchar('\n') FLUSH;#ifdef FINDNEWNG			if (doscan && maxngtodo)			    scanactive();#endif		    }		    ng = 0;		/* simulate ^ */		    retry = FALSE;		    break;		}#else		    notincl("o");		    goto reask_newsgroup;#endif		case '&':		    if (switcheroo()) /* get rest of command */			goto reinp_newsgroup;	/* if rubbed out, try something else */		    goto reask_newsgroup;		case 'l': {		/* list other newsgroups */		    if (!finish_command(TRUE)) /* get rest of command */			goto reinp_newsgroup;	/* if rubbed out, try something else */		    for (s = buf+1; *s == ' '; s++);		    			/* skip leading spaces */		    sprintf(cmd_buf,"%s '%s'",filexp(NEWSGROUPS),s);		    resetty();		    if (doshell(sh,cmd_buf))#ifdef VERBOSE			IF(verbose)			    fputs("    (Error from newsgroups program)\n",				stdout) FLUSH;			ELSE#endif#ifdef TERSE			    fputs("(Error)\n",stdout) FLUSH;#endif		    noecho();		    crmode();		    goto reask_newsgroup;		}		case 'U': case '+':		case '.': case '=':		case 'y': case 'Y': case '\t': /* do normal thing */		    if (ng >= nextrcline) {			fputs("\nNot on a newsgroup.",stdout) FLUSH;			goto reask_newsgroup;		    } else if (*buf == '.') {	/* start command? */			if (!finish_command(FALSE)) /* get rest of command */			    goto reinp_newsgroup;			s = savestr(buf+1);  /* do_newsgroup will free it */		    } else {			s = buf;			if (*buf == '+' || *buf == 'U' || *buf == '=')			    *s++ = lastchar; /* restore 0200 if from a macro */			save_typeahead(s, sizeof buf - 1);			if (*buf)			    s = savestr(buf);			else			    s = Nullch;		    }		    if (toread[ng])			retry = TRUE;		    switch (do_newsgroup(s)) {		    case NG_ERROR:		    case NG_NORM:			ng++;			break;		    case NG_ASK:			goto reask_newsgroup;		    case NG_SELPRIOR:			*buf = 'p';			goto do_command;		    case NG_SELNEXT:			*buf = 'n';			goto do_command;		    case NG_MINUS:			ng = recent_ng;	/* recall previous newsgroup */			special = TRUE;	/* don't skip it if toread==0 */			break;		    }		    break;#ifdef STRICTCR		case '\n':		    fputs(badcr,stdout) FLUSH;		    goto reask_newsgroup;#endif		case 'v':		    printf("\n%s",rnid);		    printf("\n%s",patchlevel);		    printf("\nSend bugs to davison@borland.com\n") FLUSH;		    goto reask_newsgroup;		default:		    printf("\n%s",hforhelp) FLUSH;		    settle_down();		    goto reask_newsgroup;		}	    }	} while (retry);    }    /* now write .newsrc back out */    write_rc();    if (oh_for_the_good_old_days)	get_old_rc();    finalize(0);			/* and exit */}/* set current newsgroup */voidset_ngname(what)char *what;{    int len = strlen(what)+1;    growstr(&ngname,&ngnlen,len);    strcpy(ngname,what);    growstr(&ngdir,&ngdlen,len);    strcpy(ngdir,getngdir(ngname));}static char *myngdir;static int ngdirlen = 0;char *getngdir(ngnam)char *ngnam;{    register char *s;    growstr(&myngdir,&ngdirlen,strlen(ngnam)+1);    strcpy(myngdir,ngnam);    for (s = myngdir; *s; s++)	if (*s == '.')	    *s = '/';    return myngdir;}

⌨️ 快捷键说明

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