Exemplo n.º 1
0
void recherchedicho(struct clientA trinomA[],int taille,struct clientB *B)//fonction qui recherche un nom dans un tableau trié pour les nom 
{
    int i,bg=0,bd=taille-1, nomtrouve=faux;
    while(nomtrouve==faux && bg <= bd)//tant qu'on n'a pas trouvé la valeur et qu'on n'a pas fouillé tout le tableau
    {
        i=(bg+bd)/2;
        if(stringcomp(trinomA[i].nom,B->nom) == -1)
        
            bd = i-1;
         else if(stringcomp(trinomA[i].nom,B->nom)==1) 
            bg=i+1;
              
          else     
                  
                  {
                         nomtrouve = vrai;
                         					
						                                            
                   }       
            
     }    
	 
	 if((nomtrouve == vrai) && (stringcomp(trinomA[i].prenom,B->prenom)==0) && (stringcomp(trinomA[i].datenaiss,B->datenaiss)==0)) { 
	 
	 printf("%d",nomtrouve); 
	 
	}
                  
                                                             
 }             
Exemplo n.º 2
0
bool label::operator ==(const label &o) const
{
    return
            position == o.position &&
            rotation == o.rotation &&
            scale == o.scale &&
            justify == o.justify &&
            pin == o.pin &&
            !stringcomp(string, o.string);
}
Exemplo n.º 3
0
void trinom(struct clientA source[],int size)   //fonction qui tri les chaine de caract
{
  int temp=0;
  int tri=faux;
  int i=0;
  while (tri==faux)
  
  {
   tri=vrai;
   for(i=0;i<size-1;i++)
   {
    if (stringcomp(source[i].nom, source[i+1].nom)==-1)
    {
     struct clientA temp = source[i];
     source[i] = source [i+1];
     source [i+1] = temp;
     tri = faux;                 
    }               
   }     
  }   
}
Exemplo n.º 4
0
static int binary_test(char *op, char *arg1, char *arg2, int w)
{
	int len, i;
	const op_tbl_t *optp;

	len = strlen(op);

	for (optp = (op_tbl_t *)&op_table, i = 0;
	     i < ARRAY_SIZE(op_table);
	     optp++, i++) {

		if ((strncmp (op, optp->op, len) == 0) && (len == strlen (optp->op))) {
			if (w == 0) {
				return (stringcomp(arg1, arg2, optp->opcode));
			} else {
				return (arithcomp (arg1, arg2, optp->opcode, w));
			}
		}
	}

	printf("Unknown operator '%s'\n", op);
	return 0;	/* op code not found */
}
Exemplo n.º 5
0
/*=====xjdicrc - access and analyze "xjdicrc" file (if any)==============*/
void xjdicrc()
{
	unsigned char xjdicdir[128],rcstr[80],*rcwd;
	int ft,fn;
	extern int thisdic;
	extern char DicDir[];
	FILE *fm,*fopen();

#ifdef XJDDIC
	extern unsigned char Dnamet[10][100],XJDXnamet[10][100];
	extern unsigned char *dicbufft[10];
	extern unsigned long diclent[10], indkent[10],indptrt[10];
	extern int NoDics;
#endif
	extern unsigned char ENVname[], KDNSlist[];
	extern unsigned char EXTJDXname[], EXTname[], Rname[], Vname[], ROMname[];
	extern unsigned char RKname[];
	extern unsigned char filtnames[NOFILT][50],filtcodes[NOFILT][10][10];
	extern int Omode, Jverb, nofilts, filtact[], filtcoden[], filttype[], filton[];
	extern int RVACTIVE;
	extern unsigned char cl_rcfile[];
#ifdef XJDFRONTEND
	extern unsigned char GPL_File[];
	extern unsigned char Clip_File[];
	extern int KImode;
#endif

	strcpy(DicDir,ENVname); /* added by [email protected] */
	while(TRUE)
	{
		if (strlen(cl_rcfile) > 0)
		{
			fm = fopen(cl_rcfile,"r");
			if (fm != NULL) break;
			else
			{
				printf("Control file: %s cannot be accessed!\n",cl_rcfile);
			}
		}
		xjdicdir[0] = '\0';
		if (strlen(ENVname) > 2)
		{
			strcpy(xjdicdir,ENVname);
			strcat(xjdicdir,"/");
		}
		else    
		{
			strcpy(xjdicdir,getenv("HOME"));
			strcat(xjdicdir,"/");
		}
		strcat(xjdicdir,".xjdicrc");
		fm = fopen(xjdicdir,"r");
		if (fm != NULL) break;
		strcpy(xjdicdir,".xjdicrc");
		fm = fopen(xjdicdir,"r");
		if (fm != NULL) break;
		if (getenv("HOME") != NULL)
		{
			strcpy(xjdicdir,getenv("HOME"));
			strcat(xjdicdir,"/");
			strcat(xjdicdir,".xjdicrc");
			fm = fopen(xjdicdir,"r");
			if (fm != NULL) break;
		}
		printf("No control file detected!\n");
		return;
	}
	if (fm != NULL)
	{
		while(fgets(rcstr,79,fm) != NULL)
		{
			rcwd = (unsigned char *)strtok(rcstr," \t");
/*  dicdir works for all modes   */
			if( stringcomp((unsigned char *)"dicdir",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				strcpy(DicDir,rcwd);
				continue;
			}
#ifdef XJDCLSERV
			if( stringcomp((unsigned char *)"port",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				portno = atoi(rcwd);
				continue;
			}
			if( stringcomp((unsigned char *)"server",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				strcpy(host,rcwd);
				continue;
			}
#endif
#ifdef XJDFRONTEND
			if( stringcomp((unsigned char *)"omode",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				rcwd[0] = rcwd[0] | 0x20;
				if(rcwd[0] == 'j') Omode = 0;
				if(rcwd[0] == 'e') Omode = 1;
				if(rcwd[0] == 's') Omode = 2;
				continue;
			}
			if( stringcomp((unsigned char *)"kanamode",rcwd) == 0)
			{
				KImode = 0;
				continue;
			}
			if( stringcomp((unsigned char *)"exactmatch",rcwd) == 0)
			{
				EMtoggle ();
				continue;
			}
#endif
#ifdef XJDDIC
			if( stringcomp((unsigned char *)"dicfile",rcwd) == 0)
			{
				if (thisdic == 0)
				{
					thisdic = 1;
				}
				else
				{
					thisdic++;
					NoDics++;
				}
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				strcpy(Dnamet[thisdic],rcwd);
				strcpy(XJDXnamet[thisdic],rcwd);
				strcat(XJDXnamet[thisdic],".xjdx");
				continue;
			}
#endif
#ifdef XJDFRONTEND
                        if( stringcomp((unsigned char *)"gnufile",rcwd) == 0)
                        {
                                rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
                                strcpy(GPL_File,rcwd);
                                continue;
                        }
#endif
#ifdef XJDFRONTEND
                        if( stringcomp((unsigned char *)"clipfile",rcwd) == 0)
                        {
                                rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
                                strcpy(Clip_File,rcwd);
                                continue;
                        }
#endif
#ifdef XJDFRONTEND
                        if( stringcomp((unsigned char *)"extfile",rcwd) == 0)
                        {
                                rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
                                strcpy(EXTname,rcwd);
                                strcpy(EXTJDXname,rcwd);
                                strcat(EXTJDXname, ".xjdx");
                                continue;
                        }
#endif
#ifdef XJDFRONTEND
			if( stringcomp((unsigned char *)"rvdisplay",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				if( stringcomp((unsigned char *)"on",rcwd) == 0) RVACTIVE = TRUE;
				if( stringcomp((unsigned char *)"off",rcwd) == 0) RVACTIVE = FALSE;
				continue;
			}
#endif
#ifdef XJDFRONTEND
			if( stringcomp((unsigned char *)"kdnoshow",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				strcpy(KDNSlist,rcwd);
				continue;
			}
#endif
#ifdef XJDDIC
			if( stringcomp((unsigned char *)"kdicfile",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				strcpy(Dnamet[0],rcwd);
				strcpy(XJDXnamet[0],rcwd);
				strcat(XJDXnamet[0],".xjdx");
				continue;
			}
#endif
#ifdef XJDFRONTEND
			if( stringcomp((unsigned char *)"radkfile",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				strcpy(RKname,rcwd);
				continue;
			}
			if( stringcomp((unsigned char *)"radfile",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				strcpy(Rname,rcwd);
				continue;
			}
			if( stringcomp((unsigned char *)"verbfile",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				strcpy(Vname,rcwd);
				continue;
			}
			if( stringcomp((unsigned char *)"romfile",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				strcpy(ROMname,rcwd);
				continue;
			}
			if( stringcomp((unsigned char *)"jverb",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				if(stringcomp(rcwd,(unsigned char *)"on") == 0) Jverb = TRUE;
				if(stringcomp(rcwd,(unsigned char *)"off") == 0) Jverb = FALSE;
				continue;
			}
			if( stringcomp((unsigned char *)"filt",rcwd) == 0)
			{
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				sscanf(rcwd,"%d",&fn);
				if ((fn < 0)||(fn > NOFILT)) continue;
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				sscanf(rcwd,"%d",&ft);
				if (ft > 2) continue;
				filttype[fn] = ft;
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				filton[fn] = FALSE;
				if(stringcomp((unsigned char *)"on",rcwd) == 0) 
				{
					filton[fn] = TRUE;
					nofilts  = TRUE;
				}
				rcwd = (unsigned char *)strtok(NULL,"\"");
				strcpy(filtnames[fn],rcwd);
				ft=0;
				rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				while(rcwd != NULL)
				{
					strcpy(filtcodes[fn][ft],rcwd);
					ft++;
					rcwd = (unsigned char *)strtok(NULL," \t\f\r\n");
				}
				if(ft==0)continue;
				filtcoden[fn] = ft;
				filtact[fn] = TRUE;
				continue;
			}
#endif
		}
	}
	else
	{
		printf("No .xjdicrc file detected\n");
		return;
	}
	fclose(fm);
}