- Minor API file update.
[wine.git] / libtest / expand.c
blobf1daf8cf71599180816f1ca606f5b7f94546ba5e
1 /*
2 * Copyright 1997 Victor Schneider
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include <stdlib.h>
20 #include <stdio.h>
21 #include <string.h>
22 #include <windows.h>
23 #include <lzexpand.h>
25 int PASCAL WinMain(HINSTANCE hinstCurrent,
26 HINSTANCE hinstPrevious,
27 LPSTR lpCmdLine,
28 int nCmdShow)
30 OFSTRUCT SourceOpenStruct1, SourceOpenStruct2;
31 char OriginalName[256];
32 char FAR *lpzDestFile;
33 DWORD dwreturn;
34 HFILE hSourceFile, hDestFile;
35 /* Most Windows compilers have something like this: */
36 extern int _ARGC;
37 extern char **_ARGV;
39 hSourceFile = LZOpenFile(_ARGV[1], (LPOFSTRUCT) &SourceOpenStruct1, OF_READ);
40 if ((_ARGC == 3) && (_ARGV[2] != NULL))
41 lpzDestFile = _ARGV[2];
42 else {
43 lpzDestFile = OriginalName;
44 GetExpandedName(_ARGV[1], lpzDestFile);
46 hDestFile = LZOpenFile(lpzDestFile, (LPOFSTRUCT) &SourceOpenStruct2,
47 OF_CREATE | OF_WRITE);
48 dwreturn = LZCopy(hSourceFile, hDestFile);
49 if (dwreturn != 0)
50 fprintf(stderr,"LZCopy failed: return is %ld\n",dwreturn);
51 LZClose(hSourceFile);
52 LZClose(hDestFile);
53 return dwreturn;