OMX_ERRORTYPE V4lRender::RenderSetConfig(
    OMX_INDEXTYPE nParamIndex,
    OMX_PTR pStructure)
{
	OMX_ERRORTYPE ret = OMX_ErrorNone;

	switch (nParamIndex)
	{
	case OMX_IndexConfigCommonOutputCrop:
	{
		OMX_CONFIG_RECTTYPE *pRect;
		pRect = (OMX_CONFIG_RECTTYPE*)pStructure;
		CHECK_STRUCT(pRect, OMX_CONFIG_RECTTYPE, ret);
		fsl_osal_memcpy(&sRectOut, pRect, sizeof(OMX_CONFIG_RECTTYPE));
		SetDeviceDisplayRegion();
	}
	break;
	case OMX_IndexConfigCaptureFrame:
	{
		OMX_CONFIG_CAPTUREFRAME *pCapture;
		pCapture = (OMX_CONFIG_CAPTUREFRAME*)pStructure;
		CHECK_STRUCT(pCapture, OMX_CONFIG_CAPTUREFRAME, ret);
		sCapture.eType = pCapture->eType;
		sCapture.pBuffer = pCapture->pBuffer;
		bCaptureFrameDone = OMX_FALSE;
		if (sCapture.eType == CAP_SNAPSHOT)
		{
			CaptureFrame(EnqueueBufferIdx);
			bCaptureFrameDone = OMX_TRUE;
		}
	}
	break;
	case OMX_IndexOutputMode:
	{
		OMX_CONFIG_OUTPUTMODE *pOutputMode;
		pOutputMode = (OMX_CONFIG_OUTPUTMODE*)pStructure;
		CHECK_STRUCT(pOutputMode, OMX_CONFIG_OUTPUTMODE, ret);
		fsl_osal_memcpy(&sOutputMode, pOutputMode, sizeof(OMX_CONFIG_OUTPUTMODE));
//                AdjustCropIn(&sOutputMode.sRectIn);
		SetOutputMode();
	}
	break;
	case OMX_IndexSysSleep:
	{
		OMX_CONFIG_SYSSLEEP *pStreamOff;
		pStreamOff = (OMX_CONFIG_SYSSLEEP *)pStructure;
		CHECK_STRUCT(pStreamOff, OMX_CONFIG_SYSSLEEP, ret);
		if (pStreamOff->bSleep)
			V4lStreamOff(OMX_TRUE);
		else
			V4lStreamOnInPause();
	}
	break;
	default:
		ret = OMX_ErrorUnsupportedIndex;
		break;
	}

	return ret;
}
void mi::MDKInit(CMachineDataInput * const pi)
{
	SetOutputMode( true );
	Vol=100;
	Left=100;
	Right=100;
	Mute=false;
	
}
void mi::MDKInit(CMachineDataInput * const pi)
{
	SetOutputMode( true );
	Fade=0;
	Length=8;
	Type=0;
	count=0;
	Unit=0;
	Trigger=false;
	

}
Example #4
0
void mi::MDKInit(CMachineDataInput * const pi)
{
            SetOutputMode( true ); // No mono sounds
            leftgain = 1.0f;
            middlegain = 1.0f;
            rightgain = 1.0f;

            valve = (254.0f - 127.0f)/254.0f;
            antivalve = (127.0f)/254.0f;

            type = 0;
}
Example #5
0
void CSerialPDD::SetDefaultConfiguration()
{
    // Default Value. Can be altered.
    m_CommPorp.wPacketLength       = 0xffff;
    m_CommPorp.wPacketVersion      = 0xffff;
    m_CommPorp.dwServiceMask       = SP_SERIALCOMM;
    m_CommPorp.dwReserved1         = 0;
    m_CommPorp.dwMaxTxQueue        = 16;
    m_CommPorp.dwMaxRxQueue        = 16;
    m_CommPorp.dwMaxBaud           = BAUD_115200;
    m_CommPorp.dwProvSubType       = PST_RS232;
    m_CommPorp.dwProvCapabilities  =
        PCF_DTRDSR | PCF_RLSD | PCF_RTSCTS |
        PCF_SETXCHAR |
        PCF_INTTIMEOUTS |
        PCF_PARITY_CHECK |
        PCF_SPECIALCHARS |
        PCF_TOTALTIMEOUTS |
        PCF_XONXOFF;
    m_CommPorp.dwSettableBaud      =
        BAUD_075 | BAUD_110 | BAUD_150 | BAUD_300 | BAUD_600 |
        BAUD_1200 | BAUD_1800 | BAUD_2400 | BAUD_4800 |
        BAUD_7200 | BAUD_9600 | BAUD_14400 |
        BAUD_19200 | BAUD_38400 | BAUD_56K | BAUD_128K |
        BAUD_115200 | BAUD_57600 | BAUD_USER;
    m_CommPorp.dwSettableParams    =
        SP_BAUD | SP_DATABITS | SP_HANDSHAKING | SP_PARITY |
        SP_PARITY_CHECK | SP_RLSD | SP_STOPBITS;
    m_CommPorp.wSettableData       =
        DATABITS_5 | DATABITS_6 | DATABITS_7 | DATABITS_8;
    m_CommPorp.wSettableStopParity =
        STOPBITS_10 | STOPBITS_20 |
        PARITY_NONE | PARITY_ODD | PARITY_EVEN | PARITY_SPACE |
        PARITY_MARK;
    // Setup m_DCB.
    
    // Set Detault Parameter.
    SetOutputMode(FALSE, TRUE );    // No IR.
    // For DCB. The PDD only need to take care BaudRate, ByteSize Parity & StopBit
    m_DCB.DCBlength  = sizeof(DCB);
    SetBaudRate(m_DCB.BaudRate   = 9600,FALSE);
    SetByteSize(m_DCB.ByteSize   = 8);
    SetParity(m_DCB.Parity     = NOPARITY);
    SetStopBits(m_DCB.StopBits   = ONESTOPBIT);
    
}
Example #6
0
static void SetLaserMode(void) {
    SetOutputMode(6);
}
Example #7
0
static void SetColourMode(void) {
    SetOutputMode(5);
}
Example #8
0
static void SetLabelMode(void) {
    SetOutputMode(4);
}
Example #9
0
static void SetThresholdMode(void) {
    SetOutputMode(3);
}
Example #10
0
static void SetSobelMode(void) {
    SetOutputMode(2);
}
static void send_file_to_printer(DocInfo *newdoc,
				 char *content_base,
				 char *sug_filename,
				 int printer_number)
{
    BOOLEAN FirstRecall = TRUE;
    FILE *outfile_fp;
    char *the_command = 0;
    bstring *my_file = NULL;
    char my_temp[LY_MAXPATH];
    int FnameTotal, FnameNum = -1;
    lynx_list_item_type *cur_printer;

    outfile_fp = LYOpenTemp(my_temp,
			    (HTisDocumentSource())
			    ? HTML_SUFFIX
			    : TEXT_SUFFIX,
			    "w");
    if (outfile_fp == NULL) {
	CannotPrint(FILE_ALLOC_FAILED);
    }

    if (LYPrependBaseToSource && HTisDocumentSource()) {
	/*
	 * Added the document's base as a BASE tag 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\n",
		newdoc->address, content_base);
    }
    print_wwwfile_to_fd(outfile_fp, FALSE, FALSE);	/* PRINTER */
    if (keypad_mode)
	printlist(outfile_fp, FALSE);

    LYCloseTempFP(outfile_fp);

    /* find the right printer number */
    {
	int count = 0;

	for (cur_printer = printers;
	     count < printer_number;
	     count++, cur_printer = cur_printer->next) ;	/* null body */
    }

    /*
     * Commands have the form "command %s [%s] [etc]" where %s is the filename
     * and the second optional %s is the suggested filename.
     */
    if (cur_printer->command == NULL) {
	CannotPrint(PRINTER_MISCONF_ERROR);
    }

    /*
     * Check for two '%s' and ask for the second filename argument if there
     * is.
     */
    BStrCopy0(my_file, "");
    if (HTCountCommandArgs(cur_printer->command) >= 2) {
	_statusline(FILENAME_PROMPT);
      again:
	SetupFilename(&my_file, sug_filename);
      check_again:
	switch (RecallFilename(&my_file, &FirstRecall, &FnameNum,
			       &FnameTotal, PRINT_FLAG)) {
	case FN_INIT:
	    goto again;
	case FN_READ:
	    goto check_again;
	case FN_QUIT:
	    goto done;
	default:
	    break;
	}

	if (no_dotfiles || !show_dotfiles) {
	    if (*LYPathLeaf(my_file->str) == '.') {
		HTAlert(FILENAME_CANNOT_BE_DOT);
		_statusline(NEW_FILENAME_PROMPT);
		FirstRecall = TRUE;
		FnameNum = FnameTotal;
		goto again;
	    }
	}
	/*
	 * Cancel if the user entered "/dev/null" on Unix, or an "nl:" path
	 * on VMS.  - FM
	 */
	if (LYIsNullDevice(my_file->str)) {
	    CancelPrint(PRINT_REQUEST_CANCELLED);
	}
	HTAddSugFilename(my_file->str);
    }
#ifdef SH_EX			/* 1999/01/04 (Mon) 09:37:03 */
    HTAddParam(&the_command, cur_printer->command, 1, my_temp);
    if (!isBEmpty(my_file)) {
	HTAddParam(&the_command, cur_printer->command, 2, my_file->str);
	HTEndParam(&the_command, cur_printer->command, 3);
    } else {
	HTEndParam(&the_command, cur_printer->command, 2);
    }
#else
    HTAddParam(&the_command, cur_printer->command, 1, my_temp);
    HTAddParam(&the_command, cur_printer->command, 2, my_file->str);
    HTEndParam(&the_command, cur_printer->command, 2);
#endif

    /*
     * Move the cursor to the top of the screen so that output from system'd
     * commands don't scroll up the screen.
     */
    LYmove(1, 1);

    stop_curses();
    CTRACE((tfp, "command: %s\n", the_command));
    SetOutputMode(O_TEXT);
    printf(PRINTING_FILE);
    /*
     * Set various bits of document information as environment variables, for
     * use by external print scripts/etc.  On UNIX, We assume there are values,
     * and leave NULL value checking up to the external PRINTER:  cmd/script -
     * KED
     */
    SET_ENVIRON(LYNX_PRINT_TITLE, HText_getTitle(), "No Title");
    SET_ENVIRON(LYNX_PRINT_URL, newdoc->address, "No URL");
    SET_ENVIRON(LYNX_PRINT_DATE, HText_getDate(), "No Date");
    SET_ENVIRON(LYNX_PRINT_LASTMOD, HText_getLastModified(), "No LastMod");

    LYSystem(the_command);
    FREE(the_command);
    (void) LYRemoveTemp(my_temp);

    /*
     * Remove the various LYNX_PRINT_xxxx logicals.  - KED
     * [could use unsetenv(), but it's not portable]
     */
    SET_ENVIRON(LYNX_PRINT_TITLE, "", "");
    SET_ENVIRON(LYNX_PRINT_URL, "", "");
    SET_ENVIRON(LYNX_PRINT_DATE, "", "");
    SET_ENVIRON(LYNX_PRINT_LASTMOD, "", "");

    fflush(stdout);
#ifndef VMS
    signal(SIGINT, cleanup_sig);
#endif /* !VMS */
#ifdef SH_EX
    fprintf(stdout, gettext(" Print job complete.\n"));
    fflush(stdout);
#endif
    SetOutputMode(O_BINARY);
    LYSleepMsg();
    start_curses();

  done:			/* send_file_to_printer() */
    BStrFree(my_file);
    return;
}
Example #12
0
/*
 * Interrupt handler.  Stop curses and exit gracefully.
 */
void cleanup_sig(int sig)
{
#ifdef IGNORE_CTRL_C
    if (sig == SIGINT) {
	/*
	 * Need to rearm the signal.
	 */
#ifdef DJGPP
	if (wathndlcbrk) {
	    sig_handler_watt(sig);	/* Use WATT-32 signal handler */
	}
#endif /* DJGPP */
	signal(SIGINT, cleanup_sig);
	sigint = TRUE;
#ifdef DJGPP
	_eth_release();
	_eth_init();
#endif /* DJGPP */
	return;
    }
#endif /* IGNORE_CTRL_C */

#ifdef VMS
    if (!dump_output_immediately) {
	int c;

	/*
	 * Reassert the AST.
	 */
	(void) signal(SIGINT, cleanup_sig);
	if (!LYCursesON)
	    return;

	/*
	 * Refresh screen to get rid of "cancel" message, then query.
	 */
	lynx_force_repaint();
	LYrefresh();

	/*
	 * Ask if exit is intended.
	 */
	if (LYQuitDefaultYes == TRUE) {
	    c = HTConfirmDefault(REALLY_EXIT, YES);
	} else {
	    c = HTConfirmDefault(REALLY_EXIT, NO);
	}
	HadVMSInterrupt = TRUE;
	if (LYQuitDefaultYes == TRUE) {
	    if (c == NO) {
		return;
	    }
	} else if (c != YES) {
	    return;
	}
    }
#endif /* VMS */

    /*
     * Ignore further interrupts.  - mhc:  11/2/91
     */
#ifndef NOSIGHUP
    (void) signal(SIGHUP, SIG_IGN);
#endif /* NOSIGHUP */

#ifdef VMS
    /*
     * Use ttclose() from cleanup() for VMS if not dumping.
     */
    if (dump_output_immediately)
#else /* Unix: */
    (void) signal(SIGINT, SIG_IGN);
#endif /* VMS */

    (void) signal(SIGTERM, SIG_IGN);

    if (traversal)
	dump_traversal_history();

#ifndef NOSIGHUP
    if (sig != SIGHUP) {
#endif /* NOSIGHUP */

	if (!dump_output_immediately) {
	    /*
	     * cleanup() also calls cleanup_files().
	     */
	    cleanup();
	}
	if (sig != 0) {
	    SetOutputMode(O_TEXT);
	    printf("\n\n%s %d\n\n",
		   gettext("Exiting via interrupt:"),
		   sig);
	    fflush(stdout);
	}
#ifndef NOSIGHUP
    } else {
	cleanup_files();
    }
#endif /* NOSIGHUP */

    if (sig != 0) {
	exit_immediately(EXIT_SUCCESS);
    } else {
	reset_signals();
    }
}
static void send_file_to_screen(DocInfo *newdoc,
				char *content_base,
				int Lpansi)
{
    FILE *outfile_fp;
    bstring *prompt = NULL;

    if (Lpansi) {
	_statusline(CHECK_PRINTER);
    } else {
	_statusline(PRESS_RETURN_TO_BEGIN);
    }

    BStrCopy0(prompt, "");
    if (LYgetBString(&prompt, FALSE, 0, NORECALL) < 0) {
	CancelPrint(PRINT_REQUEST_CANCELLED);
    } else {
	outfile_fp = stdout;

	stop_curses();
	SetOutputMode(O_TEXT);

#ifndef VMS
	signal(SIGINT, SIG_IGN);
#endif /* !VMS */

	if (LYPrependBaseToSource && HTisDocumentSource()) {
	    /*
	     * Added the document's base as a BASE tag 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\n",
		    newdoc->address, content_base);
	}
	if (Lpansi)
	    printf("\033[5i");
	print_wwwfile_to_fd(outfile_fp, FALSE, FALSE);	/* SCREEN */
	if (keypad_mode)
	    printlist(outfile_fp, FALSE);

#ifdef VMS
	if (HadVMSInterrupt) {
	    HadVMSInterrupt = FALSE;
	    start_curses();
	    CancelPrint(PRINT_REQUEST_CANCELLED);
	}
#endif /* VMS */
	if (Lpansi) {
	    printf("\n\014");	/* Form feed */
	    printf("\033[4i");
	    fflush(stdout);	/* refresh to screen */
	} else {
	    fprintf(stdout, "\n\n%s", PRESS_RETURN_TO_FINISH);
	    fflush(stdout);	/* refresh to screen */
	    (void) LYgetch();	/* grab some user input to pause */
#ifdef VMS
	    HadVMSInterrupt = FALSE;
#endif /* VMS */
	}
#ifdef SH_EX
	fprintf(stdout, "\n");
#endif
	SetOutputMode(O_BINARY);
	start_curses();
    }

  done:			/* send_file_to_screen() */
    BStrFree(prompt);
    return;
}
Example #14
0
static void SetFlood1Mode(void) {
    SetOutputMode(7);
}
Example #15
0
static void SetPassthroughMode(void) {
    SetOutputMode(0);
}
Example #16
0
static void SetFlood2Mode(void) {
    SetOutputMode(8);
}
Example #17
0
static void SetGrayscaleMode(void) {
    SetOutputMode(1);
}
Example #18
0
PUBLIC int LYSendMailFile ARGS5(
    char *,	the_address,
    char *,	the_filename,
    char *,	the_subject GCC_UNUSED,
    char *,	the_ccaddr GCC_UNUSED,
    char *,	message)
{
    char *cmd = NULL;
#ifdef __DJGPP__
    char *shell;
#endif /* __DJGPP__ */
    int code;

    if (!LYSystemMail())
	return 0;

#if USE_BLAT_MAILER
    if (mail_is_blat)
	StrAllocCopy(cmd,
		blat_cmd(
		    system_mail,
		    the_filename,
		    the_address,
		    the_subject,
		    the_ccaddr,
		    personal_mail_address
		)
	);
    else
#endif
#ifdef __DJGPP__
	if ((shell = LYGetEnv("SHELL")) != NULL) {
	    if (strstr(shell, "sh") != NULL) {
		HTSprintf0(&cmd, "%s -c %s -t \"%s\" -F %s",
			   shell,
			   system_mail,
			   the_address,
			   the_filename);
	    } else {
		HTSprintf0(&cmd, "%s /c %s -t \"%s\" -F %s",
			   shell,
			   system_mail,
			   the_address,
			   the_filename);
	    }
	} else {
	    HTSprintf0(&cmd, "%s -t \"%s\" -F %s",
		       system_mail,
		       the_address,
		       the_filename);
	}
#else
	HTSprintf0(&cmd, "%s -t \"%s\" -F %s",
		   system_mail,
		   the_address,
		   the_filename);
#endif /* __DJGPP__ */

    stop_curses();
    SetOutputMode(O_TEXT);
    printf("%s\n\n$ %s\n\n%s",
	   *message ? message : gettext("Sending"),
	   cmd, PLEASE_WAIT);
    code = LYSystem(cmd);
    LYSleepMsg();
    start_curses();
    SetOutputMode( O_BINARY );

    FREE(cmd);

    return code;
}
static void send_file_to_mail(DocInfo *newdoc,
			      char *content_base,
			      char *content_location)
{
    static BOOLEAN first_mail_preparsed = TRUE;

#if USE_VMS_MAILER
    BOOLEAN isPMDF = LYMailPMDF();
    FILE *hfd;
    char hdrfile[LY_MAXPATH];
#endif
    BOOL use_mime;

#if !CAN_PIPE_TO_MAILER
    char my_temp[LY_MAXPATH];
#endif

    BOOL use_cte;
    BOOL use_type;
    const char *disp_charset;
    FILE *outfile_fp;
    char *buffer = NULL;
    char *subject = NULL;
    bstring *user_response = NULL;

    if (!LYSystemMail())
	return;

    if (LYPreparsedSource && first_mail_preparsed &&
	HTisDocumentSource()) {
	if (HTConfirmDefault(CONFIRM_MAIL_SOURCE_PREPARSED, NO) == YES) {
	    LYaddstr("   Ok...");
	    first_mail_preparsed = FALSE;
	} else {
	    CancelPrint(MAIL_REQUEST_CANCELLED);
	}
    }

    _statusline(MAIL_ADDRESS_PROMPT);
    BStrCopy0(user_response, NonNull(personal_mail_address));
    if (LYgetBString(&user_response, FALSE, 0, RECALL_MAIL) < 0 ||
	isBEmpty(user_response)) {
	CancelPrint(MAIL_REQUEST_CANCELLED);
    }

    /*
     * 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;
#if USE_VMS_MAILER
	use_cte = FALSE;
#endif
    }
#if USE_VMS_MAILER
    use_type = (BOOL) (disp_charset || HTisDocumentSource());
#endif

    /*
     * Use newdoc->title as a subject instead of sug_filename:  MORE readable
     * and 8-bit letters shouldn't be a problem - LP
     */
    /* change_sug_filename(sug_filename); */
    subject = subject_translate8bit(newdoc->title);

    if (newdoc->isHEAD) {
	/*
	 * Special case for mailing HEAD responce:  this is rather technical
	 * information, show URL.
	 */
	FREE(subject);
	StrAllocCopy(subject, "HEAD  ");
	StrAllocCat(subject, newdoc->address);
    }
#if USE_VMS_MAILER
    if (StrChr(user_response->str, '@') &&
	!StrChr(user_response->str, ':') &&
	!StrChr(user_response->str, '%') &&
	!StrChr(user_response->str, '"')) {
	char *temp = 0;

	HTSprintf0(&temp, mail_adrs, user_response->str);
	BStrCopy0(user_response, temp);
	FREE(temp);
    }

    outfile_fp = LYOpenTemp(my_temp,
			    (HTisDocumentSource())
			    ? HTML_SUFFIX
			    : TEXT_SUFFIX,
			    "w");
    if (outfile_fp == NULL) {
	CannotPrint(UNABLE_TO_OPEN_TEMPFILE);
    }

    if (isPMDF) {
	if ((hfd = LYOpenTemp(hdrfile, TEXT_SUFFIX, "w")) == NULL) {
	    CannotPrint(UNABLE_TO_OPEN_TEMPFILE);
	}
	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);
	/*
	 * For PMDF, put the subject in the header file and close it.  - FM
	 */
	fprintf(hfd, "Subject: %.70s\n\n", subject);
	LYCloseTempFP(hfd);
    }

    /*
     * 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, TRUE, FALSE);	/* MAIL */
    if (keypad_mode)
	printlist(outfile_fp, FALSE);
    LYCloseTempFP(outfile_fp);

    buffer = NULL;
    if (isPMDF) {
	/*
	 * Now set up the command.  - FM
	 */
	HTSprintf0(&buffer,
		   "%s %s %s,%s %s",
		   system_mail,
		   system_mail_flags,
		   hdrfile,
		   my_temp,
		   user_response->str);
    } else {
	/*
	 * For "generic" VMS MAIL, include the subject in the command.  - FM
	 */
	remove_quotes(subject);
	HTSprintf0(&buffer,
		   "%s %s/subject=\"%.70s\" %s %s",
		   system_mail,
		   system_mail_flags,
		   subject,
		   my_temp,
		   user_response->str);
    }

    stop_curses();
    SetOutputMode(O_TEXT);
    printf(MAILING_FILE);
    LYSystem(buffer);
    LYSleepAlert();
    start_curses();
    SetOutputMode(O_BINARY);

    if (isPMDF)
	(void) LYRemoveTemp(hdrfile);
    (void) LYRemoveTemp(my_temp);
#else /* !VMS (Unix or DOS) */

#if CAN_PIPE_TO_MAILER
    outfile_fp = LYPipeToMailer();
#else
    outfile_fp = LYOpenTemp(my_temp, TEXT_SUFFIX, "w");
#endif
    if (outfile_fp == NULL) {
	CannotPrint(MAIL_REQUEST_FAILED);
    }

    /*
     * 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 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 unofficial "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_charset)
	use_cte = FALSE;
#endif /* NOTDEFINED */
    use_type = (BOOL) (disp_charset || HTisDocumentSource());
    use_mime = (BOOL) (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->str, subject);
    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, TRUE, FALSE);	/* MAIL */
    if (keypad_mode)
	printlist(outfile_fp, FALSE);

#if CAN_PIPE_TO_MAILER
    pclose(outfile_fp);
#else
    LYCloseOutput(outfile_fp);
    LYSendMailFile(user_response->str,
		   my_temp,
		   subject,
		   "",
		   "");
    (void) LYRemoveTemp(my_temp);	/* Delete the tmpfile. */
#endif /* CAN_PIPE_TO_MAILER */
#endif /* USE_VMS_MAILER */

  done:			/* send_file_to_mail() */
    BStrFree(user_response);
    FREE(buffer);
    FREE(subject);
    return;
}