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 |
|
---|
17 | static VOID fullname(CHAR * directory, CHAR * name)
|
---|
18 | {
|
---|
19 |
|
---|
20 | CHAR temp[CCHMAXPATH];
|
---|
21 |
|
---|
22 | if (!*name) {
|
---|
23 | strcpy(name, directory);
|
---|
24 | return;
|
---|
25 | }
|
---|
26 | if (!strchr(name, ':')) {
|
---|
27 | if (*name != '\\' && *name != '/') {
|
---|
28 | strcpy(temp, directory);
|
---|
29 | if (directory[strlen(directory) - 1] != '\\')
|
---|
30 | strcat(temp, "\\");
|
---|
31 | }
|
---|
32 | else {
|
---|
33 | *temp = *directory;
|
---|
34 | temp[1] = ':';
|
---|
35 | temp[2] = 0;
|
---|
36 | }
|
---|
37 | strcat(temp, name);
|
---|
38 | strcpy(name, temp);
|
---|
39 | }
|
---|
40 | MakeFullName(name);
|
---|
41 | }
|
---|
42 |
|
---|
43 | static VOID parse(CHAR * command, CHAR * key, CHAR * rest)
|
---|
44 | {
|
---|
45 |
|
---|
46 | CHAR *p;
|
---|
47 |
|
---|
48 | *key = *rest = 0;
|
---|
49 | strcpy(key, command);
|
---|
50 | p = strchr(key, ' ');
|
---|
51 | if (p) {
|
---|
52 | *p = 0;
|
---|
53 | p++;
|
---|
54 | p = skip_delim(p, " \t");
|
---|
55 | strcpy(rest, p);
|
---|
56 | }
|
---|
57 | }
|
---|
58 |
|
---|
59 | BOOL FM2Command(CHAR * directory, CHAR * command)
|
---|
60 | {
|
---|
61 |
|
---|
62 | BOOL ret = FALSE;
|
---|
63 | CHAR key[CCHMAXPATH], rest[CCHMAXPATH];
|
---|
64 | HWND hwnd;
|
---|
65 |
|
---|
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);
|
---|
71 | ret = TRUE;
|
---|
72 | }
|
---|
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);
|
---|
78 | ret = TRUE;
|
---|
79 | }
|
---|
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));
|
---|
84 | ret = TRUE;
|
---|
85 | }
|
---|
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;
|
---|
91 | }
|
---|
92 | }
|
---|
93 | else if (!stricmp(key, GetPString(IDS_KEEPCMDTEXT)) ||
|
---|
94 | !stricmp(key, GetPString(IDS_NOKEEPCMDTEXT))) {
|
---|
95 | if (!stricmp(key, GetPString(IDS_NOKEEPCMDTEXT)))
|
---|
96 | fKeepCmdLine = FALSE;
|
---|
97 | else
|
---|
98 | fKeepCmdLine = TRUE;
|
---|
99 | PrfWriteProfileData(fmprof, FM3Str, "KeepCmdLine", &fKeepCmdLine,
|
---|
100 | sizeof(BOOL));
|
---|
101 | ret = TRUE;
|
---|
102 | }
|
---|
103 | else if (!stricmp(key, GetPString(IDS_SAVECMDTEXT)) ||
|
---|
104 | !stricmp(key, GetPString(IDS_NOSAVECMDTEXT))) {
|
---|
105 | if (!stricmp(key, GetPString(IDS_NOSAVECMDTEXT)))
|
---|
106 | fSaveMiniCmds = FALSE;
|
---|
107 | else
|
---|
108 | fSaveMiniCmds = TRUE;
|
---|
109 | PrfWriteProfileData(fmprof, FM3Str, "SaveMiniCmds", &fSaveMiniCmds,
|
---|
110 | sizeof(BOOL));
|
---|
111 | ret = TRUE;
|
---|
112 | }
|
---|
113 | }
|
---|
114 | return ret;
|
---|
115 | }
|
---|