Пример #1
0
void filesel_hdd(REG8 drv) {

	UINT		num;
	OEMCHAR		*p;
const FSELPRM	*prm;
	OEMCHAR		path[MAX_PATH];

	num = drv & 0x0f;
	p = NULL;
	prm = NULL;
	if (!(drv & 0x20)) {		// SASI/IDE
		if (num < 2) {
			p = np2cfg.sasihdd[num];
			prm = &sasiprm;
		}
	}
#if defined(SUPPORT_SCSI)
	else {						// SCSI
		if (num < 4) {
			p = np2cfg.scsihdd[num];
			prm = &scsiprm;
		}
	}
#endif
#ifdef EMSCRIPTEN
	if (prm){
	  selectfile(prm, path, NELEMENTS(path), p,1,drv);
	}
#else
	if ((prm) && (selectfile(prm, path, NELEMENTS(path), p))) {
		diskdrv_sethdd(drv, path);
	}
#endif
}
Пример #2
0
void filesel_fdd(REG8 drv) {

	OEMCHAR	path[MAX_PATH];

	if (drv < 4) {
#ifdef EMSCRIPTEN
		selectfile(&fddprm, path, NELEMENTS(path), fdd_diskname(drv),0,drv);
#else
		if (selectfile(&fddprm, path, NELEMENTS(path), fdd_diskname(drv))) {
			diskdrv_setfdd(drv, path, 0);
		}
#endif
	}
}
Пример #3
0
void filesel_fdd(REG8 drv) {

	OEMCHAR	path[MAX_PATH];

	if (drv < 4) {
		if (selectfile(&fddprm, path, NELEMENTS(path), fdd_diskname(drv))) {
			diskdrv_setfdd(drv, path, 0);
		}
	}
}
Пример #4
0
int
copyout(register Ftw_t* ftw)
{
	register Archive_t*	ap = state.out;
	register File_t*	f = &ap->file;

	if (getfile(ap, f, ftw))
	{
		if (selectfile(ap, f))
		{
			f->fd = openin(ap, f);
			deltaout(NiL, ap, f);
		}
		else
			ftw->status = FTW_SKIP;
	}
	return 0;
}
Пример #5
0
void
copyin(register Archive_t* ap)
{
	register File_t*	f = &ap->file;

	deltabase(ap);
	while (getprologue(ap))
	{
		while (getheader(ap, f))
		{
			if (selectfile(ap, f))
				filein(ap, f);
			else
				fileskip(ap, f);
			if (ap->info)
				ap->info->checksum = ap->memsum;
			gettrailer(ap, f);
		}
		if (!getepilogue(ap))
			break;
	}
	deltaverify(ap);
}
Пример #6
0
Файл: PIC.C Проект: kytulendu/TW
void insertgraph( ) {
	int i;
	char graphname[30];

	notavailable( ); /* comment this out */

	storeline( curline );

	blockmsg( 5 );
	dispstrhgc( "ãÊèª×èÍá¿éÁÃÙ»ÀÒ¾·Õèµéͧ¡ÒÃÍèÒ¹ :", ( 14 + center_factor ) + 3, 6, REVERSEATTR );

	strcpy( graphname, "*.*" );
	i = getname( graphname,  ( 14 + center_factor ) + 28, 5, 22, REVERSEATTR );
	if ( ( i == YES ) && ( graphname[0] != '\0' ) ) {
		if ( havewild( graphname ) ) {
			selectfile( graphname );
		}
		curline->graph = readgraph( graphname );
	}
	changeflag = YES;
	pagecomplete = NO;
	loadtoline( curline->text );
}
Пример #7
0
int main(void)
{
   int firmver;
   char eingabe[20];
   char *file;
   char row, col, row2, col2;
   long int *ticker;
   struct padtime mytime;
   char seribyte;

   eingabe[0] = 0; 
   firmver=padgetversion();

   SNDCHAL = 50;
   SNDCHAH = 30;

   ticker = padgetticker();
   printf("Ticker is: %li\n", *ticker);
   
   padgettime(&mytime);
   printf("Address is: %u\n", (unsigned int)mytime);
   printf("Date: %i.%i. Time is %i:%i:%i\n", mytime.month, mytime.date, mytime.hour, mytime.minute, mytime.second);

   while(1) 
   {
    while(!padserialwaiting());
    printf("Serial data waiting...\n");   
    padinserial(&seribyte);
    printf("Byte: %02x\n", seribyte);
    padoutserial(seribyte + 1);
   }

   getchar();

   // txtsetwindow(10,1,50,6);
   if(txtgetwindow(&col, &row, &col2, &row2))
   {
     printf("The window coordinates are (%i,%i) - (%i,%i)\n", col, row, col2, row2);
   }
   
   
   txtoutput(65);
   txtwrchar(66);
   
   printf("Current Time: %s\n", dasciitime);
   txtsetcursor(1,1);
   printf("C on the Amstrad Notepad, Build %i\n", BUILD);
   txtboldon();
   printf("Your firmware version is: %i, mmu0 is %02X\n", firmver,copyofmmu0);
   txtboldoff();
   printf("Please enter your name:");
   kmcharreturn(65);
   txtcuroff();
   if (editbuf(eingabe, 20, EDITBUF_DOTTY))
   {
    txtgetcursor(&col, &row);
    printf("\nYour name is %s and the cursor was at (%i, %i)\n", eingabe, col, row);
   }
   else
   {
    printf("\nOk, you're to shy!\n");
   }
   txtcuron();
   getchar();
   
   txtclearwindow();
   printf("\nPress any key to continue");
   kmsettickcount(0,0);
   kmwaitkbd();
   col1();
   printf("Press a key to quit!");
   kmwaitkbd();
   file = selectfile();
   if (file == NULL) {
    printf("Don't you want to view a file?\n");
   } else {
    printf("Your file was %s!\n", file);
   }
   
   kmwaitkbd();
   // getchar();
   
   return 0;
}
Пример #8
0
int
copyinout(Ftw_t* ftw)
{
	register File_t*	f = &state.out->file;
	register char*		s;
	register off_t		c;
	register ssize_t	n;
	register int		rfd;
	register int		wfd;

	if (getfile(state.out, f, ftw) && selectfile(state.out, f))
	{
		s = f->name;
		f->name = stash(&state.out->path.copy, NiL, state.pwdlen + f->namesize);
		strcpy(stpcpy(f->name, state.pwd), s + (*s == '/'));
		if ((wfd = openout(state.out, f)) >= 0)
		{
			if ((rfd = openin(state.out, f)) >= 0)
			{
#if defined(SEEK_DATA) && defined(SEEK_HOLE)
				off_t		data;
				off_t		hole;
				int		more;

				data = 0;
				more = 1;
				while (more)
				{
					if ((hole = lseek(rfd, data, SEEK_HOLE)) < data)
					{
						hole = lseek(rfd, 0, SEEK_END);
						more = 0;
					}
					while ((c = hole - data) > 0)
					{
						if (c > state.buffersize)
							c = state.buffersize;
						if (lseek(rfd, data, SEEK_SET) != data || (n = read(rfd, state.tmp.buffer, (size_t)c)) <= 0)
						{
							error(ERROR_SYSTEM|2, "%s: read error", f->name);
							more = 0;
							break;
						}
						if (lseek(wfd, data, SEEK_SET) != data || write(wfd, state.tmp.buffer, n) != n)
						{
							error(ERROR_SYSTEM|2, "%s: write error", f->name);
							more = 0;
							break;
						}
						state.out->io->count += n;
						data += n;
					}
					if (!more)
						break;
					if ((data = lseek(rfd, hole, SEEK_DATA)) < hole)
					{
						if ((data = lseek(rfd, -1, SEEK_END)) < 0 || (data + 1) > hole && (lseek(wfd, data, SEEK_SET) != data || write(wfd, "", 1) != 1))
							error(ERROR_SYSTEM|2, "%s: write error", f->name);
						state.out->io->count += 1;
						break;
					}
				}
#else
				holeinit(wfd);
				for (c = f->st->st_size; c > 0; c -= n)
				{
					if ((n = read(rfd, state.tmp.buffer, (size_t)((c > state.buffersize) ? state.buffersize : c))) <= 0)
					{
						error(ERROR_SYSTEM|2, "%s: read error", f->name);
						break;
					}
					if (holewrite(wfd, state.tmp.buffer, n) != n)
					{
						error(ERROR_SYSTEM|2, "%s: write error", f->name);
						break;
					}
					state.out->io->count += n;
				}
				holedone(wfd);
#endif
				closeout(state.out, f, wfd);
				closein(state.out, f, rfd);
				setfile(state.out, f);
				listentry(f);
			}
			else
				closeout(state.out, f, wfd);
		}
		else if (wfd != -1)
			listentry(f);
	}
	return 0;
}