findstr: Add basic functionality.

Company of Heroes: Battle of Crete needs a functioning findstr.exe to exit properly.
Freemake Video Converter 4.1 installer also needs this.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=35254
This commit is contained in:
Zhiyi Zhang 2023-04-17 16:07:18 +08:00 committed by Alexandre Julliard
parent db0ccc440a
commit f88affa2a1
57 changed files with 1413 additions and 5 deletions

1
configure vendored
View file

@ -22095,6 +22095,7 @@ wine_fn_config_makefile programs/fc enable_fc
wine_fn_config_makefile programs/find enable_find
wine_fn_config_makefile programs/find/tests enable_tests
wine_fn_config_makefile programs/findstr enable_findstr
wine_fn_config_makefile programs/findstr/tests enable_tests
wine_fn_config_makefile programs/fsutil enable_fsutil
wine_fn_config_makefile programs/fsutil/tests enable_tests
wine_fn_config_makefile programs/hh enable_hh

View file

@ -3333,6 +3333,7 @@ WINE_CONFIG_MAKEFILE(programs/fc)
WINE_CONFIG_MAKEFILE(programs/find)
WINE_CONFIG_MAKEFILE(programs/find/tests)
WINE_CONFIG_MAKEFILE(programs/findstr)
WINE_CONFIG_MAKEFILE(programs/findstr/tests)
WINE_CONFIG_MAKEFILE(programs/fsutil)
WINE_CONFIG_MAKEFILE(programs/fsutil/tests)
WINE_CONFIG_MAKEFILE(programs/hh)

View file

