예제 #1
0
void ls(char * filePath)
{
	unsigned int destinationDirBlockNumber; 
	int y;
	directoryBlock destinationDirectory;
	destinationDirBlockNumber = findFileBlockInPath(filePath);
	
	if (destinationDirBlockNumber == -1)
	{
		printstring("Directory does not exists");
		return;
	}
	
	readsector(destinationDirBlockNumber, &destinationDirectory);
	y = 0;
	while (y < DIRECTORYENTRYCOUNT)
	{
		if (destinationDirectory.entries[y].fileBlockStart != 0)
		{
			char *tempName = (char*)mallocFS(mystrlen(destinationDirectory.entries[y].fileName));
			tempName = getData(destinationDirectory.entries[y].fileName);
			if (destinationDirectory.entries[y].fileType == IS_DIRECTORY)
			{
				printstring("Directory: %s\n", tempName);
			}
			else if (destinationDirectory.entries[y].fileType == IS_FILE)
			{
				printstring("File: %s\n", tempName);
			}
		}
		y++;
	}
}
watchdog_interrupt(void)
{
#ifdef CONTIKI_TARGET_SKY
#if PRINT_STACK_ON_REBOOT
  uint8_t dummy;
  static uint8_t *ptr;
  static int i;

  ptr = &dummy;
  printstring("Watchdog reset");
  printstring("\nStack at $");
  hexprint(((int)ptr) >> 8);
  hexprint(((int)ptr) & 0xff);
  printstring(":\n");

  for(i = 0; i < 64; ++i) {
    hexprint(ptr[i]);
    printchar(' ');
    if((i & 0x0f) == 0x0f) {
      printchar('\n');
    }
  }
  printchar('\n');
#endif /* PRINT_STACK_ON_REBOOT */
#endif /* CONTIKI_TARGET_SKY */

  watchdog_reboot();
}
예제 #3
0
void quit_program(int rc)
{
	set_process_permissions(0, 0, xstrtoo(VBOX_ROOT_UMASK, 0));

	modem_hangup(&vboxmodem);

	log_line(LOG_D, "Closing modem device (%d)...\n", vboxmodem.fd);

	if (vboxmodem_close(&vboxmodem) != 0)
	{
		log_line(LOG_E, "%s (%s)\n", vboxmodem_error(), strerror(errno));
	}

	if (isdnttyname)
	{
		printstring(temppathname, "%s/LCK..%s", LOCKDIR, isdnttyname);

		lock_remove(temppathname);

		printstring(temppathname, "%s/vboxgetty-%s.pid", PIDDIR, isdnttyname);

		pid_remove(temppathname);
	}

	scr_remove_interpreter();
	rc_free(rc_getty_c);
	breaklist_clear();
	log_close();

	exit(rc);
}
예제 #4
0
파일: MESSAGE.C 프로젝트: joncampbell123/16
void RenderGUI()
{ int i;

  CheckMessageExpirations();
  for (i=0; i<num_msgs; i++)
  {
    GotoXY(1,1+(i*10));
    printstring(0,messages[i].text);
  }

  if (!cpu_watch) return;
  frames++;

  i=sx-76;
  GotoXY(i,sy-39);
  sprintf(strbuf,"etc:%d",profile[0]);
  printstring(0,strbuf);
  GotoXY(i,sy-29);
  sprintf(strbuf,"Render:%d",profile[1]);
  printstring(0,strbuf);
  GotoXY(i,sy-19);
  sprintf(strbuf,"PFlip:%d",profile[2]);
  printstring(0,strbuf);
  GotoXY(i,sy-9);
  sprintf(strbuf,"FPS:%d",fps);
  printstring(0,strbuf);
}
예제 #5
0
static void printhelp(void)
{
  glEnable(GL_BLEND);
  glColor4f(0.5,0.5,0.5,0.5);
  glRecti(40,40,600,440);
  glDisable(GL_BLEND);

  glColor3f(1.0,0.0,0.0);
  glRasterPos2i(300,420);
  printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Help");

  glRasterPos2i(60,390);
  printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Toggle Help");
  glRasterPos2i(60,360);
  printstring(GLUT_BITMAP_TIMES_ROMAN_24,"t - Toggle Textures");
  glRasterPos2i(60,330);
  printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Toggle Fog");
  glRasterPos2i(60,300);
  printstring(GLUT_BITMAP_TIMES_ROMAN_24,"b - Toggle Back face culling");
  glRasterPos2i(60,270);
  printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Arrow Keys - Rotate");
  glRasterPos2i(60,240);
  printstring(GLUT_BITMAP_TIMES_ROMAN_24,"a - Increase velocity");
  glRasterPos2i(60,210);
  printstring(GLUT_BITMAP_TIMES_ROMAN_24,"z - Decrease velocity");

  glRasterPos2i(60,180);
  if(joyavailable)
    printstring(GLUT_BITMAP_TIMES_ROMAN_24,"j - Toggle jostick control (Joystick control available)");
  else
    printstring(GLUT_BITMAP_TIMES_ROMAN_24,"(No Joystick control available)");
}
예제 #6
0
파일: shell.c 프로젝트: alujajakerry/SISO2
/*allow the user to create a text file*/
void docreate(char* line)
{
	char file[12800];
	int index=0;
	char* name=getargument(line);
	char c=0;

	printstring("Enter your text.  End the file by typing CTRL-C.\r\n\n\0");

	/*terminates when user presses CTRL-C - 3) */
	while(c!=0x3)
	{
		/*get a character and store it*/
		c=getchar();
		file[index++]=c;
		/*echo it back if it isn't CTRL-C*/
		if (c!=0x3)
			putchar(c);
		/*if the user presses ENTER, follow the CR with a LF*/
		if (c==0xd)
		{
			file[index++]=0xa;
			putchar(0xa);
		}
	}
	/*terminate the file with a 0*/
	file[index-1]=0x0;

	/*write it to the disk.  Round up the sector*/
	writefile(name,file,div(index,512)+1);
	printstring("\r\n\0");
}
예제 #7
0
//---------------------------------------------------------------------------------------
void main(void)
{
  if(BD == 0) // Baudratengenerator noch nicht aktiv
   init_seriell();  // serielle Kommunikation ermöglichen
  init_timer0();  // Timer 0 initialisieren
  init_ad();
  init_p33();
  EAL=1;  // Interrupts generell freigegeben
      
  while(1)  // Endlos 
  {
    maske=0x01;
    sec=0;  // Sec reset
    printstring("Portpin: ");  // Portpin Eingabeaufforderung
    pin=getchar();  // Einlesen
    putchar(pin);
    putchar('\n');
    printstring("Vorwahl: ");  // Eingabeaufforderung
    ADDATL=1;
    while(BSY==1);
    vorwahl=ad10bit/100;
    printuintdez(vorwahl);
    putchar('s');
    pin-=0x30;  // ASCII Konvertierung
    maske=maske<<pin;  // Pin in maske schieben              
    P5=P5&~maske;  // LED an   
    TR0=1;  // Timer0 starten
    while(vorwahl!=sec);  // Warten bis die Zeit erreicht wurde
    P5=P5|maske;  // LED aus
    TR0=0;  // Timer 0 stoppen
  }
}
예제 #8
0
파일: shell.c 프로젝트: alujajakerry/SISO2
/*copy a file*/
void docopy()
{
	char sname[7];
	char dname[7];
	char line[80];
	char file[12800];
	char dirsector[512];
	int index,i;

	/*prompt for the first file name*/
	printstring("Name of the source file? \0");
	readstring(line);
	for (i=0; i<6; i++)
	{
		sname[i]=line[i];
		if (line[i]==0xd)
			break;
	}
	sname[i]=0x0;

	/*make sure it exists - find the directory entry*/
	readsector(2,dirsector);
	index=findname(sname,dirsector);
	if (index==-1)
	{
		printstring("File not found\r\n\0");
		return;
	}

	/*read the source file*/
	readfile(sname,file);

	/*prompt for the destination file name*/
	printstring("Name of the destination file? \0");
	readstring(line);
	for (i=0; i<6; i++)
	{
		dname[i]=line[i];
		if (line[i]==0xd)
			break;
	}
	dname[i]=0x0;

	/*figure out how long the source file is*/
	i=0;
	index=index+6;
	while(dirsector[index]!=0x0)
	{
		index++;
		i++;
	}

	/*write the file*/
	writefile(dname,file,i);
}
예제 #9
0
파일: lib.c 프로젝트: alujajakerry/SISO2
void ImprimirLista(char sectorNumber, int depth, char* mapsector)
{
	char dirsector[512];
	char name[7];
	int i,j,index,files,x;
	char symbol [2];
	symbol[0] = 195;
	symbol[1] = 0;
	readsector(BASEOFFSET + sectorNumber,dirsector);
	index=0;
	files=0;
	for (i=0; i<16; i++)
	{
		if (dirsector[index]!=0)
		{
			for (j=0; j<6; j++)
				name[j]=dirsector[index+j];
			name[6]=0;
			for(x =0;x<depth;x++)
				printstring("\t");
			printstring(symbol);
			printstring(name);
			sectorNumber = dirsector[i*0x20+6];
			if(mapsector[sectorNumber] == 0x44)
			{	
				j=0;
				while(dirsector[index+j+6]!=0)
					j++;
				printstring("  \0");
				printstring( "D\0");
				printstring("\r\n\0");
				ImprimirLista(sectorNumber,depth+1,mapsector);
				files++;
			}
			else if(mapsector[sectorNumber] == 0x46)
			{	
				j=0;
				while(dirsector[index+j+6]!=0)
					j++;
				printstring(".txt");
				printstring("  \0");
				printstring("F\0");
				printstring("\r\n\0");
				files++;
			}
		}
		index=index+0x20;
	}
	j=0;
	for (i=0; i<256; i++)
	{
		if (mapsector[i]==0x0)
			j++;
	}
}
예제 #10
0
파일: guicomp.cpp 프로젝트: mcgrue/maped2w
void TextField(int x, int y, int width, char *str, int blink)
{
  FilledBox(x, y, width, 9, 0);
  HLine(x, y, width+1, darkw);
  VLine(x, y, 9, darkw);
  HLine(x+1, y+8, width-1, brightw);
  VLine(x+width, y+1, 8, brightw);
  GotoXY(x+2, y+2);
  printstring(str);
  if (blink) printstring("_");
}
예제 #11
0
파일: output.c 프로젝트: emdenrg/graphviz
static void writenodeandport(FILE * f, node_t * node, char *port)
{
    char *name;
    if (IS_CLUST_NODE(node))
	name = canon (agraphof(node), strchr(agnameof(node), ':') + 1);
    else
	name = agcanonStr (agnameof(node));
    printstring(f, " ", name); /* slimey i know */
    if (port && *port)
	printstring(f, ":", agcanonStr(port));
}
예제 #12
0
int mkdir(char * filePath, char * fileName)
{
	unsigned int destinationDirBlockNumber,newDirBlockNumber;
	directoryBlock destinationDirectory,newDirectory;
	int z, y, isfile;
	if (strCmp(filePath, "/") == 1)
		destinationDirBlockNumber = ROOTBLOCK;
	else
		destinationDirBlockNumber = findFileBlockInPath(filePath);
	if (destinationDirBlockNumber == -1)
	{
		printstring("Directory does not exists");
		return -1;
	}
	
	filePath = getData(filePath);
	fileName = getData(fileName);	
	readsector(destinationDirBlockNumber, &destinationDirectory);
	isfile = IsNewFile(destinationDirectory, fileName);
	if (isfile == -1)
	{
		printstring("Directory already exist\n");
		return -1;
	}
	newDirBlockNumber = AllocateBlock();
	y  = 0;
	while(y < DIRECTORYENTRYCOUNT)
	{
		newDirectory.entries[y].fileType = IS_FILE;
		newDirectory.entries[y].fileBlockStart = 0;
		newDirectory.entries[y].fileBlockSize = 0;
		y++;
	}
	writesector(newDirBlockNumber, &newDirectory);
	z = 0;
	while (z < DIRECTORYENTRYCOUNT)
	{
		if (destinationDirectory.entries[z].fileBlockStart == 0)
		{
			strcpy(fileName, destinationDirectory.entries[z].fileName);
			destinationDirectory.entries[z].fileType = IS_DIRECTORY;
			destinationDirectory.entries[z].fileBlockStart = newDirBlockNumber;
			destinationDirectory.entries[z].fileBlockSize = 1;
			break;
		}
		z++;
	}
	writesector(destinationDirBlockNumber, &destinationDirectory);
	printstring("Directory ");
	printstring(fileName);
	printstring(" Created!\n");
	return newDirBlockNumber;
}
예제 #13
0
파일: LCD_06.C 프로젝트: Thaodan/rs
//---------------------------------------------------------------------------------------
unsigned char *readdata(void)
  {
  unsigned char c, maske, z, s, row;

  for(z=0; z<8; z++)
    {
    row=0;
    for(s=0; s<5; s++)
      {
      c=getchar();
      if(c=='0' || c==' ')
         c='0';
      else if(c==0x1B)
         return(NULL);                 // unvollendet
      else if(c==ENTER)                // daten[k] fetig
        {
        while(s<5)
          {
          maske=0x10>>s;
          row=row&~maske;              // 0 eintragen
          putchar('_');
          s++;
          }
        break;
        }
      else if(c==0x08)                 // Backspace
        {
        if(s>0)
          {
          s--;
          putchar(c);                 // Backspace ausgeben
          }
        s--;
        continue;
        }
      if(c == '0')
        putchar('.');
      else
        putchar('#');
      maske=0x10>>s;
      if(c=='0')
        row=row&~maske;                // 0 eintragen
      else
        row=row|maske;                 // 1 eintragen
      }
    daten[z]=row;
    printstring(" daten[");
    putchar(z+'0');
    printstring("] = ");
    printhex(daten[z]);
    putchar('\n');
    }
예제 #14
0
void mkf(char * path, char* fileName, char acess[], char *data)
{
	int y,isfile;
	directoryBlock destinationDirectory;
	fileBlock file;
	unsigned int newDirBlockNumber, destinationDirBlockNumber;
	
	if (strCmp(getData(path), "/") != 1)
	{
		destinationDirBlockNumber = findFileBlockInPath(getData(path));
	}
	else
	{
		destinationDirBlockNumber = ROOTBLOCK;
	}
	if (destinationDirBlockNumber == -1)
	{
		printstring("Path cannot be found, creating file failed");
		return;
	}
	readsector(destinationDirBlockNumber, (char*)&destinationDirectory);
	isfile = IsNewFile(destinationDirectory, getData(fileName));
	if (isfile == -1)
	{
		printstring("File already exist\n");
		return;
	}
	file.size = 0;
	file.type = IS_FILE;
	file.data[0] = '\0';
	strcpy(getData(fileName), file.fileName);
	strcpy(getData(acess), file.acessRights);
	strcpy(getData(data), file.data);
	newDirBlockNumber = AllocateBlock();
	wf(&file, getData(data), newDirBlockNumber);
	y = 0;
	while( y < DIRECTORYENTRYCOUNT)
	{
		if (destinationDirectory.entries[y].fileBlockStart == 0)
		{
			strcpy(destinationDirectory.entries[y].fileName, file.fileName);
			destinationDirectory.entries[y].fileType = IS_FILE;
			destinationDirectory.entries[y].fileBlockStart = newDirBlockNumber;
			destinationDirectory.entries[y].fileBlockSize = file.size;
			break;
		}
		y++;
	}
	writesector(destinationDirBlockNumber, (char*)&destinationDirectory);
	return;
}
예제 #15
0
static void voice_handle_touchtone(char Tone)
{
	char Temp[2];

	log(L_DEBUG, "Found touchtone \"%c\"...\n", Tone);

	if (Tone == '*')
	{
		printstring(touchtones, "*");
		
		return;
	}

	if (*touchtones != '*')
	{
		if ((Tone != '#') && (Tone != '*'))
		{
			printstring(touchtones, "*%c#", Tone);
		}
		else
		{
			if (Tone == '#') printstring(touchtones, "*#");
		}

		return;
	}

	if (index(touchtones, '#'))
	{
		if ((Tone != '#') && (Tone != '*'))
		{
			printstring(touchtones, "*%c#", Tone);
		}
		else
		{
			if (Tone == '#') printstring(touchtones, "*#");
		}

		return;
	}

	if (strlen(touchtones) < TOUCHTONE_BUFFER_LEN)
	{
		Temp[0] = Tone;
		Temp[1] = 0;
		
		strcat(touchtones, Temp);
	}
}
예제 #16
0
	string TestGeneric(vector<T>& list)
	{
		sum = 0;
		for (int i = 0; i < OuterIterations; i++)
			sum += (int64)GenericSum(listI);
		return printstring("%I64d", sum);
	}
예제 #17
0
파일: shell.c 프로젝트: alujajakerry/SISO2
void doCreateFile(char* line)
{
	char file[12800];
	int index=0;
	char* name=getargument(line);
	char c=0;
	printstring("Ingrese el texto del archivo, para finalizar escriba Ctrl + C.\r\n\n\0");
	while(c!=0x3)
	{
		c=getchar();
		file[index++]=c;
		
		if (c!=0x3)
			putchar(c);
		
			//putchar(c);
		
		if (c==0xd)
		{
			file[index++]=0xa;
			putchar(0xa);
		}
	}
	
	file[index-1]=0x0;
	
	guardarArchivo(name,file, index);
	

}
예제 #18
0
	string TestNonGeneric(vector<int>& listI)
	{
		int64 sum = 0;
		for (int i = 0; i < OuterIterations; i++)
			sum += NonGenericSum(listI);
		return printstring("%I64d", sum);
	}
예제 #19
0
int main(int argc, char** argv) {
	if (argc != 2) {
		fprintf(stderr, "Usage: %s \"<banner string>\"\n", argv[0]);
		exit(1);
	}
	setupsignals();
	setupcurses();
	setupscreen();

	for (;;) {
		int x, y;
		
		if (g_requireinit) {
			endwin();
			setupcurses();
			setupscreen();
			g_requireinit = 0;
		}
	
		x = rand() % (COLS - pstrwidth(argv[1]));
		y = rand() % (LINES - nlines);

		clear();
		printstring(argv[1], x, y, 3, 1);
		refresh();
		
		sleep(1);
	}
}
예제 #20
0
/*prints an integer*/
void printnumber(int number)
{
	char num[12];
	char pnum[12];
	int d=1;
	int i=0;
	int j;

	/*convert the number to a string digit by digit*/
	while(i<10)
	{
		num[i]=mod(mydiv(number,d),10)+0x30;
		i++;
		d=d*10;
		if (mydiv(number,d)==0)
			break;
	}

	/*reverse it to read most significant to least significant*/
	j=0;
	for (d=i-1; d>=0; d--)
		pnum[j++]=num[d];
	pnum[j]=0;
	printstring(pnum);
}
예제 #21
0
파일: shell.c 프로젝트: alujajakerry/SISO2
/*load the file and print out the contents.  assume that's it's ASCII*/
void dotype(char* line)
{
	char file[12800];

	char* name=getargument(line);
	file[0]=0x1;
	readfile(name,file);
	if (file[0]==0x1)
	{
		printstring("File not found\r\n\0");
	}
	else
	{
		printstring(file);
	}
}
예제 #22
0
파일: stdio.c 프로젝트: kshmir/so-2011-3
// Standard vprintf, not complete
void vprintf(char* string, va_list ap) {
	int i = 0, va_count = 0;
	while (string[i] != '\0') {
		if (string[i] == '%') {
			i++;
			switch (string[i]) {
			case 'd':
				printint(va_arg(ap,int),string);
				break;
			case 's':
				printstring( va_arg( ap, char*));
				break;
			case 'c':
				putchar( va_arg( ap, int));
				break;
			case 'f':
				printdouble(va_arg(ap,double),string);
				break;
			case '%':
				putchar('%');
				break;

			default:
				printstring("\n invalid argument type error \n");
			}
			i++;
		} else {
			putchar(string[i]);
			i++;
		}
	}
	va_end(ap);
}
예제 #23
0
void av_log_wx_callback(void* ptr, int level, const char* fmt, va_list vl)
{
   int av_log_level = AV_LOG_WARNING;
   AVClass* avc = ptr ? *(AVClass**)ptr : NULL;
   if (level > av_log_level)
      return;
   wxString printstring(wxT(""));

   if (avc) {
      printstring.Append(wxString::Format(wxT("[%s @ %p] "), wxString::FromUTF8(avc->item_name(ptr)).c_str(), avc));
   }

   wxString frm(fmt,wxConvLibc);
   printstring.Append(wxString::FormatV(frm,vl));

   wxString cpt;
   switch (level)
   {
   case 0: cpt = wxT("Error"); break;
   case 1: cpt = wxT("Info"); break;
   case 2: cpt = wxT("Debug"); break;
   default: cpt = wxT("Log"); break;
   }
   wxLogMessage(wxT("%s: %s"),cpt.c_str(),printstring.c_str());
}
예제 #24
0
int lock_type_unlock(int type)
{
	char *name;
	char *device;
	int	i;
	int   size;

	lock_init_locknames();

	if (!(device = rindex(setup.modem.device, '/')))
		device = setup.modem.device;
	else
		device++;
	
	i = 0;
	
	while (TRUE)
	{
		if (locks[i].file == NULL)
		{
			log(L_WARN, "Lock setup for type %d not found.\n", type);

			returnerror();
		}

		if (locks[i].type == type) break;

		i++;
	}

	size = (strlen(locks[i].file) + strlen(device) + 2);
	
	if ((name = (char *)malloc(size)))
	{
		printstring(name, locks[i].file, device);

		log(L_DEBUG, "Unlocking %s (%s)...\n", locks[i].desc, name);

		if (*(locks[i].fd) != -1)
		{
			lock_unlocking(*(locks[i].fd), 5);

			close(*(locks[i].fd));

			*(locks[i].fd) = -1;
		}

		if (unlink(name) != 0)
		{
			log(L_WARN, "Can't remove lock \"%s\".\n", name);
		}

		free(name);

		returnok();
	}
	else log(L_FATAL, "Not enough memory to allocate lockname.\n");
				
	returnerror();
}
void Words::printWord ( int32_t i ) {
	fprintf(stderr,"#%05"INT32" ",i);
	fprintf(stderr,"%020"UINT64" ",m_wordIds[i]);
	// print the word
	printstring(m_words[i],m_wordLens[i]);
	//if (m_spam.m_spam[i]!=0)
	//	printf("[%i]",m_spam.m_spam[i]);
}
예제 #26
0
//Prints a formatted string to the main window at the current cursor
int printw(const char *fmt, ...)
{
    va_list args;
    va_start(args, fmt);
    const std::string printbuf = vstring_format(fmt, args);
    va_end(args);
    return printstring(mainwin, printbuf);
}
예제 #27
0
파일: lib.c 프로젝트: alujajakerry/SISO2
void Listar()
{
	char mapsector[512];
	readsector(BASEOFFSET,mapsector);
	printstring("Directory:\r\n\0");
	ImprimirLista(0x01,0,mapsector);
	
}
예제 #28
0
void Words::printWord ( long i ) {
	fprintf(stderr,"#%05li ",i);
	fprintf(stderr,"%020llu ",m_wordIds[i]);
	// print the word
	printstring(m_words[i],m_wordLens[i]);
	//if (m_spam.m_spam[i]!=0)
	//	printf("[%i]",m_spam.m_spam[i]);
}
예제 #29
0
//Prints a formatted string to window 0 (stdscr) at the current cursor
int printw(const char *fmt, ...)
{
    va_list args;
    va_start(args, fmt);
    char printbuf[2078];
    vsnprintf(printbuf, 2047, fmt, args);
    va_end(args);
    return printstring(&_windows[0],printbuf);
};
예제 #30
0
//Prints a formatted string to a window at the current cursor, base function
int wprintw(WINDOW *win, const char *fmt, ...)
{
    va_list args;
    va_start(args, fmt);
    char printbuf[2048];
    vsnprintf(printbuf, 2047, fmt, args);
    va_end(args);
    return printstring(win,printbuf);
};