Example #1
0
void OCatCmd_Cat (void)
{
	CHAR path[128];
	INTEGER i;
	Texts_Text T = NIL;
	Texts_Reader R;
	CHAR ch;
	BOOLEAN tab;
	CHAR buf[1024];
	INTEGER bufpos;
	struct Cat__1 _s;
	_s.buf = (void*)buf;
	_s.bufpos = &bufpos;
	_s.lnk = Cat__1_s;
	Cat__1_s = &_s;
	path[0] = 0x00;
	__NEW(T, Texts_TextDesc);
	Args_Get(1, (void*)path, 128);
	if (__STRCMP(path, "-t") == 0) {
		tab = 1;
		i = 2;
		Args_Get(2, (void*)path, 128);
	} else {
		tab = 0;
		i = 1;
	}
	while (path[0] != 0x00) {
		if (Files_Old(path, 128) != NIL) {
			Texts_Open(T, path, 128);
			Texts_OpenReader(&R, Texts_Reader__typ, T, 0);
			Texts_Read(&R, Texts_Reader__typ, &ch);
			bufpos = 0;
			while (!R.eot) {
				if (ch >= ' ') {
					ConsoleChar__2(ch);
				} else if (ch == 0x09) {
					if (tab) {
						ConsoleChar__2(ch);
					} else {
						ConsoleChar__2(' ');
						ConsoleChar__2(' ');
					}
				} else if (ch == 0x0d) {
					ConsoleChar__2(0x0a);
				}
				Texts_Read(&R, Texts_Reader__typ, &ch);
			}
			buf[__X(bufpos, 1024)] = 0x00;
			Console_String(buf, 1024);
		} else {
			Console_String((CHAR*)"OCat: cannot open ", 19);
			Console_String(path, 128);
			Console_Ln();
		}
		i += 1;
		path[0] = 0x00;
		Args_Get(i, (void*)path, 128);
	}
	Cat__1_s = _s.lnk;
}
Example #2
0
static void WatsonCmd_ShowDef (void)
{
	CmdlnTexts_Text T = NIL;
	CHAR mod[32];
	__MOVE("Watson0", mod, 8);
	__NEW(T, CmdlnTexts_TextDesc);
	CmdlnTexts_Open(T, (CHAR*)"", (LONGINT)1);
	Watson0_ShowDef((void*)mod, 32, T);
}