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

void setpeer ( int  argc,
const char argv[] 
)

Definition at line 49 of file cmds.c.

Referenced by main().

{
    char *host;

    if (connected) {
        printf("Already connected to %s, use close first.\n",
            hostname);
        (void) fflush(stdout);
        code = -1;
        return;
    }
    if (argc < 2) {
        (void) strcat(line, " ");
        printf("(to) ");
        (void) fflush(stdout);
        (void) gets(&line[strlen(line)]);
        makeargv();
        argc = margc;
        argv = margv;
    }
    if (argc > 3) {
        printf("usage: %s host-name [port]\n", argv[0]);
        (void) fflush(stdout);
        code = -1;
        return;
    }
    if (argc > 2) {
        portnum = atoi(argv[2]);
        if (portnum <= 0) {
            printf("%s: bad port number-- %s\n", argv[1], argv[2]);
            printf ("usage: %s host-name [port]\n", argv[0]);
            (void) fflush(stdout);
            code = -1;
            return;
        }
        portnum = htons(portnum);
    }
    host = hookup(argv[1], portnum);
    if (host) {
#if defined(unix) && NBBY == 8
        int overbose;
#endif
        connected = 1;
        if (autologin)
            (void) login(argv[1]);

#if defined(unix) && NBBY == 8
/*
 * this ifdef is to keep someone form "porting" this to an incompatible
 * system and not checking this out. This way they have to think about it.
 */
        overbose = verbose;
        if (debug == 0)
            verbose = -1;
        allbinary = 0;
        if (command("SYST") == COMPLETE && overbose) {
            register char *cp, c;
            cp = index(reply_string+4, ' ');
            if (cp == NULL)
                cp = index(reply_string+4, '\r');
            if (cp) {
                if (cp[-1] == '.')
                    cp--;
                c = *cp;
                *cp = '\0';
            }

            printf("Remote system type is %s.\n",
                reply_string+4);
            if (cp)
                *cp = c;
        }
        if (!strncmp(reply_string, "215 UNIX Type: L8", 17)) {
            setbinary();
            /* allbinary = 1; this violates the RFC */
            if (overbose)
                printf("Using %s mode to transfer files.\n",
                typename);
        } else if (overbose &&
            !strncmp(reply_string, "215 TOPS20", 10)) {
            printf(
"Remember to set tenex mode when transfering binary files from this machine.\n");
        }
        verbose = overbose;
#endif /* unix */
    }
    (void) fflush(stdout);
}

Generated on Sun May 27 2012 04:42:44 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.