예제 #1
0
파일: alloc.cpp 프로젝트: DTidd/OpenRDAAPI
short checkallocdiag(int line,char *file)
{
	struct Rmds *md;
	char *tmp;
	short retval=FALSE;

	for(md=Rmd;md!=NULL;md=md->next) if(md->ptr!=NULL)
	{
		tmp=md->ptr-sizeof(unsigned);
		if(*(unsigned *)tmp!=(unsigned)SIGWORD)
		{
			prterr("Error ALLOC ptr=%p head damaged alloc=%d,%s cur=%d,%s\n",md->ptr,md->line,md->file,line,file);
			retval=(-1);
		}
		tmp+=md->size+sizeof(unsigned);
		if(*(unsigned *)tmp!=(unsigned)SIGWORD)
		{
			prterr("Error ALLOC ptr=%p foot damaged alloc=%d,%s cur=%d,%s\n",md->ptr,md->line,md->file,line,file);
			retval=(-1);
		}
	}
	return(retval);
}
예제 #2
0
파일: fsx.c 프로젝트: konis/xfstests
/* fallocate is basically a no-op unless extending, then a lot like a truncate */
void
do_preallocate(unsigned offset, unsigned length)
{
	unsigned end_offset;
	int keep_size;

        if (length == 0) {
                if (!quiet && testcalls > simulatedopcount)
                        prt("skipping zero length fallocate\n");
                log4(OP_SKIPPED, OP_FALLOCATE, offset, length);
                return;
        }

	keep_size = random() % 2;

	end_offset = keep_size ? 0 : offset + length;

	if (end_offset > biggest) {
		biggest = end_offset;
		if (!quiet && testcalls > simulatedopcount)
			prt("fallocating to largest ever: 0x%x\n", end_offset);
	}

	/*
	 * last arg matches fallocate string array index in logdump:
	 * 	0: allocate past EOF
	 * 	1: extending prealloc
	 * 	2: interior prealloc
	 */
	log4(OP_FALLOCATE, offset, length, (end_offset > file_size) ? (keep_size ? 0 : 1) : 2);

	if (end_offset > file_size) {
		memset(good_buf + file_size, '\0', end_offset - file_size);
		file_size = end_offset;
	}

	if (testcalls <= simulatedopcount)
		return;
	
	if ((progressinterval && testcalls % progressinterval == 0) ||
	    (debug && (monitorstart == -1 || monitorend == -1 ||
		      end_offset <= monitorend)))
		prt("%lu falloc\tfrom 0x%x to 0x%x (0x%x bytes)\n", testcalls,
				offset, offset + length, length);
	if (fallocate(fd, keep_size ? FALLOC_FL_KEEP_SIZE : 0, (loff_t)offset, (loff_t)length) == -1) {
	        prt("fallocate: %x to %x\n", offset, length);
		prterr("do_preallocate: fallocate");
		report_failure(161);
	}
}
예제 #3
0
void main(int argc,char **argv)
{
	short filenum=(-1);
	char *warnmessage=NULL;
	char *module=NULL,*mtnname=NULL;

	module="FINMGT";
	mtnname="MTN FINRACT";
	if(InitializeSubsystems(argc,argv,module,mtnname))
	{
		RDAAPPMAINLOOP();
		return;
	}
	MASTER=MaintainMasterNew(module,mtnname);
	if(findMaintainMaster(MASTER))
	{
		warnmessage=Rmalloc(300+RDAstrlen(MASTER->module)+RDAstrlen(mtnname));
		sprintf(warnmessage,"Error Maintain Master Definition not found, this process cannot be executed without it's definition [%s] in the [%s.MTN] library.",mtnname,MASTER->module);
		ERRORDIALOG("MAINTAIN MASTER NOT FOUND.",warnmessage,NULL,TRUE);
		prterr("%s",warnmessage);
		if(warnmessage!=NULL) Rfree(warnmessage);
		doexit(NULL);
	} else {
		if((filenum=APPOPNNRDEDITABLE(MASTER->module,MASTER->mainfile,&editable))==(-1))
		{
			doexit(NULL);
			return;
		}
		SetSupportingWritable(MASTER,MASTER->module,"FINRYR",1,TRUE,&editable);
		if(!OPEN_MASTER_FILES(MASTER))
		{
			doexit(NULL);
			return;
		}
		ryrnum=APPReturnSupportingFileno(MASTER,"FINMGT","FINRYR",1);
		MASTER->passkey=READPassKey(filenum);
		MASTER->inheritrsrcs=TRUE;
		switch(MASTER->start_with)
		{
			default:
			case 0:
				finractm(1,NULL);
				break;
			case 1:
				browse_finract(NULL,NULL);
				break;
		}
	}
	RDAAPPMAINLOOP();
}
예제 #4
0
static void IMPEXP_FILESEC_IN()
{
	IEfile *IMPEXP=NULL;
	char *temp1=NULL;
	char *temp2=NULL;

	temp1=Rmalloc(3+1);
	sprintf(temp1,"%s",
		"");

	temp2=Rmalloc(3+1);
	sprintf(temp2,"%s",
		"");

#ifdef WIN32
	IMPEXP=IMPEXPdefNEW("FILESEC_IN","SECURITY","FILESEC","securityfile.csv",temp1,"\\t","\\r\\n",0,1,1,1,1,0,1,0,temp2,0,NULL);
#endif /* ifdef WIN32 */
#ifndef WIN32
	IMPEXP=IMPEXPdefNEW("FILESEC_IN","SECURITY","FILESEC","securityfile.csv",temp1,"\\t","\\r\\n",0,1,1,1,1,0,1,0,temp2,0,NULL);
#endif /* ifndef WIN32 */
	if(temp1!=NULL) Rfree(temp1);
	if(temp2!=NULL) Rfree(temp2);
	if(IMPEXP!=NULL)
	{
		addIMPEXPfieldADV(IMPEXP,"USER IDENTIFICATION",1,1,15,NULL,1,NULL);
		addIMPEXPfieldADV(IMPEXP,"MODULE NAME",1,16,15,NULL,1,NULL);
		addIMPEXPfieldADV(IMPEXP,"FILE NAME",1,31,15,NULL,1,NULL);
		addIMPEXPfieldADV(IMPEXP,"FIELD SECURITY",10,46,1,NULL,1,NULL);
		addIMPEXPfieldADV(IMPEXP,"READ FILE",10,47,1,NULL,1,NULL);
		addIMPEXPfieldADV(IMPEXP,"WRITE FILE",10,48,1,NULL,1,NULL);
		addIMPEXPfieldADV(IMPEXP,"PRINT FILE",10,49,1,NULL,1,NULL);
		addIMPEXPfieldADV(IMPEXP,"DELETE FILE",10,50,1,NULL,1,NULL);
		addIMPEXPfieldADV(IMPEXP,"EXPRESSION",14,51,1024,NULL,1,NULL);
		if(writeIMPORTbin(module,IMPEXP))
		{
			if(temp1!=NULL) Rfree(temp1);
			temp1=Rmalloc(10+0+110+1);
			sprintf(temp1,"IMPORT/EXPORT WRITE ERROR: Module [] Import/Export definition [FILESEC_IN], Can Not Save Import/Export Definition!");
			prterr(temp1);
			if(errorlist!=NULL)
			{
				addERRlist(&errorlist,temp1);
			}
			if(temp1!=NULL) Rfree(temp1);
			if(temp2!=NULL) Rfree(temp2);
		}
		if(IMPEXP!=NULL) free_import(IMPEXP);
	}
}
예제 #5
0
파일: dfgsv.cpp 프로젝트: DTidd/OpenRDAAPI
static void changeftype(RDArsrc *r)
{
	int type=0;

	FINDRSCGETINT(r,"FIELD TYPES",&type);
	switch(type)
	{
		case SCROLLEDTEXT:
		case VARIABLETEXT:
		case PLAINTEXT:
		case DATES:
		case TIMES:
		case SOCSECNUM:
		case PHONE:
		case CUSTOMTYPE:
		case ZIPCODE:
		case EXPENDITURE:
		case REVENUE:
		case BALANCESHEET:
		case BEGINNINGBALANCE:
		case OPTIONALFIELDS:
		case BOOLNS:
		case CHARACTERS:
			GSV->value.string_value=NULL;
			break;
		case SHORTV:
		case SSHORTV:
			GSV->value.short_value=NULL;
			break;
		case SCROLLEDLIST:
		case LONGV:
		case SLONGV:
			GSV->value.integer_value=NULL;
			break;
		case DOLLARS:
		case DOLLARS_NOCENTS:
		case DECIMALV:
		case DOUBLEV:
		case SDOUBLEV:
		case SDECIMALV:
			GSV->value.float_value=NULL;
			break;
		case BUTTONS:
			break;
		default:
			prterr("Error Unrecognized Field type [%d].",type); 
			break;
	}
}
예제 #6
0
static void DEF_PURGEFLDSEC_RANGE_SCREEN()
{
	RDAdefault *def=NULL;
	char *defdir=NULL;
	char *temp1=NULL;

	def=RDAdefaultNEW("SECURITY","PURGEFLDSEC RANGE SCREEN");
	if(def!=NULL)
	{
		def->input_focus=stralloc("DEFAULTS");
		addDefaultFieldCHAR(def,"SELECT [FLDSEC][DELETEFLAG] TRUE",TRUE,10,1);
		addDefaultFieldCHAR(def,"SELECT [FLDSEC][DELETEFLAG] FALSE",TRUE,10,1);
		addDefaultFieldCHAR(def,"RANGE ON [FLDSEC][USER IDENTIFICATION]",TRUE,10,0);
		addDefaultFieldSTRING(def,"FROM [FLDSEC][USER IDENTIFICATION]",TRUE,1,"");
		addDefaultFieldSTRING(def,"TO [FLDSEC][USER IDENTIFICATION]",TRUE,1,"");
		addDefaultFieldCHAR(def,"RANGE ON [FLDSEC][MODULE NAME]",TRUE,10,0);
		addDefaultFieldSTRING(def,"FROM [FLDSEC][MODULE NAME]",TRUE,1,"");
		addDefaultFieldSTRING(def,"TO [FLDSEC][MODULE NAME]",TRUE,1,"");
		addDefaultFieldCHAR(def,"RANGE ON [FLDSEC][FILE NAME]",TRUE,10,0);
		addDefaultFieldSTRING(def,"FROM [FLDSEC][FILE NAME]",TRUE,1,"");
		addDefaultFieldSTRING(def,"TO [FLDSEC][FILE NAME]",TRUE,1,"");
		addDefaultFieldCHAR(def,"SELECT [FLDSEC][FIELD SECURITY] TRUE",TRUE,10,1);
		addDefaultFieldCHAR(def,"SELECT [FLDSEC][FIELD SECURITY] FALSE",TRUE,10,1);
		addDefaultFieldCHAR(def,"SELECT [FLDSEC][READ FIELD] TRUE",TRUE,10,0);
		addDefaultFieldCHAR(def,"SELECT [FLDSEC][READ FIELD] FALSE",TRUE,10,1);

		defdir=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+12);
#ifndef WIN32
		sprintf(defdir,"%s/rda/%s.DEF",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
		sprintf(defdir,"%s\\rda\\%s.DEF",CURRENTDIRECTORY,module);
#endif
		if(writedefaultbin(defdir,def))
		{
			if(temp1!=NULL) Rfree(temp1);
			temp1=Rmalloc(25+8+100+1);
			sprintf(temp1,"SCREEN DEFAULT WRITE ERROR: Module [SECURITY] Screen [PURGEFLDSEC RANGE SCREEN], Can Not Save Screen Defaults!");
			prterr(temp1);
			if(errorlist!=NULL)
			{
				addERRlist(&errorlist,temp1);
			}
			if(temp1!=NULL) Rfree(temp1);
		}
		if(defdir!=NULL) Rfree(defdir);
		if(def!=NULL) FreeRDAdefault(def);
	}
}
예제 #7
0
파일: misc-fsx.c 프로젝트: 151706061/osv
void
writefileimage()
{
	ssize_t iret;

	if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) {
		prterr("writefileimage: lseek");
		report_failure(171);
	}
	iret = write(fd, good_buf, file_size);
	if ((off_t)iret != file_size) {
		if (iret == -1)
			prterr("writefileimage: write");
		else
			prt("short write: 0x%x bytes instead of 0x%llx\n",
			    iret, (unsigned long long)file_size);
		report_failure(172);
	}
	if (lite ? 0 : ftruncate(fd, file_size) == -1) {
	        prt("ftruncate2: %llx\n", (unsigned long long)file_size);
		prterr("writefileimage: ftruncate");
		report_failure(173);
	}
}
예제 #8
0
파일: mkgui.cpp 프로젝트: DTidd/OpenRDAAPI
int main(int argc,char **argv)
#endif
{
	RDArsrc *mainrsrc=NULL;
	int x=0;
	int ret_int=0;

	if(InitializeSubsystems(argc,argv,module,"MAKE GUI SCREENS")) 
	{
		ShutdownSubsystems();
		return(-1);
	}
	if(XPERT_SETUP==NULL)
	{
		prterr("ERROR: Make GUI can not load Xpert Setup, exiting abnormally");
		ShutdownSubsystems();
		return(-1);
	}
	RDAmkdir("GUI",00770,&ret_int);
	RDAmkdir("pixmaps",00770,&ret_int);
	RDAmkdir("html",00770,&ret_int);
	RDAmkdir("cgi-bin",00770,&ret_int);
	MAKE_GUI_SCREENS();
	if(argc>1)
	{
		make_screens(argc,argv);
		ShutdownSubsystems();
		return(-1);
	} else {
		mainrsrc=RDArsrcNEW(module,"MAKE GUI SCREENS");
		scnlist=makescnlist();
		addlstrsrc(mainrsrc,"RESOURCE LIST",&x,TRUE,NULL,scnlist->numlibs,
			&scnlist->libs,NULL);
		errorlist=APPlibNEW();
		addAPPlib(errorlist,"No Errors Detected");
		addlstrsrc(mainrsrc,"ERROR LIST",&x,TRUE,NULL,errorlist->numlibs,
			&errorlist->libs,NULL);
/*lint -e611 */
		addbtnrsrc(mainrsrc,"PRINT ERROR LIST",TRUE,print_list,(void *)printerrorlistcb);
/*lint +e611 */
		addbtnrsrc(mainrsrc,"SELECT ALL",TRUE,selectall,NULL);
		addbtnrsrc(mainrsrc,"SELECT",TRUE,selectrpt,NULL);
		addrfexrsrc(mainrsrc,"QUIT",TRUE,quitfinrpt,NULL);
		addbtnrsrc(mainrsrc,"HELP",TRUE,screenhelp,NULL);
		addbtnrsrc(mainrsrc,"PRINT RESOURCES",TRUE,printrsrcs,NULL);
		APPmakescrn(mainrsrc,TRUE,quitfinrpt,NULL,TRUE);
	}
}
예제 #9
0
파일: misc-fsx.c 프로젝트: 151706061/osv
void
do_punch_hole(unsigned offset, unsigned length)
{
	unsigned end_offset;
	int max_offset = 0;
	int max_len = 0;
	int mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;

	if (length == 0) {
		if (!quiet && testcalls > simulatedopcount)
			prt("skipping zero length punch hole\n");
			log4(OP_SKIPPED, OP_PUNCH_HOLE, offset, length);
		return;
	}

	if (file_size <= (loff_t)offset) {
		if (!quiet && testcalls > simulatedopcount)
			prt("skipping hole punch off the end of the file\n");
			log4(OP_SKIPPED, OP_PUNCH_HOLE, offset, length);
		return;
	}

	end_offset = offset + length;

	log4(OP_PUNCH_HOLE, offset, length, 0);

	if (testcalls <= simulatedopcount)
		return;

	if ((progressinterval && testcalls % progressinterval == 0) ||
	    (fsx_debug && (monitorstart == -1 || monitorend == -1 ||
		      end_offset <= monitorend))) {
		prt("%lu punch\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
			offset, offset+length, length);
	}
	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
		prt("%punch hole: %x to %x\n", offset, length);
		prterr("do_punch_hole: fallocate");
		report_failure(161);
	}


	max_offset = offset < file_size ? offset : file_size;
	max_len = max_offset + length <= file_size ? length :
			file_size - max_offset;
	memset(good_buf + max_offset, '\0', max_len);
}
예제 #10
0
파일: lvemst.cpp 프로젝트: DTidd/OpenRDAAPI
void main(int argc,char **argv)
{
	short filenum=(-1);
	char *module=NULL,*mtnname=NULL;

	module="LVEMGT";
	mtnname="MTN LVEMSTR";
	if(InitializeSubsystems(argc,argv,module,mtnname))
	{
		RDAAPPMAINLOOP();
		return;
	}
	MASTER=MaintainMasterNew(module,mtnname);
	if(findMaintainMaster(MASTER))
	{
		ERRORDIALOG("MAINTAIN MASTER NOT FOUND.","The Maintain Master function wasn't found.",NULL,TRUE);
		prterr("Error Maintain Master Definition not found, this process can not be executed without it's definition [%s] in the [%s.MTN] library.",mtnname,MASTER->module);
		doexit(NULL);
	} else {
		if((filenum=APPOPNNRDEDITABLE(MASTER->module,MASTER->mainfile,&editable))==(-1))
		{
			doexit(NULL);
			return;
		}
		if(!OPEN_MASTER_FILES(MASTER))
		{
			doexit(NULL);
			return;
		}
		dscnum=APPReturnSupportingFileno(MASTER,MASTER->module,"LVEDSC",1);
		lvetyp=APPReturnSupportingFileno(MASTER,MASTER->module,"LVETPMS",1);
		MASTER->passkey=READPassKey(filenum);
		MASTER->inheritrsrcs=FALSE;
		switch(MASTER->start_with)
		{
			default:
			case 0:
				lvemstm(1,NULL);
				break;
			case 1:
				browse_mst(NULL,NULL);
				break;
		}
	}
	RDAAPPMAINLOOP();
}
예제 #11
0
void main(int argc,char **argv)
{
	short filenum=(-1);

	if(InitializeSubsystems(argc,argv,"POSTRK","MTN POSPER")) 
	{
		RDAAPPMAINLOOP();
		return;
	}
	MASTER=MaintainMasterNew("POSTRK","MTN POSPER");
	if(findMaintainMaster(MASTER))
	{
		ERRORDIALOG("MAINTAIN MASTER NOT FOUND.","The Maintain Master function wasn't found.",NULL,TRUE);
		prterr("Error Maintain Master Definition not found, this process cannot be executed without it's definition [%s] in the [%s.MTN] library.","MTN POSPER",MASTER->module);
		doexit(NULL);
	} else {
		if((filenum=APPOPNNRDEDITABLE(MASTER->module,MASTER->mainfile,
			&editable))==(-1))
		{
			doexit(NULL);
			return;
		}
		SetSupportingWritable(MASTER,"PAYROLL","PAYJMST",1,TRUE,&editable);
		SetSupportingWritable(MASTER,MASTER->module,"POSMSTR",1,TRUE,&editable);
		if(!OPEN_MASTER_FILES(MASTER))
		{
			doexit(NULL);
			return;
		}
		jmstnum=APPReturnSupportingFileno(MASTER,"PAYROLL","PAYJMST",1);
		msrnum=APPReturnSupportingFileno(MASTER,MASTER->module,"POSMSTR",1);
		MASTER->passkey=READPassKey(filenum);
		MASTER->inheritrsrcs=TRUE;
		switch(MASTER->start_with)
		{
			default:
			case 0:
				posperm(1,NULL);
				break;
			case 1:
				browse_posper(NULL,NULL);
				break;
		}
	}
	RDAAPPMAINLOOP();
}
예제 #12
0
static void DEF_MSG_GATEWAY_DEFINE_LIST()
{
	RDAdefault *def=NULL;
	char *defdir=NULL;
	char *temp1=NULL;

	def=RDAdefaultNEW("UTILITIES","MSG-GATEWAY DEFINE LIST");
	if(def!=NULL)
	{
		def->input_focus=stralloc("DEFAULTS");
		addDefaultFieldINT(def,"KEY LIST",TRUE,13,0);
		addDefaultFieldSHORT(def,"CARRIER POSITION",TRUE,7,1);
		addDefaultFieldSHORT(def,"CARRIER LENGTH",TRUE,7,40);
		addDefaultFieldSHORT(def,"TYPE POSITION",TRUE,7,0);
		addDefaultFieldSHORT(def,"TYPE LENGTH",TRUE,7,0);
		addDefaultFieldSHORT(def,"DELETEFLAG POSITION",TRUE,7,0);
		addDefaultFieldSHORT(def,"DELETEFLAG LENGTH",TRUE,7,0);
		addDefaultFieldSHORT(def,"MAIL-TO-GATEWAY FORMULA POSITION",TRUE,7,6);
		addDefaultFieldSHORT(def,"MAIL-TO-GATEWAY FORMULA LENGTH",TRUE,7,80);
		addDefaultFieldSHORT(def,"MSG-GATEWAY TYPE DESCRIPTION POSITION",TRUE,7,5);
		addDefaultFieldSHORT(def,"MSG-GATEWAY TYPE DESCRIPTION LENGTH",TRUE,7,5);

		defdir=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+12);
#ifndef WIN32
		sprintf(defdir,"%s/rda/%s.DEF",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
		sprintf(defdir,"%s\\rda\\%s.DEF",CURRENTDIRECTORY,module);
#endif
		if(writedefaultbin(defdir,def))
		{
			if(temp1!=NULL) Rfree(temp1);
			temp1=Rmalloc(23+9+100+1);
			sprintf(temp1,"SCREEN DEFAULT WRITE ERROR: Module [UTILITIES] Screen [MSG-GATEWAY DEFINE LIST], Can Not Save Screen Defaults!");
			prterr(temp1);
			if(errorlist!=NULL)
			{
				addERRlist(&errorlist,temp1);
			}
			if(temp1!=NULL) Rfree(temp1);
		}
		if(defdir!=NULL) Rfree(defdir);
		if(def!=NULL) FreeRDAdefault(def);
	}
}
예제 #13
0
void DB_MSGGATEWAY()
{
	DBsort *sort=NULL;
	short x=(-1);
	char same=FALSE;
	char *temp1=NULL;

	sort=DBsortNEW("UTILITIES","MSG-GATEWAY",0);
	if(sort!=NULL)
	{
		addDBfield(sort,"CARRIER",1,40);
		addDBfield(sort,"TYPE",7,2);
		addDBfield(sort,"DELETEFLAG",10,1);
		addDBfield(sort,"MAIL-TO-GATEWAY FORMULA",14,4000);
		addDBkey(sort,"MSG-GATEWAY KEY 1");
		addDBkeypart(sort,1,"CARRIER");
		addDBkeypart(sort,1,"TYPE");
		addDBkey(sort,"MSG-GATEWAY KEY 2");
		addDBkeypart(sort,2,"TYPE");
		addDBkeypart(sort,2,"CARRIER");

		same=CompareDATABASE(sort);
		if(same==FALSE)
		{
			MergeDATABASE(sort);
			SetupFileDefinition(sort);
			x=CHANGE_DATABASE_FILE(sort->module,sort->engine,sort->filename,sort->nofields,sort->fields,sort->nokeys,sort->keys,sort->servername);
			if(x==(-1))
			{
				if(temp1!=NULL) Rfree(temp1);
				temp1=Rmalloc(11+9+77+1);
				sprintf(temp1,"DATABASE FILE WRITE ERROR: Module [UTILITIES] Screen [MSG-GATEWAY], Can Not Save Database File!");
				prterr(temp1);
				if(errorlist!=NULL)
				{
					addERRlist(&errorlist,temp1);
				}
				if(temp1!=NULL) Rfree(temp1);
			} else {
				CLSNRD(x);
			}
		}
		if(sort!=NULL) ADVFreeDBsort(sort,FALSE);
	}
}
예제 #14
0
파일: alloc.cpp 프로젝트: DTidd/OpenRDAAPI
void diagRfree(void *tmp,int line,char *file)
{
	char *adjptr;
	struct Rmds *md;

	checkallocdiag(line,file);
	for(md=Rmd;md!=NULL;md=md->next) if((void *)md->ptr==tmp) break;
	if(md==NULL)
	{
		prterr("Error in diagRfree freeing pointer not allocated with RDA at line [%d] program [%s].",line,file);
		free(tmp);
		return;
	}
	adjptr=(char *)tmp;
	adjptr-=sizeof(unsigned);
	md->ptr=NULL;
	free(adjptr);
}
예제 #15
0
파일: alloc.cpp 프로젝트: DTidd/OpenRDAAPI
char *xstralloc(char *d,int line,char *file)
{
	char *temp;

	if(diagmisc && !diagallocx)
	{
		prterr("DIAG xstralloc String Allocated at line [%d] program [%s].",line,file);	
	}
	if(isEMPTY(d)) return(NULL);
	if(diagallocx && diagmisc)
	{		
		temp=(char *)xRmalloc(RDAstrlen(d)+1,line,file);
	} else {
		temp=(char *)Rmalloc(RDAstrlen(d)+1);
	}
	strcpy(temp,d);
	return(temp);
}
예제 #16
0
static void GSV_MYSQL_CASE_SENSITIVE_COLLATION()
{
	RDAGenericSetup *gsv=NULL;
	char *temp1=NULL,*libx=NULL;

	libx=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+11);
#ifndef WIN32
	sprintf(libx,"%s/rda/%s.GSV",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
	sprintf(libx,"%s\\rda\\%s.GSV",CURRENTDIRECTORY,module);
#endif

	gsv=RDAGenericSetupNew("DATABASE","MYSQL CASE SENSITIVE COLLATION");
	if(gsv!=NULL)
	{
		if(getRDAGenericSetupbin(libx,gsv))
		{
			gsv->type=10;
			gsv->length=1;
			gsv->desc=stralloc("Used to denote when Case Sensitive Collation should be implemented while building indexes.");
			gsv->label=stralloc("MySQL Case Sensitive Collation");
			gsv->value.string_value=Rmalloc(1);
			*gsv->value.string_value=1;
	
			if(writeRDAGenericSetupbin(libx,gsv))
			{
				if(temp1!=NULL) Rfree(temp1);
				if(libx!=NULL) Rfree(libx);
				temp1=Rmalloc(30+8+110+1);
				sprintf(temp1,"GENERIC SETUP VARIABLE WRITE ERROR: Module [DATABASE] GSV [MYSQL CASE SENSITIVE COLLATION], Can Not Save Generic Setup Variable!");
				prterr(temp1);
				if(errorlist!=NULL)
				{
					addERRlist(&errorlist,temp1);
				}
				if(temp1!=NULL) Rfree(temp1);
			}
		}
		if(temp1!=NULL) Rfree(temp1);
	}
	if(libx!=NULL) Rfree(libx);
	if(gsv!=NULL) FreeRDAGenericSetup(gsv);
}
예제 #17
0
void main(int argc,char **argv)
{
	short filenum=(-1);

	if(InitializeSubsystems(argc,argv,"POSTRK","MTN POSGRAT")) 
	{
		RDAAPPMAINLOOP();
		return;
	}
	MASTER=MaintainMasterNew("POSTRK","MTN POSGRAT");
	PAYROLL_SETUP=RDApayrollNEW();
	getpayrollbin(PAYROLL_SETUP);
	if(findMaintainMaster(MASTER))
	{
		ERRORDIALOG("MAINTAIN MASTER NOT FOUND.","The Maintain Master function wasn't found.",NULL,TRUE);
		prterr("Error Maintain Master Definition not found, this process cannot be executed without it's definition [%s] in the [%s.MTN] library.","MTN POSGRAT",MASTER->module);
		doexit(NULL);
	} else {
		if((filenum=APPOPNNRDEDITABLE(MASTER->module,"POSGRAT",&editable))==(-1))
		{
			doexit(NULL);
			return;
		}
		if(!OPEN_MASTER_FILES(MASTER))
		{
			doexit(NULL);
			return;
		}
		MASTER->passkey=READPassKey(filenum);
		MASTER->inheritrsrcs=TRUE;
		switch(MASTER->start_with)
		{
			default:
			case 0:
				posgratm(1,NULL);
				break;
			case 1:
				browse_posgrat(NULL,NULL);
				break;
		}
	}
	RDAAPPMAINLOOP();
}
예제 #18
0
void xUndoIDifnoPO(short purids,short purmst,char *id,void (*SubFunc)(...),void *args,
	int line,char *file)
{
	char *test=NULL,assigned=FALSE,force=FALSE;
	RDATData *prev=NULL;
	short keyno=(-1),ef=FALSE;

#ifdef USE_RDA_DIAGNOSTICS
	if(diagmix || diagapps)
	{
		prterr("DIAG UndoIDifnoPO at line [%d] program [%s].",line,file);
	}
#endif /* ifdef USE_RDA_DIAGNOSTICS */
	ZERNRD(purmst);
	FINDFLDSETSTRING(purmst,"PO IDENTIFICATION",id);
	keyno=KEYNUMBER(purmst,"RDA PURMST KEY");
	if(SubFunc!=NULL) ef=ADVGTENRDsec(purmst,keyno,SubFunc,args);
		else ef=GTENRDsec(purmst,keyno);
	if(ef) 
	{
		ZERNRD(purmst);
		force=TRUE;
	}
	FINDFLDGETSTRING(purmst,"PO IDENTIFICATION",&test);
	if(RDAstrcmp(test,id) || force)
	{
		ZERNRD(purids);
		FINDFLDSETSTRING(purids,"PO IDENTIFICATION",id);
		LOCNRDFILE(purids);
		if(SubFunc!=NULL) ef=ADVEQLNRDsec(purids,1,SubFunc,args);
			else ef=EQLNRDsec(purids,1);
		if(!ef)
		{
			prev=RDATDataNEW(purids);
			FINDFLDSETCHAR(purids,"ASSIGNED",assigned);
			if(SubFunc!=NULL) ADVWRTTRANSsec(purids,0,NULL,prev,SubFunc,args);
				else WRTTRANSsec(purids,0,NULL,prev);
			if(prev!=NULL) FreeRDATData(prev);
		}
		UNLNRDFILE(purids);
	}
	if(test!=NULL) Rfree(test);
}
예제 #19
0
파일: misc-fsx.c 프로젝트: 151706061/osv
void
check_size(void)
{
	struct stat	statbuf;
	off_t	size_by_seek;

	if (fstat(fd, &statbuf)) {
		prterr("check_size: fstat");
		statbuf.st_size = -1;
	}
	size_by_seek = lseek(fd, (off_t)0, SEEK_END);
	if (file_size != statbuf.st_size || file_size != size_by_seek) {
		prt("Size error: expected 0x%llx stat 0x%llx seek 0x%llx\n",
		    (unsigned long long)file_size,
		    (unsigned long long)statbuf.st_size,
		    (unsigned long long)size_by_seek);
		report_failure(120);
	}
}
예제 #20
0
int main(int argc,char **argv)
#endif
{
	short filenum=(-1);

	RDA_SOFTWARE_TYPE=RDA_XPERT_AND_LITE_APP;
	if(InitializeSubsystems(argc,argv,"BFTMGT","MTN BFTMDAC")) 
	{
		RDAAPPMAINLOOP();
		return;
	}
	MTNMASTER=MaintainMasterNew("BFTMGT","MTN BFTMDAC");
	if(findMaintainMaster(MTNMASTER))
	{
		ERRORDIALOG("MAINTAIN MTNMASTER NOT FOUND.","The Maintain Master function wasn't found.",NULL,TRUE);
		prterr("Error Maintain Master Definition not found, this process cannot be executed without it's definition [%s] in the [%s.MTN] library.","MTN BFTMDAC",MTNMASTER->module);
		doexit(NULL);
	} else {
		if((filenum=APPOPNNRDEDITABLE(MTNMASTER->module,"BFTMDAC",&editable))==(-1))
		{
			doexit(NULL);
			return;
		}
		if(!OPEN_MASTER_FILES(MTNMASTER))
		{
			doexit(NULL);
			return;
		}
		MTNMASTER->passkey=READPassKey(filenum);
		MTNMASTER->inheritrsrcs=FALSE;
		switch(MTNMASTER->start_with)
		{
			default:
			case 0:
				bftmdacm(1,NULL);
				break;
			case 1:
				browse_bftmdac(NULL,NULL);
				break;
		}
	}
	RDAAPPMAINLOOP();
}
예제 #21
0
파일: mkolh5.cpp 프로젝트: DTidd/OpenRDAAPI
static void DEF_USER_RESOURCE_NOTES_DEFINE_LIST()
{
	RDAdefault *def=NULL;
	char *defdir=NULL;
	char *temp1=NULL;

	def=RDAdefaultNEW("OLHELP","USER RESOURCE NOTES DEFINE LIST");
	if(def!=NULL)
	{
		def->input_focus=stralloc("DEFAULTS");
		addDefaultFieldINT(def,"KEY LIST",TRUE,13,0);
		addDefaultFieldSHORT(def,"DELETEFLAG POSITION",TRUE,7,0);
		addDefaultFieldSHORT(def,"DELETEFLAG LENGTH",TRUE,7,0);
		addDefaultFieldSHORT(def,"MODULE NAME POSITION",TRUE,7,1);
		addDefaultFieldSHORT(def,"MODULE NAME LENGTH",TRUE,7,15);
		addDefaultFieldSHORT(def,"USER IDENTIFICATION POSITION",TRUE,7,4);
		addDefaultFieldSHORT(def,"USER IDENTIFICATION LENGTH",TRUE,7,15);
		addDefaultFieldSHORT(def,"SCREEN NAME POSITION",TRUE,7,2);
		addDefaultFieldSHORT(def,"SCREEN NAME LENGTH",TRUE,7,40);
		addDefaultFieldSHORT(def,"RESOURCE NAME POSITION",TRUE,7,3);
		addDefaultFieldSHORT(def,"RESOURCE NAME LENGTH",TRUE,7,20);
		addDefaultFieldSHORT(def,"NOTES POSITION",TRUE,7,0);
		addDefaultFieldSHORT(def,"NOTES LENGTH",TRUE,7,0);

		defdir=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+12);
#ifndef WIN32
		sprintf(defdir,"%s/rda/%s.DEF",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
		sprintf(defdir,"%s\\rda\\%s.DEF",CURRENTDIRECTORY,module);
#endif
		if(writedefaultbin(defdir,def))
		{
			if(temp1!=NULL) Rfree(temp1);
			temp1=Rmalloc(31+6+100+1);
			sprintf(temp1,"SCREEN DEFAULT WRITE ERROR: Module [OLHELP] Screen [USER RESOURCE NOTES DEFINE LIST], Can Not Save Screen Defaults!");
			prterr(temp1);
			if(temp1!=NULL) Rfree(temp1);
		}
		if(defdir!=NULL) Rfree(defdir);
		if(def!=NULL) FreeRDAdefault(def);
	}
}
예제 #22
0
short xGetPayrollSetup(RDApayroll *paysetup,void (*qfunc)(void *),void *arg,int line,
	char *file)
{
#ifdef USE_RDA_DIAGNOSTICS
	if(diagmix)
	{
		prterr("DIAG GetPayrollSetup at line [%d] program [%s].",line,file);
	}
#endif /* ifdef USE_RDA_DIAGNOSTICS */
	if(getpayrollbin(paysetup)==(-1))
	{
		ERRORDIALOG("Payroll Setup Not Available","The Payroll Setup File cannot opened.\n",NULL,TRUE);
		ShutdownSecurity();
		RDAAPPMAINLOOP();
		if(qfunc!=NULL) qfunc(arg);
		return(-1);
	}
	return(0);
}
예제 #23
0
static void GSV_MYSQL_USERNAME()
{
	RDAGenericSetup *gsv=NULL;
	char *temp1=NULL,*libx=NULL;

	libx=Rmalloc(RDAstrlen(CURRENTDIRECTORY)+RDAstrlen(module)+11);
#ifndef WIN32
	sprintf(libx,"%s/rda/%s.GSV",CURRENTDIRECTORY,module);
#endif
#ifdef WIN32
	sprintf(libx,"%s\\rda\\%s.GSV",CURRENTDIRECTORY,module);
#endif

	gsv=RDAGenericSetupNew("DATABASE","MYSQL USERNAME");
	if(gsv!=NULL)
	{
		if(getRDAGenericSetupbin(libx,gsv))
		{
			gsv->type=1;
			gsv->length=80;
			gsv->desc=stralloc("Used to Represent the MySQL Server Username where the RDA Database resides.");
			gsv->label=stralloc("MySQL Username:"******"");
	
			if(writeRDAGenericSetupbin(libx,gsv))
			{
				if(temp1!=NULL) Rfree(temp1);
				if(libx!=NULL) Rfree(libx);
				temp1=Rmalloc(14+8+110+1);
				sprintf(temp1,"GENERIC SETUP VARIABLE WRITE ERROR: Module [DATABASE] GSV [MYSQL USERNAME], Can Not Save Generic Setup Variable!");
				prterr(temp1);
				if(errorlist!=NULL)
				{
					addERRlist(&errorlist,temp1);
				}
				if(temp1!=NULL) Rfree(temp1);
			}
		}
		if(temp1!=NULL) Rfree(temp1);
	}
	if(libx!=NULL) Rfree(libx);
	if(gsv!=NULL) FreeRDAGenericSetup(gsv);
}
예제 #24
0
파일: fsx.c 프로젝트: konis/xfstests
void
do_collapse_range(unsigned offset, unsigned length)
{
	unsigned end_offset;
	int mode = FALLOC_FL_COLLAPSE_RANGE;

	if (length == 0) {
		if (!quiet && testcalls > simulatedopcount)
			prt("skipping zero length collapse range\n");
		log4(OP_SKIPPED, OP_COLLAPSE_RANGE, offset, length);
		return;
	}

	end_offset = offset + length;
	if ((loff_t)end_offset >= file_size) {
		if (!quiet && testcalls > simulatedopcount)
			prt("skipping collapse range behind EOF\n");
		log4(OP_SKIPPED, OP_COLLAPSE_RANGE, offset, length);
		return;
	}

	log4(OP_COLLAPSE_RANGE, offset, length, 0);

	if (testcalls <= simulatedopcount)
		return;

	if ((progressinterval && testcalls % progressinterval == 0) ||
	    (debug && (monitorstart == -1 || monitorend == -1 ||
		      end_offset <= monitorend))) {
		prt("%lu collapse\tfrom 0x%x to 0x%x, (0x%x bytes)\n", testcalls,
			offset, offset+length, length);
	}
	if (fallocate(fd, mode, (loff_t)offset, (loff_t)length) == -1) {
		prt("collapse range: %x to %x\n", offset, length);
		prterr("do_collapse_range: fallocate");
		report_failure(161);
	}

	memmove(good_buf + offset, good_buf + end_offset,
		file_size - end_offset);
	file_size -= length;
}
예제 #25
0
char *xGetAssignNextPOID(short purids,char *poid,void (*SubFunc)(...),void *args,int line,char *file)
{
	char deleteflag=FALSE,assigned=FALSE;
	char *tmp=NULL;
	RDATData *prev=NULL;
	short ef=0;

#ifdef USE_RDA_DIAGNOSTICS
	if(diagmix || diagapps)
	{
		prterr("DIAG GetAssignNextPOID at line [%d] program [%s].",line,file);
	}
#endif /* ifdef USE_RDA_DIAGNOSTICS */
	ZERNRD(purids);
	LOCNRDFILE(purids);
	FINDFLDSETSTRING(purids,"PO IDENTIFICATION",poid);
	if(SubFunc!=NULL) ef=ADVGTENRDsec(purids,1,SubFunc,args);
		else ef=GTENRDsec(purids,1);
	while(!ef)
	{
		FINDFLDGETCHAR(purids,"DELETEFLAG",&deleteflag);
		FINDFLDGETCHAR(purids,"ASSIGNED",&assigned);
		FINDFLDGETSTRING(purids,"PO IDENTIFICATION",&tmp);
		if(!isEMPTY(poid)) if(strncmp(tmp,poid,RDAstrlen(poid))) break;
		if(!deleteflag && !assigned)
		{
			prev=RDATDataNEW(purids);
			assigned=TRUE;
			FINDFLDSETCHAR(purids,"ASSIGNED",assigned);
			if(SubFunc!=NULL) ADVWRTTRANSsec(purids,0,NULL,prev,SubFunc,args);
				else WRTTRANSsec(purids,0,NULL,prev);
			if(prev!=NULL) FreeRDATData(prev);
			UNLNRDFILE(purids);
			return(tmp);
		}
		if(SubFunc!=NULL) ef=ADVNXTNRDsec(purids,1,SubFunc,args);
			else ef=NXTNRDsec(purids,1);
	}
	if(tmp!=NULL) Rfree(tmp);
	UNLNRDFILE(purids);
	return(NULL);
}
예제 #26
0
파일: mkgui.cpp 프로젝트: DTidd/OpenRDAAPI
static void selectrpt(RDArsrc *mainrsrc)
{
	int selected=0;
	struct RPTSTRUCTs r;
	char *temp=NULL;
	RDArsrc *tmprsrc=NULL;

	FINDRSCGETINT(mainrsrc,"RESOURCE LIST",&selected);
	r=RptAvl[selected];
	if(r.func!=NULL)
	{
		temp=Rmalloc(RDAstrlen(r.name)+18);
		sprintf(temp,"Creating %s Report",(r.name!=NULL?r.name:""));
		tmprsrc=odiagscrn("DIAGNOSTIC SCREEN",module,temp,NULL,NE(RptAvl));
		if(temp!=NULL) Rfree(temp);
		if(tmprsrc!=NULL)
		{
			if(ADVmakescrn(tmprsrc,TRUE))
			{
				prterr("Error Cannot Create Diagnostic Screen.");
				if(tmprsrc!=NULL) free_rsrc(tmprsrc);
			} else {
				ForceWindowUpdate(tmprsrc);
			}
		}
/*lint -e746 */
		r.func();
/*lint +e746 */
		FINDRSCLISTAPPlib(mainrsrc,"ERROR LIST",0,errorlist);
		updatersrc(mainrsrc,"ERROR LIST");
		if(tmprsrc!=NULL) 
		{
			update_diagnostic(tmprsrc,TRUE);
		}
		if(tmprsrc!=NULL)
		{
			killwindow(tmprsrc);
			free_rsrc(tmprsrc);
		}
	}
}
예제 #27
0
static void savecron(RDArsrc *r,RDArsrc *mainrsrc)
{
	char daymo[3],mon[3],daywk[3],*c=NULL;
	char tempx[1024];
	short m=0;
	int h=0,d=0,mo=0,wd=0,p=0;
	
	readallwidgets(r);
	FINDRSCGETSHORT(r,"MINUTE",&m);
	FINDRSCGETINT(r,"HOUR OF DAY",&h);
	FINDRSCGETINT(r,"DAY OF MONTH",&d);
	FINDRSCGETINT(r,"MONTH OF YEAR",&mo);
	FINDRSCGETINT(r,"DAY OF WEEK",&wd);
	FINDRSCGETINT(r,"PACKAGES",&p);
	FINDRSCGETSTRING(r,"COMMAND",&c);
	if(d==0) sprintf(daymo,"*");
		else sprintf(daymo,"%d",d);
	if(mo==0) sprintf(mon,"*");
		else sprintf(mon,"%d",mo);
	if(wd==7) sprintf(daywk,"*");
		else sprintf(daywk,"%d",wd);
	switch(p)
	{
		case 0: /* crontran */
			sprintf(tempx,"%d %d %s %s %s cd %s ; /rda/xpgms/crontran.lnx >/dev/null 2>&1",m,h,daymo,mon,daywk,CURRENTDIRECTORY);
			break;
		case 1: /* rdacroncd */
			sprintf(tempx,"%d %d %s %s %s %s/rdacroncd.lnx >/dev/null 2>&1",m,h,daymo,mon,daywk,CURRENTDIRECTORY);
			break;
		case 2: /* rdacrontape */
			sprintf(tempx,"%d %d %s %s %s %s/rdacrontape.lnx >/dev/null 2>&1",m,h,daymo,mon,daywk,CURRENTDIRECTORY);
			break;
		case 3: /* custom command */
			sprintf(tempx,"%d %d %s %s %s cd %s ; %s/scripts/setRDAenv %s",m,h,daymo,mon,daywk,CURRENTDIRECTORY,CURRENTDIRECTORY,c);
			prterr("%s",tempx);
			break;
	}	
	if(c!=NULL) Rfree(c);
	WriteCronJobs(mainrsrc,tempx);
	quitadd(r);
}
예제 #28
0
static void save_record(RDArsrc *mtnrsrc,mtnstruct *mtn,short update_list)
{
	char *rcddesc=NULL;

	if(ADVRECORDsec(MASTER->passkey->fileno,SCRNvirtualSubData,mtnrsrc))
	{
		rcddesc=ADVRECORDsecDesc(MASTER->passkey->fileno,SCRNvirtualSubData,mtnrsrc);
		if(rcddesc!=NULL)
		{
			ERRORDIALOG("Security Access Denied.",rcddesc,NULL,FALSE);
			Rfree(rcddesc);
		}
		prterr("Error didn't write record.");
	} else {
		WRTTRANS(MASTER->passkey->fileno,0,NULL,mtn->previous);
		DELETE_SUBORDINATES(mtnrsrc,MASTER,SCRNvirtualSubData,(void *)mtnrsrc);
		updatebrowse(update_list,mbl_fineacc,MASTER->passkey->fileno,MASTER->module,mtnrsrc);
		if(mbl_fineacc!=NULL) quit_record(mtnrsrc,mtn);
		else GetRDATData(MASTER->passkey->fileno,mtn->previous);
	}
}
예제 #29
0
파일: appadd.cpp 프로젝트: DTidd/OpenRDAAPI
int main(int argc,char **argv)
#endif
{
	short filenum=(-1);
	char *warnmessage=NULL,*module=NULL,*mtnname=NULL;

	RDA_SOFTWARE_TYPE=RDA_XPERT_AND_LITE_APP;
	module="APPMGT";
	mtnname="ADD APPLICANTS";
	if(InitializeSubsystems(argc,argv,module,mtnname))
	{
		RDAAPPMAINLOOP();
		return;
	}
	MTNMASTER=MaintainMasterNew(module,mtnname);
	if(findMaintainMaster(MTNMASTER))
	{
		warnmessage=Rmalloc(300+RDAstrlen(MTNMASTER->module)+RDAstrlen(mtnname));
		sprintf(warnmessage,"Error Maintain Master Definition not found, this process cannot be executed without it's definition [%s] in the [%s.MTN] library.",mtnname,MTNMASTER->module);
		ERRORDIALOG("MAINTAIN MTNMASTER NOT FOUND.",warnmessage,NULL,TRUE);
		prterr("%s",warnmessage);
		if(warnmessage!=NULL) Rfree(warnmessage);
		doexit(NULL);
	} else {
		if((filenum=APPOPNNRDEDITABLE(MTNMASTER->module,"APPCNT",&editable))==(-1))
		{
			doexit(NULL);
			return;
		}
		if(!OPEN_MASTER_FILES(MTNMASTER))
		{
			doexit(NULL);
			return;
		}
		MTNMASTER->passkey=READPassKey(filenum);
		MTNMASTER->inheritrsrcs=FALSE;
		mtndmg(NULL);
	}
	RDAAPPMAINLOOP();
}
예제 #30
0
파일: opncls.cpp 프로젝트: DTidd/OpenRDAAPI
DTA OPNNRDrda(NRDbuffer *NRDtmp)
{
	DTA tmp=NULL;
	char *filename=NULL;
	char *dashes=NULL;

#ifdef USE_RDA_DIAGNOSTICS
	if(diagnrd) { prterr("DIAG OPNNRDrda Opening File Definition [%s] [%s] using RDA Engine.",NRDtmp->modname,NRDtmp->name); }
#endif /* USE_RDA_DIAGNOSTICS */
	dashes=Rmalloc(RDAstrlen(NRDtmp->name)+8+RDAstrlen(NRDtmp->modname));
#ifndef WIN32
	sprintf(dashes,"./%s/%s.dat",NRDtmp->modname,NRDtmp->name);
#endif
#ifdef WIN32
	sprintf(dashes,".\\%s\\%s.dat",NRDtmp->modname,NRDtmp->name);
#endif
	filename=adddashes(dashes);
	tmp=OPNDTA(filename);
	if(filename!=NULL) Rfree(filename);
	if(dashes!=NULL) Rfree(dashes);
	return(tmp);
}