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