Пример #1
0
void print_title_bar()
{
	gotoxy(3, 1);
	setcolor(WHITE);
	disptime();

	setcolor(WHITE);
	gotoxy(0, 3);
	printf("-------------------------------------------------------------------------------\n");
	gotoxy(0, 27);
	printf("-------------------------------------------------------------------------------\n");

	// Check if user has logged in
	if (strcmp(current_user, "") == 0)
	{
		setcolor(YELLOW);
		gotoxy(47, 1);
		printf("%30.30s", "Welcome, Guest!");
		gotoxy(68, 2);
		printf("[L] Login");
	}
	else
	{
		setcolor(GREEN);
		gotoxy(47, 1);
		char temp[32];
		sprintf(temp, "Welcome, %s!", current_user);
		printf("%30.30s", temp);
		gotoxy(69, 2);
		printf("[L] More");
	}
	gotoxy(0, 5);
}
Пример #2
0
void disp_dir(unsigned char * rde,unsigned int sector_address)      //DIsplay Dir
{
	char fname[8],ext[3],temp_path[50];
	int i,i1,l=0;
	for(l=0;l<224;l++)							//512*14=(224)*32: 512-size of sector,14-No of Sector,32-Size of one Directory
	{
	if(*rde==0x00)								//Shows last entry of Directory
	break;
	else if(*rde==0xe5)							//Shows vacant entry
	{
		asm jmp next1
	}
	else if(isalnum(*rde))						//start of file name should be Alphanumeric
	{
		printf("\n");
		name[j].address=sector_address;
		name[j].line=l;
		strcpy(name[j].path,dir_name);
		i1=i=0;
		for(i=0;i<8;i++)						//Name of file
		{
			printf("%c",*(rde+i));
			if(*(rde+i)!=' ')
			name[j].nm[i1++]=*(rde+i);
		}
		printf(".");

		if (*(rde+0x0b)&0x10)					//for DIR='\' and File= '.'
			name[j].nm[i1++]='\\';
		else
			name[j].nm[i1++]='.';

		for(i=8;i<11;i++)						//Extension
		{
			printf("%c",*(rde+i));
			if(*(rde+i)!=' ')
			name[j].nm[i1++]=*(rde+i);
		}
		name[j].nm[i1]='\0';
		dispdate(rde);							//Display Date of last update to file
		disptime(rde);							//Display Time of last update to file
		if (*(rde+0x0b)&0x10)					//checking for Directory
		{
			printf("  <DIR>");
			name[j].size=-1;
			strcpy(temp_path,name[j].path);
			strcat(temp_path,name[j].nm);
			enqueue(*(int*)(rde+26),temp_path);	//Enqueuing Dir and its path
			j++;
		}
		else
		{
		name[j].size=*(int*)(rde+0x1c);
		printf("  %d",*(int*)(rde+0x1c));
		j++;
		}
	}
	next1:
	rde=rde+32;									//Size of one Entry is 32
	}
Пример #3
0
void append_device_details(JsonNode *userlist, char *user, char *device)
{
	char path[BUFSIZ];
	JsonNode *node, *last;

	snprintf(path, BUFSIZ, "%s/last/%s/%s/%s-%s.json",
		STORAGEDIR, user, device, user, device);

	last = json_mkobject();
	if (json_copy_from_file(last, path) == TRUE) {
		JsonNode *tst;

		if ((tst = json_find_member(last, "tst")) != NULL) {
			json_append_member(last, "isotst", json_mkstring(isotime(tst->number_)));
			json_append_member(last, "disptst", json_mkstring(disptime(tst->number_)));
		}
	}

	append_card_to_object(last, user, device);


	if ((node = json_find_member(last, "ghash")) != NULL) {
		if (node->tag == JSON_STRING) {
			get_geo(last, node->string_);
		}
	}

	/* Extra data */
	snprintf(path, BUFSIZ, "%s/last/%s/%s/extra.json",
		STORAGEDIR, user, device);
	json_copy_from_file(last, path);
#if WITH_GREENWICH
	get_gw_data(user, device, last);
#endif
	json_append_element(userlist, last);
}