@ -16017,6 +16017,26 @@ msgstr "بدء التشغيل"
msgid "&Run..."
msgstr "ش&غل..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Reset Connections"
msgid "Usage: findstr /options string\n"
msgstr "إعادة الاتصالات"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "سطر الاوامر غير سليم.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14819,6 +14819,24 @@ msgstr ""
msgid "&Run..."
msgstr "&Executar..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Connections"
msgid "Usage: findstr /options string\n"
msgstr "Conexones"
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14717,6 +14717,25 @@ msgstr "Рестартиране"
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "LAN Connection"
msgid "Usage: findstr /options string\n"
msgstr "LAN връзка"
#: programs/findstr/findstr.rc:29
#, fuzzy
msgid "FINDSTR: Bad command line\n"
msgstr "Невалидни знаци в пътя.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14811,6 +14811,26 @@ msgstr "Inici"
msgid "&Run..."
msgstr "&Executa..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "Utilitza una cadena de c&onnexió"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "La línia d'ordres no és vàlida.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15520,6 +15520,26 @@ msgstr "Start"
msgid "&Run..."
msgstr "&Spustit..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Reset Connections"
msgid "Usage: findstr /options string\n"
msgstr "Resetovat připojení"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Neplatné zadání příkazu.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15926,6 +15926,26 @@ msgstr "Start op"
msgid "&Run..."
msgstr "Kø&r..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "LAN Connection"
msgid "Usage: findstr /options string\n"
msgstr "Lokal netværksforbindelse"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Ugyldig kommando linje.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14789,6 +14789,26 @@ msgstr "Start"
msgid "&Run..."
msgstr "&Ausführen..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "Verbindungs-Zeichenkette &verwenden"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Ungültige Kommandozeile.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14469,6 +14469,24 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
#, fuzzy
msgid "Usage: findstr /options string\n"
msgstr "Επιλογές"
#: programs/findstr/findstr.rc:29
#, fuzzy
msgid "FINDSTR: Bad command line\n"
msgstr "Μη έγγυρος(οι) χαρακτήρας(ες) στο μονοπάτι.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14706,6 +14706,22 @@ msgstr "Start"
msgid "&Run..."
msgstr "&Run..."
#: programs/findstr/findstr.rc:28
msgid "Usage: findstr /options string\n"
msgstr "Usage: findstr /options string\n"
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr "FINDSTR: Bad command line\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr "FINDSTR: Cannot open %s\n"
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr "FINDSTR: /%c ignored\n"
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14706,6 +14706,22 @@ msgstr "Start"
msgid "&Run..."
msgstr "&Run..."
#: programs/findstr/findstr.rc:28
msgid "Usage: findstr /options string\n"
msgstr "Usage: findstr /options string\n"
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr "FINDSTR: Bad command line\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr "FINDSTR: Cannot open %s\n"
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr "FINDSTR: /%c ignored\n"
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15082,6 +15082,26 @@ msgstr "Starto"
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "LAN Connection"
msgid "Usage: findstr /options string\n"
msgstr "LAN konektiĝo"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Nevalida komandlinio.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15379,6 +15379,26 @@ msgstr "Arranque"
msgid "&Run..."
msgstr "E&jecutar..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "Utilice datos de C&onexión"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Línea de comandos inválida.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14654,6 +14654,23 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
#, fuzzy
msgid "Usage: findstr /options string\n"
msgstr "اطلاعات"
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14684,6 +14684,26 @@ msgstr "Käynnistä"
msgid "&Run..."
msgstr "&Suorita..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "Syötä yhteysasetukset &merkkijonona"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Komentorivi ei kelpaa.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15296,6 +15296,26 @@ msgstr "Démarrer"
msgid "&Run..."
msgstr "E&xécuter..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "Utiliser une chaîne de connexion"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Ligne de commande invalide.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15480,6 +15480,25 @@ msgstr "תפריט ההתחלה"
msgid "&Run..."
msgstr "הפע&לה..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Reset Connections"
msgid "Usage: findstr /options string\n"
msgstr "Reset Connections"
#: programs/findstr/findstr.rc:29
#, fuzzy
msgid "FINDSTR: Bad command line\n"
msgstr "אפשרות שגויה.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14201,6 +14201,22 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
msgid "Usage: findstr /options string\n"
msgstr ""
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15482,6 +15482,26 @@ msgstr "'Start' izbornik"
msgid "&Run..."
msgstr "Pok&reni..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Reconnecting"
msgid "Usage: findstr /options string\n"
msgstr "Ponovno povezivanje"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Neispravna naredbena linija.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15918,6 +15918,26 @@ msgstr "Indítópult"
msgid "&Run..."
msgstr "&Futtatás..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "LAN Connection"
msgid "Usage: findstr /options string\n"
msgstr "LAN kapcsolat"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Érvénytelen parancs sor.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15995,6 +15995,26 @@ msgstr "Esecuzione automatica"
msgid "&Run..."
msgstr "&Esegui..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "LAN Connection"
msgid "Usage: findstr /options string\n"
msgstr "Connessione LAN"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Linea di comando non valida.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14705,6 +14705,26 @@ msgstr "スタート"
msgid "&Run..."
msgstr "実行(&R)..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "利用する接続文字列(&O)"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "コマンド ラインが正しくありません。\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14661,6 +14661,26 @@ msgstr "시작"
msgid "&Run..."
msgstr "실행(&R)..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "연결 문자열 사용(&O)"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "잘못된 명령줄.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14710,6 +14710,26 @@ msgstr "Pradžia"
msgid "&Run..."
msgstr "&Vykdyti..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "Naudoti r&yšio eilutę"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Neteisinga komandos eilutė.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14200,6 +14200,22 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
msgid "Usage: findstr /options string\n"
msgstr ""
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15500,6 +15500,26 @@ msgstr "Start"
msgid "&Run..."
msgstr "Kjø&r..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Reset Connections"
msgid "Usage: findstr /options string\n"
msgstr "Tilbakestill tilkoblinger"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Ugyldig kommandolinje.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14761,6 +14761,26 @@ msgstr "Start"
msgid "&Run..."
msgstr "&Uitvoeren..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "Ver&bindingsreeks gebruiken"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Ongeldige opdrachtregel.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14186,6 +14186,22 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
msgid "Usage: findstr /options string\n"
msgstr ""
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14186,6 +14186,22 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
msgid "Usage: findstr /options string\n"
msgstr ""
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14848,6 +14848,26 @@ msgstr "Start"
msgid "&Run..."
msgstr "Urucho&m..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "&Użyj ciągu znaków połączenia"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Nieprawidłowy wiersz poleceń.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14900,6 +14900,26 @@ msgstr "Iniciar"
msgid "&Run..."
msgstr "E&xecutar..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "Usar string de conexão"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Linha de comando inválida.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15675,6 +15675,26 @@ msgstr "Iniciar"
msgid "&Run..."
msgstr "Exec&utar..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Reset Connections"
msgid "Usage: findstr /options string\n"
msgstr "Restabelecer ligações"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Linha de comandos inválida.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14277,6 +14277,22 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
msgid "Usage: findstr /options string\n"
msgstr ""
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15752,6 +15752,26 @@ msgstr "Meniu Start"
msgid "&Run..."
msgstr "E&xecutare..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Reset Connections"
msgid "Usage: findstr /options string\n"
msgstr "Conexiuni întrerupte"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Linie de comandă nevalidă.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15131,6 +15131,26 @@ msgstr "Пуск"
msgid "&Run..."
msgstr "&Запустить..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "Использовать &строку подключения"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Неверная командная строка.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14796,6 +14796,26 @@ msgstr "ඇරඹුම"
msgid "&Run..."
msgstr "ධාවනය කරන්න... (&R)"
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Connection is being made"
msgid "Usage: findstr /options string\n"
msgstr "සබැඳුම දැන් හදනවා"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "අවලංගු විධාන පේළිය.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15227,6 +15227,24 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Activation"
msgid "Usage: findstr /options string\n"
msgstr "Aktivácia"
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15948,6 +15948,26 @@ msgstr "Zagon"
msgid "&Run..."
msgstr "&Zaženi ..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "LAN Connection"
msgid "Usage: findstr /options string\n"
msgstr "Povezava LAN"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Neveljavna ukazna vrstica.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15268,6 +15268,25 @@ msgstr "„Старт“ мени"
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "LAN Connection"
msgid "Usage: findstr /options string\n"
msgstr "LAN веза"
#: programs/findstr/findstr.rc:29
#, fuzzy
msgid "FINDSTR: Bad command line\n"
msgstr "Неисправна синтакса.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15420,6 +15420,25 @@ msgstr "„Start“ meni"
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "LAN Connection"
msgid "Usage: findstr /options string\n"
msgstr "LAN veza"
#: programs/findstr/findstr.rc:29
#, fuzzy
msgid "FINDSTR: Bad command line\n"
msgstr "Neispravna sintaksa.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -15630,6 +15630,26 @@ msgstr "Start"
msgid "&Run..."
msgstr "&Kör..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Reset Connections"
msgid "Usage: findstr /options string\n"
msgstr "Återställda anslutningar"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Ogiltig kommandorad.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14171,6 +14171,22 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
msgid "Usage: findstr /options string\n"
msgstr ""
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14186,6 +14186,22 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
msgid "Usage: findstr /options string\n"
msgstr ""
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14744,6 +14744,23 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
#, fuzzy
msgid "Usage: findstr /options string\n"
msgstr "รายละเอียด"
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14722,6 +14722,26 @@ msgstr "Başlangıç"
msgid "&Run..."
msgstr "&Çalıştır..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "&Bağlantı dizesini kullan"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Geçersiz komut satırı.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14994,6 +14994,26 @@ msgstr "Пуск"
msgid "&Run..."
msgstr "&Запустити..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "Використовувати р&ядок підключення"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "Невірний командний рядок.\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14641,6 +14641,24 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Direction"
msgid "Usage: findstr /options string\n"
msgstr "Direccion"
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14100,6 +14100,22 @@ msgstr ""
msgid "&Run..."
msgstr ""
#: programs/findstr/findstr.rc:28
msgid "Usage: findstr /options string\n"
msgstr ""
#: programs/findstr/findstr.rc:29
msgid "FINDSTR: Bad command line\n"
msgstr ""
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14498,6 +14498,26 @@ msgstr "起点"
msgid "&Run..."
msgstr "运行(&R)..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "使用连接字符串(&O)"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "命令行无效。\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -14554,6 +14554,26 @@ msgstr "開始"
msgid "&Run..."
msgstr "執行(&R)..."
#: programs/findstr/findstr.rc:28
#, fuzzy
#| msgid "Use c&onnection string"
msgid "Usage: findstr /options string\n"
msgstr "使用連線字串(&O)"
#: programs/findstr/findstr.rc:29
#, fuzzy
#| msgid "Invalid command line.\n"
msgid "FINDSTR: Bad command line\n"
msgstr "無效的命令列。\n"
#: programs/findstr/findstr.rc:30
msgid "FINDSTR: Cannot open %s\n"
msgstr ""
#: programs/findstr/findstr.rc:31
msgid "FINDSTR: /%c ignored\n"
msgstr ""
#: programs/fsutil/fsutil.mc:28
msgid ""
"- Supported Commands -\n"

