Author: mbosma
Date: Tue Aug 14 00:09:47 2007
New Revision: 28322
URL:
http://svn.reactos.org/svn/reactos?rev=28322&view=rev
Log:
Add a tiny command line download tool.
Added:
trunk/reactos/base/applications/network/dwnl/
trunk/reactos/base/applications/network/dwnl/dwnl.c
trunk/reactos/base/applications/network/dwnl/dwnl.rbuild
Modified:
trunk/reactos/base/applications/network/network.rbuild
Added: trunk/reactos/base/applications/network/dwnl/dwnl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/dwnl/dwnl.c (added)
+++ trunk/reactos/base/applications/network/dwnl/dwnl.c Tue Aug 14 00:09:47 2007
@@ -1,0 +1,47 @@
+#include <windows.h>
+#include <urlmon.h>
+#include <tchar.h>
+
+HRESULT WINAPI URLDownloadToFileA(
+ LPUNKNOWN pCaller,
+ LPCSTR szURL,
+ LPCSTR szFileName,
+ DWORD dwReserved,
+ LPBINDSTATUSCALLBACK lpfnCB);
+
+// ToDo: Show status, get file name from webserver, better error reporting
+
+int tmain(int argc, TCHAR **argv)
+{
+ int i;
+
+ if(argc != 2)
+ {
+ _tprintf(TEXT("Usage: dwnl <url>"));
+ return 2;
+ }
+
+ TCHAR* filename = argv[1];
+ for(i=_tcslen(argv[1]);i>0
+ &&filename[i]!='/'
+ &&filename[i]!='\\'
+ &&filename[i]!='?'
+ &&filename[i]!='*'
+ &&filename[i]!=':'
+ &&filename[i]!='\"'
+ &&filename[i]!='<'
+ &&filename[i]!='>'
+ &&filename[i]!='|';i--);
+ filename = &argv[1][i+1];
+
+ _tprintf("Downloading %s... ", filename);
+
+ if(URLDownloadToFileA(NULL, argv[1], filename, 0, NULL) != S_OK)
+ {
+ _tprintf("Failed.\n");
+ return 1;
+ }
+
+ _tprintf("Finished.\n");
+ return 0;
+}
Added: trunk/reactos/base/applications/network/dwnl/dwnl.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/dwnl/dwnl.rbuild (added)
+++ trunk/reactos/base/applications/network/dwnl/dwnl.rbuild Tue Aug 14 00:09:47 2007
@@ -1,0 +1,12 @@
+<?xml version="1.0"?>
+<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
+<module name="dwnl" type="win32cui"
installbase="system32" installname="dwnl.exe">
+ <include base="dwnl">.</include>
+ <library>kernel32</library>
+ <library>crtdll</library>
+ <library>urlmon</library>
+ <define name="__USE_W32API" />
+ <define name="WINVER">0x0501</define>
+ <define name="_WIN32_IE>0x0600</define>
+ <file>dwnl.c</file>
+</module>
Modified: trunk/reactos/base/applications/network/network.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/network.rbuild (original)
+++ trunk/reactos/base/applications/network/network.rbuild Tue Aug 14 00:09:47 2007
@@ -3,6 +3,9 @@
<group>
<directory name="arp">
<xi:include href="arp/arp.rbuild" />
+</directory>
+<directory name="dwnl">
+ <xi:include href="dwnl/dwnl.rbuild" />
</directory>
<directory name="finger">
<xi:include href="finger/finger.rbuild" />