66 lines · 1.7 KB · C
RawDownload
/*  * This file is part of the UCB release of Plan 9. It is subject to the license * terms in the LICENSE file found in the top-level directory of this * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No * part of the UCB release of Plan 9, including this file, may be copied, * modified, propagated, or distributed except according to the terms contained * in the LICENSE file. */ #include "common.h" /* format of REMOTE FROM lines */char *REMFROMRE =	"^>?From[ \t]+((\".*\")?[^\" \t]+?(\".*\")?[^\" \t]+?)[ \t]+(.+)[ \t]+remote[ \t]+from[ \t]+(.*)\n$";int REMSENDERMATCH = 1;int REMDATEMATCH = 4;int REMSYSMATCH = 5; /* format of LOCAL FROM lines */char *FROMRE =	"^>?From[ \t]+((\".*\")?[^\" \t]+?(\".*\")?[^\" \t]+?)[ \t]+(.+)\n$";int SENDERMATCH = 1;int DATEMATCH = 4; /* output a unix style local header */intprint_header(Biobuf *fp, char *sender, char *date){	return Bprint(fp, "From %s %s\n", sender, date);} /* output a unix style remote header */intprint_remote_header(Biobuf *fp, char *sender, char *date, char *system){	return Bprint(fp, "From %s %s remote from %s\n", sender, date, system);} /* parse a mailbox style header */intparse_header(char *line, String *sender, String *date){	if (!IS_HEADER(line))		return -1;	line += sizeof("From ") - 1;	s_restart(sender);	while(*line==' '||*line=='\t')		line++;	if(*line == '"'){		s_putc(sender, *line++);		while(*line && *line != '"')			s_putc(sender, *line++);		s_putc(sender, *line++);	} else {		while(*line && *line != ' ' && *line != '\t')			s_putc(sender, *line++);	}	s_terminate(sender);	s_restart(date);	while(*line==' '||*line=='\t')		line++;	while(*line)		s_putc(date, *line++);	s_terminate(date);	return 0;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t