View file

@ -1,6 +1,9 @@
MODULE = findstr.exe
IMPORTS = user32
EXTRADLLFLAGS = -mconsole -municode
C_SRCS = \
main.c
RC_SRCS = findstr.rc

View file

@ -0,0 +1,38 @@
/*
* Copyright 2023 Zhiyi Zhang for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windef.h>
#define MAXSTRING 8192
#define STRING_USAGE 101
#define STRING_BAD_COMMAND_LINE 102
#define STRING_CANNOT_OPEN 103
#define STRING_IGNORED 104
struct findstr_string
{
const WCHAR *string;
struct findstr_string *next;
};
struct findstr_file
{
FILE *file;
struct findstr_file *next;
};

View file

@ -0,0 +1,31 @@
/*
* Copyright 2023 Zhiyi Zhang for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "findstr.h"
#pragma makedep po
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE
{
STRING_USAGE, "Usage: findstr /options string\n"
STRING_BAD_COMMAND_LINE, "FINDSTR: Bad command line\n"
STRING_CANNOT_OPEN, "FINDSTR: Cannot open %s\n"
STRING_IGNORED, "FINDSTR: /%c ignored\n"
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2012 Qian Hong
* Copyright 2023 Zhiyi Zhang for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -16,18 +17,217 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windows.h>
#include <stdio.h>
#include "findstr.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(findstr);
static int WINAPIV findstr_error_wprintf(int msg, ...)
{
WCHAR msg_buffer[MAXSTRING];
va_list va_args;
int ret;
LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
va_start(va_args, msg);
ret = vfwprintf(stderr, msg_buffer, va_args);
va_end(va_args);
return ret;
}
static int findstr_message(int msg)
{
WCHAR msg_buffer[MAXSTRING];
LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
return wprintf(msg_buffer);
}
static BOOL add_file(struct findstr_file **head, const WCHAR *path)
{
struct findstr_file **ptr, *new_file;
ptr = head;
while (*ptr)
ptr = &((*ptr)->next);
new_file = calloc(1, sizeof(*new_file));
if (!new_file)
{
WINE_ERR("Out of memory.\n");
return FALSE;
}
if (!path)
{
new_file->file = stdin;
}
else
{
new_file->file = _wfopen(path, L"rt,ccs=unicode");
if (!new_file->file)
{
findstr_error_wprintf(STRING_CANNOT_OPEN, path);
return FALSE;
}
}
*ptr = new_file;
return TRUE;
}
static void add_string(struct findstr_string **head, const WCHAR *string)
{
struct findstr_string **ptr, *new_string;
ptr = head;
while (*ptr)
ptr = &((*ptr)->next);
new_string = calloc(1, sizeof(*new_string));
if (!new_string)
{
WINE_ERR("Out of memory.\n");
return;
}
new_string->string = string;
*ptr = new_string;
}
int __cdecl wmain(int argc, WCHAR *argv[])
{
int i;
struct findstr_string *string_head = NULL, *current_string, *next_string;
struct findstr_file *file_head = NULL, *current_file, *next_file;
WCHAR *string, *ptr, *buffer, line[MAXSTRING];
BOOL has_string = FALSE, has_file = FALSE;
int ret = 1, i, j;
WINE_FIXME("stub:");
for (i = 0; i < argc; i++)
WINE_FIXME(" %s", wine_dbgstr_w(argv[i]));
WINE_FIXME("\n");
WINE_TRACE("%s ", wine_dbgstr_w(argv[i]));
WINE_TRACE("\n");
return 0;
if (argc == 1)
{
findstr_error_wprintf(STRING_BAD_COMMAND_LINE);
return 2;
}
for (i = 1; i < argc; i++)
{
if (argv[i][0] == '/')
{
if (argv[i][1] == '\0')
{
findstr_error_wprintf(STRING_BAD_COMMAND_LINE);
return 2;
}
j = 1;
while (argv[i][j] != '\0')
{
switch(argv[i][j])
{
case '?':
findstr_message(STRING_USAGE);
ret = 0;
goto done;
case 'C':
case 'c':
if (argv[i][j + 1] == ':')
{
ptr = argv[i] + j + 2;
if (*ptr == '"')
ptr++;
string = ptr;
while (*ptr != '"' && *ptr != '\0' )
ptr++;
*ptr = '\0';
j = ptr - argv[i] - 1;
add_string(&string_head, string);
has_string = TRUE;
}
break;
default:
findstr_error_wprintf(STRING_IGNORED, argv[i][j]);
break;
}
j++;
}
}
else if (!has_string)
{
string = wcstok(argv[i], L" ", &buffer);
if (string)
{
add_string(&string_head, string);
has_string = TRUE;
}
while ((string = wcstok(NULL, L" ", &buffer)))
add_string(&string_head, string);
}
else
{
if (!add_file(&file_head, argv[i]))
goto done;
has_file = TRUE;
}
}
if (!has_string)
{
findstr_error_wprintf(STRING_BAD_COMMAND_LINE);
ret = 2;
goto done;
}
if (!has_file)
add_file(&file_head, NULL);
current_file = file_head;
while (current_file)
{
while (fgetws(line, ARRAY_SIZE(line), current_file->file))
{
current_string = string_head;
while (current_string)
{
if (wcsstr(line, current_string->string))
{
wprintf(line);
if (current_file->file == stdin)
wprintf(L"\n");
ret = 0;
}
current_string = current_string->next;
}
}
current_file = current_file->next;
}
done:
current_file = file_head;
while (current_file)
{
next_file = current_file->next;
if (current_file->file != stdin)
fclose(current_file->file);
free(current_file);
current_file = next_file;
}
current_string = string_head;
while (current_string)
{
next_string = current_string->next;
free(current_string);
current_string = next_string;
}
return ret;
}

View file

@ -0,0 +1,4 @@
TESTDLL = findstr.exe
C_SRCS = \
findstr.c

View file

@ -0,0 +1,208 @@
/*
* Copyright 2023 Zhiyi Zhang for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windows.h>
#include "wine/test.h"
#define MAX_BUFFER 65536
static char stdout_buffer[MAX_BUFFER], stderr_buffer[MAX_BUFFER];
static DWORD stdout_size, stderr_size;
static void read_all_from_handle(HANDLE handle, char *buffer, DWORD *size)
{
char bytes[4096];
DWORD bytes_read;
memset(buffer, 0, MAX_BUFFER);
*size = 0;
for (;;)
{
BOOL success = ReadFile(handle, bytes, sizeof(bytes), &bytes_read, NULL);
if (!success || !bytes_read)
break;
if (*size + bytes_read > MAX_BUFFER)
{
ok(FALSE, "Insufficient buffer.\n");
break;
}
memcpy(buffer + *size, bytes, bytes_read);
*size += bytes_read;
}
}
static void write_to_handle(HANDLE handle, const char *str, int len)
{
DWORD dummy;
WriteFile(handle, str, len, &dummy, NULL);
}
#define run_find_stdin(a, b, c) _run_find_stdin(__FILE__, __LINE__, a, b, c)
static void _run_find_stdin(const char *file, int line, const char *commandline, const char *input,
int exitcode_expected)
{
HANDLE parent_stdin_write, parent_stdout_read, parent_stderr_read;
HANDLE child_stdin_read, child_stdout_write, child_stderr_write;
SECURITY_ATTRIBUTES security_attributes = {0};
PROCESS_INFORMATION process_info = {0};
STARTUPINFOA startup_info = {0};
char cmd[4096];
DWORD exitcode;
security_attributes.nLength = sizeof(SECURITY_ATTRIBUTES);
security_attributes.bInheritHandle = TRUE;
CreatePipe(&child_stdin_read, &parent_stdin_write, &security_attributes, 0);
CreatePipe(&parent_stdout_read, &child_stdout_write, &security_attributes, 0);
CreatePipe(&parent_stderr_read, &child_stderr_write, &security_attributes, 0);
SetHandleInformation(parent_stdin_write, HANDLE_FLAG_INHERIT, 0);
SetHandleInformation(parent_stdout_read, HANDLE_FLAG_INHERIT, 0);
SetHandleInformation(parent_stderr_read, HANDLE_FLAG_INHERIT, 0);
startup_info.cb = sizeof(STARTUPINFOA);
startup_info.hStdInput = child_stdin_read;
startup_info.hStdOutput = child_stdout_write;
startup_info.hStdError = child_stderr_write;
startup_info.dwFlags |= STARTF_USESTDHANDLES;
sprintf(cmd, "findstr.exe %s", commandline);
CreateProcessA(NULL, cmd, NULL, NULL, TRUE, 0, NULL, NULL, &startup_info, &process_info);
CloseHandle(child_stdin_read);
CloseHandle(child_stdout_write);
CloseHandle(child_stderr_write);
write_to_handle(parent_stdin_write, input, lstrlenA(input));
CloseHandle(parent_stdin_write);
read_all_from_handle(parent_stdout_read, stdout_buffer, &stdout_size);
read_all_from_handle(parent_stderr_read, stderr_buffer, &stderr_size);
CloseHandle(parent_stdout_read);
CloseHandle(parent_stderr_read);
WaitForSingleObject(process_info.hProcess, INFINITE);
GetExitCodeProcess(process_info.hProcess, &exitcode);
CloseHandle(process_info.hProcess);
CloseHandle(process_info.hThread);
ok_(file, line)(exitcode == exitcode_expected, "Expected exitcode %d, got %ld\n",
exitcode_expected, exitcode);
}
#define run_find_file(a, b, c) _run_find_file(__FILE__, __LINE__, a, b, c)
static void _run_find_file(const char *file, int line, const char *commandline, const char *input,
int exitcode_expected)
{
char path_temp_file[MAX_PATH], path_temp_dir[MAX_PATH], commandline_new[MAX_PATH];
HANDLE handle_file;
GetTempPathA(ARRAY_SIZE(path_temp_dir), path_temp_dir);
GetTempFileNameA(path_temp_dir, "", 0, path_temp_file);
handle_file = CreateFileA(path_temp_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
write_to_handle(handle_file, input, lstrlenA(input));
CloseHandle(handle_file);
sprintf(commandline_new, "%s %s", commandline, path_temp_file);
_run_find_stdin(file, line, commandline_new, "", exitcode_expected);
DeleteFileA(path_temp_file);
}
static void test_basic(void)
{
int ret;
/* No options */
run_find_stdin("", "", 2);
ok(stdout_size == 0, "Unexpected stdout buffer size %ld.\n", stdout_size);
ok(stderr_size > 0, "Unexpected stderr buffer size %ld.\n", stderr_size);
ret = strcmp(stderr_buffer, "FINDSTR: Bad command line\r\n");
ok(!ret, "Got the wrong result.\n");
/* /? */
run_find_stdin("/?", "", 0);
ok(stdout_size > 0, "Unexpected stdout buffer size %ld.\n", stdout_size);
ok(stderr_size == 0, "Unexpected stderr buffer size %ld.\n", stderr_size);
/* find string in stdin */
run_find_stdin("abc", "abc", 0);
ok(stdout_size > 0, "Unexpected stdout buffer size %ld.\n", stdout_size);
ok(stderr_size == 0, "Unexpected stderr buffer size %ld.\n", stderr_size);
ret = strcmp(stdout_buffer, "abc\r\n");
ok(!ret, "Got the wrong result.\n");
/* find string in stdin fails */
run_find_stdin("abc", "cba", 1);
ok(stdout_size == 0, "Unexpected stdout buffer size %ld.\n", stdout_size);
ok(stderr_size == 0, "Unexpected stderr buffer size %ld.\n", stderr_size);
/* find string in file */
run_find_file("abc", "abc", 0);
ok(stdout_size > 0, "Unexpected stdout buffer size %ld.\n", stdout_size);
ok(stderr_size == 0, "Unexpected stderr buffer size %ld.\n", stderr_size);
ret = strcmp(stdout_buffer, "abc");
ok(!ret, "Got the wrong result.\n");
/* find string in file fails */
run_find_file("abc", "cba", 1);
ok(stdout_size == 0, "Unexpected stdout buffer size %ld.\n", stdout_size);
ok(stderr_size == 0, "Unexpected stderr buffer size %ld.\n", stderr_size);
/* find string in stdin with space separator */
run_find_stdin("\"abc cba\"", "abc", 0);
ok(stdout_size > 0, "Unexpected stdout buffer size %ld.\n", stdout_size);
ok(stderr_size == 0, "Unexpected stderr buffer size %ld.\n", stderr_size);
ret = strcmp(stdout_buffer, "abc\r\n");
ok(!ret, "Got the wrong result.\n");
/* find string in stdin with /C: */
run_find_stdin("/C:abc", "abc", 0);
ok(stdout_size > 0, "Unexpected stdout buffer size %ld.\n", stdout_size);
ok(stderr_size == 0, "Unexpected stderr buffer size %ld.\n", stderr_size);
ret = strcmp(stdout_buffer, "abc\r\n");
ok(!ret, "Got the wrong result.\n");
/* find string in stdin with /C:"abc" */
run_find_stdin("/C:\"abc\"", "abc", 0);
ok(stdout_size > 0, "Unexpected stdout buffer size %ld.\n", stdout_size);
ok(stderr_size == 0, "Unexpected stderr buffer size %ld.\n", stderr_size);
ret = strcmp(stdout_buffer, "abc\r\n");
ok(!ret, "Got the wrong result.\n");
/* find string in stdin with /C:"abc cba" fails */
run_find_stdin("/C:\"abc cba\"", "abc", 1);
ok(stdout_size == 0, "Unexpected stdout buffer size %ld.\n", stdout_size);
ok(stderr_size == 0, "Unexpected stderr buffer size %ld.\n", stderr_size);
/* find string in stdin with /C: fails */
run_find_stdin("/C:abc", "cba", 1);
ok(stdout_size == 0, "Unexpected stdout buffer size %ld.\n", stdout_size);
ok(stderr_size == 0, "Unexpected stderr buffer size %ld.\n", stderr_size);
}
START_TEST(findstr)
{
if (PRIMARYLANGID(GetUserDefaultUILanguage()) != LANG_ENGLISH)
{
skip("Tests only work with English locale.\n");
return;
}
test_basic();
}