Author: peterw Date: Thu Oct 25 11:14:03 2007 New Revision: 29866
URL: http://svn.reactos.org/svn/reactos?rev=29866&view=rev Log: - Added a minimal replacement for tee. - Some other miscellaneous cleanup.
Added: trunk/tools/RosBE-Windows/Tools/tee.c (with props) Modified: trunk/tools/RosBE-Windows/Tools/buildtime.c trunk/tools/RosBE-Windows/Tools/chknewer.c trunk/tools/RosBE-Windows/Tools/chkslash.c trunk/tools/RosBE-Windows/Tools/makefile
Modified: trunk/tools/RosBE-Windows/Tools/buildtime.c URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/buildtime... ============================================================================== --- trunk/tools/RosBE-Windows/Tools/buildtime.c (original) +++ trunk/tools/RosBE-Windows/Tools/buildtime.c Thu Oct 25 11:14:03 2007 @@ -82,9 +82,7 @@ }
CommandLineBuffer[0] = 0; - //strcat(CommandLineBuffer, """); strcat(CommandLineBuffer, CommandLine); - //strcat(CommandLineBuffer, """);
// // Grab the starting timestamp.
Modified: trunk/tools/RosBE-Windows/Tools/chknewer.c URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/chknewer.... ============================================================================== --- trunk/tools/RosBE-Windows/Tools/chknewer.c (original) +++ trunk/tools/RosBE-Windows/Tools/chknewer.c Thu Oct 25 11:14:03 2007 @@ -25,7 +25,7 @@
if (argc > 3) { - printf("%s: Error too many parameters specified.\n", argv[0]); + fprintf(stderr, "%s: Error too many parameters specified.\n", argv[0]); return -1; } if ((argc == 1) || @@ -43,19 +43,20 @@ FILE1 = fopen(argv[1], "r"); if (!FILE1) { - printf("%s: Error file "%s" doesn't seem to exist.\n", argv[0], argv[1]); + fprintf(stderr, "%s: Error file "%s" doesn't seem to exist.\n", argv[0], argv[1]); return -1; } else { if (fclose(FILE1)) { - printf("%s: Error closing file "%s"\n", argv[0], argv[1]); + fprintf(stderr, "%s: Error closing file "%s"\n", argv[0], argv[1]); + return -1; } file1time = getfmodtime(argv[1]); if (!file1time) { - printf("%s: Error unable to aquire stats for file: %s\n", argv[0], argv[1]); + fprintf(stderr, "%s: Error unable to aquire stats for file: %s\n", argv[0], argv[1]); return -1; } } @@ -63,19 +64,20 @@ FILE2 = fopen(argv[2], "r"); if (!FILE2) { - printf("%s: Error file "%s" doesn't seem to exist.\n", argv[0], argv[2]); + fprintf(stderr, "%s: Error file "%s" doesn't seem to exist.\n", argv[0], argv[2]); return -1; } else { if (fclose(FILE2)) { - printf("%s: Error closing file "%s"\n", argv[0], argv[2]); + fprintf(stderr, "%s: Error closing file "%s"\n", argv[0], argv[2]); + return -1; } file2time = getfmodtime(argv[2]); if (!file2time) { - printf("%s: Error unable to aquire stats for file: %s\n", argv[0], argv[2]); + fprintf(stderr, "%s: Error unable to aquire stats for file: %s\n", argv[0], argv[2]); return -1; } }
Modified: trunk/tools/RosBE-Windows/Tools/chkslash.c URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/chkslash.... ============================================================================== --- trunk/tools/RosBE-Windows/Tools/chkslash.c (original) +++ trunk/tools/RosBE-Windows/Tools/chkslash.c Thu Oct 25 11:14:03 2007 @@ -17,7 +17,7 @@
if (argc > 2) { - printf("%s: Error too many parameters specified.\n", argv[0]); + fprintf(stderr, "%s: Error too many parameters specified.\n", argv[0]); return -1; } if ((argc == 1) ||
Modified: trunk/tools/RosBE-Windows/Tools/makefile URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/makefile?... ============================================================================== --- trunk/tools/RosBE-Windows/Tools/makefile (original) +++ trunk/tools/RosBE-Windows/Tools/makefile Thu Oct 25 11:14:03 2007 @@ -7,7 +7,7 @@ LFLAGS := -s WINVER := 0x502
-all: buildtime chknewer chkslash cpucount echoh flash getdate +all: buildtime chknewer chkslash cpucount echoh flash getdate tee
buildtime: buildtime.c ${CC} ${CFLAGS} buildtime buildtime.c @@ -30,5 +30,8 @@ getdate: getdate.c ${CC} ${CFLAGS} getdate getdate.c
+tee: tee.c + ${CC} ${CFLAGS} tee tee.c + clean: - del /f buildtime.exe chknewer.exe chkslash.exe cpucount.exe echoh.exe flash.exe getdate.exe + del /f buildtime.exe chknewer.exe chkslash.exe cpucount.exe echoh.exe flash.exe getdate.exe tee.exe
Added: trunk/tools/RosBE-Windows/Tools/tee.c URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/tee.c?rev... ============================================================================== --- trunk/tools/RosBE-Windows/Tools/tee.c (added) +++ trunk/tools/RosBE-Windows/Tools/tee.c Thu Oct 25 11:14:03 2007 @@ -1,0 +1,69 @@ +/* + * PROJECT: RosBE - ReactOS Build Environment for Windows. + * LICENSE: GPL - See LICENSE.txt in the top level directory. + * FILE: Tools/tee.c + * PURPOSE: Spit stdin to stdout and a file. + * COPYRIGHT: Copyright 2007 Peter Ward dralnix@gmail.com + * + */ + +#include <stdio.h> +#include <string.h> + +int main(int argc, char* argv[]) +{ + unsigned char charbuff; + FILE *FILE; + + if (argc > 2) + { + fprintf(stderr, "%s: Error too many parameters specified.\n", argv[0]); + return -1; + } + if ((argc == 1) || + (!strncmp(argv[1], "/?", 2)) || + (!strncmp(argv[1], "-h", 2)) || + (!strncmp(argv[1], "--help", 6))) + { + printf("Usage: %s FILE\n", argv[0]); + printf("Takes standard input and sends it to standard output\n"); + printf("and FILE.\n\n"); + return 0; + } + + FILE = fopen(argv[1], "r"); + if (FILE) + { + fprintf(stderr, "%s: Error file "%s" already exists.\n", argv[0], argv[1]); + if (fclose(FILE)) + { + fprintf(stderr, "%s: Error closing file "%s"\n", argv[0], argv[1]); + } + return -1; + } + else + { + FILE = fopen(argv[1], "w"); + if (!FILE) + { + fprintf(stderr, "%s: Error cannot create file "%s".\n", argv[0], argv[1]); + return -1; + } + while (!feof(stdin)) + { + charbuff = fgetc(stdin); + if (!feof(stdin)) + { + fputc(charbuff, stdout); + fputc(charbuff, FILE); + } + } + if (fclose(FILE)) + { + fprintf(stderr, "%s: Error closing file "%s"\n", argv[0], argv[1]); + return -1; + } + } + + return 0; +}
Propchange: trunk/tools/RosBE-Windows/Tools/tee.c ------------------------------------------------------------------------------ svn:eol-style = native