| [2] | 1 | 
 | 
|---|
| [862] | 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 | 
 | 
|---|
| [2] | 16 | #include <string.h>
 | 
|---|
| [862] | 17 | 
 | 
|---|
 | 18 | #define INCL_DOS
 | 
|---|
 | 19 | 
 | 
|---|
| [1189] | 20 | #include "dll\fm3dll.h"
 | 
|---|
| [1216] | 21 | #include "dll\mainwnd.h"                // Data declaration(s)
 | 
|---|
| [907] | 22 | #include "dll\fm3dlg.h"
 | 
|---|
| [1189] | 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
 | 
|---|
| [2] | 27 | 
 | 
|---|
| [551] | 28 | int main(int argc, char *argv[])
 | 
|---|
 | 29 | {
 | 
|---|
 | 30 |   HAB hab;
 | 
|---|
 | 31 |   HMQ hmq;
 | 
|---|
| [844] | 32 |   FILESTATUS3 fs;
 | 
|---|
| [862] | 33 |   CHAR fullname[CCHMAXPATH];
 | 
|---|
| [551] | 34 |   CHAR *thisarg = NULL;
 | 
|---|
 | 35 |   INT x;
 | 
|---|
| [2] | 36 | 
 | 
|---|
 | 37 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| [551] | 38 |   for (x = 1; x < argc; x++) {
 | 
|---|
 | 39 |     if (!strchr("/;,`\'", *argv[x]) && !thisarg) {
 | 
|---|
| [2] | 40 |       thisarg = argv[x];
 | 
|---|
 | 41 |       break;
 | 
|---|
 | 42 |     }
 | 
|---|
 | 43 |   }
 | 
|---|
| [551] | 44 |   if (!thisarg) {
 | 
|---|
| [2] | 45 |     thisarg = fullname;
 | 
|---|
 | 46 |     save_dir(fullname);
 | 
|---|
 | 47 |   }
 | 
|---|
 | 48 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| [844] | 49 |   if (thisarg && !DosQueryPathInfo(thisarg, FIL_STANDARD, &fs, sizeof(fs))) {
 | 
|---|
| [551] | 50 |     if (DosQueryPathInfo(thisarg,
 | 
|---|
 | 51 |                          FIL_QUERYFULLNAME, fullname, sizeof(fullname)))
 | 
|---|
 | 52 |       strcpy(fullname, thisarg);
 | 
|---|
| [2] | 53 |     hab = WinInitialize(0);
 | 
|---|
| [551] | 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,
 | 
|---|
| [862] | 62 |                     FM3ModHandle,
 | 
|---|
 | 63 |                     UNDEL_FRAME,
 | 
|---|
 | 64 |                     fullname);
 | 
|---|
| [551] | 65 |         }
 | 
|---|
| [844] | 66 |         DosSleep(250);
 | 
|---|
| [551] | 67 |         WinDestroyMsgQueue(hmq);
 | 
|---|
| [2] | 68 |       }
 | 
|---|
 | 69 |       WinTerminate(hab);
 | 
|---|
 | 70 |     }
 | 
|---|
 | 71 |   }
 | 
|---|
 | 72 |   else
 | 
|---|
| [551] | 73 |     DosBeep(250, 100);
 | 
|---|
| [2] | 74 |   return 0;
 | 
|---|
 | 75 | }
 | 
|---|