Beispiel #1
0
//vls-begin// subst page
void DLLEXPORT RemoveSubst(char* pattern)
{
    struct listnode* ln;
    if((ln=searchnode_list(common_subs, pattern))!=NULL) {
      deletenode_list(common_subs, ln);
      subnum--;
    }
}
Beispiel #2
0
LPSTR DLLEXPORT GetSubstText(char* pattern)
{
    if (!pattern)
        return NULL;

    char p[BUFFER_SIZE];
    strcpy(p, pattern);
    listnode* ln = searchnode_list(common_subs, p);
    if (ln)
        return ln->right;
    return NULL;
}
Beispiel #3
0
LPSTR DLLEXPORT SetSubst(char* text, char* pattern)
{
    struct listnode *ln;

    if ( !pattern || !*pattern) 
        return NULL;

    if((ln=searchnode_list(common_subs, pattern))!=NULL) {
        deletenode_list(common_subs, ln);
        subnum--;
    }

    if( text  ) {
        insertnode_list(common_subs, pattern, text, "0", ALPHA);
        subnum++;
        ln = searchnode_list(common_subs, pattern);
        return ln->left;
    }

    return NULL;
}
Beispiel #4
0
LPWSTR DLLEXPORT GetSubstText(const wchar_t* pattern)
{
    if (!pattern)
        return NULL;

    wchar_t p[BUFFER_SIZE];
    wcscpy(p, pattern);
    listnode* ln = searchnode_list(common_subs, p);
    if (ln)
        return ln->right;
    return NULL;
}
Beispiel #5
0
void DLLEXPORT SetSubstPattern(LPCSTR strOldPattern, LPCSTR strNewPattern)
{
    struct listnode *ln;
    char text[BUFFER_SIZE];
    if (!strOldPattern || !strcmp(strOldPattern, strNewPattern)) return;

    if((ln=searchnode_list(common_subs, (char *)strOldPattern))!=NULL) {
        strcpy(text, ln->left);
        deletenode_list(common_subs, ln);
        subnum--;
        SetSubst(text, (char*)strNewPattern);
    }
}
Beispiel #6
0
void DLLEXPORT SetSubstPattern(const wchar_t* strOldPattern, const wchar_t* strNewPattern)
{
    struct listnode *ln;
    wchar_t text[BUFFER_SIZE];
    if (!strOldPattern || !wcscmp(strOldPattern, strNewPattern)) return;

    if((ln=searchnode_list(common_subs, (wchar_t *)strOldPattern))!=NULL) {
        wcscpy(text, ln->left);
        deletenode_list(common_subs, ln);
        subnum--;
        SetSubst(text, (wchar_t*)strNewPattern);
    }
}
Beispiel #7
0
int is_speedwalk_dirs(char *cp)
{
  char command[2];
  int flag;
  flag=FALSE;

  while(*cp) {
      command[0] = *cp;
      command[1] = 0;
    if(*cp!='n' && *cp!='e' && *cp!='s' && *cp!='w' && *cp!='u' && *cp!='d' &&
    !isdigit(*cp) && !searchnode_list(common_pathdirs, cp) )
      return FALSE;
    if(!isdigit(*cp))
      flag=TRUE;
    cp++;
  }
  return flag;
}
Beispiel #8
0
void parse_sub(char *arg)
{
  char left[BUFFER_SIZE], right[BUFFER_SIZE], result[BUFFER_SIZE];
  struct listnode *mysubs, *ln;
  mysubs=common_subs;
  arg=get_arg_in_braces(arg, left,STOP_SPACES);
  arg=get_arg_in_braces(arg, right,WITH_SPACES);

  if(!*left) {
    tintin_puts2(rs::rs(1166));
    show_list(mysubs);
  }

  else if(*left && !*right) {
    if ((ln=search_node_with_wild(mysubs,left))!=NULL) {
      while((mysubs=search_node_with_wild(mysubs, left))!=NULL) {
        shownode_list(mysubs);
      }
    }
    else
      if (mesvar[MSG_SUB])
        tintin_puts2(rs::rs(1167));
  }

  else {
    if((ln=searchnode_list(mysubs, left))!=NULL) {
      deletenode_list(mysubs, ln);
      subnum--;
    }
    insertnode_list(mysubs, left, right, "0", ALPHA);
    subnum++;
    if (strcmp(right,".")!=0)
      sprintf(result, rs::rs(1168),right,left);
    else
      sprintf(result, rs::rs(1169), left);
    if (mesvar[MSG_SUB])
      tintin_puts2(result);
  }
}
Beispiel #9
0
void antisubstitute_command(const char *arg, struct session *ses)
{
    char left[BUFFER_SIZE];
    struct listnode *myantisubs, *ln;

    myantisubs = ses->antisubs;
    arg = get_arg_in_braces(arg, left, 1);

    if (!*left)
    {
        tintin_puts("#THESE ANTISUBSTITUTES HAS BEEN DEFINED:", ses);
        show_list(myantisubs);
    }
    else
    {
        if ((ln = searchnode_list(myantisubs, left)) != NULL)
            deletenode_list(myantisubs, ln);
        insertnode_list(myantisubs, left, left, 0, ALPHA);
        antisubnum++;
        if (ses->mesvar[MSG_SUBSTITUTE])
            tintin_printf(ses, "Ok. Any line with {%s} will not be subbed.", left);
    }
}