ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

int main ( int  ArgC,
char ArgV[] 
)

Definition at line 307 of file tnmain.cpp.

                                 {

    CONSOLE_SCREEN_BUFFER_INFO  ConsoleScreenBufferInfo;
    GetConsoleScreenBufferInfo(
        GetStdHandle(STD_OUTPUT_HANDLE),
        &ConsoleScreenBufferInfo
        );

    char *k;
    char startdir[MAX_PATH*2];
    char exename[MAX_PATH];

    // strncpy(startdir, ArgV[0],MAX_PATH);
    // This should be more accurate than using argv[0] (Paul Brannan 9/16/98)
    GetModuleFileName(NULL, startdir, sizeof(startdir));

    // Get the current console title so it can be set later
    // ("Pedro A. Aranda Gutiérrez" <paag@coppi.tid.es>)
    TCHAR ConsoleTitle[255];
    GetConsoleTitle(ConsoleTitle, sizeof(ConsoleTitle));

    k = strrchr(startdir, '\\');
    if (k == NULL){                     // if the \ character is not found...
        strcpy(exename, startdir);
        strcpy(startdir,"");            // set the path to nothing
    } else {
        // end the string after the last '\' to get rid of the file name
        strcpy(exename, k+1);
        k[1] = 0;
    }

    printm(0, FALSE, MSG_COPYRIGHT);
    printm(0, FALSE, MSG_COPYRIGHT_1);

    // set up the ini class
    ini.init(startdir, exename);

    // Process the command line arguments and connect to a host if necessary
    if(ini.Process_Params(ArgC, ArgV)) {
        const char *szHost = ini.get_host();
        const char *strPort = ini.get_port();
        if(!*szHost) {
            Telnet MyConnection;
            while(telCommandLine(MyConnection));
        } else {
            Telnet MyConnection;
            if(MyConnection.Open(szHost, strPort) == TNPROMPT) {
                // still connected
                printit("\n");
                telCommandLine(MyConnection);
            }
        }
    }

    if(ini.get_term_width() != -1 || ini.get_term_height() != -1) {
        SetConsoleScreenBufferSize(
            GetStdHandle(STD_OUTPUT_HANDLE),    // handle of console screen buffer
            ConsoleScreenBufferInfo.dwSize      // new size in character rows and cols.
            );
        SetConsoleWindowInfo(
            GetStdHandle(STD_OUTPUT_HANDLE),    // handle of console screen buffer
            TRUE,                               // coordinate type flag
            &ConsoleScreenBufferInfo.srWindow   // address of new window rectangle
            );
    }
    SetConsoleTextAttribute(
        GetStdHandle(STD_OUTPUT_HANDLE),        // handle of console screen buffer
        ConsoleScreenBufferInfo.wAttributes     // text and background colors
        );

    // Restore the original console title
    // ("Pedro A. Aranda Gutiérrez" <paag@coppi.tid.es>)
    SetConsoleTitle(ConsoleTitle);

    return 0;
}

Generated on Sun May 27 2012 04:42:57 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.