示例#1
0
int MatchNoCase(char *string, char *match)
{
  int result = -1;
  char *pattern;

  if(!(pattern = calloc(strlen(match)*2+2, sizeof(char)))) return -1;

  if(ParsePatternNoCase(match, pattern, (LONG)strlen(match)*2+2) > -1)
  {
     result = MatchPatternNoCase(pattern, string);
  }

  free(pattern);

  return result;
}
示例#2
0
static int findNextMatch( char * pFileName, char * wpName )
{
while(currentnode->ln_Succ)
	{
	/* printf("Trying with %s\n", currentnode->ln_Name); */
	if(MatchPatternNoCase(parsebuf, currentnode->ln_Name))
		{
		/* printf("Trovato %s\n", currentnode->ln_Name); */
		strcpy(wpName, pathpart);
		AddPart(wpName, currentnode->ln_Name, MAX_NAMELEN);
		currentnode = currentnode->ln_Succ;
		return TRUE;
		}
	currentnode = currentnode->ln_Succ;
	}
return FALSE;
}
示例#3
0
void listmot(char *foo)
{
    struct Mote *listpek=(struct Mote *)Servermem->mot_list.mlh_Head;
    int cnt, pattern = 0, patret;
    char buffer[61], motpattern[101];
    puttekn("\r\n\n",-1);

    if(foo[0])
    {
        strncpy(buffer,foo,50);
        patret = ParsePatternNoCase(buffer, motpattern, 98);

        if(patret != 1)
        {
            puttekn("\r\n\nDu måste ange ett argument som innehåller wildcards!\r\n", -1);
            return;
        }

        pattern = 1;
    }

    for(; listpek->mot_node.mln_Succ; listpek=(struct Mote *)listpek->mot_node.mln_Succ) {
        if(!MaySeeConf(listpek->nummer,inloggad,&Servermem->inne[nodnr])) continue;

        if(pattern && !MatchPatternNoCase(motpattern, listpek->namn)) continue;
        cnt=0;
        if(IsMemberConf(listpek->nummer, inloggad, &Servermem->inne[nodnr])) sprintf(outbuffer,"%3d %s ",countunread(listpek->nummer),listpek->namn);
        else sprintf(outbuffer,"   *%s ",listpek->namn);
        if(puttekn(outbuffer,-1)) return;
        if(listpek->status & SLUTET) if(puttekn(" (Slutet)",-1)) return;
        if(listpek->status & SKRIVSKYDD) if(puttekn(" (Skrivskyddat)",-1)) return;
        if(listpek->status & KOMSKYDD) if(puttekn(" (Kom.skyddat)",-1)) return;
        if(listpek->status & HEMLIGT) if(puttekn(" (Hemligt)",-1)) return;
        if(listpek->status & AUTOMEDLEM) if(puttekn(" (Auto)",-1)) return;
        if(listpek->status & SKRIVSTYRT) if(puttekn(" (Skrivstyrt)",-1)) return;
        if((listpek->status & SUPERHEMLIGT) && Servermem->inne[nodnr].status >= Servermem->cfg.st.medmoten) if(puttekn(" (ARexx-styrt)",-1)) return;
        if(puttekn("\r\n",-1)) return;
    }

    if(Servermem->info.hightext > -1)
        sprintf(outbuffer,"\r\n\nGlobala texter: Lägsta textnummer: %d   Högsta textnummer: %d\r\n\n",Servermem->info.lowtext, Servermem->info.hightext);
    else
        strcpy(outbuffer, "\r\n\nDet finns inga texter.\r\n\n");
    puttekn(outbuffer,-1);
}
示例#4
0
static int findFirstMatch( char * pFileName, char * wpName )
{
static BOOL isfirst=TRUE;
BPTR dirlock;
struct Node * newnode;
/* char * onefname; */
char * point;
unsigned len;

/* printf("Called findFirstMatch: %s %s\n", pFileName, wpName); */

if(isfirst)
	{
	isfirst=FALSE;

	NewListPPC(&filelist);

	fib = AllocDosObject(DOS_FIB, NULL);

	strcpy(filepart, FilePart(pFileName));

	if((point=PathPart(pFileName)) == pFileName) /* Current directory */
		{
		dirlock=DupLock(((struct Process *)FindTask(NULL))->pr_CurrentDir);
		*pathpart=0;
		}
	else
		{
		len =(unsigned) (point-pFileName);
		strncpy(pathpart, pFileName, len);
		pathpart[len]=0;

		dirlock=Lock(pathpart, ACCESS_READ);
		}

	if(dirlock)
		{
		if(Examine(dirlock, fib))
			{
			while(ExNext(dirlock, fib))
				{
				if(fib->fib_DirEntryType == ST_FILE || fib->fib_DirEntryType == ST_LINKFILE)
					{
					/* printf("%s\n", fib->fib_FileName); */

					newnode=malloc(sizeof(struct Node));

					newnode->ln_Type = NT_USER;
					newnode->ln_Name=malloc(strlen(fib->fib_FileName)+1);
					strcpy(newnode->ln_Name, fib->fib_FileName);

					AddTailPPC(&filelist, newnode);

					}
				}
			}

		UnLock(dirlock);

		FreeDosObject(DOS_FIB, fib);
		}
	else	return FALSE;
	}

if(ParsePatternNoCase(filepart, parsebuf, PARSEBUFLEN))
	{
	for(currentnode = filelist.lh_Head; currentnode->ln_Succ; currentnode = currentnode->ln_Succ)
		{
		/* printf("Match %s %s\n", parsebuf, currentnode->ln_Name); */
		if(MatchPatternNoCase(parsebuf, currentnode->ln_Name))
			{
			/* printf("Trovato %s\n", currentnode->ln_Name); */
			strcpy(wpName, pathpart);
			AddPart(wpName, currentnode->ln_Name, MAX_NAMELEN);
			currentnode = currentnode->ln_Succ;
			return TRUE;
			}
		}
/*	return FALSE; */
	}
return FALSE;
}