예제 #1
0
파일: process.c 프로젝트: joewing/itop
/****************************************************************************
 * List the process information.
 ****************************************************************************/
void ListProcesses(int line, int max) {
	int x;
	int number;
	int limit;

	printf("\033[%d;%dH\033[2K\033[1m\033[7m", line, 0);
	printf("%10s %10s USERNAME PRI  SIZE   RES STATE    TIME"
		" TRS  RCPU%% COMMAND", "PID", "PGRP");
	printf("\033[0m");

	limit = (max < listSize) ? max : listSize;
	number = line + 1;
	for(x = 0; x < limit; x++) {
		if(!displayIdle && list[x].pcpu < IDLE_THRESHOLD) {
			continue;
		}
		if(displayUser >= 0 && displayUser != list[x].uid) {
			continue;
		}
		printf("\033[%d;%dH\033[2K", number, 0);
		printf("%10lu %10lu", (long)list[x].pid, (long)list[x].pgrp);
		if(list[x].username) {
			printf(" %-8s ", list[x].username);
		} else {
			printf(" %-8s ", "?");
		}
		printf("%3d ", list[x].priority);
		PrintInteger(list[x].size);
		printf(" ");
		PrintInteger(list[x].res);
		printf(" ");
		if(list[x].state == STATE_RUN) {
			printf(STATE_NAME[list[x].state], list[x].cpu);
		} else {
			printf(STATE_NAME[list[x].state]);
		}
		printf("%5lu:%02lu", list[x].t / 60, list[x].t % 60);
		printf("%4lu", list[x].threads);
		if(processTotal) {
			printf(" %6.2f ", (double)list[x].pcpu * 100.0
				/ (double)processTotal);
		} else {
			printf(" %6.2f ", 0.0);
		}
		printf("%-7s", list[x].command);
		++number;
	}
	while(number <= maxLines + line) {
		printf("\033[%d;%dH\033[2K", number, 0);
		++number;
	}

}
예제 #2
0
파일: pasm.c 프로젝트: neutered/propgcc
static void
PrintGasConstantDecl(FILE *f, AST *ast, int inlineAsm)
{
    startLine(f, inlineAsm);
    fprintf(f, "\t\t.equ\t%s, ", ast->d.string);
    PrintInteger(f, EvalConstExpr(ast));
    endLine(f, inlineAsm);
}
예제 #3
0
파일: main.c 프로젝트: VIJESHG/project
int main(){
	Integer ans;
	char arr[128];
	scanf("%[^\n]", arr);   /* expression */
	ans = infix(arr);
	printf("Answer: ");
	PrintInteger(ans);
	return 0;
}
예제 #4
0
int main()
{
	int the_variable = 1;
	PrintInteger(the_variable);
	{
		PrintInteger(the_variable);
		int the_variable = 2;
		PrintInteger(the_variable);
		{
			PrintInteger(the_variable);
			int the_variable = 3;
			PrintInteger(the_variable);
		}
		PrintInteger(the_variable);
	}
	PrintInteger(the_variable);
	
}//the output of this fuction is: 1, 1, 2, 2, 3, 2, 1
예제 #5
0
int main()
{
	int the_variable = 1;
	PrintInteger(the_variable);
	{
		PrintInteger(the_variable);
		int the_variable = 2;
		PrintInteger(the_variable);
		{
			PrintInteger(the_variable);
			int the_variable = 3;
			PrintInteger(the_variable);
		}
		PrintInteger(the_variable);
	}
	PrintInteger(the_variable);
	system("pause");

	/*Output is 1,1,2,2,3,2,1*/
}