Example #1
0
TFile::TFile(const Stroka& name)
    : GeneratedDescriptor(NULL)
{
    if (!name)
        ythrow yexception() << "NBuiltin::TFile's base name cannot be empty";
    AddAlias(name);
}
Example #2
0
void CLI::Add(const std::string& path,
              const std::string& description,
              const std::string& alias,
              bool required)
{

  po::options_description& desc = CLI::GetSingleton().desc;
  // Must make use of boost syntax here.
  std::string progOptId = alias.length() ? path + "," + alias : path;

  // Add the alias, if necessary
  AddAlias(alias, path);

  // Add the option to boost program_options.
  desc.add_options()(progOptId.c_str(), po::value<T>(), description.c_str());

  // Make sure the appropriate metadata is inserted into gmap.
  gmap_t& gmap = GetSingleton().globalValues;

  ParamData data;
  T tmp = T();

  data.desc = description;
  data.name = path;
  data.tname = TYPENAME(T);
  data.value = boost::any(tmp);
  data.wasPassed = false;

  gmap[path] = data;

  // If the option is required, add it to the required options list.
  if (required)
    GetSingleton().requiredOptions.push_front(path);
}
Example #3
0
void LoanAssumption::SetAliases(const QString& val)
{
	ClearAliases();
	auto TempAl = val.split("$,$");
	for (auto i = TempAl.constBegin(); i != TempAl.constEnd();++i) {
		AddAlias(*i);
	}
}
Example #4
0
void ParseVarsFile(const string& filename)
{
  ifstream f(filename.c_str());

  if( f.is_open() )
  {
    while( !f.bad() && !f.eof())
    {
      const int c = f.peek();

      if( isspace(c) )
      {
        // ignore leading whitespace
        f.get();
      }else{
        if( c == '#' || c == '%' )
        {
          // ignore lines starting # or %
          string comment;
          getline(f,comment);
        }else{
          // Otherwise, find name and value, seperated by '=' and ';'
          string name;
          string val;
          getline(f,name,'=');
          getline(f,val,';');
          boost::trim_if(name, boost::is_any_of(" \t\n\r"));
          boost::trim_if(val, boost::is_any_of(" \t\n\r"));

          if( name.size() >0 && val.size() > 0 )
          {
            if( !val.substr(0,1).compare("@") )
            {
                AddAlias(name,val.substr(1));
            }else{
                AddVar(name,val);
            }
          }
        }
      }
    }
    f.close();
  }else{
    cerr << "Unable to open '" << filename << "' for configuration data" << endl;
  }
}
Example #5
0
aliasL* ReadInAliasList(char* file) {
  char* line = NULL;
  size_t len = 0;
  aliasL* aliasHead = NULL;
  FILE* fp = fopen(file, "r");
  if (fp) {
    while (getline(&line, &len, fp) != -1) {
      line[strlen(line)-1] = 0;
      AddAlias(&aliasHead, line);
    }
    fclose(fp);
    if (line) {
      free(line);
    }
  }
  return aliasHead;
}
Example #6
0
/*
 * AliasDlgProc - alias list dialog procedure
 */
