[rtems commit] testsuites/fstests/fsdosfsname01/create_files.cs: Convert to UNIX CR/LF.
Christian Mauderer
christianm at rtems.org
Thu Mar 10 08:06:48 UTC 2022
Module: rtems
Branch: master
Commit: da7204301a7d713896329cf554d286a1f4678520
Changeset: http://git.rtems.org/rtems/commit/?id=da7204301a7d713896329cf554d286a1f4678520
Author: Joel Sherrill <joel at rtems.org>
Date: Tue Mar 1 12:00:48 2022 -0600
testsuites/fstests/fsdosfsname01/create_files.cs: Convert to UNIX CR/LF.
This file had a mix of both DOS and UNIX CR/LF.
Updates #4625.
---
testsuites/fstests/fsdosfsname01/create_files.cs | 242 +++++++++++------------
1 file changed, 121 insertions(+), 121 deletions(-)
diff --git a/testsuites/fstests/fsdosfsname01/create_files.cs b/testsuites/fstests/fsdosfsname01/create_files.cs
index 3cb7604..1340f27 100644
--- a/testsuites/fstests/fsdosfsname01/create_files.cs
+++ b/testsuites/fstests/fsdosfsname01/create_files.cs
@@ -1,4 +1,4 @@
-/**
+/**
* @file Create_Files.cs
*
* @brief Format a USB memory stick and create files on the stick
@@ -9,8 +9,8 @@
* whith files with exotic multibyte filenames. The image will get
* mounted under RTEMS for testing the mutibyte/UTF-8 feature of the
* RTEMS FAT file system and the compatibility to MS Windows.
- */
-
+ */
+
/*
* Copyright (c) 2013 embedded brains GmbH. All rights reserved.
*
@@ -23,21 +23,21 @@
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
- */
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Diagnostics;
-using System.Threading;
-using System.Text;
-
-namespace Create_Files
-{
- public static class Create_Files
- {
- // Strings for file names and file contents
- public static string[] Strings = new string[] {
- "this is a long filename",
+ */
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Diagnostics;
+using System.Threading;
+using System.Text;
+
+namespace Create_Files
+{
+ public static class Create_Files
+ {
+ // Strings for file names and file contents
+ public static string[] Strings = new string[] {
+ "this is a long filename",
"Äây là má»t tên táºp tin dà i",
"Bu uzun bir dosya adı",
"ÙØ°Ø§ Ù٠اسÙ
Ù
ÙÙ Ø·ÙÙÙ",
@@ -45,106 +45,106 @@ namespace Create_Files
"ÑÑо длинное имÑ",
"гÑÑа доÑгае ÑмÑ",
"Ñова е дÑлго име на Ñайла",
- "è¿æ¯ä¸ä¸ªé¿æä»¶å",
- "মà§à§°à¦¿à¦à¦¾ মহাদà§à¦¶, à¦à¦¤à§à¦¤à§° à¦à¦®à§à§°à¦¿à¦à¦¾ à¦à§°à§ দà¦à§à¦·à¦¿à¦£ à¦à¦®à§à§°à¦¿à¦à¦¾ মহাদà§à¦¶à¦ লৠà¦à¦ িত à¦à¦",
- "Ø¢Ù
رÛکا ÙØ§Ø±Ù ÛÚ©ØªÙ ÙØ§Ø±ÙÙ° زÙ
ÛÙË ÙØ§Ø±ÙâÙ°ÙË Ù
Ø¦Ù Ø§ÛØ³Ø³Ù Ú©Û Ø²Ù
ÛÙË ÙÙÙâØ´Ø± (Ù
Ø³Ø§ØØª)Ë Ø¬Û Û³Û¸Ùª ٠زÙ
ÛÙË Ø®ÙØ´Ú©ÛâØ¦ÙË Ø¬Û Û´Û²Û¸Ùª Ø§Û ÙØ§Ø±Ù Ø´Û Ø§ÛØ³Ø³Ù",
- "Manâhestôtse 910,720,588 (July 2008 est.)",
- "Elle s'étend depuis l'océan Arctique au nord jusqu'au cap Horn dans le passage de Drake au sud, à la confluence des océans",
- "ཨà¼à½à½ºà¼à½¢à½²à¼à½, ཨà¼à½à½ºà¼à½¢à½²à¼à½, à½à½ºà¼à½à¾³à½²à½à¼",
- "е ÑÑ Ð·ÐµÐ¼Ñе западне Ñ
емиÑÑеÑе или Ðовог ÑвеÑа коÑе Ñе ÑаÑÑоÑе од конÑиненаÑа СевеÑна ÐмеÑика",
- "This is a filename with with 255 characters. The following numbers are aligned in that way, that the character 0 is the mentioned one. xx140xxxxxxx150xxxxxxx160xxxxxxx170xxxxxxx180xxxxxxx190xxxxxxx200xxxxxxx210xxxxxxx220xxxxxxx230xxxxxxx240xxxxxxx250xxxxx",
- "Bu gezegen Roma mitolojisindeki savaŠilahı Mars'a",
- "Amerike su zemlje zapadne hemisfere ili Novog svijeta koje se sastoje od kontinenata Sjeverna Amerika i Južna Amerika sa svim pridruženim otocima i regijama.",
- "áááááá¡ áá áááá¢ááááá¢á¡, á¡ááá®á áá áá á©á áááááá áááá áááá¡ áá®áááááááá á áá£áá«á£áááááá áá ",
- " Ð Ñо ÑдинÑй конÑÑненÑ, коÑÑого ÑÑла ÑеÑÑÑоÑÑÑ Ð»ÐµÐ¶ÑÑÑ Ð½Ð° ÐападнÑй пÑвкÑÐ»Ñ Ñай Ñазом"
- };
-
- // Use the features of MS Windows to format the USB memory stick. We want a genuine Microsoft FAT file system
- public static void FormatDrive(string driveLetter)
- {
- ProcessStartInfo StartInfo = new ProcessStartInfo();
- StartInfo.FileName = Environment.SystemDirectory + "\\cmd.exe";
- StartInfo.Arguments = "/C \"format " + driveLetter + " /FS:FAT\"";
- StartInfo.UseShellExecute = false;
- StartInfo.RedirectStandardInput = true;
- Process Process = Process.Start(StartInfo);
- //Thread.Sleep(1000);
- Process.StandardInput.WriteLine();
- Process.StandardInput.WriteLine();
- Process.WaitForExit();
- }
- // Format a USB meory stick and create files on the new volume
- // args[0] The drive to be formatted. E.g. "e:"
- public static void Main(string[] args)
- {
- // Display help text on the console
- if ((args.Length <= 0) || (args[0].Equals("-h", StringComparison.InvariantCultureIgnoreCase) || args[0].Equals("-help", StringComparison.InvariantCultureIgnoreCase)))
- {
- Console.WriteLine("create_files.bat <DRIVE>");
- Console.WriteLine("Will format DRIVE and create files on the new formated drive.");
- }
- else
- {
- // Show a warning
- Console.WriteLine(args[0] + " will get formated!");
- while (true)
- {
- Console.WriteLine("Press y to continue or press n to abort. [y\\n]");
- string Input = Console.ReadLine();
- if (Input[0].Equals('y') || Input[0].Equals('Y'))
- break;
- else if (Input[0].Equals('n') || Input[0].Equals('N'))
- return;
- }
- // Format the USB memory stick
- FormatDrive(args[0]);
-
- // Create the files and write their own file names into them
- for (int i = 0; i < Strings.GetLength(0); i++)
- {
- File.WriteAllText(Path.Combine(args[0], Strings[i]), Strings[i], Encoding.UTF8);
- Console.WriteLine("The file \"" + Strings[i] + "\" created.");
- }
-
- // Create a c header file which contains an array with the strings and a #define
- // for the number of strings
- string HeaderPath = Path.Combine(args[0]/*Environment.CurrentDirectory*/, "files.h");
- Console.WriteLine("The header \"" + HeaderPath + "\" will write.");
- StreamWriter HeaderStream = new StreamWriter(HeaderPath);
-
- HeaderStream.Write("\n" +
- "/*\n" +
- " * Array with files, that were created in the FAT-filesystem image.bin.\n" +
- " *\n" +
- " * WARNING: Automatically generated by Create_Files.cs -- do not edit!\n" +
- " */\n" +
- "\n" +
- "#ifndef __FILE_H__\n" +
- "#define __FILE_H__\n" +
- "\n" +
- "#ifdef __cplusplus\n" +
- "extern C {\n" +
- "#endif\n" +
- "\n" +
- "static const char *const filenames[] = {\n");
- for (int i = 0; i < Strings.GetLength(0); i++)
- HeaderStream.WriteLine(" \"" + Strings[i] + ((i == (Strings.GetLength(0) - 1)) ? "\"" : "\","));
- string NumberOfFilesStr = Strings.GetLength(0).ToString(System.Globalization.CultureInfo.InvariantCulture);
- HeaderStream.Write("};\n" +
- "#define FILES_FILENAMES_NUMBER_OF " + NumberOfFilesStr + "\n" +
- "\n" +
- "#ifdef __cplusplus\n" +
- "}\n" +
- "#endif\n" +
- "\n" +
- "#endif /* __FILE_H__ */\n" +
- "\n");
-
- // Finalize
- HeaderStream.Flush();
- HeaderStream.Close();
- HeaderStream.Dispose();
- }
- }
- }
-}
+ "è¿æ¯ä¸ä¸ªé¿æä»¶å",
+ "মà§à§°à¦¿à¦à¦¾ মহাদà§à¦¶, à¦à¦¤à§à¦¤à§° à¦à¦®à§à§°à¦¿à¦à¦¾ à¦à§°à§ দà¦à§à¦·à¦¿à¦£ à¦à¦®à§à§°à¦¿à¦à¦¾ মহাদà§à¦¶à¦ লৠà¦à¦ িত à¦à¦",
+ "Ø¢Ù
رÛکا ÙØ§Ø±Ù ÛÚ©ØªÙ ÙØ§Ø±ÙÙ° زÙ
ÛÙË ÙØ§Ø±ÙâÙ°ÙË Ù
Ø¦Ù Ø§ÛØ³Ø³Ù Ú©Û Ø²Ù
ÛÙË ÙÙÙâØ´Ø± (Ù
Ø³Ø§ØØª)Ë Ø¬Û Û³Û¸Ùª ٠زÙ
ÛÙË Ø®ÙØ´Ú©ÛâØ¦ÙË Ø¬Û Û´Û²Û¸Ùª Ø§Û ÙØ§Ø±Ù Ø´Û Ø§ÛØ³Ø³Ù",
+ "Manâhestôtse 910,720,588 (July 2008 est.)",
+ "Elle s'étend depuis l'océan Arctique au nord jusqu'au cap Horn dans le passage de Drake au sud, à la confluence des océans",
+ "ཨà¼à½à½ºà¼à½¢à½²à¼à½, ཨà¼à½à½ºà¼à½¢à½²à¼à½, à½à½ºà¼à½à¾³à½²à½à¼",
+ "е ÑÑ Ð·ÐµÐ¼Ñе западне Ñ
емиÑÑеÑе или Ðовог ÑвеÑа коÑе Ñе ÑаÑÑоÑе од конÑиненаÑа СевеÑна ÐмеÑика",
+ "This is a filename with with 255 characters. The following numbers are aligned in that way, that the character 0 is the mentioned one. xx140xxxxxxx150xxxxxxx160xxxxxxx170xxxxxxx180xxxxxxx190xxxxxxx200xxxxxxx210xxxxxxx220xxxxxxx230xxxxxxx240xxxxxxx250xxxxx",
+ "Bu gezegen Roma mitolojisindeki savaŠilahı Mars'a",
+ "Amerike su zemlje zapadne hemisfere ili Novog svijeta koje se sastoje od kontinenata Sjeverna Amerika i Južna Amerika sa svim pridruženim otocima i regijama.",
+ "áááááá¡ áá áááá¢ááááá¢á¡, á¡ááá®á áá áá á©á áááááá áááá áááá¡ áá®áááááááá á áá£áá«á£áááááá áá ",
+ " Ð Ñо ÑдинÑй конÑÑненÑ, коÑÑого ÑÑла ÑеÑÑÑоÑÑÑ Ð»ÐµÐ¶ÑÑÑ Ð½Ð° ÐападнÑй пÑвкÑÐ»Ñ Ñай Ñазом"
+ };
+
+ // Use the features of MS Windows to format the USB memory stick. We want a genuine Microsoft FAT file system
+ public static void FormatDrive(string driveLetter)
+ {
+ ProcessStartInfo StartInfo = new ProcessStartInfo();
+ StartInfo.FileName = Environment.SystemDirectory + "\\cmd.exe";
+ StartInfo.Arguments = "/C \"format " + driveLetter + " /FS:FAT\"";
+ StartInfo.UseShellExecute = false;
+ StartInfo.RedirectStandardInput = true;
+ Process Process = Process.Start(StartInfo);
+ //Thread.Sleep(1000);
+ Process.StandardInput.WriteLine();
+ Process.StandardInput.WriteLine();
+ Process.WaitForExit();
+ }
+ // Format a USB meory stick and create files on the new volume
+ // args[0] The drive to be formatted. E.g. "e:"
+ public static void Main(string[] args)
+ {
+ // Display help text on the console
+ if ((args.Length <= 0) || (args[0].Equals("-h", StringComparison.InvariantCultureIgnoreCase) || args[0].Equals("-help", StringComparison.InvariantCultureIgnoreCase)))
+ {
+ Console.WriteLine("create_files.bat <DRIVE>");
+ Console.WriteLine("Will format DRIVE and create files on the new formated drive.");
+ }
+ else
+ {
+ // Show a warning
+ Console.WriteLine(args[0] + " will get formated!");
+ while (true)
+ {
+ Console.WriteLine("Press y to continue or press n to abort. [y\\n]");
+ string Input = Console.ReadLine();
+ if (Input[0].Equals('y') || Input[0].Equals('Y'))
+ break;
+ else if (Input[0].Equals('n') || Input[0].Equals('N'))
+ return;
+ }
+ // Format the USB memory stick
+ FormatDrive(args[0]);
+
+ // Create the files and write their own file names into them
+ for (int i = 0; i < Strings.GetLength(0); i++)
+ {
+ File.WriteAllText(Path.Combine(args[0], Strings[i]), Strings[i], Encoding.UTF8);
+ Console.WriteLine("The file \"" + Strings[i] + "\" created.");
+ }
+
+ // Create a c header file which contains an array with the strings and a #define
+ // for the number of strings
+ string HeaderPath = Path.Combine(args[0]/*Environment.CurrentDirectory*/, "files.h");
+ Console.WriteLine("The header \"" + HeaderPath + "\" will write.");
+ StreamWriter HeaderStream = new StreamWriter(HeaderPath);
+
+ HeaderStream.Write("\n" +
+ "/*\n" +
+ " * Array with files, that were created in the FAT-filesystem image.bin.\n" +
+ " *\n" +
+ " * WARNING: Automatically generated by Create_Files.cs -- do not edit!\n" +
+ " */\n" +
+ "\n" +
+ "#ifndef __FILE_H__\n" +
+ "#define __FILE_H__\n" +
+ "\n" +
+ "#ifdef __cplusplus\n" +
+ "extern C {\n" +
+ "#endif\n" +
+ "\n" +
+ "static const char *const filenames[] = {\n");
+ for (int i = 0; i < Strings.GetLength(0); i++)
+ HeaderStream.WriteLine(" \"" + Strings[i] + ((i == (Strings.GetLength(0) - 1)) ? "\"" : "\","));
+ string NumberOfFilesStr = Strings.GetLength(0).ToString(System.Globalization.CultureInfo.InvariantCulture);
+ HeaderStream.Write("};\n" +
+ "#define FILES_FILENAMES_NUMBER_OF " + NumberOfFilesStr + "\n" +
+ "\n" +
+ "#ifdef __cplusplus\n" +
+ "}\n" +
+ "#endif\n" +
+ "\n" +
+ "#endif /* __FILE_H__ */\n" +
+ "\n");
+
+ // Finalize
+ HeaderStream.Flush();
+ HeaderStream.Close();
+ HeaderStream.Dispose();
+ }
+ }
+ }
+}
More information about the vc
mailing list