Exemple #1
0
NS_IMETHODIMP EmbedDownload::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest, nsresult aStatus, const PRUnichar* aMessage) {
	nsString 			u_message(aMessage);
	char *message = ToNewCString(u_message);
	//printf("EmbedDownload::OnStatusChange: aRequest 0x%x, message %s\n", aRequest, message);
	if (aRequest)
		ReportDownload( Pt_WEB_DOWNLOAD_ERROR, 0, 0, message );
	if( message ) nsMemory::Free( (void*)message );
	return NS_OK;
	}
Exemple #2
0
void
do_display(globalstate *gstate)

{
    int active_procs;
    int i;
    time_t curr_time;
    caddr_t processes;
    struct system_info system_info;
    char *hdr;

    /* get the time */
    time_mark(&(gstate->now));
    curr_time = (time_t)(gstate->now.tv_sec);

    /* get the current stats */
    get_system_info(&system_info);

    /* get the current processes */
    processes = get_process_info(&system_info, &(gstate->pselect), gstate->order_index);

    /* determine number of processes to actually display */
    if (gstate->topn > 0)
    {
	/* this number will be the smallest of:  active processes,
	   number user requested, number current screen accomodates */
	active_procs = system_info.P_ACTIVE;
	if (active_procs > gstate->topn)
	{
	    active_procs = gstate->topn;
	}
	if (active_procs > gstate->max_topn)
	{
	    active_procs = gstate->max_topn;
	}
    }
    else
    {
	/* dont show any */
	active_procs = 0;
    }

    hdr = gstate->header_text;

    /* full screen or update? */
    if (gstate->fulldraw)
    {
	display_clear();
	i_loadave(system_info.last_pid, system_info.load_avg);
	i_uptime(&(gstate->statics->boottime), &curr_time);
	i_timeofday(&curr_time);
	i_procstates(system_info.p_total, system_info.procstates, gstate->pselect.threads);
	if (gstate->show_cpustates)
	{
	    i_cpustates(system_info.cpustates);
	}
	else
	{
	    if (smart_terminal)
	    {
		z_cpustates();
	    }
	    gstate->show_cpustates = Yes;
	}
	i_kernel(system_info.kernel);
	i_memory(system_info.memory);
	i_swap(system_info.swap);
	i_message(&(gstate->now));
	i_header(hdr);
	for (i = 0; i < active_procs; i++)
	{
	    i_process(i, format_next_process(processes, gstate->get_userid));
	}
	i_endscreen();
	if (gstate->smart_terminal)
	{
	    gstate->fulldraw = No;
	}
    }
    else
    {
	u_loadave(system_info.last_pid, system_info.load_avg);
	u_uptime(&(gstate->statics->boottime), &curr_time);
	i_timeofday(&curr_time);
	u_procstates(system_info.p_total, system_info.procstates, gstate->pselect.threads);
	u_cpustates(system_info.cpustates);
	u_kernel(system_info.kernel);
	u_memory(system_info.memory);
	u_swap(system_info.swap);
	u_message(&(gstate->now));
	u_header(hdr);
	for (i = 0; i < active_procs; i++)
	{
	    u_process(i, format_next_process(processes, gstate->get_userid));
	}
	u_endscreen();
    }
}