INT_PTR CALLBACK AliasDlgProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    AnAlias     *cur;
    size_t      len;
    char        buf[CONST_LEN];
    char        msgbuf[256];
    int         sel;
    char        *endptr;
    char        *realend;
    char        *alias;
    long        id;
    WORD        cmd;

    switch( msg ) {
    case WM_INITDIALOG:
        if( (char *)lparam != NULL ) {
            SetWindowText( hwnd, (char *)lparam );
        }
        SendDlgItemMessage( hwnd, ALIAS_TEXT, EM_LIMITTEXT, 20, 0 );
        for( cur = CurHdl->data; cur != NULL; cur = cur->next ) {
            sprintf( buf, "0x%08lX", cur->id );
            SendDlgItemMessage( hwnd, ALIAS_ID_LIST, LB_ADDSTRING, 0, (LPARAM)buf );
        }
        break;
#ifndef NOUSE3D
    case WM_SYSCOLORCHANGE:
        CvrCtl3dColorChange();
        break;
#endif
    case WM_COMMAND:
        cmd = LOWORD( wparam );
        switch( cmd ) {
            case IDOK:
            case ALIAS_DO_MORE:
                SendDlgItemMessage( hwnd, ALIAS_CUR_ID, WM_GETTEXT, CONST_LEN, (LPARAM)buf );
                realend = buf;
                while( *realend != '\0' ) {
                    realend++;
                }
                realend--;
                while( isspace( *realend ) ) {
                    realend--;
                }
                realend++;
                id = strtol( buf, &endptr, 0 );
                if( endptr != realend || *buf == '\0' ) {
                    RCMessageBox( hwnd, ALIAS_VALUE_MUST_BE_INT, "", MB_OK );
                    break;
                }
                len = SendDlgItemMessage( hwnd, ALIAS_TEXT, WM_GETTEXTLENGTH, 0, 0 );
                alias = MemAlloc( len + 1 );
                len = SendDlgItemMessage( hwnd, ALIAS_TEXT, WM_GETTEXT, len + 1, (LPARAM)alias );
                /* check for spaces */
                endptr = alias;
                while( !isspace( *endptr ) && *endptr != '\0' ) {
                    endptr++;
                }
                realend = endptr;
                while( isspace( *endptr ) ) {
                    endptr++;
                }
                if( *endptr != '\0' ) {
                    RCMessageBox( hwnd, ALIAS_NO_SPACES_ALLOWED, "", MB_OK );
                    MemFree( alias );
                    break;
                }
                realend = '\0'; /* truncate trailing spaces */
                cur = findAliasFromText( CurHdl, alias );
                if( cur == NULL ) {
                    AddAlias( CurHdl, alias, id );
                } else {
                    RCsprintf( msgbuf, ALIAS_NO_DUPLICATES_ALLOWED, alias, cur->id );
                    MessageBox( hwnd, msgbuf, "", MB_OK );
                    MemFree( alias );
                    break;
                }
                MemFree( alias );
                EndDialog( hwnd, cmd );
                break;
            case IDCANCEL:
                EndDialog( hwnd, cmd );
                break;
            case ALIAS_ID_LIST:
                if( GET_WM_COMMAND_CMD( wparam, lparam ) == LBN_SELCHANGE ) {
                    sel = (int)SendDlgItemMessage( hwnd, ALIAS_ID_LIST, LB_GETCURSEL, 0, 0L );
                    SendDlgItemMessage( hwnd, ALIAS_ID_LIST, LB_GETTEXT, sel, (LPARAM)buf );
                    SendDlgItemMessage( hwnd, ALIAS_CUR_ID, WM_SETTEXT, 0, (LPARAM)buf );
                    cur = getIthAlias( CurHdl, sel );
                    SendDlgItemMessage( hwnd, ALIAS_TEXT, WM_SETTEXT, 0, (LPARAM)cur->name );
                }
                break;
            default:
                return( FALSE );
        }
    default:
        return( FALSE );
    }
    return( TRUE );
}
Example #7
0
//Run commands that are built-in shell functions
static void RunBuiltInCmd(commandT* cmd)
{
  //Send SIGCONT to a backgrounded job, but do not give it the foreground 
  if (strncmp(cmd->argv[0], "bg", 2) == 0)
  {
    //If there are two arguments in the command...
    if (cmd->argc == 2)
      //Bring the process with the given jobNumber
      continueBgJob(strtol(cmd->argv[1],NULL,10));
    //If there is one argument in the command...
    else if (cmd->argc == 1)
      //Bring the most recent background process to the foreground
      continueBgJob(-1);
    else
    {
      fprintf(stderr, "Too many arguments were given with bg.\n");
    }
  }
  //Return a backgrounded job to the foreground 
  else if (strncmp(cmd->argv[0], "fg", 2) == 0)
  {
    //If there are two arguments in the command...
    if (cmd->argc == 2)
      //Bring the process with the given jobNumber
      bringToForeground(strtol(cmd->argv[1],NULL,10));
    //If there is one argument in the command...
    else if (cmd->argc == 1)
      //Bring the most recent background process to the foreground
      bringToForeground(-1);
    else
    {
      fprintf(stderr, "Too many arguments were given with fg.\n");
    }
  }
  //makenew alias 
  else if (strncmp(cmd->argv[0], "alias", 5) == 0)
  {
    //If there are two arguments in the command...
    if (cmd->argc == 2)
      //make new binding
      AddAlias(cmd);
    //show all bindings
    else if (cmd->argc == 1)
      PrintAliases();

  }
  else if (strncmp(cmd->argv[0], "unalias", 7) == 0)
  {
    RemoveAlias(cmd->argv[1]);
  }
  else if (strncmp(cmd->argv[0], "cd", 2) == 0)
  {
    int err;
    //If a directory is given, go to that directory
    if (cmd->argc == 2)
      err = chdir(cmd->argv[1]);
    //If a directory isn't given, go to the user's home directory
    else
      err = chdir(getenv("HOME"));
    //If there was a problem changing directories, print an error
    if (err == -1)
      fprintf(stderr, "%s\n", "Invalid directory\n");
  }
  //Print the list of background jobs (bgJobsHead)
  else if (strncmp(cmd->argv[0], "jobs", 4) == 0){
    PrintBgJobList();
  } 
  else
  {
    fprintf(stderr, "%s is an unrecognized internal command\n", cmd->argv[0]);
    fflush(stdout);
  }
}
Example #8
0
int directive( int i, long direct )
/* Handle all directives */
{
    int         ret;

    /* no expansion on the following */
    switch( direct ) {
    case T_MASM:
        Options.mode &= ~MODE_IDEAL;
        return( NOT_ERROR );
    case T_IDEAL:
        Options.mode |= MODE_IDEAL;
        return( NOT_ERROR );
    case T_DOT_286C:
        direct = T_DOT_286;
    case T_DOT_8086:
    case T_DOT_186:
    case T_DOT_286:
    case T_DOT_286P:
    case T_DOT_386:
    case T_DOT_386P:
    case T_DOT_486:
    case T_DOT_486P:
    case T_DOT_586:
    case T_DOT_586P:
    case T_DOT_686:
    case T_DOT_686P:
    case T_DOT_8087:
    case T_DOT_287:
    case T_DOT_387:
    case T_DOT_NO87:
    case T_DOT_K3D:
    case T_DOT_MMX:
    case T_DOT_XMM:
    case T_DOT_XMM2:
    case T_DOT_XMM3:
        if( Options.mode & MODE_IDEAL ) {
            AsmError( UNKNOWN_DIRECTIVE );
            return( ERROR );
        } else {
            ret = cpu_directive(direct);
            if( Parse_Pass != PASS_1 )
                ret = NOT_ERROR;
            return( ret );
        }
    case T_P286N:
        direct = T_P286;
    case T_P8086:
    case T_P186:
    case T_P286:
    case T_P286P:
    case T_P386:
    case T_P386P:
    case T_P486:
    case T_P486P:
    case T_P586:
    case T_P586P:
    case T_P686:
    case T_P686P:
    case T_P8087:
    case T_P287:
    case T_P387:
    case T_PK3D:
    case T_PMMX:
    case T_PXMM:
    case T_PXMM2:
    case T_PXMM3:
        ret = cpu_directive(direct);
        if( Parse_Pass != PASS_1 )
            ret = NOT_ERROR;
        return( ret );
    case T_DOT_DOSSEG:
        if( Options.mode & MODE_IDEAL ) {
            AsmError( UNKNOWN_DIRECTIVE );
            return( ERROR );
        }
    case T_DOSSEG:
        Globals.dosseg = TRUE;
        return( NOT_ERROR );
    case T_PUBLIC:
        /* special case - expanded inside iff it is an EQU to a symbol */
        return( Parse_Pass == PASS_1 ? PubDef(i+1) : NOT_ERROR );
    case T_ELSE:
    case T_ELSEIF:
    case T_ELSEIF1:
    case T_ELSEIF2:
    case T_ELSEIFB:
    case T_ELSEIFDEF:
    case T_ELSEIFE:
    case T_ELSEIFNB:
    case T_ELSEIFNDEF:
    case T_ELSEIFDIF:
    case T_ELSEIFDIFI:
    case T_ELSEIFIDN:
    case T_ELSEIFIDNI:
    case T_ENDIF:
    case T_IF:
    case T_IF1:
    case T_IF2:
    case T_IFB:
    case T_IFDEF:
    case T_IFE:
    case T_IFNB:
    case T_IFNDEF:
    case T_IFDIF:
    case T_IFDIFI:
    case T_IFIDN:
    case T_IFIDNI:
        return( conditional_assembly_directive( i ) );
    case T_DOT_ERR:
    case T_DOT_ERRB:
    case T_DOT_ERRDEF:
    case T_DOT_ERRDIF:
    case T_DOT_ERRDIFI:
    case T_DOT_ERRE:
    case T_DOT_ERRIDN:
    case T_DOT_ERRIDNI:
    case T_DOT_ERRNB:
    case T_DOT_ERRNDEF:
    case T_DOT_ERRNZ:
        if( Options.mode & MODE_IDEAL ) {
            AsmError( UNKNOWN_DIRECTIVE );
            return( ERROR );
        }
    case T_ERR:
    case T_ERRIFB:
    case T_ERRIFDEF:
    case T_ERRIFDIF:
    case T_ERRIFDIFI:
    case T_ERRIFE:
    case T_ERRIFIDN:
    case T_ERRIFIDNI:
    case T_ERRIFNDEF:
        return( conditional_error_directive( i ) );
    case T_ENDS:
        if( Definition.struct_depth != 0 )
            return( StructDef( i ) );
        // else fall through to T_SEGMENT
    case T_SEGMENT:
        return( Parse_Pass == PASS_1 ? SegDef(i) : SetCurrSeg(i) );
    case T_GROUP:
        return( Parse_Pass == PASS_1 ? GrpDef(i) : NOT_ERROR );
    case T_PROC:
        return( ProcDef( i, TRUE ) );
    case T_ENDP:
        return( ProcEnd(i) );
    case T_ENUM:
        return( EnumDef( i ) );
    case T_DOT_CODE:
    case T_DOT_STACK:
    case T_DOT_DATA:
    case T_DOT_DATA_UN:
    case T_DOT_FARDATA:
    case T_DOT_FARDATA_UN:
    case T_DOT_CONST:
        if( Options.mode & MODE_IDEAL ) {
            AsmError( UNKNOWN_DIRECTIVE );
            return( ERROR );
        }
    case T_CODESEG:
    case T_STACK:
    case T_DATASEG:
    case T_UDATASEG:
    case T_FARDATA:
    case T_UFARDATA:
    case T_CONST:
        return( SimSeg(i) );
    case T_WARN:
    case T_NOWARN:
        return( NOT_ERROR ); /* Not implemented yet */
    case T_DOT_ALPHA:
    case T_DOT_SEQ:
    case T_DOT_LIST:
    case T_DOT_LISTALL:
    case T_DOT_LISTIF:
    case T_DOT_LISTMACRO:
    case T_DOT_LISTMACROALL:
    case T_DOT_NOLIST:
    case T_DOT_XLIST:
    case T_DOT_TFCOND:
    case T_DOT_SFCOND:
    case T_DOT_LFCOND:
    case T_DOT_CREF:
    case T_DOT_XCREF:
    case T_DOT_NOCREF:
    case T_DOT_SALL:
    case T_PAGE:
    case T_TITLE:
    case T_SUBTITLE:
    case T_SUBTTL:
        if( Options.mode & MODE_IDEAL ) {
            AsmError( UNKNOWN_DIRECTIVE );
            return( ERROR );
        }
        AsmWarn( 4, IGNORING_DIRECTIVE );
        return( NOT_ERROR );
    case T_DOT_BREAK:
    case T_DOT_CONTINUE:
    case T_DOT_ELSE:
    case T_DOT_ENDIF:
    case T_DOT_ENDW:
    case T_DOT_IF:
    case T_DOT_RADIX:
    case T_DOT_REPEAT:
    case T_DOT_UNTIL:
    case T_DOT_WHILE:
        if( Options.mode & MODE_IDEAL ) {
            AsmError( UNKNOWN_DIRECTIVE );
            return( ERROR );
        }
    case T_ECHO:
    case T_HIGH:
    case T_HIGHWORD:
    case T_LOW:
    case T_LOWWORD:
    case T_ADDR:
    case T_BOUND:
    case T_CASEMAP:
    case T_INVOKE:
    case T_LROFFSET:
    case T_OPATTR:
    case T_OPTION:
    case T_POPCONTEXT:
    case T_PUSHCONTEXT:
    case T_PROTO:
    case T_THIS:
    case T_WIDTH:
        if( Options.mode & MODE_IDEAL ) {
            AsmError( UNKNOWN_DIRECTIVE );
            return( ERROR );
        }
    case T_CATSTR:
    case T_MASK:
    case T_PURGE:
    case T_RECORD:
    case T_TYPEDEF:
    case T_UNION:
        AsmError( NOT_SUPPORTED );
        return( ERROR );
    case T_ORG:
        ExpandTheWorld( 0, FALSE, TRUE );
        break;
    case T_TEXTEQU:     /* TEXTEQU */
        if( Options.mode & MODE_IDEAL ) {
            AsmError( UNKNOWN_DIRECTIVE );
            return( ERROR );
        }
    case T_EQU2:        /* = */
    case T_EQU:         /* EQU */
        /* expand any constants and simplify any expressions */
        ExpandTheConstant( 0, FALSE, TRUE );
        break;
    case T_NAME:        /* no expand parameters */
        break;
    case T_DOT_STARTUP:
    case T_DOT_EXIT:
        if( Options.mode & MODE_IDEAL ) {
            AsmError( UNKNOWN_DIRECTIVE );
            return( ERROR );
        }
    case T_STARTUPCODE:
    case T_EXITCODE:
    default:
        /* expand any constants in all other directives */
        ExpandAllConsts( 0, FALSE );
        break;
    }

    switch( direct ) {
    case T_ALIAS:
        if( Parse_Pass == PASS_1 )
            return( AddAlias( i ) );
        return( NOT_ERROR );
    case T_EXTERN:
        if( Options.mode & MODE_IDEAL ) {
            break;
        }
    case T_EXTRN:
        return( Parse_Pass == PASS_1 ? ExtDef( i+1, FALSE ) : NOT_ERROR );
    case T_COMM:
        return( Parse_Pass == PASS_1 ? CommDef(i+1) : NOT_ERROR );
    case T_EXTERNDEF:
        if( Options.mode & MODE_IDEAL ) {
            break;
        }
    case T_GLOBAL:
        return( Parse_Pass == PASS_1 ? ExtDef( i+1, TRUE ) : NOT_ERROR );
    case T_DOT_MODEL:
        if( Options.mode & MODE_IDEAL ) {
            break;
        }
    case T_MODEL:
        return( Model(i) );
    case T_INCLUDE:
        return( Include(i+1) );
    case T_INCLUDELIB:
        return( Parse_Pass == PASS_1 ? IncludeLib(i+1) : NOT_ERROR );
    case T_ASSUME:
        return( SetAssume(i) );
    case T_END:
        return( ModuleEnd(Token_Count) );
    case T_EQU:
        return( DefineConstant( i-1, FALSE, FALSE ) );
    case T_EQU2:
        return( DefineConstant( i-1, TRUE, FALSE ) );
    case T_TEXTEQU:
        return( DefineConstant( i-1, TRUE, TRUE ) );
    case T_MACRO:
        return( MacroDef(i, FALSE ) );
    case T_ENDM:
        return( MacroEnd( FALSE ) );
    case T_EXITM:
        return( MacroEnd( TRUE ) );
    case T_ARG:
        return( Parse_Pass == PASS_1 ? ArgDef(i) : NOT_ERROR );
    case T_USES:
        return( Parse_Pass == PASS_1 ? UsesDef(i) : NOT_ERROR );
    case T_LOCAL:
        return( Parse_Pass == PASS_1 ? LocalDef(i) : NOT_ERROR );
    case T_COMMENT:
        if( Options.mode & MODE_IDEAL )
            break;
        return( Comment( START_COMMENT, i ) );
    case T_STRUCT:
        if( Options.mode & MODE_IDEAL ) {
            break;
        }
    case T_STRUC:
        return( StructDef( i ) );
    case T_NAME:
        return( Parse_Pass == PASS_1 ? NameDirective(i) : NOT_ERROR );
    case T_LABEL:
        return( LabelDirective( i ) );
    case T_ORG:
        return( OrgDirective( i ) );
    case T_ALIGN:
    case T_EVEN:
        return( AlignDirective( direct, i ) );
    case T_FOR:
        if( Options.mode & MODE_IDEAL ) {
            break;
        }
    case T_IRP:
        return( ForDirective ( i+1, IRP_WORD ) );
    case T_FORC:
        if( Options.mode & MODE_IDEAL ) {
            break;
        }
    case T_IRPC:
        return( ForDirective ( i+1, IRP_CHAR ) );
    case T_REPEAT:
        if( Options.mode & MODE_IDEAL ) {
            break;
        }
    case T_REPT:
        return( ForDirective ( i+1, IRP_REPEAT ) );
    case T_DOT_STARTUP:
    case T_DOT_EXIT:
    case T_STARTUPCODE:
    case T_EXITCODE:
        return( Startup ( i ) );
    case T_LOCALS:
    case T_NOLOCALS:
        return( Locals( i ) );
    }
    AsmError( UNKNOWN_DIRECTIVE );
    return( ERROR );
}
Example #9
0
void CLI::Add(const std::string& identifier,
              const std::string& description,
              const std::string& alias,
              const bool required,
              const bool input)
{
  // Temporarily define color code escape sequences.
  #ifndef _WIN32
    #define BASH_RED "\033[0;31m"
    #define BASH_CLEAR "\033[0m"
  #else
    #define BASH_RED ""
    #define BASH_CLEAR ""
  #endif

  // Temporary outstream object for detecting duplicate identifiers.
  util::PrefixedOutStream outstr(std::cerr,
        BASH_RED "[FATAL] " BASH_CLEAR, false, true /* fatal */);

  #undef BASH_RED
  #undef BASH_CLEAR

  // Define identifier and alias maps.
  gmap_t& gmap = GetSingleton().globalValues;
  amap_t& amap = GetSingleton().aliasValues;

  // If found in current map, print fatal error and terminate the program.
  if (gmap.count(identifier))
    outstr << "Parameter --" << identifier << "(-" << alias << ") "
           << "is defined multiple times with same identifiers." << std::endl;
  if (amap.count(alias))
    outstr << "Parameter --" << identifier << "(-" << alias << ") "
           << "is defined multiple times with same alias." << std::endl;

  po::options_description& desc = CLI::GetSingleton().desc;
  // Must make use of boost syntax here.
  std::string progOptId =
          alias.length() ? identifier + "," + alias : identifier;

  // Add the alias, if necessary
  AddAlias(alias, identifier);

  // Add the option to boost program_options.
  desc.add_options()(progOptId.c_str(), po::value<T>(), description.c_str());

  // Make sure the appropriate metadata is inserted into gmap.
  ParamData data;
  T tmp = T();

  data.desc = description;
  data.name = identifier;
  data.tname = TYPENAME(T);
  data.value = boost::any(tmp);
  data.wasPassed = false;

  gmap[identifier] = data;

  // If the option is required, add it to the required options list.
  if (required)
    GetSingleton().requiredOptions.push_front(identifier);

  // Depending on whether or not the option is input or output, add it to the
  // appropriate list.
  if (input)
    GetSingleton().inputOptions.push_front(identifier);
  else
    GetSingleton().outputOptions.push_front(identifier);
}
Example #10
0
void  dbUpdateDefaultsFromFile(char * ConFigFileName)
{
   FILE *fptr;
   char buffer[100];
   char *c;
   char *keyword;
   char * value;

   if(! (fptr = fopen(ConFigFileName,"r")) )return;
   while(fgetsp(buffer,99,fptr) ){
      if( c = strchr(buffer,'!') ) *c = 0;
      if( c = strchr(buffer,'#') ) *c = 0;
      if( c = strchr(buffer,';') ) *c = 0;

      if(!buffer) continue;
      if(!strchr(buffer,'=') ){
         keyword = Upstring(strtok(buffer," \t"));
	 if(!keyword)continue;
	 if(!strcmp(keyword,"ALIAS"))AddAlias(strtok(0," \t\n"),strtok(0," \t\n"));
	 continue;
      }
      DeBlank(buffer);
      keyword = strtok(buffer,"=");
      value = strtok(0,"=\n");
      if(!value)continue;
      if(!strcmp(Upstring(keyword),"MAXROWSINQUERY") )
          sscanf(value,"%d",&MaxRowsInQuery);

      if(!strcmp(Upstring(keyword),"ORACLELOGINNAME") )
          strcpy(logname,value);

      if(!strcmp(Upstring(keyword),"ORACLEPASSWORD") )
          strcpy(passwd,value);

      if(!strcmp(Upstring(keyword),"SID") )
          strcpy(sid,value);

      if(!strcmp(Upstring(keyword),"SCHEMA") )
         strcpy(Schema,value);

      if(!strcmp(Upstring(keyword),"PHASELIST") )
         strcpy(Phaselist,value);

      if(!strcmp(Upstring(keyword),"AUTHLIST") )
         strcpy(Authlist,value);

      if(!strcmp(Upstring(keyword),"CROPFROMPATH") )
         strcpy(CropFromPath,value);

      if(!strcmp(Upstring(keyword),"PREPENDTOPATH") )
         strcpy(PrependToPath,value);

      if(!strcmp(Upstring(keyword),"CASESENSITIVITY") ){
         if(!strcmp(Upstring(value),"ON") )
            strcpy(CaseSensitivity,"ON");
         else if(!strcmp(Upstring(value),"OFF") )
            strcpy(CaseSensitivity,"OFF");
         else
	    dbPrintToDevice("WARNING: Bad value for CaseSensitivity in config file.\n");
      }

      else if( !strcmp( Upstring(    keyword ) , "WFDISCTABLE" ) )
         strcpy( wfdiscTableName     , value ) ;
      else if( !strcmp( Upstring(    keyword ) , "WFTAGTABLE" ) )
         strcpy( wftagTableName      , value ) ;
      else if( !strcmp( Upstring(    keyword ) , "ORIGINTABLE" ) )
         strcpy( originTableName     , value ) ;
      else if( !strcmp( Upstring(    keyword ) , "EVENTTABLE" ) )
         strcpy( eventTableName      , value ) ;
      else if( !strcmp( Upstring(    keyword ) , "ARRIVALTABLE" ) )
         strcpy( arrivalTableName    , value ) ;
      else if( !strcmp( Upstring(    keyword ) , "ASSOCTABLE" ) )
         strcpy( assocTableName      , value ) ;
      else if( !strcmp( Upstring(    keyword ) , "SITETABLE" ) )
         strcpy( siteTableName       , value ) ;
      else if( !strcmp( Upstring(    keyword ) , "SITECHANTABLE" ) )
         strcpy( sitechanTableName   , value ) ;
      else if( !strcmp( Upstring(    keyword ) , "SEARCHLINKTABLE" ) )
         strcpy( searchlinkTableName , value ) ;
      else if( !strcmp( Upstring(    keyword ) , "INSTRUMENTTABLE" ) )
         strcpy( instrumentTableName , value ) ;
      else if( !strcmp( Upstring(    keyword ) , "SENSORTABLE" ) )
         strcpy( sensorTableName     , value ) ;


      strcpy(ConnectString,logname);
      strcat(ConnectString,"/");
      strcat(ConnectString,passwd);

   }


   fclose(fptr);
}
Example #11
0
void InitializeMQ2Commands()
{
    int i;
    DebugSpew("Initializing Commands");
    InitializeCriticalSection(&gCommandCS);

    EzDetour(CEverQuest__InterpretCmd,&CCommandHook::Detour,&CCommandHook::Trampoline);

    // Import EQ commands
    PCMDLIST pCmdListOrig = (PCMDLIST)EQADDR_CMDLIST;
    for (i=0;pCmdListOrig[i].fAddress != 0;i++) {
        if (!strcmp(pCmdListOrig[i].szName,"/who")) {
            cmdWho  = (fEQCommand)pCmdListOrig[i].fAddress;
            AddCommand("/",pCmdListOrig[i].fAddress,TRUE,1,1); // make sure / does EQ who by default
        } else if (!strcmp(pCmdListOrig[i].szName,"/whotarget")) {
            cmdWhoTarget  = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/location")) {
            cmdLocation  = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/help")) {
            cmdHelp = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/target")) {
            cmdTarget = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/charinfo")) {
            cmdCharInfo = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/filter")) {
            cmdFilter = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/doability")) {
            cmdDoAbility = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/cast")) {
            cmdCast = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/useitem")) {
            cmdUseItem = (fEQCommand)pCmdListOrig[i].fAddress;
        }
        AddCommand(pCmdListOrig[i].szName,pCmdListOrig[i].fAddress,TRUE,1,1);
    }    



    // Add MQ commands...
    struct _NEWCOMMANDLIST { PCHAR szCommand; fEQCommand pFunc; BOOL Parse; BOOL InGame;} NewCommands[] = {
        {"/who",        SuperWho,1,1},
        {"/whotarget",  SuperWhoTarget,1,1},
        {"/location",   Location,1,1},
        {"/help",       Help,1,0},
        {"/target",     Target,1,1},
        {"/alias",      Alias,0,0},
        {"/aa",         AltAbility,0,1},
        {"/substitute", Substitute,0,0},
        {"/filter",     Filter,1,0},
        {"/whofilter",  SWhoFilter,1,1},
        {"/spewfile",   DebugSpewFile,1,0},
        {"/char",       CharInfo,1,1},
        {"/face",       Face,1,1},
        {"/identify",   Identify,1,1},
        {"/where",      Where,1,1},
        {"/skills",     Skills,1,1},
        {"/unload",     Unload,1,0},
        {"/macro",      Macro,1,0},
        {"/buyitem",    BuyItem,1,1},
        {"/sellitem",   SellItem,1,1},
        {"/memspell",   MemSpell,1,1},
        {"/loadspells", LoadSpells,1,1},
        {"/loginname",  DisplayLoginName,1,0},
        {"/endmacro",   EndMacro,1,0},
        {"/listmacros", ListMacros,1,0},
        {"/echo",       Echo,1,0},
        {"/msgbox",     MQMsgBox,1,0},
        {"/lootall",    LootAll,1,0},
        {"/alert",      Alert,1,1},
        {"/click",      Click,1,0},
        {"/mqpause",    MacroPause,1,0},
        {"/items",      Items,1,1},
        {"/itemtarget", ItemTarget,1,1},
        {"/doability",  DoAbility,1,1},
        {"/doors",      Doors,1,1},
        {"/doortarget", DoorTarget,1,1},
        {"/beep",       MacroBeep,1,0},
        {"/cast",       Cast,1,1},
        {"/mqlog",      MacroLog,1,0},
        {"/seterror",   SetError,1,0},
        {"/declare",    NewDeclareVar,1,0},
        {"/deletevar",  NewDeleteVarCmd,1,0},
        {"/varcalc",    NewVarcalc,1,0},
        {"/varset",     NewVarset,1,0},
        {"/vardata",    NewVardata,1,0},
        {"/delay",      Delay,0,0}, // do not parse
        {"/cleanup",    Cleanup,1,0},
        {"/doevents",   DoEvents,1,0},
        {"/goto",       Goto,1,0},
        {"/for",        For,1,0},
        {"/next",       Next,1,0},
        {"/call",       Call,1,0},
        {"/return",     Return,1,0},
        {"/updateitems",UpdateItemInfo,1,1},
        {"/ini",        IniOutput,1,0},
        {"/dumpstack",  DumpStack,1,0},
        {"/setautorun", SetAutoRun,0,1},
        {"/banklist",   BankList,1,1},
        {"/look",       Look,1,1},
        {"/keepkeys",   KeepKeys,1,0},
        {"/windowstate",WindowState,1,0},
        {"/plugin",     PluginCommand,1,0},
        {"/destroy",    EQDestroyHeldItemOrMoney,1,1},
        {"/exec",       Exec,1,0}, 
        {"/keypress",   DoMappable,1,0},
        {"/popup",      PopupText,1,1},
        {"/multiline",  MultilineCommand,0,0},
        {"/bind",       MQ2KeyBindCommand,1,0},
        {"/ranged",     do_ranged,1,1},
        {"/loadcfg",    LoadCfgCommand,1,0},
        {"/dumpbinds",  DumpBindsCommand,1,0},
        {"/squelch",    SquelchCommand,1,0},
        {"/dosocial",   DoSocial,1,1},
        {"/docommand",  DoCommandCmd,1,0},
        {"/ctrlkey",    DoCtrlCmd,0,0},
        {"/altkey",     DoAltCmd,0,0},
        {"/shiftkey",   DoShiftCmd,0,0},
        {"/timed",      DoTimedCmd,0,0},
        {"/if",         NewIf,1,0},
        {"/while",      WhileCmd,1,0},
        {"/combine",    CombineCmd,1,1},
        {"/clearerrors",ClearErrorsCmd,1,0},
        {"/drop",       DropCmd,1,0},
        {"/hud",        HudCmd,1,0},
        {"/caption",    CaptionCmd,0,0},
        {"/captioncolor",CaptionColorCmd,1,0},
        {"/noparse",    NoParseCmd,0,0},
        {"/nomodkey",   NoModKeyCmd,0,0},
        {"/useitem",    UseItemCmd,1,1},
		{"/spellslotinfo",SpellSlotInfo,1,1},
		{"/getwintitle",GetWinTitle,1,0},
		{"/setwintitle",SetWinTitle,1,0},
		{"/removebuff",RemoveBuff,1,1},
		{"/makemevisible",MakeMeVisible,0,1},
        {NULL,          NULL,0,1},
    };

    // Remove replaced commands first
    for (i = 0 ; NewCommands[i].szCommand && NewCommands[i].pFunc ; i++)
    {
        RemoveCommand(NewCommands[i].szCommand);
        AddCommand(NewCommands[i].szCommand,NewCommands[i].pFunc,0,NewCommands[i].Parse,NewCommands[i].InGame);
    }

    /* ALIASES FOR OUT OF ORDER SHORTHAND COMMANDS */
    AddAlias("/d","/duel");
    AddAlias("/t","/tell");
    AddAlias("/w","/who");
    AddAlias("/a","/anonymous");
    AddAlias("/ta","/tap");
    AddAlias("/c","/consider");
    AddAlias("/cha","/channel");
    AddAlias("/f","/feedback");
    AddAlias("/fa","/fastdrop");
    AddAlias("/m","/msg");
    AddAlias("/load","/loadspells");
    AddAlias("/b","/bazaar");
    AddAlias("/ba","/bazaar");
    AddAlias("/g","/gsay");
    AddAlias("/gu","/guildsay");
    AddAlias("/key","/keys");
    AddAlias("/r","/reply");

    AddAlias("/newif","/if");
    /* NOW IMPORT THE USER'S ALIAS LIST, THEIR MODIFICATIONS OVERRIDE EXISTING. */

    CHAR AliasList[MAX_STRING*10] = {0};
    CHAR szBuffer[MAX_STRING] = {0};
    CHAR MainINI[MAX_STRING] = {0};
    sprintf(MainINI,"%s\\macroquest.ini",gszINIPath);
    GetPrivateProfileString("Aliases",NULL,"",AliasList,MAX_STRING*10,MainINI);
    PCHAR pAliasList = AliasList;
    while (pAliasList[0]!=0) {
        GetPrivateProfileString("Aliases",pAliasList,"",szBuffer,MAX_STRING,MainINI);
        if (szBuffer[0]!=0) {
            AddAlias(pAliasList,szBuffer);
        }
        pAliasList+=strlen(pAliasList)+1;
    }

    // Here is where you can add in permanent Substitutions
    AddSubstitute("omg","Oh My God");

    //Importing the User's Substitution List from .ini file
    CHAR SubsList[MAX_STRING*10] = {0};
    CHAR szBuffer2[MAX_STRING] = {0};
    sprintf(MainINI,"%s\\macroquest.ini",gszINIPath);
    GetPrivateProfileString("Substitutions",NULL,"",SubsList,MAX_STRING*10,MainINI);
    PCHAR pSubsList = SubsList;
    while (pSubsList[0]!=0) {
        GetPrivateProfileString("Substitutions",pSubsList,"",szBuffer2,MAX_STRING,MainINI);
        if (szBuffer[0]!=0) {
            AddSubstitute(pSubsList,szBuffer2);
        }
        pSubsList+=strlen(pSubsList)+1;
    }
}
Example #12
0
static void RunBuiltInCmd(commandT* cmd) {
  if (cmd->fd_in != STDIN_FILENO) {
    dup2(cmd->fd_in, STDIN_FILENO);
    close(cmd->fd_in);
  }
  if (cmd->fd_out != STDOUT_FILENO) {
    dup2(cmd->fd_out, STDOUT_FILENO);
    close(cmd->fd_out);
  }
  if (!strcmp(cmd->argv[0], "alias")) {
    if (cmd->argc == 1) {
      DisplayAlias(alist);
    } else {
      char* cmdline = strdup(cmd->cmdline);
      strsep(&cmdline, " ");
      AddAlias(&alist, cmdline);
    }
  } else if (!strcmp(cmd->argv[0], "cd")) {
    char* dir = NULL;
    char err[256];
    if (cmd->argc == 1) {
      dir = getenv("HOME");
    } else {
      if ((cmd->argv[1])[0] == '~') {
        char* fulldir = (char*)malloc(sizeof(char) * 256);
        char* homedir = getenv("HOME");
        strcat(fulldir, homedir);
        if (strlen(cmd->argv[1]) > 2) {
          char subdir[128];
          memcpy(subdir, &(cmd->argv[1])[1], strlen(cmd->argv[1]) - 1);
          subdir[strlen(cmd->argv[1])] = 0;
          strcat(fulldir, subdir);
        }
        dir = fulldir;
      } else {
        dir = cmd->argv[1];
      }
    }
    sprintf(err, "cd: fail to change directory: %s\n", dir);
    if (chdir(dir)) {
      perror(err);
    }
  } else if (!strcmp(cmd->argv[0], "bg")) {
    if (cmd->argc == 1) BGJob(bgjobs, -1);
    else BGJob(bgjobs, atoi(cmd->argv[1]));
  } else if (!strcmp(cmd->argv[0], "fg")) {
    if (cmd->argc == 1) FGJob(bgjobs, -1);
    else FGJob(bgjobs, atoi(cmd->argv[1]));
  } else if (!strcmp(cmd->argv[0], "jobs")) {
    DisplayJobs(bgjobs);
  } else if (!strcmp(cmd->argv[0], "unalias")) {
    if (cmd->argc == 1) {
      printf("unalias: not enough arguments\n");
    } else {
      DelAlias(&alist, cmd->argv[1]);
    }
  }
  if (cmd->fd_in != STDIN_FILENO) {
    close(cmd->fd_in);
  }
  if (cmd->fd_out != STDOUT_FILENO) {
    close(cmd->fd_out);
  }
}
Example #13
0
void InitializeMQ2Commands()
{
    int i = 0;
    DebugSpew("Initializing Commands");
    InitializeCriticalSection(&gCommandCS);
	if (!ghCCommandLock)
		ghCCommandLock = CreateMutex(NULL, FALSE, NULL);
    EzDetourwName(CEverQuest__InterpretCmd,&CCommandHook::Detour,&CCommandHook::Trampoline,"CEverQuest__InterpretCmd");

    // Import EQ commands
    PCMDLIST pCmdListOrig = (PCMDLIST)EQADDR_CMDLIST;
    for (i=0;pCmdListOrig[i].fAddress != 0;i++) {
        if (!strcmp(pCmdListOrig[i].szName,"/who")) {
            cmdWho  = (fEQCommand)pCmdListOrig[i].fAddress;
            AddCommand("/",pCmdListOrig[i].fAddress,TRUE,1,1); // make sure / does EQ who by default
        } else if (!strcmp(pCmdListOrig[i].szName,"/whotarget")) {
            cmdWhoTarget  = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/location")) {
            cmdLocation  = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/help")) {
            cmdHelp = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/target")) {
            cmdTarget = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/charinfo")) {
            cmdCharInfo = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/filter")) {
            cmdFilter = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/doability")) {
            cmdDoAbility = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/cast")) {
            cmdCast = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/useitem")) {
            cmdUseItem = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/pet")) {
            cmdPet = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/mercswitch")) {
            cmdMercSwitch = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/advloot")) {
            cmdAdvLoot = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/pickzone")) {
            cmdPickZone = (fEQCommand)pCmdListOrig[i].fAddress;
		} else if (!strcmp(pCmdListOrig[i].szName,"/assist")) {
			cmdAssist = (fEQCommand)pCmdListOrig[i].fAddress;
        }
        AddCommand(pCmdListOrig[i].szName,pCmdListOrig[i].fAddress,TRUE,1,1);
    }



    // Add MQ commands...
    struct _NEWCOMMANDLIST { PCHAR szCommand; fEQCommand pFunc; BOOL Parse; BOOL InGame;} NewCommands[] = {
        {"/whotarget",  SuperWhoTarget,1,1},
        {"/location",   Location,1,1},
        {"/help",       Help,1,0},
        {"/target",     Target,1,1},
        {"/alias",      Alias,0,0},
        {"/aa",         AltAbility,0,1},
        {"/substitute", Substitute,0,0},
        {"/filter",     Filter,1,0},
        {"/whofilter",  SWhoFilter,1,1},
        {"/spewfile",   DebugSpewFile,1,0},
        {"/char",       CharInfo,1,1},
        {"/face",       Face,1,1},
        {"/identify",   Identify,1,1},
        {"/where",      Where,1,1},
        {"/skills",     Skills,1,1},
        {"/unload",     Unload,1,0},
		{"/selectitem", SelectItem,1,1},
        {"/buyitem",    BuyItem,1,1},
        {"/sellitem",   SellItem,1,1},
        {"/memspell",   MemSpell,1,1},
        {"/loadspells", LoadSpells,1,1},
        {"/loginname",  DisplayLoginName,1,0},
        {"/echo",       Echo,1,0},
        {"/msgbox",     MQMsgBox,1,0},
        {"/lootall",    LootAll,1,0},
        {"/alert",      Alert,1,1},
        {"/click",      Click,1,0},
		{"/mouseto",    MouseTo,1,0},
        {"/items",      Items,1,1},
        {"/itemtarget", ItemTarget,1,1},
        {"/doability",  DoAbility,1,1},
        {"/doors",      Doors,1,1},
        {"/doortarget", DoorTarget,1,1},
        {"/beep",       MacroBeep,1,0},
        {"/cast",       Cast,1,1},
        {"/mqlog",      MacroLog,1,0},
		{"/updateitems",UpdateItemInfo,1,1},
        {"/ini",        IniOutput,1,0},
        {"/setautorun", SetAutoRun,0,1},
        {"/banklist",   BankList,1,1},
        {"/look",       Look,1,1},
        {"/windowstate",WindowState,1,0},
        {"/destroy",    EQDestroyHeldItemOrMoney,1,1},
        {"/popup",      PopupText,1,1},
		{"/popcustom",	PopupTextCustom,1,1},
		{"/popupecho",	PopupTextEcho,1,1},
		{"/exec",       Exec,1,0},
		{"/keypress",   DoMappable,1,0},
		{"/multiline",  MultilineCommand,0,0},
		{"/ranged",     do_ranged,1,1},
		{"/loadcfg",    LoadCfgCommand,1,0},
		{"/squelch",    SquelchCommand,1,0},
		{"/docommand",  DoCommandCmd,1,0},
		{"/ctrlkey",    DoCtrlCmd,0,0},
		{"/altkey",     DoAltCmd,0,0},
		{"/shiftkey",   DoShiftCmd,0,0},
		{"/timed",      DoTimedCmd,0,0},
#ifndef ISXEQ_LEGACY
        {"/bind",       MQ2KeyBindCommand,1,0},
#endif
		{"/noparse",    NoParseCmd,0,0},
		{"/nomodkey",   NoModKeyCmd,0,0},
        {"/dumpbinds",  DumpBindsCommand,1,0},
        {"/dosocial",   DoSocial,1,1},
		{"/combine",    CombineCmd,1,1},
        {"/drop",       DropCmd,1,0},
		{"/delay",      Delay,0,0}, // do not parse
        {"/hud",        HudCmd,1,0},
        {"/caption",    CaptionCmd,0,0},
        {"/captioncolor",CaptionColorCmd,1,0},
        {"/useitem",    UseItemCmd,1,1},
		{"/spellslotinfo",SpellSlotInfo,1,1},
		{"/getwintitle",GetWinTitle,1,0},
		{"/setwintitle",SetWinTitle,1,0},
		{"/removebuff", RemoveBuff,1,1},
		{"/removepetbuff", RemovePetBuff,1,1},
		{"/makemevisible",MakeMeVisible,0,1},
		{"/pet",        PetCmd,1,1},
		{"/mercswitch", MercSwitchCmd,1,1},
		{"/removeaura", RemoveAura,0,1},
		{"/advloot",    AdvLootCmd,1,1},
		{"/pickzone",   PickZoneCmd,1,1},
		{"/assist",     AssistCmd,1,1},
		{"/setprio",    SetProcessPriority,1,0},
		{"/screenmode", ScreenModeCmd,1,0},
		{"/usercamera", UserCameraCmd,1,0},
		{"/mapzoom",    MapZoomCmd,1,0},
		{"/foreground", ForeGroundCmd,1,0},
		
        {NULL,          NULL,0,1},
    };
    // Remove replaced commands first
    for (i = 0 ; NewCommands[i].szCommand && NewCommands[i].pFunc ; i++)
    {
        RemoveCommand(NewCommands[i].szCommand);
        AddCommand(NewCommands[i].szCommand,NewCommands[i].pFunc,0,NewCommands[i].Parse,NewCommands[i].InGame);
    }
	//truebox builds are not supported anymore.
	//This code is here to make sure we are NOT run on truebox.
	//(bypassing these calls will severly cripple your mq2) -eqmule
	typedef DWORD(__cdecl *fAuthenticateTrueBox)(DWORD);
	fAuthenticateTrueBox AuthenticateTrueBox = 0;
	typedef DWORD(__cdecl *fGetTrueBoxKey)(DWORD);
	fGetTrueBoxKey GetTrueBoxKey = 0;
	if (ghmq2ic) {
		AuthenticateTrueBox = (fAuthenticateTrueBox)GetProcAddress(ghmq2ic, "AuthenticateTrueBox");
		GetTrueBoxKey = (fGetTrueBoxKey)GetProcAddress(ghmq2ic, "GetTrueBoxKey");
		DWORD tbkey = GetTrueBoxKey(1);
		if (AuthenticateTrueBox) {
			AuthenticateTrueBox(tbkey);
		}
	}
	
    /* ALIASES FOR OUT OF ORDER SHORTHAND COMMANDS */
    AddAlias("/d","/duel");
    AddAlias("/t","/tell");
    AddAlias("/w","/who");
    AddAlias("/a","/anonymous");
    AddAlias("/ta","/tap");
    AddAlias("/c","/consider");
    AddAlias("/cha","/channel");
    AddAlias("/f","/feedback");
    AddAlias("/fa","/fastdrop");
    AddAlias("/m","/msg");
    AddAlias("/load","/loadspells");
    AddAlias("/b","/bazaar");
    AddAlias("/ba","/bazaar");
    AddAlias("/g","/gsay");
    AddAlias("/gu","/guildsay");
    AddAlias("/key","/keys");
    AddAlias("/r","/reply");

    AddAlias("/newif","/if");
    /* NOW IMPORT THE USER'S ALIAS LIST, THEIR MODIFICATIONS OVERRIDE EXISTING. */

    CHAR AliasList[MAX_STRING*10] = {0};
    CHAR szBuffer[MAX_STRING] = {0};
    CHAR MainINI[MAX_STRING] = {0};
    sprintf_s(MainINI,"%s\\macroquest.ini",gszINIPath);
    GetPrivateProfileString("Aliases",NULL,"",AliasList,MAX_STRING*10,MainINI);
    PCHAR pAliasList = AliasList;
    while (pAliasList[0]!=0) {
        GetPrivateProfileString("Aliases",pAliasList,"",szBuffer,MAX_STRING,MainINI);
        if (szBuffer[0]!=0) {
            AddAlias(pAliasList,szBuffer);
        }
        pAliasList+=strlen(pAliasList)+1;
    }

    // Here is where you can add in permanent Substitutions
    AddSubstitute("omg","Oh My God");

    //Importing the User's Substitution List from .ini file
    CHAR SubsList[MAX_STRING*10] = {0};
    CHAR szBuffer2[MAX_STRING] = {0};
	sprintf_s(MainINI,"%s\\macroquest.ini",gszINIPath);
    GetPrivateProfileString("Substitutions",NULL,"",SubsList,MAX_STRING*10,MainINI);
    PCHAR pSubsList = SubsList;
    while (pSubsList[0]!=0) {
        GetPrivateProfileString("Substitutions",pSubsList,"",szBuffer2,MAX_STRING,MainINI);
        if (szBuffer[0]!=0) {
            AddSubstitute(pSubsList,szBuffer2);
        }
        pSubsList+=strlen(pSubsList)+1;
    }
}
Example #14
0
AliasNodes::AliasNodes(class Ast* ast, const location& loc, AstNode* nm, AstNode* asnm) :
		AstNode(AST_ALIASNODE, ast, loc)
{
	AddAlias(nm, asnm);
}