/******************************************* Name : initDeviceList Descr.: initializes a devicelist structure Input : devicelist - devicelist structure to initialize rootblock - cacheblock of the rootblock Output: DOSTRUE for success; DOSFALSE otherwise ********************************************/ LONG initDeviceList ( struct AFSBase *afsbase, struct Volume *volume, struct BlockCache *rootblock ) { STRPTR name; BSTR newname; UBYTE i; name=(char *)rootblock->buffer+(BLK_DISKNAME_START(volume)*4); volume->devicelist.dl_Next = 0; volume->devicelist.dl_Type = DLT_VOLUME; volume->devicelist.dl_Lock = 0; volume->devicelist.dl_VolumeDate.ds_Days = AROS_BE2LONG(rootblock->buffer[BLK_ROOT_DAYS(volume)]); volume->devicelist.dl_VolumeDate.ds_Minute = AROS_BE2LONG(rootblock->buffer[BLK_ROOT_MINS(volume)]); volume->devicelist.dl_VolumeDate.ds_Tick = AROS_BE2LONG(rootblock->buffer[BLK_ROOT_TICKS(volume)]); volume->devicelist.dl_LockList = 0; volume->devicelist.dl_DiskType = volume->dostype; if (volume->devicelist.dl_Name != BNULL) { newname = volume->devicelist.dl_Name; } else { newname = MKBADDR(AllocVec(32,MEMF_CLEAR | MEMF_PUBLIC)); if (newname == BNULL) return DOSFALSE; } for (i=0; i<name[0]; i++) AROS_BSTR_putchar(newname, i, name[i+1]); AROS_BSTR_setstrlen(newname, name[0]); volume->devicelist.dl_Name = newname; return DOSTRUE; }
/************************************************************************** MUIM_Configdata_GetULong **************************************************************************/ IPTR Configdata__MUIM_GetULong(struct IClass *cl, Object * obj, struct MUIP_Configdata_GetULong *msg) { ULONG *vp; vp = (ULONG *)DoMethod(obj, MUIM_Dataspace_Find, msg->id); if (!vp) { int i; for (i = 0; DefULValues[i].id != 0; i++) { if (DefULValues[i].id == msg->id) return DefULValues[i].val; } return 0; } else { return AROS_BE2LONG(*vp); } }
static Att_List *do_read_sites_iff(struct opusftp_globals *og,char *filename,LONG *diskerr) { APTR iff; BOOL err=FALSE; Att_List *list; D(bug("read sites\n")); if (!(list=Att_NewList(LISTF_POOL))) return(NULL); // Open IFF file if ((iff=IFFOpen(filename,IFF_READ,ID_OPUS))) { struct site_entry *e; ULONG chunk; while (!err && (chunk=IFFNextChunk(iff,0))) { if ((e=AllocVec(sizeof(struct site_entry),MEMF_CLEAR))) { int size; int chunksize = 0; if (chunk==ID_FTPSITE_SHORT) size=SMALL_SIZE; else if (chunk==ID_FTPSITE_LONG) size=LARGE_SIZE; else { *diskerr=212; err=TRUE; FreeVec(e); break; } // Adjustment for changed ListFormat size chunksize = (int)IFFChunkSize(iff); if ((chunksize < size) && (size - chunksize == 84)) { if (!(err=(chunksize!=IFFReadChunkBytes(iff,(char *)e,chunksize)))); { char patterns[82] = {'\0'}; int i = 0; CopyMem(e->se_listformat.show_pattern_p, patterns, 80); memset(e->se_listformat.show_pattern_p, 0, 160); for (i = 0; i < 40; i++) { e->se_listformat.show_pattern_p[i] = patterns[i]; e->se_listformat.hide_pattern_p[i] = patterns[i+40]; } } } else err=(size!=IFFReadChunkBytes(iff,(char *)e,size)); if (!err) { #ifdef __AROS__ e->se_anon = AROS_BE2WORD(e->se_anon); e->se_port = AROS_BE2LONG(e->se_port); e->se_has_custom_env = AROS_BE2WORD(e->se_has_custom_env); if (size == LARGE_SIZE) { e->se_env_private.e_retry_count = AROS_BE2LONG(e->se_env_private.e_retry_count); e->se_env_private.e_retry_delay = AROS_BE2LONG(e->se_env_private.e_retry_delay); e->se_env_private.e_list_update = AROS_BE2LONG(e->se_env_private.e_list_update); e->se_env_private.e_timeout = AROS_BE2LONG(e->se_env_private.e_timeout); e->se_env_private.e_script_time = AROS_BE2LONG(e->se_env_private.e_script_time); e->se_env_private.e_indexsize = AROS_BE2LONG(e->se_env_private.e_indexsize); e->se_env_private.bitfield1 = AROS_BE2LONG(e->se_env_private.bitfield1); e->se_env_private.bitfield2 = AROS_BE2LONG(e->se_env_private.bitfield2); } #endif // adjust ptrs for environment // if custom env then set ptr to internal private copy // else set it to point to global ftp default if (e->se_has_custom_env) e->se_env=&e->se_env_private; else e->se_env=&og->og_oc.oc_env; Att_NewNode(list, e->se_name ,(ULONG)e ,0 ); } else FreeVec(e); } else err=TRUE; } // Close file IFFClose(iff); if (!err) return(list); } Att_RemList(list,REMLIST_FREEDATA); if (!*diskerr) *diskerr=IoErr(); return(NULL); }
static struct ftp_config *do_read_options_iff(char *filename,int opt_type,LONG *diskerr) { APTR iff; BOOL ok=FALSE; struct ftp_config *conf; LONG chunk; D(bug("read options\n")); if ((conf=AllocVec(sizeof(struct ftp_config),MEMF_CLEAR))) { // Open IFF file if ((iff=IFFOpen(filename,IFF_READ,ID_OPUS))) { chunk=IFFNextChunk(iff,0); if (opt_type==WT_OPT && chunk!=ID_ENV) *diskerr=212; else { // Adjustment for changed ListFormat size int chunksize = (int)IFFChunkSize(iff); int size = sizeof(struct ftp_config); if (chunk==ID_OPTIONS) { if ((chunksize < size) && (size - chunksize == 84)) { if ((ok = (chunksize==IFFReadChunkBytes(iff,(char *)conf,chunksize)))); { char patterns[82] = {'\0'}; int i = 0; CopyMem(conf->oc_env.e_listformat.show_pattern_p, patterns, 80); memset(conf->oc_env.e_listformat.show_pattern_p, 0, 160); for (i = 0; i < 40; i++) { conf->oc_env.e_listformat.show_pattern_p[i] = patterns[i]; conf->oc_env.e_listformat.hide_pattern_p[i] = patterns[i+40]; } } } else ok = ((sizeof(struct ftp_config))==IFFReadChunkBytes(iff,(char *)conf,sizeof(struct ftp_config))); } else if (chunk==ID_ENV) { ok=((sizeof(struct ftp_environment))==IFFReadChunkBytes(iff,(char *)&conf->oc_env,sizeof(struct ftp_environment))); } else *diskerr=212; } // Close file IFFClose(iff); if (ok) { #ifdef __AROS__ conf->bitfield1 = AROS_LONG2BE(conf->bitfield1); conf->oc_env.e_retry_count = AROS_BE2LONG(conf->oc_env.e_retry_count); conf->oc_env.e_retry_delay = AROS_BE2LONG(conf->oc_env.e_retry_delay); conf->oc_env.e_list_update = AROS_BE2LONG(conf->oc_env.e_list_update); conf->oc_env.e_timeout = AROS_BE2LONG(conf->oc_env.e_timeout); conf->oc_env.e_script_time = AROS_BE2LONG(conf->oc_env.e_script_time); conf->oc_env.e_indexsize = AROS_BE2LONG(conf->oc_env.e_indexsize); conf->oc_env.bitfield1 = AROS_BE2LONG(conf->oc_env.bitfield1); conf->oc_env.bitfield2 = AROS_BE2LONG(conf->oc_env.bitfield2); #endif return(conf); } } FreeVec(conf); } if (!*diskerr) *diskerr=IoErr(); return(NULL); }