| [195] | 1 |  | 
|---|
|  | 2 | /*********************************************************************** | 
|---|
|  | 3 |  | 
|---|
|  | 4 | $Id: uudecode.c 404 2006-07-29 20:01:14Z root $ | 
|---|
|  | 5 |  | 
|---|
|  | 6 | uudecode | 
|---|
|  | 7 |  | 
|---|
|  | 8 | Copyright (c) 1993-98 M. Kimes | 
|---|
| [328] | 9 | Copyright (c) 2005, 2006 Steven H. Levine | 
|---|
| [195] | 10 |  | 
|---|
|  | 11 | 06 Jun 05 SHL Indent -i2 | 
|---|
| [204] | 12 | 06 Jun 05 SHL Drop unused code | 
|---|
| [328] | 13 | 17 Jul 06 SHL Use Runtime_Error | 
|---|
| [404] | 14 | 29 Jul 06 SHL Use xfgets | 
|---|
| [195] | 15 |  | 
|---|
|  | 16 | ***********************************************************************/ | 
|---|
|  | 17 |  | 
|---|
| [2] | 18 | #define INCL_DOS | 
|---|
|  | 19 | #define INCL_WIN | 
|---|
| [328] | 20 | #include <os2.h> | 
|---|
| [2] | 21 |  | 
|---|
|  | 22 | #include <stdlib.h> | 
|---|
|  | 23 | #include <stdio.h> | 
|---|
|  | 24 | #include <string.h> | 
|---|
|  | 25 | #include <share.h> | 
|---|
| [328] | 26 |  | 
|---|
| [2] | 27 | #include "fm3dll.h" | 
|---|
|  | 28 | #include "fm3dlg.h" | 
|---|
|  | 29 | #include "fm3str.h" | 
|---|
|  | 30 |  | 
|---|
| [328] | 31 | static PSZ pszSrcFile = __FILE__; | 
|---|
|  | 32 |  | 
|---|
| [2] | 33 | /* prototypes */ | 
|---|
| [195] | 34 | static BOOL decode(FILE * in, FILE * out); | 
|---|
|  | 35 | static void outdec(char *p, FILE * f, int n); | 
|---|
| [2] | 36 |  | 
|---|
|  | 37 | /* single character decode */ | 
|---|
|  | 38 | #define DEC(c)  (((c) - ' ') & 077) | 
|---|
|  | 39 |  | 
|---|
|  | 40 | #pragma alloc_text(UUD,UUD,decode,outdec) | 
|---|
|  | 41 | #pragma alloc_text(MERGE,MergeDlgProc) | 
|---|
|  | 42 |  | 
|---|
| [195] | 43 | int UUD(char *filename, CHAR * dest) | 
|---|
|  | 44 | { | 
|---|
|  | 45 | FILE *in, *out; | 
|---|
|  | 46 | int mode, ret = 0; | 
|---|
|  | 47 | char buf[80]; | 
|---|
|  | 48 | char fakedest[CCHMAXPATH]; | 
|---|
| [2] | 49 |  | 
|---|
| [195] | 50 | if (!dest) | 
|---|
| [2] | 51 | dest = fakedest; | 
|---|
| [195] | 52 | in = _fsopen(filename, "r", SH_DENYWR); | 
|---|
|  | 53 | if (!in) | 
|---|
|  | 54 | { | 
|---|
| [2] | 55 | saymsg(MB_CANCEL, | 
|---|
| [195] | 56 | HWND_DESKTOP, | 
|---|
|  | 57 | GetPString(IDS_ERRORTEXT), | 
|---|
|  | 58 | GetPString(IDS_COMPCANTOPENTEXT), | 
|---|
|  | 59 | filename); | 
|---|
| [2] | 60 | return ret; | 
|---|
|  | 61 | } | 
|---|
|  | 62 |  | 
|---|
| [195] | 63 | /* search for header line */ | 
|---|
|  | 64 | for (;;) | 
|---|
|  | 65 | { | 
|---|
| [404] | 66 | if (!xfgets(buf, sizeof(buf), in,pszSrcFile,__LINE__)) { | 
|---|
| [2] | 67 | fclose(in); | 
|---|
|  | 68 | saymsg(MB_CANCEL, | 
|---|
| [195] | 69 | HWND_DESKTOP, | 
|---|
|  | 70 | GetPString(IDS_ERRORTEXT), | 
|---|
|  | 71 | GetPString(IDS_UUDNOBEGINTEXT), | 
|---|
|  | 72 | filename); | 
|---|
| [2] | 73 | return ret; | 
|---|
| [195] | 74 | } | 
|---|
|  | 75 | if (!strncmp(buf, "begin ", 6)) | 
|---|
|  | 76 | break; | 
|---|
|  | 77 | } | 
|---|
| [2] | 78 | *dest = 0; | 
|---|
| [195] | 79 | sscanf(buf, "begin %o %259s", &mode, dest); | 
|---|
| [2] | 80 | dest[CCHMAXPATH - 1] = 0; | 
|---|
| [195] | 81 | {                                     /* place dest in same directory as filename by default... */ | 
|---|
|  | 82 | char build[CCHMAXPATH], *p; | 
|---|
| [2] | 83 |  | 
|---|
| [195] | 84 | strcpy(build, filename); | 
|---|
|  | 85 | p = strrchr(build, '\\'); | 
|---|
|  | 86 | if (p) | 
|---|
|  | 87 | { | 
|---|
| [2] | 88 | p++; | 
|---|
|  | 89 | *p = 0; | 
|---|
|  | 90 | } | 
|---|
|  | 91 | else | 
|---|
| [195] | 92 | strcat(build, "\\"); | 
|---|
|  | 93 | strncat(build, dest, CCHMAXPATH - strlen(dest)); | 
|---|
|  | 94 | strcpy(dest, build); | 
|---|
| [2] | 95 | } | 
|---|
|  | 96 |  | 
|---|
| [195] | 97 | if (!export_filename(HWND_DESKTOP, dest, FALSE)) | 
|---|
|  | 98 | { | 
|---|
| [2] | 99 | fclose(in); | 
|---|
|  | 100 | return ret; | 
|---|
|  | 101 | } | 
|---|
|  | 102 |  | 
|---|
| [195] | 103 | /* create output file */ | 
|---|
|  | 104 | out = _fsopen(dest, "ab+", SH_DENYWR); | 
|---|
|  | 105 | if (!out) | 
|---|
|  | 106 | { | 
|---|
| [2] | 107 | fclose(in); | 
|---|
|  | 108 | saymsg(MB_CANCEL, | 
|---|
| [195] | 109 | HWND_DESKTOP, | 
|---|
|  | 110 | GetPString(IDS_ERRORTEXT), | 
|---|
|  | 111 | GetPString(IDS_UUDCANTOPENFORTEXT), | 
|---|
|  | 112 | dest, | 
|---|
|  | 113 | filename); | 
|---|
| [2] | 114 | return ret; | 
|---|
| [195] | 115 | } | 
|---|
| [2] | 116 |  | 
|---|
| [204] | 117 | ret = 1; | 
|---|
|  | 118 | decode(in, out); | 
|---|
| [2] | 119 |  | 
|---|
| [404] | 120 | xfgets(buf, sizeof(buf), in,pszSrcFile,__LINE__); | 
|---|
| [204] | 121 |  | 
|---|
| [2] | 122 | fclose(in); | 
|---|
|  | 123 | fclose(out); | 
|---|
|  | 124 | return ret; | 
|---|
|  | 125 | } | 
|---|
|  | 126 |  | 
|---|
|  | 127 | /* | 
|---|
|  | 128 | * copy from in to out, decoding as you go along. | 
|---|
|  | 129 | */ | 
|---|
| [195] | 130 | static BOOL decode(FILE * in, FILE * out) | 
|---|
|  | 131 | { | 
|---|
|  | 132 | char buf[80]; | 
|---|
|  | 133 | char *bp; | 
|---|
|  | 134 | int n; | 
|---|
| [2] | 135 |  | 
|---|
| [195] | 136 | for (;;) | 
|---|
|  | 137 | { | 
|---|
|  | 138 | /* for each input line */ | 
|---|
| [404] | 139 | if (!xfgets(buf, sizeof(buf), in,pszSrcFile,__LINE__)) | 
|---|
| [2] | 140 | return FALSE; | 
|---|
|  | 141 | n = DEC(buf[0]); | 
|---|
| [195] | 142 | if (n <= 0) | 
|---|
|  | 143 | break; | 
|---|
|  | 144 | bp = &buf[1]; | 
|---|
|  | 145 | while (n > 0) | 
|---|
|  | 146 | { | 
|---|
|  | 147 | outdec(bp, out, n); | 
|---|
|  | 148 | bp += 4; | 
|---|
|  | 149 | n -= 3; | 
|---|
|  | 150 | } | 
|---|
|  | 151 | } | 
|---|
| [2] | 152 | return TRUE; | 
|---|
|  | 153 | } | 
|---|
|  | 154 |  | 
|---|
|  | 155 | /* | 
|---|
|  | 156 | * output a group of 3 bytes (4 input characters). | 
|---|
|  | 157 | * the input chars are pointed to by p, they are to | 
|---|
|  | 158 | * be output to file f.  n is used to tell us not to | 
|---|
|  | 159 | * output all of them at the end of the file. | 
|---|
|  | 160 | */ | 
|---|
| [195] | 161 | static void outdec(char *p, FILE * f, int n) | 
|---|
|  | 162 | { | 
|---|
| [204] | 163 | INT c1, c2, c3; | 
|---|
| [2] | 164 |  | 
|---|
| [204] | 165 | c1 = DEC(*p) << 2 | (UINT)DEC(p[1]) >> 4; | 
|---|
|  | 166 | c2 = DEC(p[1]) << 4 | (UINT)DEC(p[2]) >> 2; | 
|---|
| [195] | 167 | c3 = DEC(p[2]) << 6 | DEC(p[3]); | 
|---|
|  | 168 | if (n >= 1) | 
|---|
|  | 169 | putc(c1, f); | 
|---|
|  | 170 | if (n >= 2) | 
|---|
|  | 171 | putc(c2, f); | 
|---|
|  | 172 | if (n >= 3) | 
|---|
|  | 173 | putc(c3, f); | 
|---|
| [2] | 174 | } | 
|---|
|  | 175 |  | 
|---|
| [195] | 176 | MRESULT EXPENTRY MergeDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
|  | 177 | { | 
|---|
| [2] | 178 | WORKER *wk; | 
|---|
|  | 179 |  | 
|---|
| [195] | 180 | switch (msg) | 
|---|
|  | 181 | { | 
|---|
|  | 182 | case WM_INITDLG: | 
|---|
|  | 183 | if (mp2) | 
|---|
|  | 184 | { | 
|---|
|  | 185 | WinSetWindowPtr(hwnd, 0, mp2); | 
|---|
|  | 186 | wk = (WORKER *) mp2; | 
|---|
|  | 187 | if (wk -> li && wk -> li -> list && wk -> li -> list[0]) | 
|---|
|  | 188 | { | 
|---|
|  | 189 | WinSendDlgItemMsg(hwnd, MRG_TARGETNAME, EM_SETTEXTLIMIT, | 
|---|
|  | 190 | MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); | 
|---|
|  | 191 | PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); | 
|---|
| [2] | 192 | } | 
|---|
|  | 193 | else | 
|---|
| [195] | 194 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 195 | } | 
|---|
|  | 196 | else | 
|---|
|  | 197 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 198 | break; | 
|---|
| [2] | 199 |  | 
|---|
| [195] | 200 | case UM_UNDO: | 
|---|
|  | 201 | WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_DELETEALL, MPVOID, MPVOID); | 
|---|
|  | 202 | wk = WinQueryWindowPtr(hwnd, 0); | 
|---|
|  | 203 | if (wk) | 
|---|
|  | 204 | { | 
|---|
| [2] | 205 |  | 
|---|
| [195] | 206 | INT x, numfiles = 0; | 
|---|
|  | 207 | SHORT start; | 
|---|
|  | 208 | CHAR *p; | 
|---|
| [2] | 209 |  | 
|---|
| [195] | 210 | WinSetDlgItemText(hwnd, MRG_TARGETNAME, wk -> li -> targetpath); | 
|---|
|  | 211 | start = 0; | 
|---|
|  | 212 | p = strrchr(wk -> li -> targetpath, '\\'); | 
|---|
|  | 213 | if (p) | 
|---|
|  | 214 | start = (p + 1) - wk -> li -> targetpath; | 
|---|
|  | 215 | WinSendDlgItemMsg(hwnd, MRG_TARGETNAME, EM_SETSEL, | 
|---|
|  | 216 | MPFROM2SHORT(start, CCHMAXPATH), MPVOID); | 
|---|
|  | 217 | for (x = 0; wk -> li -> list[x]; x++) | 
|---|
|  | 218 | { | 
|---|
|  | 219 | if (IsFile(wk -> li -> list[x]) == 1) | 
|---|
|  | 220 | { | 
|---|
|  | 221 | numfiles++; | 
|---|
|  | 222 | WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_INSERTITEM, | 
|---|
|  | 223 | MPFROM2SHORT(LIT_END, 0), | 
|---|
|  | 224 | MPFROMP(wk -> li -> list[x])); | 
|---|
|  | 225 | } | 
|---|
| [2] | 226 | } | 
|---|
| [195] | 227 | WinCheckButton(hwnd, MRG_BINARY, (wk -> li -> type == IDM_MERGEBINARY)); | 
|---|
|  | 228 | if (!numfiles) | 
|---|
|  | 229 | { | 
|---|
|  | 230 | saymsg(MB_CANCEL | MB_ICONEXCLAMATION, | 
|---|
|  | 231 | hwnd, | 
|---|
|  | 232 | GetPString(IDS_SILLYERRORTEXT), | 
|---|
|  | 233 | GetPString(IDS_MERGEWASTETEXT)); | 
|---|
|  | 234 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 235 | } | 
|---|
|  | 236 | } | 
|---|
|  | 237 | return 0; | 
|---|
| [2] | 238 |  | 
|---|
| [195] | 239 | case WM_CONTROL: | 
|---|
|  | 240 | switch (SHORT1FROMMP(mp1)) | 
|---|
|  | 241 | { | 
|---|
|  | 242 | case MRG_LISTBOX: | 
|---|
|  | 243 | switch (SHORT2FROMMP(mp1)) | 
|---|
|  | 244 | { | 
|---|
|  | 245 | case LN_ENTER: | 
|---|
|  | 246 | { | 
|---|
|  | 247 | SHORT x; | 
|---|
|  | 248 | CHAR szBuffer[CCHMAXPATH]; | 
|---|
| [2] | 249 |  | 
|---|
| [195] | 250 | x = (SHORT) WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYSELECTION, | 
|---|
|  | 251 | MPFROMSHORT(LIT_FIRST), MPVOID); | 
|---|
|  | 252 | if (x >= 0) | 
|---|
|  | 253 | { | 
|---|
|  | 254 | *szBuffer = 0; | 
|---|
|  | 255 | WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYITEMTEXT, | 
|---|
|  | 256 | MPFROM2SHORT(x, CCHMAXPATH), | 
|---|
|  | 257 | MPFROMP(szBuffer)); | 
|---|
|  | 258 | if (*szBuffer) | 
|---|
|  | 259 | QuickEdit(hwnd, szBuffer); | 
|---|
|  | 260 | } | 
|---|
|  | 261 | } | 
|---|
|  | 262 | break; | 
|---|
| [2] | 263 | } | 
|---|
|  | 264 | break; | 
|---|
| [195] | 265 | } | 
|---|
|  | 266 | break; | 
|---|
| [2] | 267 |  | 
|---|
| [195] | 268 | case WM_ADJUSTWINDOWPOS: | 
|---|
|  | 269 | PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); | 
|---|
|  | 270 | break; | 
|---|
| [2] | 271 |  | 
|---|
| [195] | 272 | case UM_SETDIR: | 
|---|
|  | 273 | PaintRecessedWindow(WinWindowFromID(hwnd, MRG_HELP), (HPS) 0, FALSE, TRUE); | 
|---|
|  | 274 | return 0; | 
|---|
| [2] | 275 |  | 
|---|
| [195] | 276 | case WM_COMMAND: | 
|---|
|  | 277 | switch (SHORT1FROMMP(mp1)) | 
|---|
|  | 278 | { | 
|---|
|  | 279 | case IDM_UNDO: | 
|---|
|  | 280 | PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); | 
|---|
|  | 281 | break; | 
|---|
| [2] | 282 |  | 
|---|
| [195] | 283 | case MRG_CHANGETARGET: | 
|---|
|  | 284 | wk = WinQueryWindowPtr(hwnd, 0); | 
|---|
|  | 285 | if (wk) | 
|---|
|  | 286 | { | 
|---|
| [2] | 287 |  | 
|---|
| [195] | 288 | CHAR filename[CCHMAXPATH]; | 
|---|
| [2] | 289 |  | 
|---|
| [195] | 290 | strcpy(filename, wk -> li -> targetpath); | 
|---|
|  | 291 | if (export_filename(HWND_DESKTOP, filename, FALSE) && *filename) | 
|---|
|  | 292 | { | 
|---|
|  | 293 | strcpy(wk -> li -> targetpath, filename); | 
|---|
|  | 294 | WinSetDlgItemText(hwnd, MRG_TARGETNAME, wk -> li -> targetpath); | 
|---|
|  | 295 | } | 
|---|
|  | 296 | } | 
|---|
|  | 297 | break; | 
|---|
| [2] | 298 |  | 
|---|
| [195] | 299 | case MRG_REMOVE: | 
|---|
|  | 300 | { | 
|---|
|  | 301 | SHORT x; | 
|---|
| [2] | 302 |  | 
|---|
| [195] | 303 | x = (SHORT) WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYSELECTION, | 
|---|
|  | 304 | MPFROMSHORT(LIT_FIRST), MPVOID); | 
|---|
|  | 305 | if (x >= 0) | 
|---|
|  | 306 | WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_DELETEITEM, | 
|---|
|  | 307 | MPFROMSHORT(x), MPVOID); | 
|---|
|  | 308 | } | 
|---|
|  | 309 | break; | 
|---|
| [2] | 310 |  | 
|---|
| [195] | 311 | case MRG_BOTTOM: | 
|---|
|  | 312 | case MRG_TOP: | 
|---|
|  | 313 | { | 
|---|
|  | 314 | SHORT x; | 
|---|
|  | 315 | CHAR szBuffer[CCHMAXPATH]; | 
|---|
| [2] | 316 |  | 
|---|
| [195] | 317 | x = (SHORT) WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYSELECTION, | 
|---|
|  | 318 | MPFROMSHORT(LIT_FIRST), MPVOID); | 
|---|
|  | 319 | if (x >= 0) | 
|---|
|  | 320 | { | 
|---|
|  | 321 | *szBuffer = 0; | 
|---|
|  | 322 | WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYITEMTEXT, | 
|---|
|  | 323 | MPFROM2SHORT(x, CCHMAXPATH), | 
|---|
|  | 324 | MPFROMP(szBuffer)); | 
|---|
|  | 325 | if (*szBuffer) | 
|---|
|  | 326 | { | 
|---|
|  | 327 | WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_DELETEITEM, | 
|---|
|  | 328 | MPFROMSHORT(x), MPVOID); | 
|---|
|  | 329 | if (SHORT1FROMMP(mp1) == MRG_TOP) | 
|---|
|  | 330 | WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_INSERTITEM, | 
|---|
|  | 331 | MPFROM2SHORT(0, 0), | 
|---|
|  | 332 | MPFROMP(szBuffer)); | 
|---|
|  | 333 | else | 
|---|
|  | 334 | WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_INSERTITEM, | 
|---|
|  | 335 | MPFROM2SHORT(LIT_END, 0), | 
|---|
|  | 336 | MPFROMP(szBuffer)); | 
|---|
|  | 337 | } | 
|---|
|  | 338 | } | 
|---|
|  | 339 | } | 
|---|
|  | 340 | break; | 
|---|
| [2] | 341 |  | 
|---|
| [195] | 342 | case DID_CANCEL: | 
|---|
|  | 343 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 344 | break; | 
|---|
| [2] | 345 |  | 
|---|
| [195] | 346 | case IDM_HELP: | 
|---|
|  | 347 | if (hwndHelp) | 
|---|
|  | 348 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP, | 
|---|
|  | 349 | MPFROM2SHORT(HELP_MERGE, 0), | 
|---|
|  | 350 | MPFROMSHORT(HM_RESOURCEID)); | 
|---|
|  | 351 | break; | 
|---|
| [2] | 352 |  | 
|---|
| [195] | 353 | case DID_OK: | 
|---|
|  | 354 | wk = WinQueryWindowPtr(hwnd, 0); | 
|---|
|  | 355 | if (wk) | 
|---|
|  | 356 | { | 
|---|
| [2] | 357 |  | 
|---|
| [195] | 358 | BOOL append, binary; | 
|---|
|  | 359 | CHAR **list = NULL, **test, szBuffer[CCHMAXPATH]; | 
|---|
|  | 360 | INT numfiles = 0, numalloc = 0, error; | 
|---|
|  | 361 | SHORT x, y; | 
|---|
| [2] | 362 |  | 
|---|
| [195] | 363 | *szBuffer = 0; | 
|---|
|  | 364 | WinQueryDlgItemText(hwnd, | 
|---|
|  | 365 | MRG_TARGETNAME, | 
|---|
|  | 366 | CCHMAXPATH, | 
|---|
|  | 367 | szBuffer); | 
|---|
|  | 368 | if (!*szBuffer) | 
|---|
|  | 369 | { | 
|---|
|  | 370 | DosBeep(50, 100); | 
|---|
|  | 371 | WinSetFocus(HWND_DESKTOP, | 
|---|
|  | 372 | WinWindowFromID(hwnd, MRG_TARGETNAME)); | 
|---|
|  | 373 | break; | 
|---|
|  | 374 | } | 
|---|
|  | 375 | if (DosQueryPathInfo(szBuffer, | 
|---|
|  | 376 | FIL_QUERYFULLNAME, | 
|---|
|  | 377 | wk -> li -> targetpath, | 
|---|
|  | 378 | CCHMAXPATH)) | 
|---|
|  | 379 | { | 
|---|
|  | 380 | DosBeep(50, 100); | 
|---|
|  | 381 | WinSetFocus(HWND_DESKTOP, | 
|---|
|  | 382 | WinWindowFromID(hwnd, MRG_TARGETNAME)); | 
|---|
|  | 383 | break; | 
|---|
|  | 384 | } | 
|---|
|  | 385 | WinSetDlgItemText(hwnd, | 
|---|
|  | 386 | MRG_TARGETNAME, | 
|---|
|  | 387 | szBuffer); | 
|---|
|  | 388 | append = WinQueryButtonCheckstate(hwnd, MRG_APPEND); | 
|---|
|  | 389 | binary = WinQueryButtonCheckstate(hwnd, MRG_BINARY); | 
|---|
|  | 390 | wk -> li -> type = (append && binary) ? IDM_MERGEBINARYAPPEND : | 
|---|
|  | 391 | (append) ? IDM_MERGETEXTAPPEND : | 
|---|
|  | 392 | (binary) ? IDM_MERGEBINARY : | 
|---|
|  | 393 | IDM_MERGETEXT; | 
|---|
|  | 394 | x = (SHORT) WinSendDlgItemMsg(hwnd, | 
|---|
|  | 395 | MRG_LISTBOX, | 
|---|
|  | 396 | LM_QUERYITEMCOUNT, | 
|---|
|  | 397 | MPVOID, | 
|---|
|  | 398 | MPVOID); | 
|---|
| [328] | 399 | for (y = 0; y < x; y++) { | 
|---|
| [195] | 400 | *szBuffer = 0; | 
|---|
|  | 401 | WinSendDlgItemMsg(hwnd, | 
|---|
|  | 402 | MRG_LISTBOX, | 
|---|
|  | 403 | LM_QUERYITEMTEXT, | 
|---|
|  | 404 | MPFROM2SHORT(y, CCHMAXPATH), | 
|---|
|  | 405 | MPFROMP(szBuffer)); | 
|---|
| [328] | 406 | if (*szBuffer) { | 
|---|
| [195] | 407 | error = AddToList(szBuffer, | 
|---|
|  | 408 | &list, | 
|---|
|  | 409 | &numfiles, | 
|---|
|  | 410 | &numalloc); | 
|---|
| [328] | 411 | if (error) { | 
|---|
|  | 412 | Runtime_Error(pszSrcFile, __LINE__, "AddToList"); | 
|---|
| [195] | 413 | break; | 
|---|
|  | 414 | } | 
|---|
|  | 415 | } | 
|---|
|  | 416 | } | 
|---|
|  | 417 | if (numfiles && list && numfiles + 1 < numalloc) | 
|---|
|  | 418 | { | 
|---|
| [328] | 419 | test = xrealloc(list, sizeof(CHAR *) * (numfiles + 1),pszSrcFile,__LINE__); | 
|---|
| [195] | 420 | if (test) | 
|---|
|  | 421 | list = test; | 
|---|
|  | 422 | } | 
|---|
| [328] | 423 | if (!list || !list[0]) { | 
|---|
| [382] | 424 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); | 
|---|
| [328] | 425 | break; | 
|---|
|  | 426 | } | 
|---|
|  | 427 | else { | 
|---|
| [195] | 428 | FreeList(wk -> li -> list); | 
|---|
|  | 429 | wk -> li -> list = list; | 
|---|
|  | 430 | } | 
|---|
| [2] | 431 | } | 
|---|
| [195] | 432 | WinDismissDlg(hwnd, 1); | 
|---|
|  | 433 | break; | 
|---|
| [328] | 434 | } // switch WM_COMMAND mp1 | 
|---|
| [195] | 435 | return 0; | 
|---|
| [328] | 436 | } // switch msg | 
|---|
| [195] | 437 | return WinDefDlgProc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 438 | } | 
|---|