source: trunk/dll/fm2cmd.c@ 793

Last change on this file since 793 was 793, checked in by Gregg Young, 18 years ago

Move #pragma alloc_text to end for OpenWatcom compat

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1
2/***********************************************************************
3
4 $Id: fm2cmd.c 793 2007-08-21 02:53:38Z gyoung $
5
6 Copyright (c) 1993-98 M. Kimes
7 Copyright (c) 2003, 2007 Steven H.Levine
8
9 Command processing
10
11 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
12
13***********************************************************************/
14
15#define INCL_DOS
16#define INCL_WIN
17
18#include <os2.h>
19#include <stdio.h>
20#include <stdlib.h>
21#include <string.h>
22#include <ctype.h>
23#include <share.h>
24#include "fm3dll.h"
25#include "fm3dlg.h"
26#include "fm3str.h"
27
28#pragma data_seg(DATA2)
29
30static VOID fullname(CHAR * directory, CHAR * name)
31{
32
33 CHAR temp[CCHMAXPATH];
34
35 if (!*name) {
36 strcpy(name, directory);
37 return;
38 }
39 if (!strchr(name, ':')) {
40 if (*name != '\\' && *name != '/') {
41 strcpy(temp, directory);
42 if (directory[strlen(directory) - 1] != '\\')
43 strcat(temp, "\\");
44 }
45 else {
46 *temp = *directory;
47 temp[1] = ':';
48 temp[2] = 0;
49 }
50 strcat(temp, name);
51 strcpy(name, temp);
52 }
53 MakeFullName(name);
54}
55
56static VOID parse(CHAR * command, CHAR * key, CHAR * rest)
57{
58
59 CHAR *p;
60
61 *key = *rest = 0;
62 strcpy(key, command);
63 p = strchr(key, ' ');
64 if (p) {
65 *p = 0;
66 p++;
67 p = skip_delim(p, " \t");
68 strcpy(rest, p);
69 }
70}
71
72BOOL FM2Command(CHAR * directory, CHAR * command)
73{
74
75 BOOL ret = FALSE;
76 CHAR key[CCHMAXPATH], rest[CCHMAXPATH];
77 HWND hwnd;
78
79 if (command && *command == '/') {
80 parse(command, key, rest);
81 if (!stricmp(key, GetPString(IDS_OPENCMDTEXT))) {
82 fullname(directory, rest);
83 WinSendMsg(hwndTree, UM_OPENWINDOWFORME, MPFROMP(rest), MPVOID);
84 ret = TRUE;
85 }
86 else if (!stricmp(key, GetPString(IDS_CLOSECMDTEXT))) {
87 fullname(directory, rest);
88 hwnd = FindDirCnrByName(rest, FALSE);
89 if (hwnd)
90 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
91 ret = TRUE;
92 }
93 else if (!stricmp(key, GetPString(IDS_HELPCMDTEXT))) {
94 saymsg(MB_ENTER, (hwndMain) ? hwndMain : HWND_DESKTOP,
95 GetPString(IDS_FM2CMDHELPHDRTEXT), "%s",
96 GetPString(IDS_FM2CMDHELPTEXT));
97 ret = TRUE;
98 }
99 else if (!stricmp(key, GetPString(IDS_FILTERCMDTEXT))) {
100 hwnd = FindDirCnrByName(directory, FALSE);
101 if (hwnd) {
102 WinSendMsg(hwnd, UM_FILTER, MPFROMP(rest), MPVOID);
103 ret = TRUE;
104 }
105 }
106 else if (!stricmp(key, GetPString(IDS_KEEPCMDTEXT)) ||
107 !stricmp(key, GetPString(IDS_NOKEEPCMDTEXT))) {
108 if (!stricmp(key, GetPString(IDS_NOKEEPCMDTEXT)))
109 fKeepCmdLine = FALSE;
110 else
111 fKeepCmdLine = TRUE;
112 PrfWriteProfileData(fmprof, FM3Str, "KeepCmdLine", &fKeepCmdLine,
113 sizeof(BOOL));
114 ret = TRUE;
115 }
116 else if (!stricmp(key, GetPString(IDS_SAVECMDTEXT)) ||
117 !stricmp(key, GetPString(IDS_NOSAVECMDTEXT))) {
118 if (!stricmp(key, GetPString(IDS_NOSAVECMDTEXT)))
119 fSaveMiniCmds = FALSE;
120 else
121 fSaveMiniCmds = TRUE;
122 PrfWriteProfileData(fmprof, FM3Str, "SaveMiniCmds", &fSaveMiniCmds,
123 sizeof(BOOL));
124 ret = TRUE;
125 }
126 }
127 return ret;
128}
129
130#pragma alloc_text(FM2CMD,FM2Command,fullname,parse)
Note: See TracBrowser for help on using the repository browser.