[2] | 1 | #define INCL_DOS
|
---|
| 2 | #define INCL_WIN
|
---|
| 3 |
|
---|
| 4 | #include <os2.h>
|
---|
| 5 | #include <stdio.h>
|
---|
| 6 | #include <stdlib.h>
|
---|
| 7 | #include <string.h>
|
---|
| 8 | #include <ctype.h>
|
---|
| 9 | #include <share.h>
|
---|
| 10 | #include "fm3dll.h"
|
---|
| 11 | #include "fm3dlg.h"
|
---|
| 12 | #include "fm3str.h"
|
---|
| 13 |
|
---|
| 14 | #pragma data_seg(DATA2)
|
---|
| 15 | #pragma alloc_text(FM2CMD,FM2Command,fullname,parse)
|
---|
| 16 |
|
---|
[551] | 17 | static VOID fullname(CHAR * directory, CHAR * name)
|
---|
| 18 | {
|
---|
[2] | 19 |
|
---|
| 20 | CHAR temp[CCHMAXPATH];
|
---|
| 21 |
|
---|
[551] | 22 | if (!*name) {
|
---|
| 23 | strcpy(name, directory);
|
---|
[2] | 24 | return;
|
---|
| 25 | }
|
---|
[551] | 26 | if (!strchr(name, ':')) {
|
---|
| 27 | if (*name != '\\' && *name != '/') {
|
---|
| 28 | strcpy(temp, directory);
|
---|
| 29 | if (directory[strlen(directory) - 1] != '\\')
|
---|
| 30 | strcat(temp, "\\");
|
---|
[2] | 31 | }
|
---|
| 32 | else {
|
---|
| 33 | *temp = *directory;
|
---|
| 34 | temp[1] = ':';
|
---|
| 35 | temp[2] = 0;
|
---|
| 36 | }
|
---|
[551] | 37 | strcat(temp, name);
|
---|
| 38 | strcpy(name, temp);
|
---|
[2] | 39 | }
|
---|
| 40 | MakeFullName(name);
|
---|
| 41 | }
|
---|
| 42 |
|
---|
[551] | 43 | static VOID parse(CHAR * command, CHAR * key, CHAR * rest)
|
---|
| 44 | {
|
---|
[2] | 45 |
|
---|
| 46 | CHAR *p;
|
---|
| 47 |
|
---|
| 48 | *key = *rest = 0;
|
---|
[551] | 49 | strcpy(key, command);
|
---|
| 50 | p = strchr(key, ' ');
|
---|
| 51 | if (p) {
|
---|
[2] | 52 | *p = 0;
|
---|
| 53 | p++;
|
---|
[551] | 54 | p = skip_delim(p, " \t");
|
---|
| 55 | strcpy(rest, p);
|
---|
[2] | 56 | }
|
---|
| 57 | }
|
---|
| 58 |
|
---|
[551] | 59 | BOOL FM2Command(CHAR * directory, CHAR * command)
|
---|
| 60 | {
|
---|
[2] | 61 |
|
---|
| 62 | BOOL ret = FALSE;
|
---|
[551] | 63 | CHAR key[CCHMAXPATH], rest[CCHMAXPATH];
|
---|
[2] | 64 | HWND hwnd;
|
---|
| 65 |
|
---|
[551] | 66 | if (command && *command == '/') {
|
---|
| 67 | parse(command, key, rest);
|
---|
| 68 | if (!stricmp(key, GetPString(IDS_OPENCMDTEXT))) {
|
---|
| 69 | fullname(directory, rest);
|
---|
| 70 | WinSendMsg(hwndTree, UM_OPENWINDOWFORME, MPFROMP(rest), MPVOID);
|
---|
[2] | 71 | ret = TRUE;
|
---|
| 72 | }
|
---|
[551] | 73 | else if (!stricmp(key, GetPString(IDS_CLOSECMDTEXT))) {
|
---|
| 74 | fullname(directory, rest);
|
---|
| 75 | hwnd = FindDirCnrByName(rest, FALSE);
|
---|
| 76 | if (hwnd)
|
---|
| 77 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
[2] | 78 | ret = TRUE;
|
---|
| 79 | }
|
---|
[551] | 80 | else if (!stricmp(key, GetPString(IDS_HELPCMDTEXT))) {
|
---|
| 81 | saymsg(MB_ENTER, (hwndMain) ? hwndMain : HWND_DESKTOP,
|
---|
| 82 | GetPString(IDS_FM2CMDHELPHDRTEXT), "%s",
|
---|
| 83 | GetPString(IDS_FM2CMDHELPTEXT));
|
---|
[2] | 84 | ret = TRUE;
|
---|
| 85 | }
|
---|
[551] | 86 | else if (!stricmp(key, GetPString(IDS_FILTERCMDTEXT))) {
|
---|
| 87 | hwnd = FindDirCnrByName(directory, FALSE);
|
---|
| 88 | if (hwnd) {
|
---|
| 89 | WinSendMsg(hwnd, UM_FILTER, MPFROMP(rest), MPVOID);
|
---|
| 90 | ret = TRUE;
|
---|
[2] | 91 | }
|
---|
| 92 | }
|
---|
[551] | 93 | else if (!stricmp(key, GetPString(IDS_KEEPCMDTEXT)) ||
|
---|
| 94 | !stricmp(key, GetPString(IDS_NOKEEPCMDTEXT))) {
|
---|
| 95 | if (!stricmp(key, GetPString(IDS_NOKEEPCMDTEXT)))
|
---|
| 96 | fKeepCmdLine = FALSE;
|
---|
[2] | 97 | else
|
---|
[551] | 98 | fKeepCmdLine = TRUE;
|
---|
| 99 | PrfWriteProfileData(fmprof, FM3Str, "KeepCmdLine", &fKeepCmdLine,
|
---|
| 100 | sizeof(BOOL));
|
---|
[2] | 101 | ret = TRUE;
|
---|
| 102 | }
|
---|
[551] | 103 | else if (!stricmp(key, GetPString(IDS_SAVECMDTEXT)) ||
|
---|
| 104 | !stricmp(key, GetPString(IDS_NOSAVECMDTEXT))) {
|
---|
| 105 | if (!stricmp(key, GetPString(IDS_NOSAVECMDTEXT)))
|
---|
| 106 | fSaveMiniCmds = FALSE;
|
---|
[2] | 107 | else
|
---|
[551] | 108 | fSaveMiniCmds = TRUE;
|
---|
| 109 | PrfWriteProfileData(fmprof, FM3Str, "SaveMiniCmds", &fSaveMiniCmds,
|
---|
| 110 | sizeof(BOOL));
|
---|
[2] | 111 | ret = TRUE;
|
---|
| 112 | }
|
---|
| 113 | }
|
---|
| 114 | return ret;
|
---|
| 115 | }
|
---|