From 75a008acf6b488d058f7eae04d665713dac1ee95 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Wed, 4 Feb 2004 20:02:57 +0000 Subject: [PATCH] cat for ReactOS made by Tappak (Semyon Novikov) svn path=/trunk/; revision=8029 --- rosapps/sysutils/tcat/.cvsignore | 17 +++++++++++ rosapps/sysutils/tcat/cat.c | 52 ++++++++++++++++++++++++++++++++ rosapps/sysutils/tcat/makefile | 23 ++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 rosapps/sysutils/tcat/.cvsignore create mode 100644 rosapps/sysutils/tcat/cat.c create mode 100644 rosapps/sysutils/tcat/makefile diff --git a/rosapps/sysutils/tcat/.cvsignore b/rosapps/sysutils/tcat/.cvsignore new file mode 100644 index 00000000000..954ada33419 --- /dev/null +++ b/rosapps/sysutils/tcat/.cvsignore @@ -0,0 +1,17 @@ +*.sys +*.exe +*.dll +*.cpl +*.a +*.o +*.d +*.coff +*.dsp +*.dsw +*.aps +*.ncb +*.opt +*.sym +*.plg +*.bak +*.map diff --git a/rosapps/sysutils/tcat/cat.c b/rosapps/sysutils/tcat/cat.c new file mode 100644 index 00000000000..b3f72b9380d --- /dev/null +++ b/rosapps/sysutils/tcat/cat.c @@ -0,0 +1,52 @@ +/* + * FILE : cat.c + * NATIVE NAME: tcat "tappak's cat" :) + * AUTHOR : Semyon Novikov (tappak) + * PROJECT : ReactOS Operating System + * DESCRIPTION: file concatenation tool + * DATE : 2004-01-21 + * LICENSE : GPL + */ + +#include +#include +#define F_O_ERR "can not open file" + +void help(void) +{ + puts("File concatenation tool"); + puts("Usage: cat [file]"); +} + +main(int argc, char *argv[]) +{ + FILE *srcf; + char *keys[]={"--help","/help"}; + int i=0,ret=0; + switch(argc) + { + case 1:puts("Usage: cat [file]");break; + case 2: + if ((!strcmp(argv[1],keys[0]))||(!strcmp(argv[1],keys[1]))) + help(); + else + { + if((srcf=fopen(argv[1],"r"))!=NULL) + { + while(i!=EOF) + { i=fgetc(srcf); + putchar(i); + } + fclose(srcf); + } + else + { + printf("%s %s %s\n",argv[0],F_O_ERR,argv[1]); + ret=-1; + } + } + break; + } + return ret; +} + diff --git a/rosapps/sysutils/tcat/makefile b/rosapps/sysutils/tcat/makefile new file mode 100644 index 00000000000..35dab9cc291 --- /dev/null +++ b/rosapps/sysutils/tcat/makefile @@ -0,0 +1,23 @@ +# + +PATH_TO_TOP = ../../../reactos + +TARGET_NORC = yes + +TARGET_TYPE = program + +TARGET_APPTYPE = console + +TARGET_NAME = cat + +TARGET_SDKLIBS = ntdll.a + +TARGET_CFLAGS = -D__USE_W32API -Wall + +TARGET_OBJECTS = $(TARGET_NAME).o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +# EOF