Delete all Trailing spaces in code.
[reactos.git] / reactos / base / system / expand / expand.c
1 /*
2 * Copyright 1997 Victor Schneider
3 * Copyright 2002 Alexandre Julliard
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20 #include <stdlib.h>
21 #include <stdio.h>
22 #include <string.h>
23 #include <windows.h>
24 #include <lzexpand.h>
25 #include <tchar.h>
26
27 #include "resource.h"
28
29 int _tmain(int argc, TCHAR *argv[])
30 {
31 OFSTRUCT SourceOpenStruct1, SourceOpenStruct2;
32 LONG ret;
33 HFILE hSourceFile, hDestFile;
34 TCHAR szMsg[RC_STRING_MAX_SIZE];
35
36 if (argc < 2)
37 {
38 LoadString( GetModuleHandle(NULL), IDS_Copy, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
39 _ftprintf( stderr, szMsg, argv[0] );
40 return 1;
41 }
42 hSourceFile = LZOpenFile(argv[1], &SourceOpenStruct1, OF_READ);
43 if (argv[2])
44 hDestFile = LZOpenFile(argv[2], &SourceOpenStruct2, OF_CREATE | OF_WRITE);
45 else
46 {
47 TCHAR OriginalName[MAX_PATH];
48 GetExpandedName(argv[1], OriginalName);
49 hDestFile = LZOpenFile(OriginalName, &SourceOpenStruct2, OF_CREATE | OF_WRITE);
50 }
51 ret = LZCopy(hSourceFile, hDestFile);
52 LZClose(hSourceFile);
53 LZClose(hDestFile);
54 LoadString( GetModuleHandle(NULL), IDS_FAILS, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
55 if (ret <= 0) _ftprintf(stderr,szMsg,ret);
56 return (ret <= 0);
57 }