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