Esempio n. 1
0
void unsubstitute_command(char *arg)
{
  char left[BUFFER_SIZE] ,result[BUFFER_SIZE];
  struct listnode *mysubs, *ln;
  struct listnode TempPointerHolder;
  int flag;
  flag=FALSE;
  mysubs=common_subs;
  arg=get_arg_in_braces(arg,left,WITH_SPACES);
  TempPointerHolder.next = common_subs->next;
  while ((ln=search_node_with_wild(&TempPointerHolder, left))!=NULL) {
    if (mesvar[MSG_SUB]) {
      if (*(ln->right)=='.' && !*(ln->right+1))
        sprintf(result, rs::rs(1170), ln->left);
      else
        sprintf(result, rs::rs(1171), ln->left);
      tintin_puts2(result);
    }
    TempPointerHolder.next=ln->next;
    deletenode_list(mysubs, ln);
    subnum--;
    flag=TRUE;
    if ( TempPointerHolder.next == NULL ) 
        break;
  }
  if (!flag && mesvar[MSG_SUB])
    tintin_puts2(rs::rs(1172));
}
Esempio n. 2
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--;
    }
}
Esempio n. 3
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);
    }
}
Esempio n. 4
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);
    }
}
Esempio n. 5
0
void unantisubstitute_command(const char *arg, struct session *ses)
{
    char left[BUFFER_SIZE];
    struct listnode *myantisubs, *ln, *temp;
    bool flag = false;

    myantisubs = ses->antisubs;
    temp = myantisubs;
    arg = get_arg_in_braces(arg, left, 1);
    while ((ln = search_node_with_wild(temp, left)) != NULL)
    {
        if (ses->mesvar[MSG_SUBSTITUTE])
            tintin_printf(ses, "#Ok. Lines with {%s} will now be subbed.", ln->left);
        deletenode_list(myantisubs, ln);
        flag = true;
    }
    if (!flag && ses->mesvar[MSG_SUBSTITUTE])
        tintin_printf(ses, "#THAT ANTISUBSTITUTE (%s) IS NOT DEFINED.", left);
}
Esempio n. 6
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;
}
Esempio n. 7
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);
  }
}
Esempio n. 8
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);
    }
}