| [22] | 1 | 
 | 
|---|
| [52] | 2 | /***********************************************************************
 | 
|---|
| [22] | 3 | 
 | 
|---|
| [52] | 4 |   $Id: eas.c 1215 2008-09-13 06:54:03Z jbs $
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 |   EA viewer applet
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 |   Copyright (c) 1993-98 M. Kimes
 | 
|---|
| [754] | 9 |   Copyright (c) 2002, 2007 Steven H.Levine
 | 
|---|
| [52] | 10 | 
 | 
|---|
| [620] | 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
 | 
|---|
| [1010] | 15 |   10 May 08 SHL Correct compare typo
 | 
|---|
| [52] | 16 | 
 | 
|---|
 | 17 | ***********************************************************************/
 | 
|---|
 | 18 | 
 | 
|---|
| [2] | 19 | #include <stdlib.h>
 | 
|---|
 | 20 | #include <string.h>
 | 
|---|
| [754] | 21 | 
 | 
|---|
 | 22 | #define INCL_DOS
 | 
|---|
 | 23 | #define INCL_WIN
 | 
|---|
 | 24 | 
 | 
|---|
| [1176] | 25 | #include "dll\fm3dll.h"
 | 
|---|
| [1215] | 26 | #include "dll\notebook.h"                       // Data declaration(s)
 | 
|---|
 | 27 | #include "dll\mainwnd.h"                        // Data declaration(s)
 | 
|---|
| [907] | 28 | #include "dll\fm3dlg.h"
 | 
|---|
 | 29 | #include "dll\makelist.h"
 | 
|---|
| [1176] | 30 | #include "dll\eas.h"                    // DisplayEAsProc
 | 
|---|
 | 31 | #include "dll\init.h"                   // InitFM3DLL
 | 
|---|
 | 32 | #include "dll\valid.h"                  // IsFile
 | 
|---|
 | 33 | #include "dll\wrappers.h"                       // xfree
 | 
|---|
 | 34 | #include "dll\getnames.h"                       // insert_filename
 | 
|---|
| [2] | 35 | 
 | 
|---|
| [1011] | 36 | static PSZ pszSrcFile = __FILE__;
 | 
|---|
 | 37 | 
 | 
|---|
| [52] | 38 | int main (int argc,char *argv[])
 | 
|---|
 | 39 | {
 | 
|---|
| [754] | 40 |   HAB hab;
 | 
|---|
 | 41 |   HMQ hmq;
 | 
|---|
 | 42 |   CHAR fullname[CCHMAXPATH];
 | 
|---|
 | 43 |   CHAR **list = NULL;
 | 
|---|
| [907] | 44 |   UINT x,numfiles = 0,numalloc = 0;
 | 
|---|
| [2] | 45 | 
 | 
|---|
 | 46 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| [754] | 47 |   for(x = 1; x < argc; x++) {
 | 
|---|
| [620] | 48 |     if (!strchr("/;,`\'",*argv[x]) && IsFile(argv[x]) != -1) {
 | 
|---|
| [754] | 49 |       if (DosQueryPathInfo(argv[x],
 | 
|---|
 | 50 |                            FIL_QUERYFULLNAME,fullname,
 | 
|---|
| [620] | 51 |                            sizeof(fullname)))
 | 
|---|
| [754] | 52 |         strcpy(fullname, argv[x]);
 | 
|---|
| [2] | 53 |       AddToList(fullname,&list,&numfiles,&numalloc);
 | 
|---|
 | 54 |     }
 | 
|---|
 | 55 |   }
 | 
|---|
 | 56 |   hab = WinInitialize(0);
 | 
|---|
| [620] | 57 |   if (hab) {
 | 
|---|
| [2] | 58 |     hmq = WinCreateMsgQueue(hab,384);
 | 
|---|
| [620] | 59 |     if (hmq) {
 | 
|---|
 | 60 |       if (InitFM3DLL(hab,argc,argv)) {
 | 
|---|
 | 61 |         if (!list) {
 | 
|---|
| [754] | 62 |           strcpy(fullname, "*");
 | 
|---|
| [1011] | 63 |           list = xmalloc(sizeof(CHAR *) * 2, pszSrcFile, __LINE__);
 | 
|---|
| [754] | 64 |           if (list &&
 | 
|---|
 | 65 |               insert_filename(HWND_DESKTOP,fullname,TRUE,FALSE) &&
 | 
|---|
| [1010] | 66 |               *fullname && *fullname != '*') {
 | 
|---|
| [1011] | 67 |            list[0] = fullname;
 | 
|---|
 | 68 |            list[1] = NULL;
 | 
|---|
| [754] | 69 |           }
 | 
|---|
| [620] | 70 |         }
 | 
|---|
| [754] | 71 |         if (list) {
 | 
|---|
 | 72 |           WinDlgBox(HWND_DESKTOP,
 | 
|---|
 | 73 |                     HWND_DESKTOP,
 | 
|---|
 | 74 |                     DisplayEAsProc,
 | 
|---|
 | 75 |                     FM3ModHandle,
 | 
|---|
 | 76 |                     EA_FRAME,
 | 
|---|
 | 77 |                     (PVOID)list);
 | 
|---|
 | 78 |         }
 | 
|---|
| [2] | 79 |       }
 | 
|---|
 | 80 |       WinDestroyMsgQueue(hmq);
 | 
|---|
 | 81 |     }
 | 
|---|
 | 82 |     WinTerminate(hab);
 | 
|---|
 | 83 |   }
 | 
|---|
| [1039] | 84 |   xfree(list, pszSrcFile, __LINE__);
 | 
|---|
| [2] | 85 |   return 0;
 | 
|---|
 | 86 | }
 | 
|---|
 | 87 | 
 | 
|---|