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