| 1 |  | 
|---|
| 2 | /*********************************************************************** | 
|---|
| 3 |  | 
|---|
| 4 | $Id: eas.c 620 2007-04-20 19:23:14Z stevenhl $ | 
|---|
| 5 |  | 
|---|
| 6 | EA viewer applet | 
|---|
| 7 |  | 
|---|
| 8 | Copyright (c) 1993-98 M. Kimes | 
|---|
| 9 | Copyright (c) 2002-2007 Steven H.Levine | 
|---|
| 10 |  | 
|---|
| 11 | 16 Oct 02 SHL Reformat | 
|---|
| 12 | 08 Feb 03 SHL Free list with free() since we don't | 
|---|
| 13 | allocate list contents | 
|---|
| 14 | 08 Apr 07 SHL Minor reformat | 
|---|
| 15 |  | 
|---|
| 16 | ***********************************************************************/ | 
|---|
| 17 |  | 
|---|
| 18 | #define INCL_DOS | 
|---|
| 19 | #define INCL_WIN | 
|---|
| 20 |  | 
|---|
| 21 | #include <os2.h> | 
|---|
| 22 | #include <stdarg.h> | 
|---|
| 23 | #include <stdio.h> | 
|---|
| 24 | #include <stdlib.h> | 
|---|
| 25 | #include <string.h> | 
|---|
| 26 | #include <ctype.h> | 
|---|
| 27 | #include "dll\fm3dll.h" | 
|---|
| 28 | #include "dll\fm3dlg.h" | 
|---|
| 29 |  | 
|---|
| 30 |  | 
|---|
| 31 | int main (int argc,char *argv[]) | 
|---|
| 32 | { | 
|---|
| 33 |  | 
|---|
| 34 | HAB         hab; | 
|---|
| 35 | HMQ         hmq; | 
|---|
| 36 | static CHAR fullname[CCHMAXPATH]; | 
|---|
| 37 | APIRET      rc; | 
|---|
| 38 | CHAR      **list = NULL; | 
|---|
| 39 | INT         x,numfiles = 0,numalloc = 0; | 
|---|
| 40 |  | 
|---|
| 41 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 42 | *fullname = 0; | 
|---|
| 43 | for(x = 1;x < argc;x++) { | 
|---|
| 44 | if (!strchr("/;,`\'",*argv[x]) && IsFile(argv[x]) != -1) { | 
|---|
| 45 | if (DosQueryPathInfo(argv[x],FIL_QUERYFULLNAME,fullname, | 
|---|
| 46 | sizeof(fullname))) | 
|---|
| 47 | strcpy(fullname,argv[x]); | 
|---|
| 48 | AddToList(fullname,&list,&numfiles,&numalloc); | 
|---|
| 49 | } | 
|---|
| 50 | } | 
|---|
| 51 | hab = WinInitialize(0); | 
|---|
| 52 | if (hab) { | 
|---|
| 53 | hmq = WinCreateMsgQueue(hab,384); | 
|---|
| 54 | if (hmq) { | 
|---|
| 55 | if (InitFM3DLL(hab,argc,argv)) { | 
|---|
| 56 | if (!list) { | 
|---|
| 57 | strcpy(fullname,"*"); | 
|---|
| 58 | list = malloc(sizeof(CHAR *) * 2); | 
|---|
| 59 | if (!list || !insert_filename(HWND_DESKTOP,fullname,TRUE,FALSE) || | 
|---|
| 60 | !*fullname || *fullname == '*') | 
|---|
| 61 | goto Abort; | 
|---|
| 62 | list[0] = fullname; | 
|---|
| 63 | list[1] = NULL; | 
|---|
| 64 | } | 
|---|
| 65 | WinDlgBox(HWND_DESKTOP, | 
|---|
| 66 | HWND_DESKTOP, | 
|---|
| 67 | DisplayEAsProc, | 
|---|
| 68 | FM3ModHandle, | 
|---|
| 69 | EA_FRAME, | 
|---|
| 70 | (PVOID)list); | 
|---|
| 71 | } | 
|---|
| 72 | Abort: | 
|---|
| 73 | WinDestroyMsgQueue(hmq); | 
|---|
| 74 | } | 
|---|
| 75 | WinTerminate(hab); | 
|---|
| 76 | } | 
|---|
| 77 | if (list) | 
|---|
| 78 | free(list); | 
|---|
| 79 | return 0; | 
|---|
| 80 | } | 
|---|
| 81 |  | 
|---|