mirror of
https://github.com/dlang/tools.git
synced 2025-04-25 20:51:00 +03:00
Fix whitespace
This commit is contained in:
parent
44e843e8bd
commit
ae655c8020
2 changed files with 43 additions and 43 deletions
54
catdoc.d
54
catdoc.d
|
@ -16,51 +16,51 @@ int main(string[] args)
|
||||||
{
|
{
|
||||||
if (args.length < 2)
|
if (args.length < 2)
|
||||||
{
|
{
|
||||||
writeln("catdoc: Concatenate Ddoc files
|
writeln("catdoc: Concatenate Ddoc files
|
||||||
Usage:
|
Usage:
|
||||||
catdoc -o=outputfile sourcefiles...
|
catdoc -o=outputfile sourcefiles...
|
||||||
");
|
");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ofile;
|
string ofile;
|
||||||
getopt(args, "o", &ofile);
|
getopt(args, "o", &ofile);
|
||||||
if (!ofile.ptr)
|
if (!ofile.ptr)
|
||||||
{
|
{
|
||||||
writeln("catdoc: set output file with -o=filename");
|
writeln("catdoc: set output file with -o=filename");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (args.length < 2)
|
if (args.length < 2)
|
||||||
{
|
{
|
||||||
writeln("catdoc: no input files");
|
writeln("catdoc: no input files");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
string comment = "Ddoc\n";
|
string comment = "Ddoc\n";
|
||||||
string macros;
|
string macros;
|
||||||
foreach (arg; args[1..$])
|
foreach (arg; args[1..$])
|
||||||
{
|
{
|
||||||
//writeln(arg);
|
//writeln(arg);
|
||||||
string input = cast(string)std.file.read(arg);
|
string input = cast(string)std.file.read(arg);
|
||||||
if (input.length < 4 || input[0..4] != "Ddoc")
|
if (input.length < 4 || input[0..4] != "Ddoc")
|
||||||
{ writefln("catdoc: %s is not a Ddoc file", arg);
|
{ writefln("catdoc: %s is not a Ddoc file", arg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
foreach (i, c; input)
|
foreach (i, c; input)
|
||||||
{
|
{
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
{
|
{
|
||||||
if (i + 8 < input.length && std.string.icmp(input[i + 1 .. i + 8], "Macros:") == 0)
|
if (i + 8 < input.length && std.string.icmp(input[i + 1 .. i + 8], "Macros:") == 0)
|
||||||
{
|
{
|
||||||
comment ~= input[4 .. i + 1];
|
comment ~= input[4 .. i + 1];
|
||||||
if (!macros.ptr)
|
if (!macros.ptr)
|
||||||
macros = "Macros:\n";
|
macros = "Macros:\n";
|
||||||
macros ~= input[i + 8 .. $];
|
macros ~= input[i + 8 .. $];
|
||||||
goto L1;
|
goto L1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
comment ~= input[4 .. $];
|
comment ~= input[4 .. $];
|
||||||
L1: ;
|
L1: ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,27 +88,27 @@ int main(string[] args)
|
||||||
showHelp();
|
showHelp();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args[1] == "--help")
|
if(args[1] == "--help")
|
||||||
{
|
{
|
||||||
showHelp();
|
showHelp();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup paths
|
// Setup paths
|
||||||
auto curlVersion = args[1];
|
auto curlVersion = args[1];
|
||||||
curlUrl = curlUrl .replace("$(CURL_VERSION)", curlVersion);
|
curlUrl = curlUrl .replace("$(CURL_VERSION)", curlVersion);
|
||||||
curlZipBase = curlZipBase.replace("$(CURL_VERSION)", curlVersion);
|
curlZipBase = curlZipBase.replace("$(CURL_VERSION)", curlVersion);
|
||||||
outputDir ~= "-" ~ curlVersion;
|
outputDir ~= "-" ~ curlVersion;
|
||||||
workDir = buildPath(tempDir(), workDirName);
|
workDir = buildPath(tempDir(), workDirName);
|
||||||
|
|
||||||
checkImplib();
|
checkImplib();
|
||||||
|
|
||||||
// Clear temporary work dir
|
// Clear temporary work dir
|
||||||
writeln("Clearing temporary work dir: ", workDir);
|
writeln("Clearing temporary work dir: ", workDir);
|
||||||
removeDir(workDir);
|
removeDir(workDir);
|
||||||
makeDir(workDir);
|
makeDir(workDir);
|
||||||
|
|
||||||
// Archive paths
|
// Archive paths
|
||||||
auto unzipArchivePath = buildPath(workDir, "unzip", unzipArchiveName);
|
auto unzipArchivePath = buildPath(workDir, "unzip", unzipArchiveName);
|
||||||
auto basicUtilsArchivePath = buildPath(workDir, "bup", basicUtilsArchiveName);
|
auto basicUtilsArchivePath = buildPath(workDir, "bup", basicUtilsArchiveName);
|
||||||
|
@ -122,7 +122,7 @@ int main(string[] args)
|
||||||
if(!hasImplib)
|
if(!hasImplib)
|
||||||
download(basicUtilsUrl, basicUtilsArchivePath);
|
download(basicUtilsUrl, basicUtilsArchivePath);
|
||||||
download(curlUrl, curlArchivePath);
|
download(curlUrl, curlArchivePath);
|
||||||
|
|
||||||
// Extract
|
// Extract
|
||||||
{
|
{
|
||||||
auto saveDir = getcwd();
|
auto saveDir = getcwd();
|
||||||
|
@ -140,20 +140,20 @@ int main(string[] args)
|
||||||
chdir(workDir);
|
chdir(workDir);
|
||||||
unzip(curlArchivePath);
|
unzip(curlArchivePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate import lib
|
// Generate import lib
|
||||||
auto curlDir = buildPath(workDir, curlZipBase);
|
auto curlDir = buildPath(workDir, curlZipBase);
|
||||||
implib(buildPath(curlDir, "libcurl"));
|
implib(buildPath(curlDir, "libcurl"));
|
||||||
|
|
||||||
// Copy results out of temp dir
|
// Copy results out of temp dir
|
||||||
writeln("Copying results to '", outputDir, "'");
|
writeln("Copying results to '", outputDir, "'");
|
||||||
removeDir(outputDir);
|
removeDir(outputDir);
|
||||||
copyDir(curlDir, outputDir);
|
copyDir(curlDir, outputDir);
|
||||||
|
|
||||||
writeln("Done.");
|
writeln("Done.");
|
||||||
writeln("Your OPTLINK-compatable libcurl.lib, along with the rest of libcurl,");
|
writeln("Your OPTLINK-compatable libcurl.lib, along with the rest of libcurl,");
|
||||||
writeln("is in the directory: ", outputDir);
|
writeln("is in the directory: ", outputDir);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ void copyDir(string src, string dest)
|
||||||
// Needed to generate 'relativePath' correctly.
|
// Needed to generate 'relativePath' correctly.
|
||||||
if(!src.endsWith(dirSeparator))
|
if(!src.endsWith(dirSeparator))
|
||||||
src ~= dirSeparator;
|
src ~= dirSeparator;
|
||||||
|
|
||||||
makeDir(dest);
|
makeDir(dest);
|
||||||
foreach(DirEntry entry; dirEntries(src, SpanMode.breadth))
|
foreach(DirEntry entry; dirEntries(src, SpanMode.breadth))
|
||||||
{
|
{
|
||||||
|
@ -191,11 +191,11 @@ void removeDir(string path)
|
||||||
{
|
{
|
||||||
if(exists(path))
|
if(exists(path))
|
||||||
{
|
{
|
||||||
auto failMsg =
|
auto failMsg =
|
||||||
"Failed to remove directory: "~path~"\n"~
|
"Failed to remove directory: "~path~"\n"~
|
||||||
" A process may still holding an open handle within the directory.\n"~
|
" A process may still holding an open handle within the directory.\n"~
|
||||||
" Either delete the directory manually or try again later.";
|
" Either delete the directory manually or try again later.";
|
||||||
|
|
||||||
try
|
try
|
||||||
system("rmdir /S /Q "~quote(path));
|
system("rmdir /S /Q "~quote(path));
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue