[123] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: avl.c 907 2008-01-06 07:26:17Z stevenhl $
|
---|
| 5 |
|
---|
[251] | 6 | archiver.bb2 search, load, save and date parse
|
---|
[123] | 7 |
|
---|
[251] | 8 | Copyright (c) 1993, 1998 M. Kimes
|
---|
[907] | 9 | Copyright (c) 2004, 2008 Steven H.Levine
|
---|
[123] | 10 |
|
---|
[247] | 11 | 01 Aug 04 SHL Rework lstrip/rstrip usage
|
---|
| 12 | 13 Aug 05 SHL Beautify with indent
|
---|
[248] | 13 | 13 Aug 05 SHL find_type: correct no sig exists bypass logic
|
---|
[251] | 14 | 13 Aug 05 SHL SBoxDlgProc: avoid dereferencing NULL signature
|
---|
[279] | 15 | 18 Aug 05 SHL Comments
|
---|
[287] | 16 | 31 Dec 05 SHL indent -i2
|
---|
[306] | 17 | 08 Dec 05 SHL load_archivers: allow empty startlist
|
---|
| 18 | 30 Dec 05 SHL load_archivers: use get_archiver_line?(), clean nits
|
---|
| 19 | 29 May 06 SHL SBoxDlgProc: support move, add, delete
|
---|
| 20 | 30 May 06 SHL load_archivers: add reload support
|
---|
| 21 | 16 Jun 06 SHL load_archivers: support signatures containing 0s
|
---|
[312] | 22 | 26 Jun 06 SHL load_archivers: remember where comments are
|
---|
[342] | 23 | 14 Jul 06 SHL Use Runtime_Error
|
---|
[405] | 24 | 29 Jul 06 SHL Use xfgets, xfgets_bstripcr
|
---|
[439] | 25 | 15 Aug 06 SHL Use Runtime_Error more
|
---|
[537] | 26 | 01 Nov 06 SHL Turn off leftover debug code
|
---|
[603] | 27 | 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limit
|
---|
[618] | 28 | 19 Apr 07 SHL Use FreeDragInfoData
|
---|
| 29 | 19 Apr 07 SHL Add more drag/drop error checking
|
---|
[793] | 30 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
|
---|
[806] | 31 | 25 Aug 07 SHL load_archivers: add missing close on error path
|
---|
[123] | 32 |
|
---|
| 33 | ***********************************************************************/
|
---|
| 34 |
|
---|
[907] | 35 | #include <stdlib.h>
|
---|
| 36 | #include <string.h>
|
---|
| 37 | #include <ctype.h>
|
---|
| 38 | #include <share.h>
|
---|
| 39 |
|
---|
| 40 | #define INCL_DOS
|
---|
[2] | 41 | #define INCL_WIN
|
---|
[306] | 42 | #define INCL_WINSTDDRAG
|
---|
[841] | 43 | #define INCL_LONGLONG
|
---|
[2] | 44 |
|
---|
| 45 | #include "fm3dlg.h"
|
---|
| 46 | #include "fm3str.h"
|
---|
[907] | 47 | #include "avl.h"
|
---|
| 48 | #include "strutil.h" // GetPString
|
---|
| 49 | #include "errutil.h" // Runtime_Error
|
---|
| 50 | #include "fm3dll.h"
|
---|
[2] | 51 |
|
---|
[342] | 52 | static PSZ pszSrcFile = __FILE__;
|
---|
| 53 |
|
---|
[551] | 54 | static void free_arc_type(ARC_TYPE * pat);
|
---|
[306] | 55 | static void fill_listbox(HWND hwnd, BOOL fShowAll, SHORT sOldSelect);
|
---|
| 56 |
|
---|
| 57 | //=== quick_find_type() ===
|
---|
| 58 |
|
---|
[551] | 59 | ARC_TYPE *quick_find_type(CHAR * filespec, ARC_TYPE * topsig)
|
---|
[247] | 60 | {
|
---|
[287] | 61 | ARC_TYPE *info, *found = NULL;
|
---|
| 62 | CHAR *p;
|
---|
[2] | 63 |
|
---|
[306] | 64 | if (!arcsigsloaded)
|
---|
[287] | 65 | load_archivers();
|
---|
| 66 | p = strrchr(filespec, '.');
|
---|
[551] | 67 | if (p) {
|
---|
[287] | 68 | p++;
|
---|
| 69 | info = (topsig) ? topsig : arcsighead;
|
---|
[551] | 70 | while (info) {
|
---|
| 71 | if (info->ext && *(info->ext) && !stricmp(p, info->ext)) {
|
---|
[287] | 72 | found = find_type(filespec, topsig);
|
---|
| 73 | break;
|
---|
| 74 | }
|
---|
[551] | 75 | info = info->next;
|
---|
[2] | 76 | }
|
---|
[287] | 77 | }
|
---|
| 78 | return found;
|
---|
[2] | 79 | }
|
---|
| 80 |
|
---|
[306] | 81 | //=== fill_listbox() fill or refill listbox from current archiver definitions ===
|
---|
| 82 |
|
---|
| 83 | static VOID fill_listbox(HWND hwnd, BOOL fShowAll, SHORT sOldSelect)
|
---|
| 84 | {
|
---|
| 85 | ARC_TYPE *pat;
|
---|
| 86 | BOOL found = FALSE;
|
---|
| 87 | SHORT sSelect;
|
---|
| 88 |
|
---|
| 89 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_DELETEALL, MPVOID, MPVOID);
|
---|
| 90 |
|
---|
[551] | 91 | for (pat = arcsighead; pat; pat = pat->next) {
|
---|
[306] | 92 | /*
|
---|
| 93 | * this inner loop tests for a dup signature entry and assures
|
---|
| 94 | * that only the entry at the top of the list gets used for
|
---|
| 95 | * conversion; editing any is okay
|
---|
| 96 | */
|
---|
[551] | 97 | if (!fShowAll) {
|
---|
[306] | 98 | ARC_TYPE *pat2;
|
---|
| 99 | BOOL isDup = FALSE;
|
---|
[551] | 100 |
|
---|
[306] | 101 | for (pat2 = arcsighead;
|
---|
[551] | 102 | pat2 && pat->siglen && pat2 != pat && !isDup; pat2 = pat2->next) {
|
---|
| 103 | isDup = pat2->siglen == pat->siglen &&
|
---|
| 104 | !memcmp(pat2->signature, pat->signature, pat->siglen);
|
---|
| 105 | } // for
|
---|
[306] | 106 | if (isDup)
|
---|
| 107 | continue;
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 | // If caller is editing archivers or entry useful to caller, show in listbox
|
---|
[551] | 111 | if (fShowAll || (pat->id && pat->extract && pat->create)) {
|
---|
[306] | 112 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_INSERTITEM,
|
---|
| 113 | MPFROM2SHORT(LIT_END, 0),
|
---|
[551] | 114 | MPFROMP(pat->id ? pat->id : "?"));
|
---|
| 115 | if (!found && *szDefArc && pat->id && !strcmp(szDefArc, pat->id)) {
|
---|
[306] | 116 | // Highlight default
|
---|
| 117 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SELECTITEM,
|
---|
| 118 | MPFROMSHORT(sSelect), MPFROMSHORT(TRUE));
|
---|
| 119 | found = TRUE;
|
---|
| 120 | }
|
---|
| 121 | }
|
---|
[551] | 122 | else {
|
---|
[306] | 123 | // Complain about odd entry
|
---|
[551] | 124 | if (!pat->id || !*pat->id) {
|
---|
[306] | 125 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_INSERTITEM,
|
---|
| 126 | MPFROM2SHORT(LIT_END, 0),
|
---|
| 127 | MPFROMP(GetPString(IDS_UNKNOWNUNUSABLETEXT)));
|
---|
| 128 | }
|
---|
[551] | 129 | else {
|
---|
[306] | 130 | CHAR s[81];
|
---|
[551] | 131 |
|
---|
| 132 | sprintf(s, "%0.12s %s", pat->id, GetPString(IDS_UNUSABLETEXT));
|
---|
[306] | 133 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_INSERTITEM,
|
---|
[551] | 134 | MPFROM2SHORT(LIT_END, 0), MPFROMP(s));
|
---|
[306] | 135 | }
|
---|
| 136 | }
|
---|
[551] | 137 | } // while scanning
|
---|
[306] | 138 |
|
---|
| 139 | // Try to reselect last selection unless user wants default selection
|
---|
| 140 | if (sOldSelect != LIT_NONE && !found) {
|
---|
[551] | 141 | SHORT sItemCount =
|
---|
| 142 | (SHORT) WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_QUERYITEMCOUNT,
|
---|
| 143 | MPVOID, MPVOID);
|
---|
| 144 |
|
---|
[306] | 145 | if (sOldSelect >= sItemCount)
|
---|
| 146 | sOldSelect = sItemCount - 1;
|
---|
| 147 | if (sOldSelect >= 0) {
|
---|
| 148 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SELECTITEM,
|
---|
[551] | 149 | MPFROMSHORT(sOldSelect), MPFROMSHORT(TRUE));
|
---|
[306] | 150 | }
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 | if (found)
|
---|
| 154 | PosOverOkay(hwnd);
|
---|
| 155 | }
|
---|
| 156 |
|
---|
[551] | 157 | ARC_TYPE *find_type(CHAR * filespec, ARC_TYPE * topsig)
|
---|
[247] | 158 | {
|
---|
[287] | 159 | HFILE handle;
|
---|
| 160 | ULONG action;
|
---|
| 161 | ULONG len;
|
---|
| 162 | ULONG l;
|
---|
| 163 | ARC_TYPE *info;
|
---|
| 164 | CHAR *p;
|
---|
[850] | 165 | // CHAR buffer[80];
|
---|
| 166 | CHAR buffer[4096]; // 06 Oct 07 SHL Protect against NTFS defect
|
---|
[2] | 167 |
|
---|
[306] | 168 | if (!arcsigsloaded)
|
---|
[287] | 169 | load_archivers();
|
---|
| 170 | if (!topsig)
|
---|
| 171 | topsig = arcsighead;
|
---|
| 172 | DosError(FERR_DISABLEHARDERR);
|
---|
[844] | 173 | if (DosOpen(filespec,
|
---|
| 174 | &handle,
|
---|
| 175 | &action,
|
---|
| 176 | 0,
|
---|
| 177 | 0,
|
---|
| 178 | OPEN_ACTION_FAIL_IF_NEW |
|
---|
| 179 | OPEN_ACTION_OPEN_IF_EXISTS,
|
---|
| 180 | OPEN_FLAGS_FAIL_ON_ERROR |
|
---|
| 181 | OPEN_FLAGS_NOINHERIT |
|
---|
| 182 | OPEN_FLAGS_RANDOMSEQUENTIAL |
|
---|
| 183 | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0))
|
---|
[287] | 184 | return NULL;
|
---|
| 185 | // Scan signatures
|
---|
[551] | 186 | for (info = topsig; info; info = info->next) {
|
---|
| 187 | if (info->siglen == 0) {
|
---|
[287] | 188 | // No signature -- check extension
|
---|
| 189 | p = strrchr(filespec, '.');
|
---|
[551] | 190 | if (p) {
|
---|
[287] | 191 | p++;
|
---|
[551] | 192 | if (info->ext && *(info->ext) && !stricmp(p, info->ext))
|
---|
[287] | 193 | break; // Matched
|
---|
| 194 |
|
---|
| 195 | }
|
---|
| 196 | continue; // Next sig
|
---|
| 197 |
|
---|
| 198 | }
|
---|
| 199 | // Try signature match
|
---|
[551] | 200 | l = info->siglen;
|
---|
[287] | 201 | l = min(l, 79);
|
---|
| 202 | if (!DosChgFilePtr(handle,
|
---|
[551] | 203 | abs(info->file_offset),
|
---|
[832] | 204 | (info->file_offset >= 0) ?
|
---|
[551] | 205 | FILE_BEGIN : FILE_END, &len)) {
|
---|
| 206 | if (!DosRead(handle, buffer, l, &len) && len == l) {
|
---|
| 207 | if (!memcmp(info->signature, buffer, l))
|
---|
[287] | 208 | break; // Matched
|
---|
| 209 |
|
---|
| 210 | }
|
---|
| 211 | }
|
---|
| 212 | } // for
|
---|
| 213 |
|
---|
| 214 | DosClose(handle); /* Either way, we're done for now */
|
---|
| 215 | return info; /* Return signature, if any */
|
---|
[2] | 216 | }
|
---|
| 217 |
|
---|
[306] | 218 | //=== free_arc_type() free allocated ARC_TYPE ===
|
---|
[2] | 219 |
|
---|
[551] | 220 | static void free_arc_type(ARC_TYPE * pat)
|
---|
[306] | 221 | {
|
---|
[551] | 222 | if (pat) {
|
---|
| 223 | xfree(pat->id);
|
---|
| 224 | xfree(pat->ext);
|
---|
| 225 | xfree(pat->list);
|
---|
| 226 | xfree(pat->extract);
|
---|
| 227 | xfree(pat->create);
|
---|
| 228 | xfree(pat->move);
|
---|
| 229 | xfree(pat->delete);
|
---|
| 230 | xfree(pat->signature);
|
---|
| 231 | xfree(pat->startlist);
|
---|
| 232 | xfree(pat->endlist);
|
---|
| 233 | xfree(pat->exwdirs);
|
---|
| 234 | xfree(pat->test);
|
---|
| 235 | xfree(pat->createrecurse);
|
---|
| 236 | xfree(pat->createwdirs);
|
---|
| 237 | xfree(pat->movewdirs);
|
---|
[306] | 238 | free(pat);
|
---|
| 239 | }
|
---|
| 240 | }
|
---|
| 241 |
|
---|
[551] | 242 | static UINT cur_line_num; // Input file line counter
|
---|
[306] | 243 |
|
---|
[312] | 244 | //=== get_line_strip_comments() read line, strip comments and whitespace ===
|
---|
| 245 |
|
---|
[306] | 246 | #define ARCHIVER_LINE_BYTES 256
|
---|
| 247 |
|
---|
[551] | 248 | static PSZ get_line_strip_comments(PSZ pszIn, FILE * fp)
|
---|
[306] | 249 | {
|
---|
[405] | 250 | PSZ psz = xfgets(pszIn, ARCHIVER_LINE_BYTES, fp, pszSrcFile, __LINE__);
|
---|
[306] | 251 | PSZ psz2;
|
---|
| 252 |
|
---|
[312] | 253 | if (psz) {
|
---|
| 254 | cur_line_num++;
|
---|
[306] | 255 | psz2 = strchr(pszIn, ';');
|
---|
| 256 | if (psz2)
|
---|
| 257 | *psz2 = 0; // Chop comment
|
---|
| 258 | bstripcr(pszIn); // Strip leading white and trailing white and CR/LF
|
---|
| 259 |
|
---|
| 260 | }
|
---|
| 261 | return psz;
|
---|
| 262 | }
|
---|
| 263 |
|
---|
[312] | 264 | //=== get_line_strip_white() read line, strip whitespace ===
|
---|
[306] | 265 |
|
---|
[551] | 266 | static PSZ get_line_strip_white(PSZ pszIn, FILE * fp)
|
---|
[306] | 267 | {
|
---|
[551] | 268 | PSZ psz =
|
---|
| 269 | xfgets_bstripcr(pszIn, ARCHIVER_LINE_BYTES, fp, pszSrcFile, __LINE__);
|
---|
[306] | 270 |
|
---|
[405] | 271 | if (psz)
|
---|
[312] | 272 | cur_line_num++;
|
---|
[306] | 273 |
|
---|
| 274 | return psz;
|
---|
| 275 | }
|
---|
| 276 |
|
---|
| 277 | //=== load_archivers() load or reload archive definitions from archiver.bb2 ===
|
---|
| 278 |
|
---|
[247] | 279 | INT load_archivers(VOID)
|
---|
| 280 | {
|
---|
[312] | 281 | FILE *fp;
|
---|
| 282 | CHAR sz[ARCHIVER_LINE_BYTES + 1];
|
---|
| 283 | CHAR *psz;
|
---|
| 284 | ARC_TYPE *pat = NULL;
|
---|
| 285 | ARC_TYPE *patLast = NULL;
|
---|
| 286 | UINT lines_per_arcsig = LINES_PER_ARCSIG;
|
---|
| 287 | UINT per_sig_comment_line_num = 0;
|
---|
[306] | 288 | INT i;
|
---|
[2] | 289 |
|
---|
[312] | 290 | // Free current signatures
|
---|
[306] | 291 | if (arcsighead) {
|
---|
| 292 | for (pat = arcsighead; pat;) {
|
---|
| 293 | patLast = pat;
|
---|
| 294 | pat = pat->next;
|
---|
| 295 | free_arc_type(patLast);
|
---|
| 296 | }
|
---|
| 297 | arcsighead = NULL;
|
---|
| 298 | }
|
---|
| 299 |
|
---|
| 300 | arcsigsmodified = FALSE;
|
---|
[312] | 301 | arcsigs_header_lines = 0;
|
---|
| 302 | arcsigs_trailer_line_num = 0;
|
---|
[306] | 303 |
|
---|
[287] | 304 | DosEnterCritSec();
|
---|
[312] | 305 | psz = searchpath(GetPString(IDS_ARCHIVERBB2));
|
---|
[551] | 306 | if (!psz || !*psz) {
|
---|
[2] | 307 | DosExitCritSec();
|
---|
[287] | 308 | return -1;
|
---|
| 309 | }
|
---|
[312] | 310 | fp = _fsopen(psz, "r", SH_DENYWR);
|
---|
[287] | 311 | DosExitCritSec();
|
---|
[312] | 312 | if (!fp)
|
---|
[287] | 313 | return -2;
|
---|
[312] | 314 | strcpy(archiverbb2, psz); // Remember full path
|
---|
| 315 |
|
---|
| 316 | cur_line_num = 0;
|
---|
| 317 |
|
---|
| 318 | // Line 1 must contain number of lines per signature definition
|
---|
[551] | 319 | if (!get_line_strip_comments(sz, fp)) {
|
---|
[312] | 320 | fclose(fp);
|
---|
[287] | 321 | return -3;
|
---|
| 322 | }
|
---|
[312] | 323 | if (*sz)
|
---|
| 324 | lines_per_arcsig = atoi(sz);
|
---|
[806] | 325 | if (!*sz || lines_per_arcsig < LINES_PER_ARCSIG) {
|
---|
| 326 | fclose(fp); // 25 Aug 07 SHL
|
---|
[287] | 327 | return -3;
|
---|
[806] | 328 | }
|
---|
[312] | 329 |
|
---|
| 330 | // Parse rest of file
|
---|
| 331 | // 1st non-blank line starts definition
|
---|
| 332 | // Need to determine header size and start of trailer
|
---|
| 333 |
|
---|
[551] | 334 | while (!feof(fp)) {
|
---|
[312] | 335 | // If reading header
|
---|
| 336 | if (!arcsigs_header_lines) {
|
---|
| 337 | // Reading header - find header size and start of signtures
|
---|
| 338 | if (!get_line_strip_white(sz, fp))
|
---|
| 339 | break; // Unexpected EOF
|
---|
| 340 | if (stristr(sz, "-- Current Archivers --")) {
|
---|
| 341 | arcsigs_header_lines = cur_line_num;
|
---|
| 342 | continue;
|
---|
| 343 | }
|
---|
| 344 | if (!*sz || *sz == ';')
|
---|
| 345 | continue; // Header comment or blank line
|
---|
| 346 | else {
|
---|
| 347 | // Not a comment, must be start of signatures
|
---|
| 348 | PSZ psz2 = strchr(sz, ';');
|
---|
[551] | 349 |
|
---|
| 350 | if (psz2) {
|
---|
| 351 | *psz2 = 0; // Chop trailing comment
|
---|
| 352 | bstripcr(sz); // Strip leading white and trailing white and CR/LF
|
---|
[312] | 353 | }
|
---|
[551] | 354 | arcsigs_header_lines = cur_line_num - 1;
|
---|
[312] | 355 | }
|
---|
| 356 | }
|
---|
| 357 | else {
|
---|
| 358 | // Reading defintiions
|
---|
| 359 | if (!get_line_strip_comments(sz, fp))
|
---|
[551] | 360 | break; // EOF
|
---|
[312] | 361 | }
|
---|
| 362 |
|
---|
[287] | 363 | // fixme to avoid allocating empty fields
|
---|
[306] | 364 |
|
---|
[312] | 365 | // Remember start of per sig comments for next definition
|
---|
| 366 | if (per_sig_comment_line_num == 0)
|
---|
| 367 | per_sig_comment_line_num = cur_line_num;
|
---|
| 368 |
|
---|
[551] | 369 | if (*sz) {
|
---|
[312] | 370 | // At start of defintion
|
---|
| 371 |
|
---|
[551] | 372 | pat = xmallocz(sizeof(ARC_TYPE), pszSrcFile, __LINE__);
|
---|
[306] | 373 | if (!pat)
|
---|
[342] | 374 | break;
|
---|
[551] | 375 | pat->id = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 376 |
|
---|
[551] | 377 | pat->comment_line_num = per_sig_comment_line_num;
|
---|
| 378 | pat->defn_line_num = cur_line_num;
|
---|
[312] | 379 |
|
---|
| 380 | if (!get_line_strip_comments(sz, fp)) // line 2 - extension
|
---|
[287] | 381 | break;
|
---|
[312] | 382 | if (*sz)
|
---|
[551] | 383 | pat->ext = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 384 | else
|
---|
[551] | 385 | pat->ext = NULL;
|
---|
[312] | 386 | if (!get_line_strip_comments(sz, fp)) // line 3 - offset to signature
|
---|
[287] | 387 | break;
|
---|
[551] | 388 | pat->file_offset = atol(sz);
|
---|
[312] | 389 | if (!get_line_strip_comments(sz, fp)) // line 4 - list command
|
---|
[287] | 390 | break;
|
---|
[312] | 391 | if (*sz)
|
---|
[551] | 392 | pat->list = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 393 | else
|
---|
[551] | 394 | pat->list = NULL;
|
---|
| 395 | if (!pat->list)
|
---|
[312] | 396 | break; // Must have list command - fixme to complain
|
---|
| 397 | if (!get_line_strip_comments(sz, fp)) // line 5
|
---|
[287] | 398 | break;
|
---|
[312] | 399 | if (*sz)
|
---|
[551] | 400 | pat->extract = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 401 | else
|
---|
[551] | 402 | pat->extract = NULL;
|
---|
[312] | 403 | if (!get_line_strip_comments(sz, fp)) // line 6
|
---|
[287] | 404 | break;
|
---|
[312] | 405 | if (*sz)
|
---|
[551] | 406 | pat->exwdirs = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 407 | else
|
---|
[551] | 408 | pat->exwdirs = NULL;
|
---|
[312] | 409 | if (!get_line_strip_comments(sz, fp)) // line 7
|
---|
[287] | 410 | break;
|
---|
[312] | 411 | if (*sz)
|
---|
[551] | 412 | pat->test = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 413 | else
|
---|
[551] | 414 | pat->test = NULL;
|
---|
[312] | 415 | if (!get_line_strip_comments(sz, fp)) // line 8
|
---|
[287] | 416 | break;
|
---|
[312] | 417 | if (*sz)
|
---|
[551] | 418 | pat->create = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 419 | else
|
---|
[551] | 420 | pat->create = NULL;
|
---|
[312] | 421 | if (!get_line_strip_comments(sz, fp)) // line 9
|
---|
[287] | 422 | break;
|
---|
[312] | 423 | if (*sz)
|
---|
[551] | 424 | pat->createwdirs = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 425 | else
|
---|
[551] | 426 | pat->createwdirs = NULL;
|
---|
[312] | 427 | if (!get_line_strip_comments(sz, fp)) // line 10
|
---|
[287] | 428 | break;
|
---|
[312] | 429 | if (*sz)
|
---|
[551] | 430 | pat->createrecurse = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 431 | else
|
---|
[551] | 432 | pat->createrecurse = NULL;
|
---|
[312] | 433 | if (!get_line_strip_comments(sz, fp)) // line 11
|
---|
[287] | 434 | break;
|
---|
[312] | 435 | if (*sz)
|
---|
[551] | 436 | pat->move = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 437 | else
|
---|
[551] | 438 | pat->move = NULL;
|
---|
[312] | 439 | if (!get_line_strip_comments(sz, fp)) // line 12
|
---|
[287] | 440 | break;
|
---|
[312] | 441 | if (*sz)
|
---|
[551] | 442 | pat->movewdirs = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 443 | else
|
---|
[551] | 444 | pat->movewdirs = NULL;
|
---|
[312] | 445 | if (!get_line_strip_comments(sz, fp)) // line 13
|
---|
[287] | 446 | break;
|
---|
[312] | 447 | if (*sz)
|
---|
[551] | 448 | pat->delete = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[312] | 449 | else
|
---|
[551] | 450 | pat->delete = NULL;
|
---|
[312] | 451 | if (!get_line_strip_white(sz, fp)) // line 14
|
---|
[287] | 452 | break;
|
---|
[312] | 453 | i = literal(sz); // Translate \ escapes
|
---|
[551] | 454 | if (i) {
|
---|
| 455 | pat->siglen = i;
|
---|
| 456 | pat->signature = xmalloc(i, pszSrcFile, __LINE__);
|
---|
| 457 | if (!pat->signature)
|
---|
[287] | 458 | break;
|
---|
[551] | 459 | memcpy(pat->signature, sz, i); // signature may not be a string
|
---|
[287] | 460 | }
|
---|
[306] | 461 | else {
|
---|
[551] | 462 | pat->siglen = 0;
|
---|
| 463 | pat->signature = NULL;
|
---|
[306] | 464 | }
|
---|
[312] | 465 | if (!get_line_strip_white(sz, fp)) // line 15
|
---|
[306] | 466 | break;
|
---|
[312] | 467 | if (*sz)
|
---|
[551] | 468 | pat->startlist = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 469 | else
|
---|
[551] | 470 | pat->startlist = NULL;
|
---|
[312] | 471 | if (!get_line_strip_white(sz, fp)) // line 16
|
---|
[287] | 472 | break;
|
---|
[312] | 473 | if (*sz)
|
---|
[551] | 474 | pat->endlist = xstrdup(sz, pszSrcFile, __LINE__);
|
---|
[287] | 475 | else
|
---|
[551] | 476 | pat->endlist = NULL;
|
---|
[312] | 477 | if (!get_line_strip_comments(sz, fp)) // line 17
|
---|
[287] | 478 | break;
|
---|
[551] | 479 | pat->osizepos = atoi(sz);
|
---|
[312] | 480 | if (!get_line_strip_comments(sz, fp)) // line 18
|
---|
[287] | 481 | break;
|
---|
[551] | 482 | pat->nsizepos = atoi(sz);
|
---|
[312] | 483 | if (!get_line_strip_comments(sz, fp)) // line 19
|
---|
[287] | 484 | break;
|
---|
[551] | 485 | pat->fdpos = atoi(sz);
|
---|
[312] | 486 | psz = strchr(sz, ',');
|
---|
[551] | 487 | if (psz) {
|
---|
[312] | 488 | psz++;
|
---|
[551] | 489 | pat->datetype = atoi(psz);
|
---|
[287] | 490 | }
|
---|
[312] | 491 | if (!get_line_strip_comments(sz, fp)) // line 20
|
---|
[287] | 492 | break;
|
---|
[551] | 493 | pat->fdflds = atoi(sz);
|
---|
[312] | 494 | if (!get_line_strip_comments(sz, fp)) // line 21
|
---|
[287] | 495 | break;
|
---|
[551] | 496 | pat->fnpos = atoi(sz);
|
---|
[312] | 497 | psz = strchr(sz, ',');
|
---|
[551] | 498 | if (psz) {
|
---|
[312] | 499 | psz++;
|
---|
[551] | 500 | pat->nameislast = (BOOL) (*psz && atol(psz) == 0) ? FALSE : TRUE;
|
---|
[312] | 501 | psz = strchr(psz, ',');
|
---|
[551] | 502 | if (psz) {
|
---|
[312] | 503 | psz++;
|
---|
[551] | 504 | pat->nameisnext = (BOOL) (*psz && atol(psz) == 0) ? FALSE : TRUE;
|
---|
[312] | 505 | psz = strchr(psz, ',');
|
---|
[551] | 506 | if (psz) {
|
---|
[312] | 507 | psz++;
|
---|
[551] | 508 | pat->nameisfirst = (BOOL) (*psz && atol(psz) == 0) ? FALSE : TRUE;
|
---|
[287] | 509 | }
|
---|
| 510 | }
|
---|
| 511 | }
|
---|
| 512 | // Ignore unknown lines - must be newer file format
|
---|
[551] | 513 | for (i = LINES_PER_ARCSIG; i < lines_per_arcsig; i++) {
|
---|
[312] | 514 | if (!get_line_strip_comments(sz, fp))
|
---|
| 515 | break; // Unexpected EOF - fixme to complain
|
---|
[287] | 516 | }
|
---|
[247] | 517 |
|
---|
[312] | 518 | // Add to list, assume next and prev already NULL
|
---|
[287] | 519 | if (!arcsighead)
|
---|
[306] | 520 | arcsighead = patLast = pat;
|
---|
[551] | 521 | else {
|
---|
| 522 | patLast->next = pat;
|
---|
| 523 | pat->prev = patLast;
|
---|
[306] | 524 | patLast = pat;
|
---|
[287] | 525 | }
|
---|
[551] | 526 | pat = NULL; // Done with this defintion
|
---|
[312] | 527 |
|
---|
| 528 | arcsigs_trailer_line_num = cur_line_num + 1; // In case this is last defintion
|
---|
| 529 | per_sig_comment_line_num = 0;
|
---|
[551] | 530 | } // if got definition
|
---|
[279] | 531 |
|
---|
[551] | 532 | } // while more lines
|
---|
[306] | 533 |
|
---|
[312] | 534 | fclose(fp);
|
---|
[306] | 535 |
|
---|
[551] | 536 | free_arc_type(pat); // In case partial definition in progress
|
---|
[312] | 537 |
|
---|
[287] | 538 | if (!arcsighead)
|
---|
| 539 | return -4;
|
---|
[306] | 540 |
|
---|
| 541 | arcsigsloaded = TRUE;
|
---|
| 542 |
|
---|
[287] | 543 | return 0;
|
---|
[2] | 544 | }
|
---|
| 545 |
|
---|
[342] | 546 | #define TEST_DRAG 0 // fixme to be gone or to work
|
---|
[2] | 547 |
|
---|
[551] | 548 | static MRESULT EXPENTRY SDlgListboxSubclassProc(HWND hwnd, ULONG msg,
|
---|
| 549 | MPARAM mp1, MPARAM mp2)
|
---|
[306] | 550 | {
|
---|
[551] | 551 | PFNWP pfnOldProc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
[306] | 552 |
|
---|
[618] | 553 | PDRAGITEM pDItem;
|
---|
| 554 | PDRAGINFO pDInfo;
|
---|
[306] | 555 | BOOL ok;
|
---|
| 556 |
|
---|
| 557 | static BOOL emphasized = FALSE;
|
---|
| 558 | static PSZ DRMDRF_LBOX = "<DRM_LBOX,DRF_UNKNOWN>";
|
---|
| 559 | static PSZ DRM_LBOX = "DRM_LBOX";
|
---|
| 560 |
|
---|
[551] | 561 | switch (msg) {
|
---|
[306] | 562 | case WM_BEGINDRAG:
|
---|
| 563 | {
|
---|
| 564 | LONG cur_ndx;
|
---|
| 565 | DRAGITEM ditem;
|
---|
| 566 | DRAGIMAGE dimage;
|
---|
| 567 | HWND hwndDrop;
|
---|
| 568 |
|
---|
[537] | 569 | // fprintf(stderr, "SDlgListboxSubclassProc: BEGINDRAG\n");
|
---|
[306] | 570 | cur_ndx = WinQueryLboxSelectedItem(hwnd);
|
---|
| 571 |
|
---|
| 572 | if (cur_ndx != LIT_NONE) {
|
---|
[618] | 573 | pDInfo = DrgAllocDraginfo(1);
|
---|
| 574 | if (pDInfo) {
|
---|
| 575 | pDInfo->usOperation = DO_DEFAULT;
|
---|
| 576 | pDInfo->hwndSource = hwnd;
|
---|
[306] | 577 |
|
---|
[551] | 578 | memset(&ditem, 0, sizeof(DRAGITEM));
|
---|
[306] | 579 | ditem.hwndItem = hwnd;
|
---|
| 580 | ditem.ulItemID = 1;
|
---|
| 581 | ditem.hstrType = DrgAddStrHandle(DRT_UNKNOWN);
|
---|
| 582 | ditem.hstrRMF = DrgAddStrHandle(DRMDRF_LBOX);
|
---|
| 583 | ditem.hstrContainerName = DrgAddStrHandle("");
|
---|
| 584 | ditem.hstrSourceName = DrgAddStrHandle("");
|
---|
| 585 | ditem.hstrTargetName = DrgAddStrHandle("");
|
---|
| 586 | // ditem.fsControl = 0;
|
---|
| 587 | ditem.fsSupportedOps = DO_MOVEABLE;
|
---|
| 588 |
|
---|
[551] | 589 | memset(&dimage, 0, sizeof(DRAGIMAGE));
|
---|
[306] | 590 | dimage.cb = sizeof(DRAGIMAGE);
|
---|
| 591 | dimage.hImage = hptrFile;
|
---|
| 592 | dimage.cptl = 0;
|
---|
| 593 | dimage.fl = DRG_ICON;
|
---|
| 594 | dimage.sizlStretch.cx = 32;
|
---|
| 595 | dimage.sizlStretch.cy = 32;
|
---|
| 596 | dimage.cxOffset = -16;
|
---|
| 597 | dimage.cyOffset = 0;
|
---|
[618] | 598 | DrgSetDragitem(pDInfo, &ditem, sizeof(DRAGITEM), 0); /* Index of DRAGITEM */
|
---|
| 599 | hwndDrop = DrgDrag(hwnd, pDInfo, &dimage, 1, /* One DRAGIMAGE */
|
---|
[551] | 600 | VK_ENDDRAG, NULL);
|
---|
[342] | 601 | if (!hwndDrop)
|
---|
[551] | 602 | Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, "DrgDrag");
|
---|
[306] | 603 |
|
---|
[618] | 604 | DrgFreeDraginfo(pDInfo);
|
---|
[306] | 605 | // WinSetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_ACTIVATE);
|
---|
| 606 | }
|
---|
| 607 | }
|
---|
| 608 | break;
|
---|
| 609 | }
|
---|
| 610 |
|
---|
| 611 | case DM_DRAGOVER:
|
---|
| 612 | ok = FALSE;
|
---|
[551] | 613 | if (!emphasized) {
|
---|
[306] | 614 | POINTL ptl;
|
---|
| 615 | POINTL ptl2;
|
---|
[551] | 616 |
|
---|
[306] | 617 | emphasized = TRUE;
|
---|
| 618 | ptl.x = SHORT1FROMMP(mp2);
|
---|
| 619 | ptl.y = SHORT2FROMMP(mp2);
|
---|
| 620 | ptl2 = ptl;
|
---|
| 621 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl2, 1);
|
---|
[537] | 622 | // fprintf(stderr, "DRAGOVER mapped x y %d %d to %d %d\n", ptl.x, ptl.y, ptl2.x, ptl2.y);
|
---|
[306] | 623 | WinPostMsg(hwnd, WM_BUTTON1CLICK,
|
---|
[551] | 624 | MPFROM2SHORT((SHORT) ptl2.x, (SHORT) ptl2.y),
|
---|
[306] | 625 | MPFROM2SHORT(HT_NORMAL, KC_NONE));
|
---|
[537] | 626 | // fprintf(stderr, "DRAGOVER posted 0x%x WM_BUTTON1CLICK x y %d %d\n", hwnd, ptl2.x, ptl2.y);
|
---|
[306] | 627 | }
|
---|
[618] | 628 | pDInfo = (PDRAGINFO) mp1; /* Get DRAGINFO pointer */
|
---|
| 629 | if (pDInfo) {
|
---|
| 630 | if (!DrgAccessDraginfo(pDInfo)) {
|
---|
[806] | 631 | Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 632 | "DrgAccessDraginfo");
|
---|
[306] | 633 | }
|
---|
[618] | 634 | else {
|
---|
[806] | 635 | pDItem = DrgQueryDragitemPtr(pDInfo, 0);
|
---|
| 636 | /* Check valid rendering mechanisms and data format */
|
---|
| 637 | ok = DrgVerifyRMF(pDItem, DRM_LBOX, NULL);
|
---|
| 638 | DrgFreeDraginfo(pDInfo);
|
---|
[618] | 639 | }
|
---|
[306] | 640 | }
|
---|
[618] | 641 | return ok ? MRFROM2SHORT(DOR_DROP, DO_MOVE) :
|
---|
[806] | 642 | MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
[306] | 643 |
|
---|
| 644 | case DM_DRAGLEAVE:
|
---|
[551] | 645 | if (emphasized) {
|
---|
[306] | 646 | emphasized = FALSE;
|
---|
| 647 | // fixme to draw listbox item emphasized
|
---|
| 648 | // DrawTargetEmphasis(hwnd, emphasized);
|
---|
[537] | 649 | // fprintf(stderr, "DRAGLEAVE\n");
|
---|
[306] | 650 | fflush(stderr);
|
---|
| 651 | }
|
---|
| 652 | return 0;
|
---|
| 653 |
|
---|
| 654 | case DM_DROPHELP:
|
---|
| 655 | DropHelp(mp1, mp2, hwnd, "fixme to give some help");
|
---|
| 656 | return 0;
|
---|
| 657 |
|
---|
| 658 | case DM_DROP:
|
---|
| 659 | ok = FALSE;
|
---|
[551] | 660 | if (emphasized) {
|
---|
[306] | 661 | emphasized = FALSE;
|
---|
| 662 | // DrawTargetEmphasis(hwnd, emphasized);
|
---|
| 663 | }
|
---|
[618] | 664 | pDInfo = (PDRAGINFO) mp1; /* Get DRAGINFO pointer */
|
---|
| 665 | if (pDInfo) {
|
---|
| 666 | if (!DrgAccessDraginfo(pDInfo)) {
|
---|
[806] | 667 | Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
|
---|
| 668 | "DrgAccessDraginfo");
|
---|
[306] | 669 | }
|
---|
[618] | 670 | else {
|
---|
[806] | 671 | pDItem = DrgQueryDragitemPtr(pDInfo, 0);
|
---|
| 672 | if (!pDItem)
|
---|
[618] | 673 | Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, "DM_DROP");
|
---|
[806] | 674 | /* Check valid rendering mechanisms and data */
|
---|
| 675 | ok = DrgVerifyRMF(pDItem, DRM_LBOX, NULL)
|
---|
| 676 | && ~pDItem->fsControl & DC_PREPARE;
|
---|
| 677 | if (ok) {
|
---|
[618] | 678 | // ret = FullDrgName(pDItem,buffer,buflen);
|
---|
| 679 | /* note: targetfail is returned to source for all items */
|
---|
| 680 | DrgSendTransferMsg(pDInfo->hwndSource, DM_ENDCONVERSATION,
|
---|
| 681 | MPFROMLONG(pDItem->ulItemID),
|
---|
| 682 | MPFROMLONG(DMFL_TARGETSUCCESSFUL));
|
---|
[806] | 683 | }
|
---|
| 684 | FreeDragInfoData(hwnd, pDInfo);
|
---|
[618] | 685 | }
|
---|
[306] | 686 | }
|
---|
| 687 | return 0;
|
---|
[618] | 688 | } // switch
|
---|
[306] | 689 | return pfnOldProc ? pfnOldProc(hwnd, msg, mp1, mp2) :
|
---|
[551] | 690 | WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[306] | 691 | }
|
---|
| 692 |
|
---|
| 693 | //=== SBoxDlgProc() Select archiver to use or edit, supports list reorder too ===
|
---|
| 694 |
|
---|
[439] | 695 | static PSZ pszCantFindMsg = "Can't find item %d";
|
---|
| 696 |
|
---|
[247] | 697 | MRESULT EXPENTRY SBoxDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 698 | {
|
---|
[551] | 699 | ARC_TYPE **ppatReturn; // Where to return selected archiver
|
---|
[306] | 700 | ARC_TYPE *pat;
|
---|
| 701 | SHORT sSelect;
|
---|
| 702 | SHORT sItemCount;
|
---|
| 703 | CHAR szItemText[256];
|
---|
[551] | 704 | CHAR szPCItemText[256]; // Parent or child item text
|
---|
[306] | 705 | SHORT i;
|
---|
| 706 | BOOL fShowAll;
|
---|
[2] | 707 |
|
---|
[306] | 708 | static SHORT sLastSelect = LIT_NONE;
|
---|
[2] | 709 |
|
---|
[551] | 710 | switch (msg) {
|
---|
[287] | 711 | case WM_INITDLG:
|
---|
[306] | 712 | if (!arcsigsloaded)
|
---|
[287] | 713 | load_archivers();
|
---|
[551] | 714 | if (!(ARC_TYPE **) mp2) {
|
---|
[378] | 715 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
[287] | 716 | WinDismissDlg(hwnd, 0);
|
---|
| 717 | break;
|
---|
| 718 | }
|
---|
[306] | 719 | /* Passed arg points to where to return selected archiver definition
|
---|
| 720 | * On input arg value controls selection list content
|
---|
| 721 | * If non-NULL, dup names are suppressed
|
---|
| 722 | * If NULL, all definitions are shown
|
---|
| 723 | */
|
---|
[551] | 724 | ppatReturn = (ARC_TYPE **) mp2;
|
---|
[306] | 725 | fShowAll = *ppatReturn == NULL;
|
---|
| 726 | if (*ppatReturn)
|
---|
| 727 | *ppatReturn = arcsighead; // Preset to first
|
---|
[551] | 728 | WinSetWindowPtr(hwnd, QWL_USER, (PVOID) ppatReturn);
|
---|
[306] | 729 | fill_listbox(hwnd, fShowAll, sLastSelect);
|
---|
| 730 |
|
---|
| 731 | #ifdef TEST_DRAG // fixme
|
---|
[287] | 732 | {
|
---|
[306] | 733 | HWND hwnd2 = WinWindowFromID(hwnd, ASEL_LISTBOX);
|
---|
| 734 | PFNWP pfn = WinSubclassWindow(hwnd2,
|
---|
| 735 | SDlgListboxSubclassProc);
|
---|
[551] | 736 |
|
---|
[306] | 737 | WinSetWindowPtr(hwnd2, QWL_USER, (PVOID) pfn);
|
---|
| 738 | }
|
---|
| 739 | #endif // TEST_DRAG fixme
|
---|
[287] | 740 |
|
---|
[306] | 741 | break;
|
---|
| 742 |
|
---|
| 743 | case WM_COMMAND:
|
---|
| 744 | ppatReturn = (ARC_TYPE **) WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
[551] | 745 | switch (SHORT1FROMMP(mp1)) {
|
---|
[306] | 746 | case DID_OK:
|
---|
[551] | 747 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
|
---|
| 748 | ASEL_LISTBOX,
|
---|
| 749 | LM_QUERYSELECTION,
|
---|
| 750 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
| 751 | if (sSelect == LIT_NONE) {
|
---|
| 752 | Runtime_Error(pszSrcFile, __LINE__, "list empty");
|
---|
[306] | 753 | return 0;
|
---|
| 754 | }
|
---|
| 755 | pat = arcsighead;
|
---|
[551] | 756 | if (*ppatReturn) {
|
---|
[306] | 757 | // If dups hidden, find archiver with matching id
|
---|
| 758 | *szItemText = 0;
|
---|
| 759 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_QUERYITEMTEXT,
|
---|
| 760 | MPFROM2SHORT(sSelect, 255), MPFROMP(szItemText));
|
---|
| 761 | if (!*szItemText)
|
---|
| 762 | pat = NULL;
|
---|
[551] | 763 | else {
|
---|
| 764 | for (; pat; pat = pat->next) {
|
---|
| 765 | if (pat->id && !strcmp(szItemText, pat->id))
|
---|
| 766 | break; // Found it
|
---|
[287] | 767 | }
|
---|
| 768 | }
|
---|
[306] | 769 | }
|
---|
[551] | 770 | else {
|
---|
[306] | 771 | // If dups not hidden, lookup by count
|
---|
[551] | 772 | for (i = 0; pat && i < sSelect; i++, pat = pat->next) ; // Scan
|
---|
[306] | 773 | }
|
---|
[551] | 774 | if (pat && (!*ppatReturn || (pat->id && pat->extract && pat->create))) {
|
---|
[306] | 775 | *ppatReturn = pat;
|
---|
| 776 | }
|
---|
[551] | 777 | else {
|
---|
| 778 | Runtime_Error(pszSrcFile, __LINE__, "no match");
|
---|
[306] | 779 | // Refuse to select
|
---|
| 780 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SELECTITEM,
|
---|
| 781 | MPFROMSHORT(LIT_NONE), FALSE);
|
---|
| 782 | return 0;
|
---|
| 783 | }
|
---|
| 784 | sLastSelect = sSelect;
|
---|
| 785 | WinDismissDlg(hwnd, TRUE);
|
---|
| 786 | return 0;
|
---|
[2] | 787 |
|
---|
[306] | 788 | case DID_CANCEL:
|
---|
| 789 | if (arcsigsmodified) {
|
---|
| 790 | if (saymsg(MB_YESNO,
|
---|
| 791 | hwnd,
|
---|
| 792 | GetPString(IDS_ADCHANGESINMEMTEXT),
|
---|
[551] | 793 | GetPString(IDS_ADREWRITETEXT), NullStr) == MBID_YES) {
|
---|
[306] | 794 | PSZ ab2 = searchpath(GetPString(IDS_ARCHIVERBB2)); // Rewrite without prompting
|
---|
[551] | 795 |
|
---|
[306] | 796 | rewrite_archiverbb2(ab2);
|
---|
| 797 | }
|
---|
| 798 | }
|
---|
[551] | 799 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
|
---|
| 800 | ASEL_LISTBOX,
|
---|
| 801 | LM_QUERYSELECTION,
|
---|
| 802 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
[306] | 803 | if (sSelect != LIT_NONE)
|
---|
[551] | 804 | sLastSelect = sSelect;
|
---|
[306] | 805 | *ppatReturn = NULL;
|
---|
| 806 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); // fixme to understand why needed
|
---|
| 807 | return 0;
|
---|
| 808 |
|
---|
| 809 | case ASEL_PB_ADD:
|
---|
[551] | 810 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
|
---|
| 811 | ASEL_LISTBOX,
|
---|
| 812 | LM_QUERYSELECTION,
|
---|
| 813 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
[306] | 814 | if (sSelect != LIT_NONE) {
|
---|
| 815 | ARCDUMP ad;
|
---|
[551] | 816 |
|
---|
| 817 | memset(&ad, 0, sizeof(ARCDUMP));
|
---|
| 818 | ad.info = xmallocz(sizeof(ARC_TYPE), pszSrcFile, __LINE__);
|
---|
[306] | 819 | if (ad.info) {
|
---|
| 820 | if (!WinDlgBox(HWND_DESKTOP,
|
---|
| 821 | hwnd,
|
---|
| 822 | ArcReviewDlgProc,
|
---|
[551] | 823 | FM3ModHandle, AD_FRAME, MPFROMP(&ad))) {
|
---|
[306] | 824 | free(ad.info);
|
---|
[287] | 825 | }
|
---|
[306] | 826 | else {
|
---|
| 827 | // Find self - assume all archivers listed since we are editing
|
---|
[551] | 828 | for (i = 0, pat = arcsighead; pat && i < sSelect; pat = pat->next, i++) ; // Find self
|
---|
[2] | 829 |
|
---|
[306] | 830 | if (!pat) {
|
---|
| 831 | if (arcsighead)
|
---|
[551] | 832 | Runtime_Error(pszSrcFile, __LINE__, pszCantFindMsg, sSelect);
|
---|
[306] | 833 | else
|
---|
| 834 | arcsighead = ad.info;
|
---|
| 835 | }
|
---|
| 836 | else {
|
---|
| 837 | // Insert before
|
---|
| 838 | if (pat->prev) {
|
---|
| 839 | ad.info->next = pat;
|
---|
| 840 | ad.info->prev = pat->prev;
|
---|
| 841 | pat->prev->next = ad.info;
|
---|
| 842 | pat->prev = ad.info;
|
---|
| 843 | }
|
---|
| 844 | else {
|
---|
| 845 | arcsighead = ad.info;
|
---|
| 846 | ad.info->next = pat;
|
---|
| 847 | pat->prev = ad.info;
|
---|
| 848 | }
|
---|
| 849 | }
|
---|
[287] | 850 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_INSERTITEM,
|
---|
[306] | 851 | MPFROM2SHORT(sSelect, 0),
|
---|
[551] | 852 | MPFROMP(ad.info->id ? ad.info->id : "?"));
|
---|
[306] | 853 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SELECTITEM,
|
---|
| 854 | MPFROMSHORT(sSelect - 1), MPFROMSHORT(TRUE));
|
---|
| 855 | arcsigsmodified = TRUE;
|
---|
[287] | 856 | }
|
---|
| 857 | }
|
---|
| 858 | }
|
---|
[306] | 859 | return 0;
|
---|
| 860 | case ASEL_PB_DELETE:
|
---|
[551] | 861 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
|
---|
| 862 | ASEL_LISTBOX,
|
---|
| 863 | LM_QUERYSELECTION,
|
---|
| 864 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
[306] | 865 | if (sSelect != LIT_NONE) {
|
---|
| 866 | // Find self - assume all archivers listed since we are editing
|
---|
[551] | 867 | for (i = 0, pat = arcsighead; pat && i < sSelect; pat = pat->next, i++) ; // Find self
|
---|
[2] | 868 |
|
---|
[439] | 869 | if (!pat)
|
---|
[551] | 870 | Runtime_Error(pszSrcFile, __LINE__, pszCantFindMsg, sSelect);
|
---|
[306] | 871 | else {
|
---|
| 872 | // Delete current
|
---|
| 873 | if (pat->prev) {
|
---|
| 874 | pat->prev->next = pat->next;
|
---|
| 875 | if (pat->next)
|
---|
| 876 | pat->next->prev = pat->prev;
|
---|
[287] | 877 | }
|
---|
[306] | 878 | else {
|
---|
| 879 | arcsighead = pat->next;
|
---|
| 880 | if (pat->next)
|
---|
| 881 | pat->next->prev = pat->prev;
|
---|
| 882 | }
|
---|
[247] | 883 | }
|
---|
[306] | 884 | free_arc_type(pat);
|
---|
| 885 | arcsigsmodified = TRUE;
|
---|
| 886 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_DELETEITEM,
|
---|
[551] | 887 | MPFROM2SHORT(sSelect, 0), MPVOID);
|
---|
| 888 | sItemCount =
|
---|
| 889 | (SHORT) WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_QUERYITEMCOUNT,
|
---|
| 890 | MPVOID, MPVOID);
|
---|
[306] | 891 | if (sSelect >= sItemCount)
|
---|
| 892 | sSelect--;
|
---|
| 893 | if (sSelect >= 0) {
|
---|
| 894 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SELECTITEM,
|
---|
| 895 | MPFROMSHORT(sSelect), MPFROMSHORT(TRUE));
|
---|
| 896 | }
|
---|
| 897 | }
|
---|
| 898 | return 0;
|
---|
| 899 | case ASEL_PB_UP:
|
---|
[551] | 900 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
|
---|
| 901 | ASEL_LISTBOX,
|
---|
| 902 | LM_QUERYSELECTION,
|
---|
| 903 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
[306] | 904 | if (sSelect != LIT_NONE && sSelect > 0) {
|
---|
| 905 | // Find self - assume all archivers listed since we are editing
|
---|
[551] | 906 | for (i = 0, pat = arcsighead; pat && i < sSelect; pat = pat->next, i++) ; // Find self
|
---|
[439] | 907 | if (!pat || !pat->prev)
|
---|
[551] | 908 | Runtime_Error(pszSrcFile, __LINE__, pszCantFindMsg, sSelect);
|
---|
[306] | 909 | else {
|
---|
| 910 | ARC_TYPE *patGDad;
|
---|
| 911 | ARC_TYPE *patDad;
|
---|
| 912 | ARC_TYPE *patChild;
|
---|
[551] | 913 |
|
---|
[306] | 914 | patChild = pat->next;
|
---|
| 915 | patDad = pat->prev;
|
---|
| 916 | patGDad = patDad->prev;
|
---|
| 917 | patDad->next = patChild;
|
---|
| 918 | if (patChild)
|
---|
| 919 | patChild->prev = patDad;
|
---|
| 920 | patDad->prev = pat;
|
---|
| 921 | pat->next = patDad;
|
---|
| 922 | if (patGDad) {
|
---|
| 923 | patGDad->next = pat;
|
---|
| 924 | pat->prev = patGDad;
|
---|
[287] | 925 | }
|
---|
[306] | 926 | else {
|
---|
| 927 | arcsighead = pat;
|
---|
| 928 | pat->prev = NULL;
|
---|
| 929 | }
|
---|
| 930 |
|
---|
| 931 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_QUERYITEMTEXT,
|
---|
| 932 | MPFROM2SHORT(sSelect, 255), MPFROMP(szItemText));
|
---|
| 933 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_QUERYITEMTEXT,
|
---|
[551] | 934 | MPFROM2SHORT(sSelect - 1, 255),
|
---|
| 935 | MPFROMP(szPCItemText));
|
---|
[306] | 936 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SETITEMTEXT,
|
---|
| 937 | MPFROMSHORT(sSelect), MPFROMP(szPCItemText));
|
---|
| 938 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SETITEMTEXT,
|
---|
| 939 | MPFROMSHORT(sSelect - 1), MPFROMP(szItemText));
|
---|
| 940 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SELECTITEM,
|
---|
| 941 | MPFROMSHORT(sSelect - 1), MPFROMSHORT(TRUE));
|
---|
| 942 | arcsigsmodified = TRUE;
|
---|
[287] | 943 | }
|
---|
[306] | 944 | }
|
---|
| 945 | return 0;
|
---|
| 946 | case ASEL_PB_DOWN:
|
---|
[551] | 947 | sSelect =
|
---|
| 948 | (SHORT) WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_QUERYSELECTION,
|
---|
| 949 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
| 950 | sItemCount =
|
---|
| 951 | (SHORT) WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_QUERYITEMCOUNT,
|
---|
| 952 | MPVOID, MPVOID);
|
---|
[306] | 953 | if (sSelect != LIT_NONE && sSelect < sItemCount - 1) {
|
---|
| 954 | // Find self - assume all archivers listed since we are editing
|
---|
[551] | 955 | for (i = 0, pat = arcsighead; pat && i < sSelect; pat = pat->next, i++) ; // Find self
|
---|
| 956 | if (!pat || !pat->next)
|
---|
| 957 | Runtime_Error(pszSrcFile, __LINE__, "Can't find item %d of %d",
|
---|
| 958 | sSelect, sItemCount);
|
---|
[306] | 959 | else {
|
---|
| 960 | ARC_TYPE *patDad;
|
---|
| 961 | ARC_TYPE *patChild;
|
---|
[551] | 962 |
|
---|
[306] | 963 | patDad = pat->prev;
|
---|
| 964 | patChild = pat->next;
|
---|
| 965 | pat->next = patChild->next;
|
---|
| 966 | patChild->next = pat;
|
---|
| 967 | pat->prev = patChild;
|
---|
| 968 | patChild->prev = patDad;
|
---|
| 969 | if (patDad) {
|
---|
| 970 | patDad->next = patChild;
|
---|
[551] | 971 | patChild->prev = patDad;
|
---|
[306] | 972 | }
|
---|
| 973 | else {
|
---|
| 974 | arcsighead = patChild;
|
---|
[551] | 975 | patChild->prev = NULL;
|
---|
[306] | 976 | }
|
---|
| 977 |
|
---|
| 978 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_QUERYITEMTEXT,
|
---|
| 979 | MPFROM2SHORT(sSelect, 255), MPFROMP(szItemText));
|
---|
| 980 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_QUERYITEMTEXT,
|
---|
[551] | 981 | MPFROM2SHORT(sSelect + 1, 255),
|
---|
| 982 | MPFROMP(szPCItemText));
|
---|
[306] | 983 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SETITEMTEXT,
|
---|
| 984 | MPFROMSHORT(sSelect), MPFROMP(szPCItemText));
|
---|
| 985 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SETITEMTEXT,
|
---|
| 986 | MPFROMSHORT(sSelect + 1), MPFROMP(szItemText));
|
---|
[287] | 987 | WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SELECTITEM,
|
---|
[306] | 988 | MPFROMSHORT(sSelect + 1), MPFROMSHORT(TRUE));
|
---|
| 989 | arcsigsmodified = TRUE;
|
---|
[287] | 990 | }
|
---|
| 991 | }
|
---|
| 992 | return 0;
|
---|
[2] | 993 |
|
---|
[306] | 994 | case ASEL_PB_REVERT:
|
---|
| 995 | // Reload without checking in case changed outside
|
---|
[551] | 996 | sSelect =
|
---|
| 997 | (SHORT) WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_QUERYSELECTION,
|
---|
| 998 | MPFROMSHORT(LIT_FIRST), MPVOID);
|
---|
[306] | 999 | load_archivers();
|
---|
| 1000 | fill_listbox(hwnd, TRUE, sSelect);
|
---|
| 1001 | return 0;
|
---|
[2] | 1002 |
|
---|
[306] | 1003 | case IDM_HELP:
|
---|
| 1004 | if (hwndHelp) {
|
---|
[551] | 1005 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP, MPFROM2SHORT(HELP_EDITARC, 0), // fixme to be HELP_SELARC
|
---|
| 1006 | MPFROMSHORT(HM_RESOURCEID));
|
---|
[306] | 1007 | }
|
---|
[247] | 1008 | }
|
---|
[306] | 1009 | return 0; // WM_COMMAND
|
---|
[287] | 1010 |
|
---|
| 1011 | case WM_CONTROL:
|
---|
| 1012 | if (SHORT1FROMMP(mp1) == ASEL_LISTBOX && SHORT2FROMMP(mp1) == LN_ENTER)
|
---|
| 1013 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID);
|
---|
| 1014 | return 0;
|
---|
| 1015 |
|
---|
| 1016 | case WM_CLOSE:
|
---|
| 1017 | WinDismissDlg(hwnd, FALSE);
|
---|
| 1018 | return 0;
|
---|
| 1019 |
|
---|
| 1020 | default:
|
---|
| 1021 | break;
|
---|
| 1022 | }
|
---|
| 1023 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 1024 | }
|
---|
| 1025 |
|
---|
| 1026 | /*
|
---|
[306] | 1027 | see archiver.tmp
|
---|
| 1028 | 02-08-96 23:55 1
|
---|
[247] | 1029 | 8 Feb 96 23:55:32 2
|
---|
| 1030 | 8 Feb 96 11:55p 3
|
---|
[306] | 1031 | 96-02-08 23:55:32 4
|
---|
| 1032 | 31-02-98 23:55 5
|
---|
[247] | 1033 | */
|
---|
[2] | 1034 |
|
---|
[551] | 1035 | BOOL ArcDateTime(CHAR * dt, INT type, CDATE * cdate, CTIME * ctime)
|
---|
[247] | 1036 | {
|
---|
[287] | 1037 | INT x;
|
---|
| 1038 | BOOL ret = FALSE;
|
---|
| 1039 | CHAR *p, *pp, *pd;
|
---|
[2] | 1040 |
|
---|
[551] | 1041 | if (dt && cdate && ctime) {
|
---|
[287] | 1042 | memset(cdate, 0, sizeof(CDATE));
|
---|
| 1043 | memset(ctime, 0, sizeof(CTIME));
|
---|
[551] | 1044 | if (type) {
|
---|
[287] | 1045 | p = dt;
|
---|
| 1046 | while (*p && *p == ' ')
|
---|
| 1047 | p++;
|
---|
| 1048 | pd = dt;
|
---|
[551] | 1049 | switch (type) {
|
---|
[287] | 1050 | case 1:
|
---|
[551] | 1051 | cdate->month = atoi(pd);
|
---|
[287] | 1052 | p = to_delim(pd, "-/.");
|
---|
[551] | 1053 | if (p) {
|
---|
[287] | 1054 | p++;
|
---|
[551] | 1055 | cdate->day = atoi(p);
|
---|
[287] | 1056 | pd = p;
|
---|
| 1057 | p = to_delim(pd, "-/.");
|
---|
[551] | 1058 | if (p) {
|
---|
[287] | 1059 | p++;
|
---|
[551] | 1060 | cdate->year = atoi(p);
|
---|
| 1061 | if (cdate->year > 80 && cdate->year < 1900)
|
---|
| 1062 | cdate->year += 1900;
|
---|
| 1063 | else if (cdate->year < 1900)
|
---|
| 1064 | cdate->year += 2000;
|
---|
[287] | 1065 | ret = TRUE;
|
---|
| 1066 | p = strchr(p, ' ');
|
---|
[551] | 1067 | if (p) {
|
---|
[287] | 1068 | while (*p && *p == ' ')
|
---|
[247] | 1069 | p++;
|
---|
[551] | 1070 | ctime->hours = atoi(p);
|
---|
[287] | 1071 | p = to_delim(pd, ":.");
|
---|
[551] | 1072 | if (p) {
|
---|
[287] | 1073 | p++;
|
---|
[551] | 1074 | ctime->minutes = atoi(p);
|
---|
[287] | 1075 | p = to_delim(pd, ":.");
|
---|
[551] | 1076 | if (p) {
|
---|
[287] | 1077 | p++;
|
---|
[551] | 1078 | ctime->seconds = atoi(p);
|
---|
[247] | 1079 | }
|
---|
[287] | 1080 | }
|
---|
| 1081 | }
|
---|
| 1082 | }
|
---|
| 1083 | }
|
---|
| 1084 | break;
|
---|
[2] | 1085 |
|
---|
[287] | 1086 | case 2:
|
---|
[551] | 1087 | cdate->day = atoi(p);
|
---|
[287] | 1088 | p = strchr(p, ' ');
|
---|
[551] | 1089 | if (p) {
|
---|
[287] | 1090 | p++;
|
---|
[551] | 1091 | for (x = 0; x < 12; x++) {
|
---|
[287] | 1092 | if (!strnicmp(p, GetPString(IDS_JANUARY + x), 3))
|
---|
| 1093 | break;
|
---|
| 1094 | }
|
---|
[551] | 1095 | if (x < 12) {
|
---|
| 1096 | cdate->month = x;
|
---|
[287] | 1097 | p = strchr(p, ' ');
|
---|
[551] | 1098 | if (p) {
|
---|
[287] | 1099 | p++;
|
---|
[551] | 1100 | cdate->year = atoi(p);
|
---|
| 1101 | if (cdate->year > 80 && cdate->year < 1900)
|
---|
| 1102 | cdate->year += 1900;
|
---|
| 1103 | else if (cdate->year < 1900)
|
---|
| 1104 | cdate->year += 2000;
|
---|
[287] | 1105 | ret = TRUE;
|
---|
| 1106 | p = strchr(p, ' ');
|
---|
[551] | 1107 | if (p) {
|
---|
[287] | 1108 | while (*p && *p == ' ')
|
---|
| 1109 | p++;
|
---|
[551] | 1110 | ctime->hours = atoi(p);
|
---|
[287] | 1111 | p = to_delim(pd, ":.");
|
---|
[551] | 1112 | if (p) {
|
---|
[287] | 1113 | p++;
|
---|
[551] | 1114 | ctime->minutes = atoi(p);
|
---|
[287] | 1115 | p = to_delim(pd, ":.");
|
---|
[551] | 1116 | if (p) {
|
---|
[247] | 1117 | p++;
|
---|
[551] | 1118 | ctime->seconds = atoi(p);
|
---|
[287] | 1119 | }
|
---|
[247] | 1120 | }
|
---|
[287] | 1121 | }
|
---|
| 1122 | }
|
---|
| 1123 | }
|
---|
| 1124 | }
|
---|
| 1125 | break;
|
---|
[2] | 1126 |
|
---|
[287] | 1127 | case 3:
|
---|
[551] | 1128 | cdate->day = atoi(p);
|
---|
[287] | 1129 | p = strchr(p, ' ');
|
---|
[551] | 1130 | if (p) {
|
---|
[287] | 1131 | p++;
|
---|
[551] | 1132 | for (x = 0; x < 12; x++) {
|
---|
[287] | 1133 | if (!strnicmp(p, GetPString(IDS_JANUARY + x), 3))
|
---|
| 1134 | break;
|
---|
| 1135 | }
|
---|
[551] | 1136 | if (x < 12) {
|
---|
| 1137 | cdate->month = x;
|
---|
[287] | 1138 | p = strchr(p, ' ');
|
---|
[551] | 1139 | if (p) {
|
---|
[287] | 1140 | p++;
|
---|
[551] | 1141 | cdate->year = atoi(p);
|
---|
| 1142 | if (cdate->year > 80 && cdate->year < 1900)
|
---|
| 1143 | cdate->year += 1900;
|
---|
| 1144 | else if (cdate->year < 1900)
|
---|
| 1145 | cdate->year += 2000;
|
---|
[287] | 1146 | ret = TRUE;
|
---|
| 1147 | p = strchr(p, ' ');
|
---|
[551] | 1148 | if (p) {
|
---|
[287] | 1149 | while (*p && *p == ' ')
|
---|
| 1150 | p++;
|
---|
[551] | 1151 | ctime->hours = atoi(p);
|
---|
[287] | 1152 | p = to_delim(pd, ":.");
|
---|
[551] | 1153 | if (p) {
|
---|
[287] | 1154 | p++;
|
---|
| 1155 | pp = p;
|
---|
[551] | 1156 | ctime->minutes = atoi(p);
|
---|
[287] | 1157 | p = to_delim(pd, ":.");
|
---|
[551] | 1158 | if (p) {
|
---|
[247] | 1159 | p++;
|
---|
[551] | 1160 | ctime->seconds = atoi(p);
|
---|
[287] | 1161 | p += 2;
|
---|
| 1162 | if (toupper(*p) == 'P')
|
---|
[551] | 1163 | ctime->hours += 12;
|
---|
[287] | 1164 | }
|
---|
[551] | 1165 | else {
|
---|
[287] | 1166 | p = pp;
|
---|
| 1167 | p += 2;
|
---|
| 1168 | if (toupper(*p) == 'P')
|
---|
[551] | 1169 | ctime->hours += 12;
|
---|
[287] | 1170 | }
|
---|
[247] | 1171 | }
|
---|
[287] | 1172 | }
|
---|
| 1173 | }
|
---|
| 1174 | }
|
---|
| 1175 | }
|
---|
| 1176 | break;
|
---|
[2] | 1177 |
|
---|
[287] | 1178 | case 4:
|
---|
[551] | 1179 | cdate->year = atoi(p);
|
---|
| 1180 | if (cdate->year > 80 && cdate->year < 1900)
|
---|
| 1181 | cdate->year += 1900;
|
---|
| 1182 | else if (cdate->year < 1900)
|
---|
| 1183 | cdate->year += 2000;
|
---|
[287] | 1184 | p = to_delim(pd, "-/.");
|
---|
[551] | 1185 | if (p) {
|
---|
[287] | 1186 | p++;
|
---|
[551] | 1187 | cdate->month = atoi(p);
|
---|
[287] | 1188 | pd = p;
|
---|
| 1189 | p = to_delim(pd, "-/.");
|
---|
[551] | 1190 | if (p) {
|
---|
[287] | 1191 | p++;
|
---|
[551] | 1192 | cdate->day = atoi(p);
|
---|
[287] | 1193 | ret = TRUE;
|
---|
| 1194 | p = strchr(p, ' ');
|
---|
[551] | 1195 | if (p) {
|
---|
[287] | 1196 | while (*p && *p == ' ')
|
---|
| 1197 | p++;
|
---|
[551] | 1198 | ctime->hours = atoi(p);
|
---|
[287] | 1199 | p = to_delim(pd, ":.");
|
---|
[551] | 1200 | if (p) {
|
---|
[287] | 1201 | p++;
|
---|
[551] | 1202 | ctime->minutes = atoi(p);
|
---|
[287] | 1203 | p = to_delim(pd, ":.");
|
---|
[551] | 1204 | if (p) {
|
---|
[287] | 1205 | p++;
|
---|
[551] | 1206 | ctime->seconds = atoi(p);
|
---|
[247] | 1207 | }
|
---|
[287] | 1208 | }
|
---|
| 1209 | }
|
---|
| 1210 | }
|
---|
| 1211 | }
|
---|
| 1212 | break;
|
---|
[2] | 1213 |
|
---|
[287] | 1214 | case 5:
|
---|
[551] | 1215 | cdate->day = atoi(pd);
|
---|
[287] | 1216 | p = to_delim(pd, "-/.");
|
---|
[551] | 1217 | if (p) {
|
---|
[287] | 1218 | p++;
|
---|
[551] | 1219 | cdate->month = atoi(p);
|
---|
[287] | 1220 | pd = p;
|
---|
| 1221 | p = to_delim(pd, "-/.");
|
---|
[551] | 1222 | if (p) {
|
---|
[287] | 1223 | p++;
|
---|
[551] | 1224 | cdate->year = atoi(p);
|
---|
| 1225 | if (cdate->year > 80 && cdate->year < 1900)
|
---|
| 1226 | cdate->year += 1900;
|
---|
| 1227 | else if (cdate->year < 1900)
|
---|
| 1228 | cdate->year += 2000;
|
---|
[287] | 1229 | ret = TRUE;
|
---|
| 1230 | p = strchr(p, ' ');
|
---|
[551] | 1231 | if (p) {
|
---|
[287] | 1232 | while (*p && *p == ' ')
|
---|
| 1233 | p++;
|
---|
[551] | 1234 | ctime->hours = atoi(p);
|
---|
[287] | 1235 | p = to_delim(pd, ":.");
|
---|
[551] | 1236 | if (p) {
|
---|
[287] | 1237 | p++;
|
---|
[551] | 1238 | ctime->minutes = atoi(p);
|
---|
[287] | 1239 | p = to_delim(pd, ":.");
|
---|
[551] | 1240 | if (p) {
|
---|
[287] | 1241 | p++;
|
---|
[551] | 1242 | ctime->seconds = atoi(p);
|
---|
[247] | 1243 | }
|
---|
[287] | 1244 | }
|
---|
[247] | 1245 | }
|
---|
[287] | 1246 | }
|
---|
[247] | 1247 | }
|
---|
[287] | 1248 | break;
|
---|
| 1249 |
|
---|
| 1250 | default:
|
---|
| 1251 | break;
|
---|
| 1252 | }
|
---|
[2] | 1253 | }
|
---|
[287] | 1254 | }
|
---|
| 1255 | return ret;
|
---|
[2] | 1256 | }
|
---|
[793] | 1257 |
|
---|
| 1258 | #pragma alloc_text(MISC9,quick_find_type,find_type)
|
---|
| 1259 | #pragma alloc_text(AVL,load_archivers, get_line_strip_comments, get_line_strip_white)
|
---|
| 1260 | #pragma alloc_text(FMARCHIVE,SBoxDlgProc,SDlgListboxSubclassProc)
|
---|
| 1261 | #pragma alloc_text(ARCCNRS,ArcDateTime)
|
---|