Modified: trunk/rosapps/cmdutils/cmdutils.xml
Added: trunk/rosapps/cmdutils/find/
Added: trunk/rosapps/cmdutils/find/find.c
Added: trunk/rosapps/cmdutils/find/find.rc
Added: trunk/rosapps/cmdutils/find/find.xml
Deleted: trunk/rosapps/cmdutils/find.c
Deleted: trunk/rosapps/cmdutils/find.rc
Added: trunk/rosapps/cmdutils/more/
Added: trunk/rosapps/cmdutils/more/more.c
Added: trunk/rosapps/cmdutils/more/more.rc
Added: trunk/rosapps/cmdutils/more/more.xml
Deleted: trunk/rosapps/cmdutils/more.c
Deleted: trunk/rosapps/cmdutils/more.rc
Added: trunk/rosapps/cmdutils/sort/
Added: trunk/rosapps/cmdutils/sort/sort.c
Added: trunk/rosapps/cmdutils/sort/sort.rc
Added: trunk/rosapps/cmdutils/sort/sort.xml
Deleted: trunk/rosapps/cmdutils/sort.c
Deleted: trunk/rosapps/cmdutils/sort.rc
Added: trunk/rosapps/cmdutils/tee/
Added: trunk/rosapps/cmdutils/tee/tee.c
Added: trunk/rosapps/cmdutils/tee/tee.rc
Added: trunk/rosapps/cmdutils/tee/tee.xml
Deleted: trunk/rosapps/cmdutils/tee.c
Deleted: trunk/rosapps/cmdutils/tee.rc
Added: trunk/rosapps/cmdutils/y/
Added: trunk/rosapps/cmdutils/y/y.c
Added: trunk/rosapps/cmdutils/y/y.rc
Added: trunk/rosapps/cmdutils/y/y.xml
Deleted: trunk/rosapps/cmdutils/y.c
Deleted: trunk/rosapps/cmdutils/y.rc
--- trunk/rosapps/cmdutils/cmdutils.xml 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/cmdutils.xml 2005-09-25 19:38:46 UTC (rev 18066)
@@ -1,52 +1,23 @@
+<group>
+<directory name="find">
+ <xi:include href="find/find.xml" />
+</directory>
<directory name="mode">
<xi:include href="mode/mode.xml" />
</directory>
-
+<directory name="more">
+ <xi:include href="more/more.xml" />
+</directory>
+<directory name="sort">
+ <xi:include href="sort/sort.xml" />
+</directory>
+<directory name="tee">
+ <xi:include href="tee/tee.xml" />
+</directory>
<directory name="touch">
<xi:include href="touch/touch.xml" />
</directory>
-
-<module name="find" type="win32cui" installbase="system32" installname="find.exe">
- <define name="__USE_W32API" />
- <define name="_WIN32_IE">0x0501</define>
- <define name="_WIN32_WINNT">0x0501</define>
- <library>kernel32</library>
- <file>find.c</file>
- <file>find.rc</file>
-</module>
-
-<module name="more" type="win32cui" installbase="system32" installname="more.exe">
- <define name="__USE_W32API" />
- <define name="_WIN32_IE">0x0501</define>
- <define name="_WIN32_WINNT">0x0501</define>
- <library>kernel32</library>
- <file>more.c</file>
- <file>more.rc</file>
-</module>
-
-<module name="sort" type="win32cui" installbase="system32" installname="sort.exe">
- <define name="__USE_W32API" />
- <define name="_WIN32_IE">0x0501</define>
- <define name="_WIN32_WINNT">0x0501</define>
- <library>kernel32</library>
- <file>sort.c</file>
- <file>sort.rc</file>
-</module>
-
-<module name="tee" type="win32cui" installbase="system32" installname="tee.exe">
- <define name="__USE_W32API" />
- <define name="_WIN32_IE">0x0501</define>
- <define name="_WIN32_WINNT">0x0501</define>
- <library>kernel32</library>
- <file>tee.c</file>
- <file>tee.rc</file>
-</module>
-
-<module name="y" type="win32cui" installbase="system32" installname="y.exe">
- <define name="__USE_W32API" />
- <define name="_WIN32_IE">0x0501</define>
- <define name="_WIN32_WINNT">0x0501</define>
- <library>kernel32</library>
- <file>y.c</file>
- <file>y.rc</file>
-</module>
+<directory name="y">
+ <xi:include href="y/y.xml" />
+</directory>
+</group>
--- trunk/rosapps/cmdutils/find/find.xml 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/find/find.xml 2005-09-25 19:38:46 UTC (rev 18066)
@@ -0,0 +1,8 @@
+<module name="find" type="win32cui" installbase="system32" installname="find.exe">
+ <define name="__USE_W32API" />
+ <define name="_WIN32_IE">0x0501</define>
+ <define name="_WIN32_WINNT">0x0501</define>
+ <library>kernel32</library>
+ <file>find.c</file>
+ <file>find.rc</file>
+</module>
Property changes on: trunk/rosapps/cmdutils/find/find.xml
___________________________________________________________________
Name: svn:eol-style
+ native
--- trunk/rosapps/cmdutils/find.c 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/find.c 2005-09-25 19:38:46 UTC (rev 18066)
@@ -1,248 +0,0 @@
-/* find.c */
-
-/* Copyright (C) 1994-2002, Jim Hall <jhall@freedos.org> */
-
-/* Adapted for ReactOS */
-
-/*
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-
-/* This program locates a string in a text file and prints those lines
- * that contain the string. Multiple files are clearly separated.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#include <dir.h>
-#include <dos.h>
-
-
-/* Symbol definition */
-#define MAX_STR 1024
-
-
-/* This function prints out all lines containing a substring. There are some
- * conditions that may be passed to the function.
- *
- * RETURN: If the string was found at least once, returns 1.
- * If the string was not found at all, returns 0.
- */
-int
-find_str (char *sz, FILE *p, int invert_search,
- int count_lines, int number_output, int ignore_case)
-{
- int i, length;
- long line_number = 0, total_lines = 0;
- char *c, temp_str[MAX_STR], this_line[MAX_STR];
-
- /* Convert to upper if needed */
- if (ignore_case)
- {
- length = strlen (sz);
- for (i = 0; i < length; i++)
- sz[i] = toupper (sz[i]);
- }
-
- /* Scan the file until EOF */
- while (fgets (temp_str, MAX_STR, p) != NULL)
- {
- /* Remove the trailing newline */
- length = strlen (temp_str);
- if (temp_str[length-1] == '\n')
- {
- temp_str[length-1] = '\0';
- }
-
- /* Increment number of lines */
- line_number++;
- strcpy (this_line, temp_str);
-
- /* Convert to upper if needed */
- if (ignore_case)
- {
- for (i = 0; i < length; i++)
- {
- temp_str[i] = toupper (temp_str[i]);
- }
- }
-
- /* Locate the substring */
-
- /* strstr() returns a pointer to the first occurrence in the
- string of the substring */
- c = strstr (temp_str, sz);
-
- if ( ((invert_search) ? (c == NULL) : (c != NULL)) )
- {
- if (!count_lines)
- {
- if (number_output)
- printf ("%ld:", line_number);
-
- /* Print the line of text */
- puts (this_line);
- }
-
- total_lines++;
- } /* long if */
- } /* while fgets */
-
- if (count_lines)
- {
- /* Just show num. lines that contain the string */
- printf ("%ld\n", total_lines);
- }
-
-
- /* RETURN: If the string was found at least once, returns 1.
- * If the string was not found at all, returns 0.
- */
- return (total_lines > 0 ? 1 : 0);
-}
-
-
-/* Show usage */
-void
-usage (void)
-{
- fprintf (stderr, "FIND: Prints all lines of a file that contain a string\n");
- fprintf (stderr, "FIND [ /C ] [ /I ] [ /N ] [ /V ] \"string\" [ file... ]\n");
- fprintf (stderr, " /C Count the number of lines that contain string\n");
- fprintf (stderr, " /I Ignore case\n");
- fprintf (stderr, " /N Number the displayed lines, starting at 1\n");
- fprintf (stderr, " /V Print lines that do not contain the string\n");
-}
-
-
-/* Main program */
-int
-main (int argc, char **argv)
-{
- char *opt, *needle = NULL;
- int ret = 0;
-
- int invert_search = 0; /* flag to invert the search */
- int count_lines = 0; /* flag to whether/not count lines */
- int number_output = 0; /* flag to print line numbers */
- int ignore_case = 0; /* flag to be case insensitive */
-
- FILE *pfile; /* file pointer */
- int hfind; /* search handle */
- struct _finddata_t finddata; /* _findfirst, filenext block */
-
- /* Scan the command line */
- while ((--argc) && (needle == NULL))
- {
- if (*(opt = *++argv) == '/')
- {
- switch (opt[1])
- {
- case 'c':
- case 'C': /* Count */
- count_lines = 1;
- break;
-
- case 'i':
- case 'I': /* Ignore */
- ignore_case = 1;
- break;
-
- case 'n':
- case 'N': /* Number */
- number_output = 1;
- break;
-
- case 'v':
- case 'V': /* Not with */
- invert_search = 1;
- break;
-
- default:
- usage ();
- exit (2); /* syntax error .. return error 2 */
- break;
- }
- }
- else
- {
- /* Get the string */
- if (needle == NULL)
- {
- /* Assign the string to find */
- needle = *argv;
- }
- }
- }
-
- /* Check for search string */
- if (needle == NULL)
- {
- /* No string? */
- usage ();
- exit (1);
- }
-
- /* Scan the files for the string */
- if (argc == 0)
- {
- ret = find_str (needle, stdin, invert_search, count_lines,
- number_output, ignore_case);
- }
-
- while (--argc >= 0)
- {
- hfind = _findfirst (*++argv, &finddata);
- if (hfind < 0)
- {
- /* We were not able to find a file. Display a message and
- set the exit status. */
- fprintf (stderr, "FIND: %s: No such file\n", *argv);
- }
- else
- {
- /* repeat find next file to match the filemask */
- do
- {
- /* We have found a file, so try to open it */
- if ((pfile = fopen (finddata.name, "r")) != NULL)
- {
- printf ("---------------- %s\n", finddata.name);
- ret = find_str (needle, pfile, invert_search, count_lines,
- number_output, ignore_case);
- fclose (pfile);
- }
- else
- {
- fprintf (stderr, "FIND: %s: Cannot open file\n",
- finddata.name);
- }
- }
- while (_findnext(hfind, &finddata) > 0);
- }
- _findclose(hfind);
- } /* for each argv */
-
- /* RETURN: If the string was found at least once, returns 0.
- * If the string was not found at all, returns 1.
- * (Note that find_str.c returns the exact opposite values.)
- */
- exit ( (ret ? 0 : 1) );
-}
-
--- trunk/rosapps/cmdutils/find.rc 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/find.rc 2005-09-25 19:38:46 UTC (rev 18066)
@@ -1,6 +0,0 @@
-/* $Id$ */
-
-#define REACTOS_STR_FILE_DESCRIPTION "W32 find command\0"
-#define REACTOS_STR_INTERNAL_NAME "find\0"
-#define REACTOS_STR_ORIGINAL_FILENAME "find.exe\0"
-#include <reactos/version.rc>
--- trunk/rosapps/cmdutils/more/more.xml 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/more/more.xml 2005-09-25 19:38:46 UTC (rev 18066)
@@ -0,0 +1,8 @@
+<module name="more" type="win32cui" installbase="system32" installname="more.exe">
+ <define name="__USE_W32API" />
+ <define name="_WIN32_IE">0x0501</define>
+ <define name="_WIN32_WINNT">0x0501</define>
+ <library>kernel32</library>
+ <file>more.c</file>
+ <file>more.rc</file>
+</module>
Property changes on: trunk/rosapps/cmdutils/more/more.xml
___________________________________________________________________
Name: svn:eol-style
+ native
--- trunk/rosapps/cmdutils/more.c 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/more.c 2005-09-25 19:38:46 UTC (rev 18066)
@@ -1,151 +0,0 @@
-/*
- * MORE.C - external command.
- *
- * clone from 4nt more command
- *
- * 26 Sep 1999 - Paolo Pantaleo <paolopan@freemail.it>
- * started
- * Oct 2003 - Timothy Schepens <tischepe at fastmail dot fm>
- * use window size instead of buffer size.
- */
-
-#include <windows.h>
-#include <malloc.h>
-#include <tchar.h>
-
-
-DWORD len;
-LPTSTR msg = "--- continue ---";
-
-
-/*handle for file and console*/
-HANDLE hStdIn;
-HANDLE hStdOut;
-HANDLE hStdErr;
-HANDLE hKeyboard;
-
-
-static VOID
-GetScreenSize (PSHORT maxx, PSHORT maxy)
-{
- CONSOLE_SCREEN_BUFFER_INFO csbi;
-
- GetConsoleScreenBufferInfo (hStdOut, &csbi);
- *maxx = csbi.srWindow.Right;
- *maxy = csbi.srWindow.Bottom;
-
-}
-
-
-static
-VOID ConOutPuts (LPTSTR szText)
-{
- DWORD dwWritten;
-
- WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szText, _tcslen(szText), &dwWritten, NULL);
- WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\n", 1, &dwWritten, NULL);
-}
-
-
-static VOID
-ConInKey (VOID)
-{
- INPUT_RECORD ir;
- DWORD dwRead;
-
- do
- {
- ReadConsoleInput (hKeyboard, &ir, 1, &dwRead);
- if ((ir.EventType == KEY_EVENT) &&
- (ir.Event.KeyEvent.bKeyDown == TRUE))
- return;
- }
- while (TRUE);
-}
-
-
-static VOID
-WaitForKey (VOID)
-{
- DWORD dwWritten;
-
- WriteFile (hStdErr,msg , len, &dwWritten, NULL);
-
- ConInKey();
-
- WriteFile (hStdErr, _T("\n"), 1, &dwWritten, NULL);
-
-// FlushConsoleInputBuffer (hConsoleIn);
-}
-
-
-//INT CommandMore (LPTSTR cmd, LPTSTR param)
-int main (int argc, char **argv)
-{
- SHORT maxx,maxy;
- SHORT line_count=0,ch_count=0;
- INT i, last;
-
- /*reading/writing buffer*/
- TCHAR *buff;
-
- /*bytes written by WriteFile and ReadFile*/
- DWORD dwRead,dwWritten;
-
- /*ReadFile() return value*/
- BOOL bRet;
-
- len = _tcslen (msg);
- hStdIn = GetStdHandle(STD_INPUT_HANDLE);
- hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
- hStdErr = GetStdHandle(STD_ERROR_HANDLE);
-
- if (argc > 1 && _tcsncmp (argv[1], _T("/?"), 2) == 0)
- {
- ConOutPuts(_T("Help text still missing!!"));
- return 0;
- }
-
- hKeyboard = CreateFile ("CONIN$", GENERIC_READ,
- 0,NULL,OPEN_ALWAYS,0,0);
-
- GetScreenSize(&maxx,&maxy);
-
- buff=malloc(4096);
-
- FlushConsoleInputBuffer (hKeyboard);
-
- do
- {
- bRet = ReadFile(hStdIn,buff,4096,&dwRead,NULL);
-
- for(last=i=0;i<dwRead && bRet;i++)
- {
- ch_count++;
- if(buff[i] == _T('\n') || ch_count == maxx)
- {
- ch_count=0;
- line_count++;
- if (line_count == maxy)
- {
- line_count = 0;
- WriteFile(hStdOut,&buff[last], i-last+1, &dwWritten, NULL);
- last=i+1;
- FlushFileBuffers (hStdOut);
- WaitForKey ();
- }
- }
- }
- if (last<dwRead && bRet)
- WriteFile(hStdOut,&buff[last], dwRead-last, &dwWritten, NULL);
-
- }
- while(dwRead>0 && bRet);
-
- free (buff);
- CloseHandle (hKeyboard);
-
- return 0;
-}
-
-/* EOF */
--- trunk/rosapps/cmdutils/more.rc 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/more.rc 2005-09-25 19:38:46 UTC (rev 18066)
@@ -1,6 +0,0 @@
-/* $Id$ */
-
-#define REACTOS_STR_FILE_DESCRIPTION "W32 more command\0"
-#define REACTOS_STR_INTERNAL_NAME "more\0"
-#define REACTOS_STR_ORIGINAL_FILENAME "more.exe\0"
-#include <reactos/version.rc>
--- trunk/rosapps/cmdutils/sort/sort.xml 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/sort/sort.xml 2005-09-25 19:38:46 UTC (rev 18066)
@@ -0,0 +1,8 @@
+<module name="sort" type="win32cui" installbase="system32" installname="sort.exe">
+ <define name="__USE_W32API" />
+ <define name="_WIN32_IE">0x0501</define>
+ <define name="_WIN32_WINNT">0x0501</define>
+ <library>kernel32</library>
+ <file>sort.c</file>
+ <file>sort.rc</file>
+</module>
Property changes on: trunk/rosapps/cmdutils/sort/sort.xml
___________________________________________________________________
Name: svn:eol-style
+ native
--- trunk/rosapps/cmdutils/sort.c 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/sort.c 2005-09-25 19:38:46 UTC (rev 18066)
@@ -1,141 +0,0 @@
-/*
-* SORT - reads line of a file and sorts them in order
-* Copyright 1995 Jim Lynch
-*
-* Adapted for ReactOS
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <malloc.h>
-
-#define MAXRECORDS 65536 /* maximum number of records that can be
- * sorted */
-#define MAXLEN 4095 /* maximum record length */
-
-int rev; /* reverse flag */
-int help; /* help flag */
-int sortcol; /* sort column */
-int err = 0; /* error counter */
-
-int
-cmpr(const void *a, const void *b)
-{
- char *A, *B;
-
- A = *(char **) a;
- B = *(char **) b;
-
- if (sortcol > 0) {
- if (strlen(A) > sortcol)
- A += sortcol;
- else
- A = "";
- if (strlen(B) > sortcol)
- B += sortcol;
- else
- B = "";
- }
- if (!rev)
- return strcmp(A, B);
- else
- return strcmp(B, A);
-}
-
-void
-usage(void)
-{
- fputs("SORT\n", stderr);
- fputs("Sorts input and writes output to a file, console or a device.\n", stderr);
- if (err)
- fputs("Invalid parameter\n", stderr);
- fputs(" SORT [options] < [drive:1][path1]file1 > [drive2:][path2]file2\n", stderr);
- fputs(" Command | SORT [options] > [drive:][path]file\n", stderr);
- fputs(" Options:\n", stderr);
- fputs(" /R Reverse order\n", stderr);
- fputs(" /+n Start sorting with column n\n", stderr);
- fputs(" /? Help\n", stderr);
-}
-
-int main(int argc, char **argv)
-{
- char temp[MAXLEN + 1];
- char **list;
- char *cp; /* option character pointer */
- int nr;
- int i;
-
-
- sortcol = 0;
- rev = 0;
- while (--argc) {
- if (*(cp = *++argv) == '/') {
- switch (cp[1]) {
- case 'R':
- case 'r':
- rev = 1;
- break;
- case '?':
- case 'h':
- case 'H':
- help = 1;
- break;
- case '+':
- sortcol = atoi(cp + 1);
- if (sortcol)
- sortcol--;
- break;
- default:
- err++;
- }
- }
- }
- if (err || help) {
- usage();
- exit(1);
- }
- list = (char **) malloc(MAXRECORDS * sizeof(char *));
- if (list == NULL) {
- fputs("SORT: Insufficient memory\n", stderr);
- exit(3);
- }
- for (nr = 0; nr < MAXRECORDS; nr++) {
- if (fgets(temp, MAXLEN, stdin) == NULL)
- break;
- if(strlen(temp))
- temp[strlen(temp)-1]='\0';
- list[nr] = (char *) malloc(strlen(temp) + 1);
- if (list[nr] == NULL) {
- fputs("SORT: Insufficient memory\n", stderr);
- exit(3);
- }
- strcpy(list[nr], temp);
- }
- if (nr == MAXRECORDS) {
- fputs("SORT: number of records exceeds maximum\n", stderr);
- exit(4);
- }
- qsort((void *) list, nr, sizeof(char *), cmpr);
- for (i = 0; i < nr; i++) {
- fputs(list[i], stdout);
- fputs("\n",stdout);
- }
- return 0;
-}
-
-/* EOF */
--- trunk/rosapps/cmdutils/sort.rc 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/sort.rc 2005-09-25 19:38:46 UTC (rev 18066)
@@ -1,6 +0,0 @@
-/* $Id$ */
-
-#define REACTOS_STR_FILE_DESCRIPTION "W32 sort command\0"
-#define REACTOS_STR_INTERNAL_NAME "sort\0"
-#define REACTOS_STR_ORIGINAL_FILENAME "sort.exe\0"
-#include <reactos/version.rc>
--- trunk/rosapps/cmdutils/tee/tee.xml 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/tee/tee.xml 2005-09-25 19:38:46 UTC (rev 18066)
@@ -0,0 +1,8 @@
+<module name="tee" type="win32cui" installbase="system32" installname="tee.exe">
+ <define name="__USE_W32API" />
+ <define name="_WIN32_IE">0x0501</define>
+ <define name="_WIN32_WINNT">0x0501</define>
+ <library>kernel32</library>
+ <file>tee.c</file>
+ <file>tee.rc</file>
+</module>
Property changes on: trunk/rosapps/cmdutils/tee/tee.xml
___________________________________________________________________
Name: svn:eol-style
+ native
--- trunk/rosapps/cmdutils/tee.c 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/tee.c 2005-09-25 19:38:46 UTC (rev 18066)
@@ -1,220 +0,0 @@
-/*
- * TEE.C - external command.
- *
- * clone from 4nt tee command
- *
- * 01 Sep 1999 - Paolo Pantaleo <paolopan@freemail.it>
- * started
- *
- *
- */
-
-
-#include <windows.h>
-#include <tchar.h>
-#include <stdio.h>
-#include <malloc.h>
-
-
-
-#define TEE_BUFFER_SIZE 8192
-
-/*these are function that emulate the ones used in cmd*/
-
-/*many of them are just copied in this file from their
-original location*/
-
-VOID ConOutPuts (LPTSTR szText)
-{
- DWORD dwWritten;
-
- WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szText, _tcslen(szText), &dwWritten, NULL);
- WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), _T("\n"), 1, &dwWritten, NULL);
-}
-
-
-VOID ConErrPrintf (LPTSTR szFormat, ...)
-{
- DWORD dwWritten;
- TCHAR szOut[4096];
- va_list arg_ptr;
-
- va_start (arg_ptr, szFormat);
- _vstprintf (szOut, szFormat, arg_ptr);
- va_end (arg_ptr);
-
- WriteFile (GetStdHandle (STD_ERROR_HANDLE), szOut, _tcslen(szOut), &dwWritten, NULL);
-}
-
-
-
-VOID error_sfile_not_found (LPTSTR f)
-{
- ConErrPrintf (_T("Error opening file") _T(" - %s\n"), f);
-}
-
-
-
-
-VOID ConErrPuts (LPTSTR szText)
-{
- ConErrPrintf(_T("%s\n"),szText );
-}
-
-
-INT main (int argc,char **p)
-{
- /*reading/writing buffer*/
- TCHAR buff[TEE_BUFFER_SIZE];
-
- /*handle for file and console*/
- HANDLE hConsoleIn,hConsoleOut;
-
- /*bytes written by WriteFile and ReadFile*/
- DWORD dwRead,dwWritten;
-
-
- BOOL bRet,bAppend=FALSE;
-
-
- /*command line parsing stuff*/
- LPTSTR tmp;
- INT i;
- BOOL bQuote;
-
- /*file list implementation*/
- LPTSTR *files;
- INT iFileCounter=0;
- HANDLE *hFile;
-
- /*used to remove '"' (if any)*/
- INT add;
-
- DWORD dw;
-
-
- if (argc < 2)
- return 1;
-
- if (_tcsncmp (p[1], _T("/?"), 2) == 0)
- {
- ConOutPuts (_T("Copy standard input to both standard output and a file.\n"
- "\n"
- "TEE [/A] file...\n"
- "\n"
- " file One or more files that will receive output.\n"
- " /A Append output to files.\n"));
- return 0;
- }
-
- files = malloc(sizeof(LPTSTR)*argc);
- hFile = malloc(sizeof(HANDLE)*argc);
-
- hConsoleIn=GetStdHandle(STD_INPUT_HANDLE);
- hConsoleOut=GetStdHandle(STD_OUTPUT_HANDLE);
-
- /*parse command line for /a and file name(s)*/
- for(i=1;i <argc;i++)
- {
- bQuote=FALSE;
- add=0;
-
- if(_tcsnicmp(p[i],_T("/a"),2) == 0)
- {
- bAppend = TRUE;
- continue;
- }
-
- /*remove quote if any*/
- if (p[i][0] == _T('"'))
- {
- tmp = _tcschr (p[i]+1, _T('"'));
- if (tmp != 0)
- {
- add = 1;
- *tmp= _T('\0');
- }
- }
-
- /*add filename to array of filename*/
-/*
- if( iFileCounter >= sizeof(files) / sizeof(*files) )
- {
- ConErrPrintf("too many files, maximum is %d\n",sizeof(files) / sizeof(*files));
- return 1;
- }
- */
-
- files[iFileCounter++]= p[i]+add;
- }
-
- /*open file(s)*/
- for(i=0;i<iFileCounter;i++)
- {
- //l=0;
- hFile[i] = CreateFile(files[i],GENERIC_WRITE,
- 0,NULL,
- OPEN_ALWAYS,
- FILE_ATTRIBUTE_NORMAL,NULL);
-
- if (hFile[i] == INVALID_HANDLE_VALUE)
- {
- error_sfile_not_found (files[i]);
-
- for(i=0;i<iFileCounter;i++)
- CloseHandle (hFile[i]);
-
- free (files);
- free (hFile);
-
- return 1;
- }
-
- /*set append mode*/
- if (bAppend)
- {
- if (GetFileType (hFile[i]) == FILE_TYPE_DISK)
- {
- dw = SetFilePointer (hFile[i],0,NULL,FILE_END);
- if (dw == 0xFFFFFFFF)
- {
- ConErrPrintf(_T("error moving to end of file %s"),files[i]);
-
- for(i=0;i<iFileCounter;i++)
- CloseHandle (hFile[i]);
-
- free (files);
- free (hFile);
-
- return 1;
- }
-
- ConErrPrintf(_T("SetFilePointer() = %d\n"),dw);
- }
- }
- }
-
- /*read and write*/
- do
- {
- bRet = ReadFile(hConsoleIn,buff,sizeof(buff),&dwRead,NULL);
-
- if (dwRead>0 && bRet)
- {
- for(i=0;i<iFileCounter;i++)
- WriteFile(hFile[i],buff,dwRead,&dwWritten,NULL);
-
- WriteFile(hConsoleOut,buff,dwRead,&dwWritten,NULL);
- }
- } while(dwRead>0 && bRet);
-
- for(i=0;i<iFileCounter;i++)
- CloseHandle (hFile[i]);
-
- free (files);
- free (hFile);
-
- return 0;
-}
-
-/* EOF */
--- trunk/rosapps/cmdutils/tee.rc 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/tee.rc 2005-09-25 19:38:46 UTC (rev 18066)
@@ -1,6 +0,0 @@
-/* $Id$ */
-
-#define REACTOS_STR_FILE_DESCRIPTION "W32 tee command\0"
-#define REACTOS_STR_INTERNAL_NAME "tee\0"
-#define REACTOS_STR_ORIGINAL_FILENAME "tee.exe\0"
-#include <reactos/version.rc>
--- trunk/rosapps/cmdutils/y/y.xml 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/y/y.xml 2005-09-25 19:38:46 UTC (rev 18066)
@@ -0,0 +1,8 @@
+<module name="y" type="win32cui" installbase="system32" installname="y.exe">
+ <define name="__USE_W32API" />
+ <define name="_WIN32_IE">0x0501</define>
+ <define name="_WIN32_WINNT">0x0501</define>
+ <library>kernel32</library>
+ <file>y.c</file>
+ <file>y.rc</file>
+</module>
Property changes on: trunk/rosapps/cmdutils/y/y.xml
___________________________________________________________________
Name: svn:eol-style
+ native
--- trunk/rosapps/cmdutils/y.c 2005-09-25 18:17:27 UTC (rev 18065)
+++ trunk/rosapps/cmdutils/y.c 2005-09-25 19:38:46 UTC (rev 18066)
@@ -1,122 +0,0 @@
-/*
- * Y.C - Y external command.
[truncated at 1000 lines; 131 more skipped]