コード例 #1
0
VOID ShowError(Object *application, Object *window, CONST_STRPTR message, BOOL useIOError)
{
    TEXT   buffer[128];
    STRPTR newline = "\n",
           period  = ".",
           extra   = buffer;
           
    /* Never use IO error if it is 0 */
    if (IoErr() == 0) useIOError = FALSE;
    
    if (useIOError)
    {
        Fault(IoErr(), NULL, buffer, sizeof(buffer));
        buffer[0] = toupper(buffer[0]);
    }
    else
    {
        newline = "";
        period  = "";
        extra   = "";
    }
            
    MUI_Request
    (
        application, window, 0, _(MSG_TITLE), _(MSG_ERROR_OK), 
        "%s:\n%s%s%s%s", _(MSG_ERROR_HEADER), message, newline, extra, period
    );
}
コード例 #2
0
ファイル: support.c プロジェクト: michalsc/AROS
struct DosList *MyMakeDosEntry(struct Handler *handler, const TEXT *name, LONG type)
{
   struct DosList *entry;
   LONG error = 0;

   entry = AllocMem(sizeof(struct DosList), MEMF_CLEAR | MEMF_PUBLIC);

   if(entry != NULL)
   {
      if(!MyRenameDosEntry(handler, entry, name))
         error = IoErr();
      entry->dol_Type = type;
   }
   else
      error = IoErr();

   if(error != 0)
   {
      MyFreeDosEntry(handler, entry);
      entry = NULL;
   }

   SetIoErr(error);
   return entry;
}
コード例 #3
0
ファイル: fread.c プロジェクト: michalsc/AROS
int main()
{
    LONG result = 0;
    LONG ioerr = 0;
    TEXT buffer[16];

    fh = Open("T:a", MODE_NEWFILE);

    /* Invalid parameters */
    SetIoErr(0);
    result = FRead(fh, buffer, 0, 0);
    ioerr = IoErr();
    TEST((result == 0));
    TEST((ioerr == 0));

    /* EOF */
    SetIoErr(0);
    result = FRead(fh, buffer, 1, 1);
    ioerr = IoErr();
    TEST((result == 0));
    TEST((ioerr == 0));

    /* BNULL file handle */
    SetIoErr(0);
    result = FRead(BNULL, buffer, 1, 1);
    ioerr = IoErr();
    TEST((result == 0));
    TEST((ioerr == 0));

    cleanup();

    return OK;
}
コード例 #4
0
int main(void) {
  ARP2_SysCallBase = OpenResource(ARP2_SYSCALL_NAME);

  if (ARP2_SysCallBase != NULL) {
    LONG fd = arp2sys_open("/etc/passwd", O_RDONLY, 0);
    PrintFault(IoErr(), "arp2sys_open");
    Printf("Opened file %ld\n", fd);

    if (fd != -1) {
      char buf[512];

      LONG count = arp2sys_read(fd, buf, sizeof (buf) - 1);
      buf[511] = 0;

      PrintFault(IoErr(), "arp2sys_read");
      Printf("Read %ld bytes.\n", count);
      PutStr(buf);
      PutStr("\n");
    }

    arp2sys_close(fd);
    PrintFault(IoErr(), "arp2sys_close");
    Printf("Closed file %ld\n", fd);
  }

  return 0;
}
コード例 #5
0
ファイル: fsdb_aros.cpp プロジェクト: Kalamatee/WinUAE
/******************************************************************
 * my_rename
 ******************************************************************/
