コード例 #1
0
ファイル: rtpgui.c プロジェクト: layerfsd/cifssmb
/** @memo   Prompt the user for input.

    @doc    Displays a prompt and retrieve keyboard input from the user.

    @return Nothing
*/
void rtp_gui_prompt_text(char *indent /** String of spaces used to indent before prompt. */,
char *prompt,/** Prompt to display */
char *inbuffer/** Input goes here. Not length checked so use large buffers. */)
{
	rtp_printf("%s %s :", indent, prompt);
	rtp_term_gets(inbuffer);
	rtp_printf("\n");
}
コード例 #2
0
/* int rtfs_sys_callback(int cb_code, void *pvargs)

   System service callback function. This callback provides the functionality previously provided by
   functions in the porting file, portkern.c. They were moved to the application callback layer so
   they can be adjusted at run time without the need for rebuilding the Rtfs library. */
int rtfs_sys_callback(int cb_code, void *pvargs)
{
	switch (cb_code) {

		case RTFS_CBS_INIT:
			/* This callback is made by pc_ertfs_init before any other callbacks are made or any operating system porting layer functions are called.
			   System initializations like opening the terminal window may be performed by the handler. */
		break;
		case RTFS_CBS_PUTS:
			/* use printf to print a line to the console, cputs() or a low level line output driver will work as well */
                        rtp_term_cputs ((const char *)pvargs);
//			rtp_printf("%s",(char *)pvargs);
		break;
		case RTFS_CBS_GETS:
			/* use gets() to retrieve a line from the console, low level line input driver will work as well */
                        rtp_term_gets ((char *) pvargs);
                        break;
		case RTFS_CBS_GETDATE:
			/* Call a static funtion (see below) to populate the file timestamp function.
			   Modify pc_get_system_date() for your systems calendar support function */
			pc_get_system_date((DATESTR *) pvargs);
		break;
		case RTFS_CBS_10MSINCREMENT:
			*((byte *)pvargs) = 0;
		break;

		case RTFS_CBS_UTCOFFSET:
			*((byte *)pvargs) = 0xf0; /* Eastern time zone US */
		break;


		case RTFS_CBS_POLL_DEVICE_READY:
			/* Poll the device driver. If the system does not have interrupt driven inser / remove events polling may be done here */
          /* Callback is still supplied but not needed if pc_rtfs_register_poll_devices_ready_handler is called by the device driver initialization code instead */
		break;
#if (INCLUDE_EXFAT)	  /* Exfat buffer allocation */
		case RTFS_CBS_GETEXFATBUFFERS:
		{
		EXFATMOUNTPARMS *pexfm = (EXFATMOUNTPARMS *) pvargs;
		BOOLEAN good = TRUE;

			pexfm->BitMapBufferCore = (void *) 0;
			pexfm->BitMapBufferControlCore = (void *) 0;
			pexfm->UpCaseBufferCore = (void *) 0;
			pexfm->BitMapBufferPageSizeSectors = 1;

			/* Returning exactly what he asked for for now */
			pexfm->BitMapBufferSizeSectors = pexfm->BitMapSizeSectors;
			/* Truncate the bitmap size to 64 sectors (32K typically)
			   remove this check to store the whole free bitmap in memory at all times.
			 */
			if (pexfm->BitMapBufferSizeSectors > 64)
			{
				pexfm->BitMapBufferSizeSectors = 64;
			}
			/* Allocate buffers, make sure both worked and clean up if not */
			pexfm->BitMapBufferCore = (void *) rtfs_port_malloc(pexfm->SectorSizeBytes*pexfm->BitMapBufferSizeSectors);
			/* Allocate enough control structures for one sector per page */
			if (!pexfm->BitMapBufferCore)
				good = FALSE;
			if (good)
			{
				pexfm->BitMapBufferControlCore = (void *) rtfs_port_malloc(sizeof(FATBUFF)*pexfm->BitMapSizeSectors/pexfm->BitMapBufferPageSizeSectors);
				if (!pexfm->BitMapBufferControlCore)
					good = FALSE;
			}
			/*
				Rtfs will not request uCtable memory if the volume contains the standard recommended table. It will instead use an internally compiled
				version of the expanded table.
				If rtfs does requeest memory it will request 128 K in pexfm->UpcaseSizeBytes.
				We can return NULL to force using only the 128 word mandatory table.
			*/

			if (good && pexfm->UpcaseSizeBytes)
			{
				pexfm->UpCaseBufferCore = (void *) rtfs_port_malloc(pexfm->UpcaseSizeBytes);
				if (!pexfm->UpCaseBufferCore)
					good = FALSE;
			}

			if (!good)
			{
				if (pexfm->BitMapBufferCore)
					rtfs_port_free(pexfm->BitMapBufferCore);
				if (pexfm->BitMapBufferControlCore)
					rtfs_port_free(pexfm->BitMapBufferControlCore);
				if (pexfm->UpCaseBufferCore)
					rtfs_port_free(pexfm->UpCaseBufferCore);
				pexfm->BitMapBufferCore = (void *) 0;
				pexfm->BitMapBufferControlCore = (void *) 0;
				pexfm->UpCaseBufferCore = (void *) 0;
			}
		}
		break;
		case RTFS_CBS_RELEASEEXFATBUFFERS:
		{
		EXFATMOUNTPARMS *pexfm = (EXFATMOUNTPARMS *) pvargs;
			if (pexfm->BitMapBufferCore)
				rtfs_port_free(pexfm->BitMapBufferCore);
			if (pexfm->BitMapBufferControlCore)
				rtfs_port_free(pexfm->BitMapBufferControlCore);
			if (pexfm->UpCaseBufferCore)
				rtfs_port_free(pexfm->UpCaseBufferCore);
			pexfm->BitMapBufferCore = (void *) 0;
			pexfm->BitMapBufferControlCore = (void *) 0;
			pexfm->UpCaseBufferCore = (void *) 0;
		}
		break;
#endif
	}
	return(0);
}