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

📄 lyprint.c

📁 基于rtos开发的浏览器!
💻 C
📖 第 1 页 / 共 3 页
字号:
		     *	to the top of the file.  May create		     *	technically invalid HTML, but will help		     *	get any partial or relative URLs resolved		     *	properly if no BASE tag is present to		     *	replace it. - FM		     */		    fprintf(outfile_fp,			    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n",			    newdoc->address, content_base);		}		if (LYPrependCharsetToSource && HTisDocumentSource()) {		    /*		     *	Added the document's charset as a META CHARSET tag		     *	to the top of the file.  May create		     *	technically invalid HTML, but will help to resolve		     *	properly the document converted via chartrans:		     *	printed document correspond to a display charset		     *	and we *should* override both assume_local_charset		     *	and original document's META CHARSET (if any).		     *		     *	Currently, if several META CHARSETs are found Lynx uses		     *	the first only, and it is opposite to BASE where the		     *	original BASE in the <HEAD> overrides ones from the		     *	top.		     *		     *	As in print-to-email we write charset only if the		     *	document has 8-bit characters, and we have no CJK or an		     *	unofficial "x-" charset.		     */		     use_cte = HTLoadedDocumentEightbit();		     disp_charset = LYCharSet_UC[current_char_set].MIMEname;		     if (!use_cte || LYHaveCJKCharacterSet ||			  strncasecomp(disp_charset, "x-", 2) == 0) {		     } else {			fprintf(outfile_fp,				"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=%s\">\n\n",				disp_charset);			}		}		print_wwwfile_to_fd(outfile_fp,0);		if (keypad_mode)		    printlist(outfile_fp,FALSE);		fclose(outfile_fp);#ifdef VMS		if (0 == strncasecomp(buffer, "sys$disk:", 9)) {		    if (0 == strncmp((buffer+9), "[]", 2)) {			HTAddSugFilename(buffer+11);		    } else {			HTAddSugFilename(buffer+9);		    }		} else {		    HTAddSugFilename(buffer);		}#else		HTAddSugFilename(buffer);#endif /* VMS */#if defined(__DJGPP__) || defined(_WINDOWS)		_fmode = O_BINARY;#endif /* __DJGPP__ or _WINDOWS */		break;	case MAIL:	    if (LYPreparsedSource && first_mail_preparsed &&		HTisDocumentSource()) {		_statusline(CONFIRM_MAIL_SOURCE_PREPARSED);		c = 0;		while (TOUPPER(c)!='Y' && TOUPPER(c)!='N' &&		       c != 7 && c != 3)		    c = LYgetch();#ifdef VMS		if (HadVMSInterrupt) {		    HadVMSInterrupt = FALSE;		    _statusline(MAIL_REQUEST_CANCELLED);		    sleep(InfoSecs);		    break;		}#endif /* VMS */		if (c == RTARROW || c == 'y' || c== 'Y'		    || c == '\n' || c == '\r') {		    addstr("   Ok...");		    first_mail_preparsed = FALSE;		} else	{		    _statusline(MAIL_REQUEST_CANCELLED);		    sleep(InfoSecs);		    break;		}	    }		_statusline(MAIL_ADDRESS_PROMPT);		strcpy(user_response, (personal_mail_address ?				       personal_mail_address : ""));		if (LYgetstr(user_response, VISIBLE,			     sizeof(user_response), NORECALL) < 0 ||		    *user_response == '\0') {		    _statusline(MAIL_REQUEST_CANCELLED);		    sleep(InfoSecs);		    break;		}		/*		 *  Determine which mail headers should be sent.		 *  Use Content-Type and MIME-Version headers only		 *  if needed.	We need them if we are mailing HTML		 *  source, or if we have 8-bit characters and will		 *  be sending Content-Transfer-Encoding to indicate		 *  this.  We will append a charset parameter to the		 *  Content-Type if we do not have an "x-" charset,		 *  and we will include the Content-Transfer-Encoding		 *  only if we are appending the charset parameter,		 *  because indicating an 8-bit transfer without also		 *  indicating the charset can cause problems with		 *  many mailers. - FM & KW		 */		disp_charset = LYCharSet_UC[current_char_set].MIMEname;		use_cte = HTLoadedDocumentEightbit();		if (!(use_cte && strncasecomp(disp_charset, "x-", 2))) {		    disp_charset = NULL;		    use_cte = FALSE;		}		use_type =  (disp_charset || HTisDocumentSource());		change_sug_filename(sug_filename);#ifdef VMS		if (strchr(user_response,'@') && !strchr(user_response,':') &&		   !strchr(user_response,'%') && !strchr(user_response,'"')) {		    sprintf(filename, mail_adrs, user_response);		    strcpy(user_response, filename);		}		if (first) {		    tempname(tempfile, NEW_FILE);		    if (isPMDF) {			tempname(hdrfile, NEW_FILE);			if ((len = strlen(hdrfile)) > 4) {			    len -= 5;			    if (!strcasecomp((hdrfile + len), ".html")) {				hdrfile[len] = '\0';				strcat(hdrfile, ".txt");			    }			}		    }		    first = FALSE;		} else {		    remove(tempfile);	/* remove duplicates */		}		if (HTisDocumentSource()) {		    if ((len = strlen(tempfile)) > 3) {			len -= 4;			if (!strcasecomp((tempfile + len), ".txt")) {			    tempfile[len] = '\0';			    strcat(tempfile, ".html");			}		    }		} else if ((len = strlen(tempfile)) > 4) {		    len -= 5;		    if (!strcasecomp((tempfile + len), ".html")) {			tempfile[len] = '\0';			strcat(tempfile, ".txt");		    }		}		if ((outfile_fp = LYNewTxtFile(tempfile)) == NULL) {		    HTAlert(UNABLE_TO_OPEN_TEMPFILE);		    break;		}		if (isPMDF) {		    if ((hfd = LYNewTxtFile(hdrfile)) == NULL) {			HTAlert(UNABLE_TO_OPEN_TEMPFILE);			break;		    }		    if (use_type) {			fprintf(hfd, "Mime-Version: 1.0\n");			if (use_cte) {			    fprintf(hfd,				    "Content-Transfer-Encoding: 8bit\n");			}		    }		    if (HTisDocumentSource()) {			/*			 *  Add Content-Type, Content-Location, and			 *  Content-Base headers for HTML source. - FM			 */			fprintf(hfd, "Content-Type: text/html");			if (disp_charset != NULL) {			    fprintf(hfd,				    "; charset=%s\n",				    disp_charset);			} else {			    fprintf(hfd, "\n");			}			fprintf(hfd,				"Content-Base: %s\n",				content_base);			fprintf(hfd,				"Content-Location: %s\n",				content_location);		    } else {			/*			 *  Add Content-Type: text/plain if we have 8-bit			 *  characters and a valid charset for non-source			 *  documents. - FM			 */			if (disp_charset != NULL) {			    fprintf(hfd,				    "Content-Type: text/plain; charset=%s\n",				    disp_charset);			}		    }		    /*		     *	X-URL header. - FM		     */		    fprintf(hfd, "X-URL: %s\n", newdoc->address);		}		/*		 *  Write the contents to a temp file.		 */		if (LYPrependBaseToSource && HTisDocumentSource()) {		    /*		     *	Added the document's base as a BASE tag to		     *	the top of the message body.  May create		     *	technically invalid HTML, but will help		     *	get any partial or relative URLs resolved		     *	properly if no BASE tag is present to		     *	replace it. - FM		     */		    fprintf(outfile_fp,			    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",			    newdoc->address, content_base);		} else if (!isPMDF) {		    fprintf(outfile_fp, "X-URL: %s\n\n", newdoc->address);		}		print_wwwfile_to_fd(outfile_fp, 0);		if (keypad_mode)		    printlist(outfile_fp, FALSE);		fclose(outfile_fp);		if (isPMDF) {		    /*		     *	For PMDF, put the subject in the		     *	header file and close it. - FM		     */		    fprintf(hfd, "Subject: %.70s\n\n", sug_filename);		    fclose(hfd);		    /*		     *	Now set up the command. - FM		     */		    sprintf(buffer,			    "%s %s %s,%s %s",			    system_mail,			    system_mail_flags,			    hdrfile,			    tempfile,			    user_response);		} else {		    /*		     *	For "generic" VMS MAIL, include		     *	the subject in the command. - FM		     */		    remove_quotes(sug_filename);		    sprintf(buffer,			    "%s %s/subject=\"%.70s\" %s %s",			    system_mail,			    system_mail_flags,			    sug_filename,			    tempfile,			    user_response);		}		stop_curses();		printf(MAILING_FILE);		fflush(stdout);		system(buffer);		fflush(stdout);		sleep(AlertSecs);		start_curses();		if (isPMDF) {		    /*		     *	Delete the header file. - FM		     */		    remove(hdrfile);		}#else /* Unix: */		sprintf(buffer, "%s %s", system_mail, system_mail_flags);#ifdef DOSPATH		sprintf(tempfile, "%s%s", lynx_temp_space, "temp_mail.txt");		if ((outfile_fp = LYNewTxtFile(tempfile)) == NULL) {			_statusline(MAIL_REQUEST_FAILED);			sleep(AlertSecs);			return;		}#else		if ((outfile_fp = popen(buffer, "w")) == NULL) {			_statusline(MAIL_REQUEST_FAILED);			sleep(AlertSecs);			break;		}#endif		/*		 *  Determine which mail headers should be sent.		 *  Use Content-Type and MIME-Version headers only		 *  if needed.	We need them if we are mailing HTML		 *  source, or if we have 8-bit characters and will		 *  be sending Content-Transfer-Encoding to indicate		 *  this.		 *		 *  Send Content-Transfer-Encoding only if the document		 *  has 8-bit characters.  Send a charset parameter only		 *  if the document has 8-bit characters and we we seem		 *  to have a valid charset.  - kw		 */		use_cte = HTLoadedDocumentEightbit();		disp_charset = LYCharSet_UC[current_char_set].MIMEname;		/*		 *  Don't send a charset if we have a CJK character set		 *  selected, since it may not be appropriate for mail...		 *  Also don't use an inofficial "x-" charset. - kw		 */		if (!use_cte || LYHaveCJKCharacterSet ||		    strncasecomp(disp_charset, "x-", 2) == 0) {		    disp_charset = NULL;		}#ifdef NOTDEFINED		/*  Enable this if indicating an 8-bit transfer without		 *  also indicating the charset causes problems. - kw */		if (use_cte && !disp_charse)		    use_cte = FALSE;#endif /* NOTDEFINED */		use_type =  (disp_charset || HTisDocumentSource());		use_mime = (use_cte || use_type);		if (use_mime) {		    fprintf(outfile_fp, "Mime-Version: 1.0\n");		    if (use_cte) {			fprintf(outfile_fp,				"Content-Transfer-Encoding: 8bit\n");		    }		}		if (HTisDocumentSource()) {		    /*		     *	Add Content-Type, Content-Location, and		     *	Content-Base headers for HTML source. - FM		     */		    fprintf(outfile_fp, "Content-Type: text/html");		    if (disp_charset != NULL) {			fprintf(outfile_fp, "; charset=%s\n",					    disp_charset);		    } else {			fprintf(outfile_fp, "\n");		    }		} else {		    /*		     *	Add Content-Type: text/plain if we have 8-bit		     *	characters and a valid charset for non-source		     *	documents. - KW		     */		    if (disp_charset != NULL) {			fprintf(outfile_fp,				"Content-Type: text/plain; charset=%s\n",				disp_charset);		    }		}		/*		 *  If we are using MIME headers, add content-base and		 *  content-location if we have them.  This will always		 *  be the case if the document is source. - kw		 */		if (use_mime) {		    if (content_base)			fprintf(outfile_fp, "Content-Base: %s\n",				content_base);		    if (content_location)			fprintf(outfile_fp, "Content-Location: %s\n",				content_location);		}		/*		 *  Add the To, Subject, and X-URL headers. - FM		 */		fprintf(outfile_fp, "To: %s\nSubject: %s\n",				     user_response, sug_filename);		fprintf(outfile_fp, "X-URL: %s\n\n", newdoc->address);		if (LYPrependBaseToSource && HTisDocumentSource()) {		    /*		     *	Added the document's base as a BASE tag to		     *	the top of the message body.  May create		     *	technically invalid HTML, but will help		     *	get any partial or relative URLs resolved		     *	properly if no BASE tag is present to		     *	replace it. - FM		     */		    fprintf(outfile_fp,			    "<!-- X-URL: %s -->\n<BASE HREF=\"%s\">\n\n",			    newdoc->address, content_base);		}		print_wwwfile_to_fd(outfile_fp, 0);		if (keypad_mode)		    printlist(outfile_fp, FALSE);#ifdef DOSPATH		sprintf(buffer, "%s -t \"%s\" -F %s", system_mail, user_response, tempfile);		fclose(outfile_fp);	/* Close the tmpfile. */		stop_curses();		printf("Sending \n\n$ %s\n\nPlease wait...", buffer);		system(buffer);		sleep(MessageSecs);		start_curses();		remove(tempfile);	/* Delete the tmpfile. */#else		pclose(outfile_fp);#endif#endif /* VMS */		break;	case TO_SCREEN:		pages = lines_in_file/(LYlines+1);		/* count fractional pages ! */		if ((lines_in_file % (LYlines+1)) > 0)		    pages++;		if (pages > 4) {		    sprintf(filename, CONFIRM_LONG_SCREEN_PRINT, pages);		    _statusline(filename);		    c=LYgetch();#ifdef VMS		    if (HadVMSInterrupt) {			HadVMSInterrupt = FALSE;			_statusline(PRINT_REQUEST_CANCELLED);			sleep(InfoSecs);			break;		    }#endif /* VMS */		    if (c == RTARROW || c == 'y' || c== 'Y'			 || c == '\n' || c == '\r') {			addstr("   Ok...");		    } else {			_statusline(PRINT_REQUEST_CANCELLED);			sleep(InfoSecs);			break;		    }		}		_statusline(PRESS_RETURN_TO_BEGIN);		*filename = '\0';		if (LYgetstr(filename, VISIBLE,			     sizeof(filename), NORECALL) < 0) {		      _statusline(PRINT_REQUEST_CANCELLED);		      sleep(InfoSecs);		      break;		}

⌨️ 快捷键说明

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