int my_rename (const TCHAR *oldname, const TCHAR *newname) {

  LONG res;
	char cmd[255];

  DebOut("oldname: %s newname %s\n", oldname, newname);

  res=Rename(oldname, newname);

  if(res==DOSTRUE) {
    return 0;
  }

  /* ugly hack, as windows rename can move over filesystem borders,
	 * but AROS rename can't. And there seems to be no simple
	 * API to move a file across filesystem borders...
	 * So we use the shell and hope for the best..
	 */
	DebOut("rename failed, try shell copy..\n");
	sprintf(cmd, "c:copy from %s to %s MOVE QUIET >NIL:", oldname, newname);

	DebOut("execute: %s\n", cmd);
	Execute(cmd, NULL, NULL);

	if(fsdb_exists(newname)) {
    /* there is a file, pray, it is the one we copied ;) */
		return 0;
  }

  SetLastError(IoErr());
  DebOut("return -1 (%d)\n", IoErr());
  return -1;
}
コード例 #6
0
ファイル: req-test.c プロジェクト: BackupTheBerlios/arp2-svn
void main(void)
{
  struct AHIAudioModeRequester *req;
  BOOL res;

  if(AHImp=CreateMsgPort())
    if(AHIio=(struct AHIRequest *)CreateIORequest(AHImp,sizeof(struct AHIRequest))) {
      AHIio->ahir_Version = 2;
      AHIDevice=OpenDevice(AHINAME,AHI_NO_UNIT,(struct IORequest *)AHIio,NULL);
      }

  if(AHIDevice) {
    Printf("Unable to open %s version 2\n",AHINAME);
    cleanup(RETURN_FAIL);
  }
  AHIBase=(struct Library *)AHIio->ahir_Std.io_Device;

  req=AHI_AllocAudioRequest(
      AHIR_SleepWindow,TRUE,
      AHIR_UserData,999,
      AHIR_PubScreenName,NULL,
      TAG_DONE);

  res=AHI_AudioRequest(req,
      AHIR_TitleText,       "Select a mode or cancel",
      AHIR_NegativeText,    "Abort",
      AHIR_DoMixFreq,       TRUE,
      AHIR_DoDefaultMode,   TRUE,
      AHIR_InitialAudioID,  0x20003,
      AHIR_InitialMixFreq,  30000,
      AHIR_FilterTags,      ReqFilterTags,
      TAG_DONE);

  if(!res)
  {
    if(IoErr() == ERROR_NO_FREE_STORE)
      Printf("AHI ran out of memory!\n");
    else if(IoErr() == ERROR_NO_MORE_ENTRIES)
      Printf("No available modes!\n");
    else
     Printf("Requester cancelled!\n");
  }
  else
    Printf("Selected AudioMode: 0x%08lx, %ld Hz\n",req->ahiam_AudioID,req->ahiam_MixFreq);

  AHI_FreeAudioRequest(req);

  cleanup(RETURN_OK);
}
コード例 #7
0
ファイル: readargs.c プロジェクト: michalsc/AROS
static inline SIPTR readargs_file(CONST_STRPTR format, IPTR *args, CONST_STRPTR input, struct RDArgs **retp)
{
    SIPTR retval;
    struct RDArgs *ret;
    BPTR oldin;
    BPTR io;
    CONST_STRPTR tmpfile = "RAM:readargs.test";
    BPTR oldout;
    oldout = SelectOutput(Open("NIL:", MODE_NEWFILE));
   
    io = Open(tmpfile, MODE_NEWFILE);
    Write(io, input, strlen(input));
    Close(io);

    io = Open(tmpfile, MODE_OLDFILE);

    oldin = Input();
    SelectInput(io);
    SetIoErr(0);
    ret = ReadArgs(format, args, NULL);

    *retp = ret;
    retval = (ret != NULL) ? RETURN_OK : IoErr();

    Close(SelectInput(oldin));
    Close(SelectOutput(oldout));

    DeleteFile(tmpfile);

    return retval;
}
コード例 #8
0
ファイル: __seterrno.c プロジェクト: JamesLinus/libnix
void __seterrno(void)
{ long amigaerror=IoErr(),*ptr=_errortable,err;

  while((err=*ptr++)&&(err!=amigaerror))
    ++ptr;
  errno=*ptr;
}
コード例 #9
0
ファイル: icons.c プロジェクト: MrZammler/opus_magellan
// Patched DeleteDiskObject()
BOOL __asm __saveds L_WB_DeleteDiskObject(register __a0 char *name)
{
	struct LibData *data;
	struct MyLibrary *libbase;
	BOOL result;
	char *full_name;

	// Get library
	if (!(libbase=(struct MyLibrary *)FindName(&((struct ExecBase *)*((ULONG *)4))->LibList,"dopus5.library")))
		return 0;

	// Get data pointer
	data=(struct LibData *)libbase->ml_UserData;

	// Get full name
	full_name=icon_fullname(data,name);

	// Write icon
	result=L_DeleteIcon(name,libbase);

#define DOSBase (data->dos_base)

	// Succeeded?
	if ((result || IoErr()==ERROR_OBJECT_NOT_FOUND) && full_name)
		icon_notify(data,full_name,INF_FULLNAME,1);

#undef DOSBase

	// Free full name buffer
	FreeVec(full_name);
	return result;
}
コード例 #10
0
int main()
{
    struct Process *child;
    
    struct TagItem tags[] =
    {
	{ NP_Entry,         (IPTR) entry              },
    	{ NP_Cli,           (IPTR) TRUE               },
        { NP_Name,          (IPTR) "test"             },
        { NP_NotifyOnDeath, (IPTR) TRUE               },
        { TAG_DONE,         0                         }
    };
    
    child = CreateNewProc(tags);
    
    if(child)
    {
	ULONG childid = GetETask((struct Task*) child)->et_UniqueID;
	Printf("Waiting for child with id %d\n", childid);
	ChildWait(childid);
	Printf("Child exited, freeing child\n");
	ChildFree(childid);
    }
    else
	PrintFault(IoErr(), "Couldn't create child process");
    return 0;
}
コード例 #11
0
/*** Functions **************************************************************/
int main(void)
{
    int            rc              = RETURN_OK;
    struct RDArgs *rdargs          = NULL;
    IPTR           args[ARG_COUNT] = { 0 };

    if ((rdargs = ReadArgs("FILE/M/A,VERBOSE/S", args, NULL)) != NULL)
    {
        CONST_STRPTR *files = (CONST_STRPTR *) args[ARG_FILE], file;

        while ((file = *files++) != NULL)
        {
            if (identify(file, args[ARG_VERBOSE]) != RETURN_OK)
            {
                rc = RETURN_WARN;
            }
        }
        
        FreeArgs(rdargs);
    }
    else
    {
        PrintFault(IoErr(), ERROR_HEADER);
        rc = RETURN_FAIL;
    }

    return rc;
}
コード例 #12
0
int main(int argc, char *argv)
{
    struct tracked_resource_kind *port_kind;
    struct tracked_pool *main_pool;
    struct tracked_resource *my_port_resource;
    struct MsgPort *my_port;

    make_resource_tracking();
    assert(!IoErr());

    port_kind = make_resource_kind("message port", (void(*)(void *)) DeletePort);
    assert(port_kind != NULL);

    main_pool = make_tracked_pool();
    assert(main_pool != NULL);

    my_port = CreatePort(PORTNAME,0);
    if (my_port != NULL) {
        my_port_resource = make_tracked_resource(main_pool, (void *) my_port, port_kind);
    } else {
        printf("cannot create port \"" PORTNAME "\"\n");
    }

    dispose_tracked_pool(main_pool);

    assert(FindPort(PORTNAME) == NULL);
    return 0;
}
コード例 #13
0
ファイル: fsdb_aros.cpp プロジェクト: Kalamatee/WinUAE
/******************************************************************
 * my_unlink: delete file 
 ******************************************************************/
