예제 #1
0
void MemInfo(char forced)
{
#ifndef TEXTONLY
    char str[30];
    unsigned long ldsp;
    int y=endvtoolbar();
    int color;
    long value;

    if(forced && meminfovisible)
    {
        if(arachne.framescount)
        {
            p->activeframe=0;
            redrawHTML(REDRAW_NO_MESSAGE,REDRAW_CREATE_VIRTUAL);
        }
        else
            redrawHTML(REDRAW_WITH_MESSAGE,REDRAW_VIRTUAL);
        meminfovisible=0;
        return;
    }

    if((x_maxx()<640 || arachne.GUIstyle ||
            fullscreen || customerscreen || fixedfont) /*fixedfont=printing hack*/
            && !forced) return;

    if(arachne.GUIstyle)
        meminfovisible=1;

    mouseoff();
    y+=2;
    Box3D(x_maxx()-150,y,x_maxx()-1,x_maxy()-17);
    y+=1;
    htmlfont(0,NORMAL);

    if(forced && lastinfo && endvtoolbar()>=x_maxy()-14*(fonty(0,NORMAL)-1))
        goto moreinfo;

#ifndef POSIX
//DOS memory
    value=farcoreleft();//>>10; //!!glennmcc Oct 09, 2004 don't round off to KB
    sprintf(str,"%4lu",value);
    if(value<50000l || memory_model==0)
    {
        color=2;
        strcat(str,"[!!!]");
    }
    else if(memory_model==2)
    {
        color=3;
        strcat(str,"[+]");
    }
    else
    {
        color=0;
        strcat(str,"[?]");
    }
    MemInfoLine("Dos mem",str,color,&y);//!!glennmcc Oct 09, 2004 don't round off to KB

//XMS used
    sprintf(str,"%5lu",mem_all_xmem());
    MemInfoLine("Used XMS (KB)",str,0,&y);
#endif//posix

//XSWAP free
    ldsp=ie_free()>>10;
    sprintf(str,"%4ld",ldsp);
    if(ldsp<500)
    {
        color=2;
        strcat(str,"[!!!]");
    }
    else
        color=0;
    MemInfoLine("Free xSwap (KB)",str,color,&y);

//XSWAP used
    sprintf(str,"%4ld",ie_used()>>10);
    MemInfoLine("Used xSwap (KB)",str,0,&y);

#ifndef POSIX
//disk space
//!!glennmcc: Nov 25, 2005 -- check space on the cache drive
//and the current drive .... display both when not the same drive
//when cache is on local drive, display only one
#ifndef NOKEY
    {
        ldsp=lastdiskspace(configvariable(&ARACHNEcfg,"CachePath",NULL))>>20;
//local & cache
        /**/
        if(ldsp==(localdiskspace()>>20))
            sprintf(str,"%4lu",ldsp);
        else
            sprintf(str,"%4lu %4lu",localdiskspace()>>20,ldsp);
        /**/
//temp & cache
        /*
         if(ldsp==(lastdiskspace(getenv("TEMP"))>>20))
         sprintf(str,"cache_%4lu",ldsp);
         else
         sprintf(str,"temp_%4lu cache_%4lu",lastdiskspace(getenv("TEMP"))>>20,ldsp);
        */
    }
예제 #2
0
int popdump( char *userid, char *password, longword host)
    /*, char *hoststring, char *dumpfile)  /* 94.11.19 -- removed extra params */
{
    tcp_Socket *s;
    int status;
/*    int len;  */
/*    char *p;  */
    long process = 0, count, totallength, locallength, dummy;
/*    FILE *f; */

    s = &popsock;
    if (!tcp_open( s, 0, host, POP3_PORT, NULL )) {
	puts("Sorry, unable to connect to that machine right now!");
	return (1);
    }

    printf("waiting...\r");

    sock_mode( s, TCP_MODE_ASCII );
    sock_wait_established(s, sock_delay, NULL, &status);
    sock_wait_input( s, sock_delay, NULL, &status );
    sock_gets( s, buffer, sizeof( buffer ));
    puts(buffer);
    if ( *buffer != '+' ) goto quit;

    sock_printf( s, "USER %s", userid);
    sock_wait_input( s, sock_delay, NULL, &status );
    sock_gets( s, buffer, sizeof( buffer ));
    puts(buffer);
    if ( *buffer != '+' ) goto quit;

    sock_printf( s, "PASS %s", password );
    sock_wait_input( s, sock_delay, NULL, &status );
    sock_gets( s, buffer, sizeof( buffer ));
    puts(buffer);
    if ( *buffer != '+' ) goto quit;

    sock_printf(s, "STAT");
    printf("STAT\n");
    sock_wait_input( s, sock_delay, NULL, &status );
    sock_gets( s, buffer, sizeof( buffer ));
    puts(buffer);
    if ( *buffer != '+' ) goto quit;

    /* it must return two valid numbers */
    if ( getnumbers( buffer, &count, &totallength ) < 2 ) {
        printf("protocol error on STAT\n");
        goto quit;
    }

    printf("Attempting to download %lu messages (%lu bytes)\n",
        count, totallength );

    while ( process++ < count ) {
        printf("Getting file # %lu\n", process );

        sock_printf( s, "LIST %lu", process );
        sock_wait_input( s, sock_delay, NULL, &status );
        sock_gets( s, buffer, sizeof( buffer ));
        if ( getnumbers( buffer, &dummy, &locallength ) < 2 ) {
            printf("protocol error on LIST %lu\n", process );
            goto quit;
        }

        if ( localdiskspace() < locallength * 2 ) {
            printf("Skipping file # %lu, too big for disk space available\n",
                process );
            continue;
        }
        sock_printf( s, "RETR %lu", process );
        sock_wait_input( s, sock_delay, NULL, &status );
        sock_gets( s, buffer, sizeof( buffer ));
        if (*buffer != '+' ) goto quit;

/*
        sprintf( buffer, "%s%s%lu.mai",
            dumpfile, dumpfile ? "\\":".\\", index

        if (( f = fopen( dumpfile , "wt" )) == NULL ) {
            printf("Unable to open %s\n", dumpfile );
            return;
        }
*/
        do {
            sock_wait_input( s, sock_delay, NULL, &status );
            sock_gets( s, buffer, sizeof( buffer ));
            puts( buffer );
        } while ( buffer[0] != '.' || buffer[1] != 0 );
        sock_printf(s,"DELE %lu", process );
        sock_wait_input( s, sock_delay, NULL, &status );
        sock_gets( s, buffer, sizeof( buffer ));
        puts(buffer);
        if ( *buffer != '+' ) goto quit;
    }
quit:
    sock_puts(s,"QUIT");
    sock_close( s );
    sock_wait_closed( s, sock_delay, NULL, &status );

sock_err:
    switch (status) {
	case 1 : /* foreign host closed */
		 break;
	case -1: /* timeout */
                 printf("ERROR: %s\n", sockerr(s));
		 break;
    }
    printf("\n");
    return ( (status == -1) ? 2 : status );
}