| 1 | 
 | 
|---|
| 2 | /***********************************************************************
 | 
|---|
| 3 | 
 | 
|---|
| 4 |   $Id: undel.c 1216 2008-09-13 06:54:29Z jbs $
 | 
|---|
| 5 | 
 | 
|---|
| 6 |   File undelete applet
 | 
|---|
| 7 | 
 | 
|---|
| 8 |   Copyright (c) 1993-98 M. Kimes
 | 
|---|
| 9 |   Copyright (c) 2007 Steven H. Levine
 | 
|---|
| 10 | 
 | 
|---|
| 11 |   23 Sep 07 SHL Sync with standards
 | 
|---|
| 12 |   23 Sep 07 SHL Get rid of statics
 | 
|---|
| 13 | 
 | 
|---|
| 14 | ***********************************************************************/
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include <string.h>
 | 
|---|
| 17 | 
 | 
|---|
| 18 | #define INCL_DOS
 | 
|---|
| 19 | 
 | 
|---|
| 20 | #include "dll\fm3dll.h"
 | 
|---|
| 21 | #include "dll\mainwnd.h"                // Data declaration(s)
 | 
|---|
| 22 | #include "dll\fm3dlg.h"
 | 
|---|
| 23 | #include "dll\undel.h"                  // UndeleteDlgProc
 | 
|---|
| 24 | #include "dll\init.h"                   // InitFM3DLL
 | 
|---|
| 25 | #include "dll\valid.h"                  // MakeValidDir
 | 
|---|
| 26 | #include "dll\dirs.h"                   // save_dir
 | 
|---|
| 27 | 
 | 
|---|
| 28 | int main(int argc, char *argv[])
 | 
|---|
| 29 | {
 | 
|---|
| 30 |   HAB hab;
 | 
|---|
| 31 |   HMQ hmq;
 | 
|---|
| 32 |   FILESTATUS3 fs;
 | 
|---|
| 33 |   CHAR fullname[CCHMAXPATH];
 | 
|---|
| 34 |   CHAR *thisarg = NULL;
 | 
|---|
| 35 |   INT x;
 | 
|---|
| 36 | 
 | 
|---|
| 37 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 38 |   for (x = 1; x < argc; x++) {
 | 
|---|
| 39 |     if (!strchr("/;,`\'", *argv[x]) && !thisarg) {
 | 
|---|
| 40 |       thisarg = argv[x];
 | 
|---|
| 41 |       break;
 | 
|---|
| 42 |     }
 | 
|---|
| 43 |   }
 | 
|---|
| 44 |   if (!thisarg) {
 | 
|---|
| 45 |     thisarg = fullname;
 | 
|---|
| 46 |     save_dir(fullname);
 | 
|---|
| 47 |   }
 | 
|---|
| 48 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 49 |   if (thisarg && !DosQueryPathInfo(thisarg, FIL_STANDARD, &fs, sizeof(fs))) {
 | 
|---|
| 50 |     if (DosQueryPathInfo(thisarg,
 | 
|---|
| 51 |                          FIL_QUERYFULLNAME, fullname, sizeof(fullname)))
 | 
|---|
| 52 |       strcpy(fullname, thisarg);
 | 
|---|
| 53 |     hab = WinInitialize(0);
 | 
|---|
| 54 |     if (hab) {
 | 
|---|
| 55 |       hmq = WinCreateMsgQueue(hab, 256);
 | 
|---|
| 56 |       if (hmq) {
 | 
|---|
| 57 |         if (InitFM3DLL(hab, argc, argv)) {
 | 
|---|
| 58 |           MakeValidDir(fullname);
 | 
|---|
| 59 |           WinDlgBox(HWND_DESKTOP,
 | 
|---|
| 60 |                     HWND_DESKTOP,
 | 
|---|
| 61 |                     UndeleteDlgProc,
 | 
|---|
| 62 |                     FM3ModHandle,
 | 
|---|
| 63 |                     UNDEL_FRAME,
 | 
|---|
| 64 |                     fullname);
 | 
|---|
| 65 |         }
 | 
|---|
| 66 |         DosSleep(250);
 | 
|---|
| 67 |         WinDestroyMsgQueue(hmq);
 | 
|---|
| 68 |       }
 | 
|---|
| 69 |       WinTerminate(hab);
 | 
|---|
| 70 |     }
 | 
|---|
| 71 |   }
 | 
|---|
| 72 |   else
 | 
|---|
| 73 |     DosBeep(250, 100);
 | 
|---|
| 74 |   return 0;
 | 
|---|
| 75 | }
 | 
|---|