int my_unlink (const TCHAR *name) {

  BOOL res;

  DebOut("name: %s\n", name);

  res=DeleteFile(name);

  if(res!=0) {
    return 0;
  }

  SetLastError(IoErr());
  DebOut("return -1 (%d)\n", IoErr());
  return -1;
}
コード例 #14
0
static int write_env_string(APTR iff,char *str,ULONG id)
{
	if (*str && !(IFFWriteChunk(iff,str,id,strlen(str)+1)))
		return IoErr();

	return 0;
}
コード例 #15
0
LONG setup(char *name, STRPTR args) {
BOOL retval = RETURN_FAIL;
IPTR myargs[]={0,0,0,0};
struct RDArgs *rdargs;
struct RDArgs rda = {{args, strlen(args), 0}, 0, 0, 0, NULL, 0};

	rda.RDA_Source.CS_Buffer[rda.RDA_Source.CS_Length]='\n';
	rdargs = ReadArgs(setuptemplate,myargs, &rda);
	if (rdargs)
	{
		printf
		(
			"setup\n\tdevice=%s unit=%ld\n",
			(STRPTR)myargs[0], *(LONG *)myargs[1]
		);
		if (myargs[2])
		{
			printf("\ttable in partition=%s\n", (STRPTR)myargs[2]);
		}
		else
			printf("\ttable in whole HD\n");
		if (myargs[3])
		{
			printf("\tscipt is %s\n", (STRPTR)myargs[3]);
		}
		else
			printf("\tinteractive\n");
		FreeArgs(rdargs);
	}
	else
		PrintFault(IoErr(), name);
	return retval;
}
コード例 #16
0
LONG DoIOFS(struct IOFileSys *iofs, struct DevProc *dvp, CONST_STRPTR name,
    struct DosLibrary *DOSBase) {
    BOOL freedvp = FALSE;

    if (dvp == NULL) {
        if ((dvp = GetDeviceProc(name, NULL)) == NULL)
            return IoErr();

        freedvp = TRUE;
    }

    iofs->IOFS.io_Device = (struct Device *) dvp->dvp_Port;

    if (dvp->dvp_Lock != NULL)
        iofs->IOFS.io_Unit = ((struct FileHandle *) BADDR(dvp->dvp_Lock))->fh_Unit;
    else
        iofs->IOFS.io_Unit = dvp->dvp_DevNode->dol_Ext.dol_AROS.dol_Unit;

    if (name != NULL)
        iofs->io_Union.io_NamedFile.io_Filename = StripVolume(name);

    DosDoIO((struct IORequest *)iofs);

    if (freedvp)
        FreeDeviceProc(dvp);

    SetIoErr(iofs->io_DosError);

    return iofs->io_DosError;
}
コード例 #17
0
ファイル: amigasupport.c プロジェクト: sba1/simplemail
/* Returns the lock of a name (Allocated with AllocVec()) */
STRPTR NameOfLock( BPTR lock )
{
	STRPTR n;
	BOOL again;
	ULONG bufSize = 127;
	if( !lock ) return NULL;

	do
	{
		again = FALSE;
		if((n = (STRPTR)AllocVec(bufSize, 0x10000 )))
		{
			if( NameFromLock( lock, n, bufSize-1 ) == DOSFALSE )
			{
				if( IoErr() == ERROR_LINE_TOO_LONG )
				{
					bufSize += 127;
					again = TRUE;
				}
				FreeVec(n);
				n = NULL;
			}
		}
	}	while(again);

	return n;
}
コード例 #18
0
static BOOL do_export_sites(struct display_globals *dg,char *path,LONG *diskerr)
{
BPTR cf;
struct site_entry *e;
struct Node *node,*next;
BOOL ok=FALSE;


if	((cf = Open(path, MODE_NEWFILE)))
	{
	if	((ok=Write(cf,head1,strlen(head1))))
		{
		node = dg->dg_og->og_SiteList->list.lh_Head;
		while	((next = node->ln_Succ))
			{
			e=(struct site_entry*)((Att_Node *)node)->data;
			if	(!(ok=write_entry(cf,e)))
				break;
			node = next;
			}
		}
	Close(cf);
	}

if	(!ok)
	*diskerr=IoErr();

return(ok);

}
コード例 #19
0
ファイル: io.c プロジェクト: cbeust/banker-amiga
void
saveFile(Entries entries, char *filename)
{
   BPTR f;
   struct IFFHandle *iff = NULL;

   f = Open(filename, MODE_NEWFILE);
   if (f == NULL) {
      myMsg3("couldn't open ", FileName, IoErr());
      return;
   }

   iff = AllocIFF();

   if (! iff) {
      myMsg1("couldn't alloc iff");
      return;
   }

   iff -> iff_Stream = f;

   InitIFFasDOS(iff);

   if (OpenIFF(iff, IFFF_WRITE)) {
      myMsg1("couldn't OpenIFF(WRITE)");
      return;
   }

   writeDatabaseFile(entries, iff);
   CloseIFF(iff);
   Close(iff -> iff_Stream);
   FreeIFF(iff);
}
コード例 #20
0
ファイル: utime.c プロジェクト: Belxjander/Kirito
int
utime(const char *name, const struct utimbuf *times)
{
  struct DateStamp stamp;
  unsigned long days, secs;
  time_t time;

  if (times == NULL)
    DateStamp(&stamp);
  else {
    /*
     * AmigaDOS file date is the modification time
     */
    time = times->modtime;

    /*
     * Convert time (secs since 1.1.1970 GMT) to
     * AmigaDOS DateStamp (based on 1.1.1978 local time).
     */
    time -= __local_to_GMT; /* GMT to local */
    days = (unsigned long)time / (unsigned long)(24*60*60);
    secs = (unsigned long)time % (unsigned long)(24*60*60);
    stamp.ds_Days = (LONG)days;
    stamp.ds_Minute = (LONG)(secs / 60);
    stamp.ds_Tick = (LONG)((secs % 60) * TICKS_PER_SECOND);
  }

  if (!SetFileDate((STRPTR)name, &stamp)) {
    set_errno(IoErr());
    return -1;
  }

  return 0;
}
コード例 #21
0
int main(void)
{
    IPTR           args[NOOFARGS] = { (IPTR)NULL, (IPTR)0 };
    struct RDArgs *rda;

    int    result;
    int    error = RETURN_OK;
    ULONG  buffers = 0;

    rda = ReadArgs(ARG_TEMPLATE, args, NULL);

    if (rda != NULL)
    {
	STRPTR  drive = (STRPTR)args[ARG_DRIVE];
	ULONG  *bufsptr = (ULONG *)args[ARG_BUFFERS];

	if (bufsptr != NULL)
	{
	    buffers = *bufsptr;
	}

	result = AddBuffers(drive, buffers);

	if (result == -1)
	{
	    Printf("%s has %ld buffers\n", drive, IoErr());
	}
	else if (result > 0)
	{
	    Printf("%s has %ld buffers\n", drive, (LONG)result);
	}
	else
	{
	    PrintFault(IoErr(), "AddBuffers");
	    error = RETURN_FAIL;
	}
	
	FreeArgs(rda);
    }
    else
    {
	PrintFault(IoErr(), "AddBuffers");
	error = RETURN_FAIL;
    }
    
    return error;
}
コード例 #22
0
ファイル: fsdb_aros.cpp プロジェクト: Kalamatee/WinUAE
/******************************************************************
 * my_mkdir / my_rmdir
 *
 * Create/Delete directories. Return AROS host error codes for 
 * AmigaOS guest CreateDir/DeleteFile calls.
 ******************************************************************/
