- make more util mui-aware

- english translation needs to be done

svn path=/trunk/; revision=28502
This commit is contained in:
Johannes Anderwald 2007-08-23 23:52:59 +00:00
parent f7da3af16d
commit cffe612011
6 changed files with 115 additions and 17 deletions

View file

@ -0,0 +1,35 @@
LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_USAGE, "Zeigt Daten seitenweise auf dem Bildschirm an.\n\n\
MORE [/E [/C] [/P] [/S] [/Tn] [+n]] < [Laufwerk:][Pfad]Dateiname\n\
Befehl | MORE [/E [/C] [/P] [/S] [/Tn] [+n]] \n\
MORE /E [/C] [/P] [/S] [/Tn] [+n] [Dateien]\n\n\
[Laufwerk:][Pfad]Dateiname Ein Datei, deren Inhalt angezeigt\n\
\t\t\t werden soll.\n\n\
Befehl\t\t Ein Befehl, dessen Ausgabe angezeigt\n\
\t\t\t werden soll.\n\n\
/E\tAktiviert die erweiterten Möglichkeiten.\n\
/C\tLöscht den Bildschirm, bevor eine Seite angezeigt wird.\n\
/P\tFührt Seitenvorschubzeichen aus.\n\
/S\tFasst mehrere leere Zeilen zu einer Zeile zusammen.\n\
/Tn\tErsetzt Tabulatorenzeichen durch n Leerzeichen (Standard 8).\n\n\
\tDie Optionen können in der Umgebungsvariablen MORE angegeben\n\
\twerden.\n\n\
+n\tBeginnt mit der Anzeige der ersten Datei in Zeile n.\n\n\
Dateien Gibt eine Liste mit anzuzeigenden Dateien an.\n\
\t Trennen sie die Dateinamen durch ein Leerzeichen.\n\n\
Wenn die erweiterten Möglichkeiten aktiviert sind, können die folgenden\n\
Befehle an der Eingabeforderung \"--Fortsetzung--\" eingegeben werden:\n\n\
P n\t Zeigt die nächsten n Zeilen an.\n\
S n\t Überspringt die nächsten n Zeilen.\n\
Q\tBeendet die Ausgabe.\n\
=\tZeigt die Zeilennummer an.\n\
?\tZeigt die Hilfezeile an.\n\
<LEERTASTE> Zeigt die nächste Zeile an.\n\
<EINGABETASTE> Zeigt die nächste Zeile an.\n"
IDS_CONTINUE, " -- Fortsetzung (100%) -- "
IDS_FILE_ACCESS, "Auf die Datei %s kann nicht zugegriffen werden."
}

View file

@ -13,11 +13,12 @@
#include <windows.h>
#include <malloc.h>
#include <tchar.h>
#include <stdio.h>
#include "resource.h"
DWORD len;
LPTSTR msg = _T("--- continue ---");
static TCHAR szCont[128];
static DWORD szContLength;
static HINSTANCE hApp;
/*handle for file and console*/
HANDLE hStdIn;
@ -42,7 +43,7 @@ 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);
}
@ -70,7 +71,7 @@ WaitForKey (VOID)
{
DWORD dwWritten;
WriteFile (hStdErr,msg , len, &dwWritten, NULL);
WriteFile (hStdErr, szCont , szContLength, &dwWritten, NULL);
ConInKey();
@ -88,7 +89,7 @@ int main (int argc, char **argv)
DWORD i, last;
HANDLE hFile = INVALID_HANDLE_VALUE;
TCHAR szFullPath[MAX_PATH];
TCHAR szMsg[1024];
/*reading/writing buffer*/
TCHAR *buff;
@ -98,14 +99,28 @@ int main (int argc, char **argv)
/*ReadFile() return value*/
BOOL bRet;
len = _tcslen (msg);
hStdIn = GetStdHandle(STD_INPUT_HANDLE);
hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
hStdErr = GetStdHandle(STD_ERROR_HANDLE);
hApp = GetModuleHandle(NULL);
buff=malloc(4096);
if (!buff)
{
ConOutPuts(_T("Error: no memory"));
return 0;
}
if (argc > 1 && _tcsncmp (argv[1], _T("/?"), 2) == 0)
{
ConOutPuts(_T("Help text still missing!!"));
if (LoadString(hApp, IDS_USAGE, buff, 4096 / sizeof(TCHAR)) < 4096 / sizeof(TCHAR))
{
CharToOem(buff, buff);
ConOutPuts(buff);
}
free(buff);
return 0;
}
@ -114,20 +129,31 @@ int main (int argc, char **argv)
GetScreenSize(&maxx,&maxy);
buff=malloc(4096);
FlushConsoleInputBuffer (hKeyboard);
if(argc > 1)
{
GetFullPathName(argv[1], MAX_PATH, szFullPath, NULL);
hFile = CreateFile (szFullPath, GENERIC_READ,
0,NULL,OPEN_ALWAYS,0,0);
if (hFile == INVALID_HANDLE_VALUE)
GetFullPathNameA(argv[1], MAX_PATH, szFullPath, NULL);
hFile = CreateFile (szFullPath,
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
0,
0);
if (hFile == INVALID_HANDLE_VALUE)
{
ConOutPuts(_T("The file could not be opened"));
return 0;
if (LoadString(hApp, IDS_FILE_ACCESS, szMsg, sizeof(szMsg) / sizeof(TCHAR)) < sizeof(szMsg) / sizeof(TCHAR))
{
_stprintf(buff, szMsg, szFullPath);
CharToOem(buff, buff);
ConOutPuts(buff);
}
free(buff);
return 0;
}
}
else
@ -135,6 +161,15 @@ int main (int argc, char **argv)
hFile = hStdIn;
}
if (!LoadString(hApp, IDS_CONTINUE, szCont, sizeof(szCont) / sizeof(TCHAR)))
{
/* fail back to english */
_tcscpy(szCont, _T("--- continue ---"));
}
szContLength = _tcslen(szCont);
do
{
bRet = ReadFile(hFile,buff,4096,&dwRead,NULL);

View file

@ -4,6 +4,7 @@
<define name="_WIN32_WINNT">0x0501</define>
<library>kernel32</library>
<library>ntdll</library>
<library>user32</library>
<file>more.c</file>
<file>more.rc</file>
</module>

View file

@ -4,3 +4,5 @@
#define REACTOS_STR_INTERNAL_NAME "more\0"
#define REACTOS_STR_ORIGINAL_FILENAME "more.exe\0"
#include <reactos/version.rc>
#include "rsrc.rc"

View file

@ -0,0 +1,20 @@
#ifndef RESOURCE_H__ /* resource.h */
#define RESOURCE_H__
#define IDS_USAGE 100
#define IDS_CONTINUE 101
#define IDS_FILE_ACCESS 102
#endif /* EOF of resource.h */

View file

@ -0,0 +1,5 @@
#include <windows.h>
#include "resource.h"
#include "lang/de-DE.rc"