int my_mkdir (const TCHAR *name) {

  BPTR lock;

  DebOut("name: %s\n", name);

  lock=CreateDir(name);

  if(lock) {
    UnLock(lock); /* CreateDir returns a lock, which we don't need */
    return 0;
  }

  SetLastError(IoErr());
  DebOut("return -1 (%d)\n", IoErr());
  return -1;
}
コード例 #23
0
static void getarguments(void)
{
    if (!(myargs = ReadArgs(ARG_TEMPLATE, args, 0)))
    {
    	Fault(IoErr(), 0, s, 255);
	cleanup(s, RETURN_FAIL);
    }
}
コード例 #24
0
ファイル: showvisregion.c プロジェクト: michalsc/AROS
static void GetArguments(void)
{
    if (!(MyArgs = ReadArgs(ARG_TEMPLATE,Args,0)))
    {
    	Fault(IoErr(),0,s,255);
	Cleanup(s);
    }
}
コード例 #25
0
ファイル: menu.c プロジェクト: ysei/NetSurf
void ami_menu_arexx_scan(struct gui_window_2 *gwin)
{
	int item = AMI_MENU_AREXX;
	BPTR lock = 0;
	UBYTE *buffer;
	struct ExAllControl *ctrl;
	char matchpatt[16];
	LONG cont;
	struct ExAllData *ead;
	char *menu_lab;

	if(lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))
	{
		if(buffer = AllocVecTagList(1024, NULL))
		{
			if(ctrl = AllocDosObject(DOS_EXALLCONTROL,NULL))
			{
				ctrl->eac_LastKey = 0;

				if(ParsePatternNoCase("#?.nsrx",(char *)&matchpatt,16) != -1)
				{
					ctrl->eac_MatchString = (char *)&matchpatt;
				}

				do
				{
					cont = ExAll(lock,(struct ExAllData *)buffer,1024,ED_COMMENT,ctrl);
					if((!cont) && (IoErr() != ERROR_NO_MORE_ENTRIES)) break;
					if(!ctrl->eac_Entries) continue;

					for(ead = (struct ExAllData *)buffer; ead; ead = ead->ed_Next)
					{
						if(item >= AMI_MENU_AREXX_MAX) continue;
						if(EAD_IS_FILE(ead))
						{
							gwin->menu[item].nm_Type = NM_ITEM;
							if(ead->ed_Comment[0] != '\0')
								menu_lab = ead->ed_Comment;
							else
								menu_lab = ead->ed_Name;

							ami_menu_alloc_item(gwin, item, NM_ITEM, menu_lab, 0, NULL,
								ami_menu_item_arexx_entries, (void *)strdup(ead->ed_Name));

							item++;
						}
					}
				}while(cont);
				FreeDosObject(DOS_EXALLCONTROL,ctrl);
			}
			FreeVec(buffer);
		}
		UnLock(lock);
	}

	gwin->menu[item].nm_Type = NM_END;
	gwin->menu[item].nm_Label = NULL;
}
コード例 #26
0
LONG
LoadConfig( STRPTR fname )
{
    BPTR    file;

    if( !( file = Open( fname, MODE_OLDFILE ) ) )
    {
        Fault( IoErr(), "", FaultBuff, sizeof( FaultBuff ) );
        LocEZReq( MSG_ERROR_ACCESSING_FILE, MSG_OK, fname, FaultBuff + 2 );
        return( TRUE );
    }

    if( Read( file, LOADSAVETO, PREFSLEN ) != PREFSLEN )
    {
        LocEZReq( MSG_READ_ERROR, MSG_ABORT );
        Close( file );
        return( FALSE );
    }
#ifdef __AROS__
#define READ_ULONG *((ULONG *)configptr); configptr += sizeof(ULONG)
#define READ_UWORD *((UWORD *)configptr); configptr += sizeof(UWORD)

    {
        UBYTE *configptr = configbuffer;
	ULONG val;
	WORD  i;
	
	val = READ_ULONG;
	RTPrefs.Flags = AROS_LONG2BE(val);
	
	for(i = 0;i < RTPREF_NR_OF_REQ; i++)
	{
	    val = READ_ULONG;
	    RTPrefs.ReqDefaults[i].Size = AROS_LONG2BE(val);
	    
	    val = READ_ULONG;
	    RTPrefs.ReqDefaults[i].ReqPos = AROS_LONG2BE(val);
	    
	    val = READ_UWORD;
	    RTPrefs.ReqDefaults[i].LeftOffset = AROS_WORD2BE(val);

	    val = READ_UWORD;
	    RTPrefs.ReqDefaults[i].TopOffset = AROS_WORD2BE(val);

	    val = READ_UWORD;
	    RTPrefs.ReqDefaults[i].MinEntries = AROS_WORD2BE(val);

	    val = READ_UWORD;
	    RTPrefs.ReqDefaults[i].MaxEntries = AROS_WORD2BE(val);	    
	}
	
    }
#endif

    Close( file );
    WheelType = GetWheelType( RTPrefs.Flags );
    return( TRUE );
}
コード例 #27
0
LONG
SaveConfig( STRPTR fname )
{
    BPTR    file;

    if( !( file = Open( fname, MODE_NEWFILE ) ) )
    {
        Fault( IoErr(), "", FaultBuff, sizeof( FaultBuff ) );
        LocEZReq( MSG_ERROR_ACCESSING_FILE, MSG_OK, fname, FaultBuff + 2 );
        return( FALSE );
    }

#ifdef __AROS__
#define WRITE_ULONG *((ULONG *)configptr) = AROS_LONG2BE(val); configptr += sizeof(ULONG)
#define WRITE_UWORD *((UWORD *)configptr) = AROS_WORD2BE(val); configptr += sizeof(UWORD)

    {
        UBYTE *configptr = configbuffer;
	ULONG val;
	WORD  i;
	
	val = RTPrefs.Flags;
	WRITE_ULONG;
	
	for(i = 0;i < RTPREF_NR_OF_REQ; i++)
	{
	    val = RTPrefs.ReqDefaults[i].Size;
	    WRITE_ULONG;
	    
	    val = RTPrefs.ReqDefaults[i].ReqPos;
	    WRITE_ULONG;
	    
	    val = RTPrefs.ReqDefaults[i].LeftOffset;
	    WRITE_UWORD;
	    
	    val = RTPrefs.ReqDefaults[i].TopOffset;
	    WRITE_UWORD;
	    
	    val = RTPrefs.ReqDefaults[i].MinEntries;
	    WRITE_UWORD;
	    
	    val = RTPrefs.ReqDefaults[i].MaxEntries;
	    WRITE_UWORD;

	}
	
    }
#endif
    if( Write( file, LOADSAVETO, PREFSLEN ) != PREFSLEN )
    {
        LocEZReq( MSG_ERROR_SAVING_PREFS, MSG_OK );
        Close( file );
        return( FALSE );
    }

    Close( file );
    return( TRUE );
}
コード例 #28
0
ファイル: dir.c プロジェクト: 8l/vlink
char *read_dir(char *d)
/* get next file name from opened directory, NULL if no more entries */
{
  if (ExNext(((struct Dir *)d)->lock,&(((struct Dir *)d)->fib)))
    return ((struct Dir *)d)->fib.fib_FileName;
  if (IoErr() != ERROR_NO_MORE_ENTRIES)
    error(10,((struct Dir *)d)->name);
  return NULL;
}
コード例 #29
0
static void openfile(void)
{
    fh = Open((STRPTR)args[ARG_FILE], MODE_OLDFILE);
    if (!fh)
    {
    	Fault(IoErr(), 0, s, 255);
	cleanup(s, RETURN_FAIL);
    }
}
コード例 #30
0
static int __putc(int c, BPTR fh)
{
    if (FPutC(fh, c) == EOF)
    {
	errno = IoErr2errno(IoErr());
	return EOF;
    }

    return c;
}