| 1 | 
 | 
|---|
| 2 | /***********************************************************************
 | 
|---|
| 3 | 
 | 
|---|
| 4 |   $Id: avl.c 279 2005-12-08 07:43:33Z root $
 | 
|---|
| 5 | 
 | 
|---|
| 6 |   archiver.bb2 search, load, save and date parse
 | 
|---|
| 7 | 
 | 
|---|
| 8 |   Copyright (c) 1993, 1998 M. Kimes
 | 
|---|
| 9 |   Copyright (c) 2004, 2005 Steven H.Levine
 | 
|---|
| 10 | 
 | 
|---|
| 11 |   01 Aug 04 SHL Rework lstrip/rstrip usage
 | 
|---|
| 12 |   13 Aug 05 SHL Beautify with indent
 | 
|---|
| 13 |   13 Aug 05 SHL find_type: correct no sig exists bypass logic
 | 
|---|
| 14 |   13 Aug 05 SHL SBoxDlgProc: avoid dereferencing NULL signature
 | 
|---|
| 15 |   18 Aug 05 SHL Comments
 | 
|---|
| 16 | 
 | 
|---|
| 17 | ***********************************************************************/
 | 
|---|
| 18 | 
 | 
|---|
| 19 | #define INCL_WIN
 | 
|---|
| 20 | #define INCL_DOS
 | 
|---|
| 21 | #include <os2.h>
 | 
|---|
| 22 | 
 | 
|---|
| 23 | #include <stdlib.h>
 | 
|---|
| 24 | #include <stdio.h>
 | 
|---|
| 25 | #include <string.h>
 | 
|---|
| 26 | #include <share.h>
 | 
|---|
| 27 | #include <ctype.h>
 | 
|---|
| 28 | 
 | 
|---|
| 29 | #include "fm3dll.h"
 | 
|---|
| 30 | #include "fm3dlg.h"
 | 
|---|
| 31 | #include "fm3str.h"
 | 
|---|
| 32 | 
 | 
|---|
| 33 | BOOL loadedarcs;
 | 
|---|
| 34 | 
 | 
|---|
| 35 | #pragma alloc_text(MISC9,quick_find_type,find_type)
 | 
|---|
| 36 | 
 | 
|---|
| 37 | ARC_TYPE *quick_find_type(CHAR * filespec, ARC_TYPE * topsig)
 | 
|---|
| 38 | {
 | 
|---|
| 39 |     ARC_TYPE *info, *found = NULL;
 | 
|---|
| 40 |     CHAR *p;
 | 
|---|
| 41 | 
 | 
|---|
| 42 |     if (!loadedarcs)
 | 
|---|
| 43 |         load_archivers();
 | 
|---|
| 44 |     p = strrchr(filespec, '.');
 | 
|---|
| 45 |     if (p)
 | 
|---|
| 46 |     {
 | 
|---|
| 47 |         p++;
 | 
|---|
| 48 |         info = (topsig) ? topsig : arcsighead;
 | 
|---|
| 49 |         while (info)
 | 
|---|
| 50 |         {
 | 
|---|
| 51 |             if (info -> ext &&
 | 
|---|
| 52 |                     *(info -> ext) &&
 | 
|---|
| 53 |                     !stricmp(p, info -> ext))
 | 
|---|
| 54 |             {
 | 
|---|
| 55 |                 found = find_type(filespec, topsig);
 | 
|---|
| 56 |                 break;
 | 
|---|
| 57 |             }
 | 
|---|
| 58 |             info = info -> next;
 | 
|---|
| 59 |         }
 | 
|---|
| 60 |     }
 | 
|---|
| 61 |     return found;
 | 
|---|
| 62 | }
 | 
|---|
| 63 | 
 | 
|---|
| 64 | ARC_TYPE *find_type(CHAR * filespec, ARC_TYPE * topsig)
 | 
|---|
| 65 | {
 | 
|---|
| 66 |     HFILE handle;
 | 
|---|
| 67 |     ULONG action;
 | 
|---|
| 68 |     ULONG len;
 | 
|---|
| 69 |     ULONG l;
 | 
|---|
| 70 |     ARC_TYPE *info;
 | 
|---|
| 71 |     CHAR *p;
 | 
|---|
| 72 |     CHAR buffer[80];
 | 
|---|
| 73 | 
 | 
|---|
| 74 |     if (!loadedarcs)
 | 
|---|
| 75 |         load_archivers();
 | 
|---|
| 76 |     if (!topsig)
 | 
|---|
| 77 |         topsig = arcsighead;
 | 
|---|
| 78 |     DosError(FERR_DISABLEHARDERR);
 | 
|---|
| 79 |     if (DosOpen(filespec,
 | 
|---|
| 80 |                 &handle,
 | 
|---|
| 81 |                 &action,
 | 
|---|
| 82 |                 0L,
 | 
|---|
| 83 |                 0L,
 | 
|---|
| 84 |                 OPEN_ACTION_FAIL_IF_NEW |
 | 
|---|
| 85 |                 OPEN_ACTION_OPEN_IF_EXISTS,
 | 
|---|
| 86 |                 OPEN_FLAGS_FAIL_ON_ERROR |
 | 
|---|
| 87 |                 OPEN_FLAGS_NOINHERIT |
 | 
|---|
| 88 |                 OPEN_FLAGS_RANDOMSEQUENTIAL |
 | 
|---|
| 89 |                 OPEN_SHARE_DENYNONE |
 | 
|---|
| 90 |                 OPEN_ACCESS_READONLY,
 | 
|---|
| 91 |                 0L))
 | 
|---|
| 92 |         return NULL;
 | 
|---|
| 93 |     // Scan signatures
 | 
|---|
| 94 |     for (info = topsig; info; info = info -> next)
 | 
|---|
| 95 |     {
 | 
|---|
| 96 |         if (!info -> signature || !*info -> signature)
 | 
|---|
| 97 |         {
 | 
|---|
| 98 |             // No signature -- check extension
 | 
|---|
| 99 |             p = strrchr(filespec, '.');
 | 
|---|
| 100 |             if (p)
 | 
|---|
| 101 |             {
 | 
|---|
| 102 |                 p++;
 | 
|---|
| 103 |                 if (info -> ext &&
 | 
|---|
| 104 |                         *(info -> ext) &&
 | 
|---|
| 105 |                         !stricmp(p, info -> ext))
 | 
|---|
| 106 |                     break;              // Matched
 | 
|---|
| 107 |             }
 | 
|---|
| 108 |             continue;                   // Next sig
 | 
|---|
| 109 |         }
 | 
|---|
| 110 |         // Try signature match
 | 
|---|
| 111 |         l = strlen(info -> signature);
 | 
|---|
| 112 |         l = min(l, 79);
 | 
|---|
| 113 |         if (!DosChgFilePtr(handle,
 | 
|---|
| 114 |                            abs(info -> file_offset),
 | 
|---|
| 115 |                            (info -> file_offset >= 0L) ?
 | 
|---|
| 116 |                            FILE_BEGIN :
 | 
|---|
| 117 |                            FILE_END,
 | 
|---|
| 118 |                            &len))
 | 
|---|
| 119 |         {
 | 
|---|
| 120 |             if (!DosRead(handle,
 | 
|---|
| 121 |                          buffer,
 | 
|---|
| 122 |                          l,
 | 
|---|
| 123 |                          &len) &&
 | 
|---|
| 124 |                     len == l)
 | 
|---|
| 125 |             {
 | 
|---|
| 126 |                 if (!memcmp(info -> signature,
 | 
|---|
| 127 |                             buffer,
 | 
|---|
| 128 |                             l))
 | 
|---|
| 129 |                     break;              // Matched
 | 
|---|
| 130 |             }
 | 
|---|
| 131 |         }
 | 
|---|
| 132 |     } // for
 | 
|---|
| 133 |     DosClose(handle);                   /* Either way, we're done for now */
 | 
|---|
| 134 |     return info;                        /* Return signature, if any */
 | 
|---|
| 135 | }
 | 
|---|
| 136 | 
 | 
|---|
| 137 | #pragma alloc_text(AVL,load_archivers)
 | 
|---|
| 138 | 
 | 
|---|
| 139 | INT load_archivers(VOID)
 | 
|---|
| 140 | {
 | 
|---|
| 141 |     FILE *handle;
 | 
|---|
| 142 |     CHAR s[257];
 | 
|---|
| 143 |     CHAR *p;
 | 
|---|
| 144 |     ARC_TYPE *info = NULL;
 | 
|---|
| 145 |     ARC_TYPE *last = NULL;
 | 
|---|
| 146 |     INT numlines = NUMLINES;
 | 
|---|
| 147 |     INT x;
 | 
|---|
| 148 | 
 | 
|---|
| 149 |     loadedarcs = TRUE;
 | 
|---|
| 150 |     DosEnterCritSec();
 | 
|---|
| 151 |     p = searchpath(GetPString(IDS_ARCHIVERBB2));
 | 
|---|
| 152 |     if (!p || !*p)
 | 
|---|
| 153 |     {
 | 
|---|
| 154 |         DosExitCritSec();
 | 
|---|
| 155 |         return -1;
 | 
|---|
| 156 |     }
 | 
|---|
| 157 |     handle = _fsopen(p, "r", SH_DENYWR);
 | 
|---|
| 158 |     DosExitCritSec();
 | 
|---|
| 159 |     if (!handle)
 | 
|---|
| 160 |         return -2;
 | 
|---|
| 161 |     strcpy(archiverbb2, p);
 | 
|---|
| 162 |     // Get lines per record count
 | 
|---|
| 163 |     if (!fgets(s, 256, handle))
 | 
|---|
| 164 |     {
 | 
|---|
| 165 |         fclose(handle);
 | 
|---|
| 166 |         return -3;
 | 
|---|
| 167 |     }
 | 
|---|
| 168 |     p = strchr(s, ';');
 | 
|---|
| 169 |     if (p)
 | 
|---|
| 170 |         *p = 0;                         // Chop trailing comment
 | 
|---|
| 171 |     bstripcr(s);
 | 
|---|
| 172 |     if (*s)
 | 
|---|
| 173 |         numlines = atoi(s);
 | 
|---|
| 174 |     if (!*s || numlines < NUMLINES)
 | 
|---|
| 175 |         return -3;
 | 
|---|
| 176 |     // Parse rest
 | 
|---|
| 177 |     while (!feof(handle))
 | 
|---|
| 178 |     {
 | 
|---|
| 179 |         if (!fgets(s, 256, handle))
 | 
|---|
| 180 |             break;                      // EOF
 | 
|---|
| 181 |         p = strchr(s, ';');
 | 
|---|
| 182 |         if (p)
 | 
|---|
| 183 |             *p = 0;                     // Chop comment
 | 
|---|
| 184 |         bstripcr(s);
 | 
|---|
| 185 |         // 1st non-blank line starts definition
 | 
|---|
| 186 |         // fixme to preserve comments
 | 
|---|
| 187 |         // fixme to avoid allocating empty fields
 | 
|---|
| 188 |         if (*s)
 | 
|---|
| 189 |         {
 | 
|---|
| 190 |             info = malloc(sizeof(ARC_TYPE));
 | 
|---|
| 191 |             if (!info)
 | 
|---|
| 192 |                 break;                  // fixme to complain
 | 
|---|
| 193 |             memset(info, 0, sizeof(ARC_TYPE));
 | 
|---|
| 194 |             if (*s)
 | 
|---|
| 195 |                 info -> id = strdup(s);
 | 
|---|
| 196 |             else
 | 
|---|
| 197 |                 info -> id = NULL;
 | 
|---|
| 198 |             if (!fgets(s, 256, handle))
 | 
|---|
| 199 |                 break;
 | 
|---|
| 200 |             p = strchr(s, ';');
 | 
|---|
| 201 |             if (p)
 | 
|---|
| 202 |                 *p = 0;
 | 
|---|
| 203 |             bstripcr(s);
 | 
|---|
| 204 |             if (*s)
 | 
|---|
| 205 |                 info -> ext = strdup(s);
 | 
|---|
| 206 |             else
 | 
|---|
| 207 |                 info -> ext = NULL;
 | 
|---|
| 208 |             if (!fgets(s, 256, handle))
 | 
|---|
| 209 |                 break;
 | 
|---|
| 210 |             p = strchr(s, ';');
 | 
|---|
| 211 |             if (p)
 | 
|---|
| 212 |                 *p = 0;
 | 
|---|
| 213 |             info -> file_offset = atol(s);
 | 
|---|
| 214 |             if (!fgets(s, 256, handle))
 | 
|---|
| 215 |                 break;
 | 
|---|
| 216 |             p = strchr(s, ';');
 | 
|---|
| 217 |             if (p)
 | 
|---|
| 218 |                 *p = 0;
 | 
|---|
| 219 |             bstripcr(s);
 | 
|---|
| 220 |             if (*s)
 | 
|---|
| 221 |                 info -> list = strdup(s);
 | 
|---|
| 222 |             else
 | 
|---|
| 223 |                 info -> list = NULL;
 | 
|---|
| 224 |             if (!info -> list)
 | 
|---|
| 225 |                 break;
 | 
|---|
| 226 |             if (!fgets(s, 256, handle))
 | 
|---|
| 227 |                 break;
 | 
|---|
| 228 |             p = strchr(s, ';');
 | 
|---|
| 229 |             if (p)
 | 
|---|
| 230 |                 *p = 0;
 | 
|---|
| 231 |             bstripcr(s);
 | 
|---|
| 232 |             if (*s)
 | 
|---|
| 233 |                 info -> extract = strdup(s);
 | 
|---|
| 234 |             else
 | 
|---|
| 235 |                 info -> extract = NULL;
 | 
|---|
| 236 |             if (!fgets(s, 256, handle))
 | 
|---|
| 237 |                 break;
 | 
|---|
| 238 |             p = strchr(s, ';');
 | 
|---|
| 239 |             if (p)
 | 
|---|
| 240 |                 *p = 0;
 | 
|---|
| 241 |             bstripcr(s);
 | 
|---|
| 242 |             if (*s)
 | 
|---|
| 243 |                 info -> exwdirs = strdup(s);
 | 
|---|
| 244 |             else
 | 
|---|
| 245 |                 info -> exwdirs = NULL;
 | 
|---|
| 246 |             if (!fgets(s, 256, handle))
 | 
|---|
| 247 |                 break;
 | 
|---|
| 248 |             p = strchr(s, ';');
 | 
|---|
| 249 |             if (p)
 | 
|---|
| 250 |                 *p = 0;
 | 
|---|
| 251 |             bstripcr(s);
 | 
|---|
| 252 |             if (*s)
 | 
|---|
| 253 |                 info -> test = strdup(s);
 | 
|---|
| 254 |             else
 | 
|---|
| 255 |                 info -> test = NULL;
 | 
|---|
| 256 |             if (!fgets(s, 256, handle))
 | 
|---|
| 257 |                 break;
 | 
|---|
| 258 |             p = strchr(s, ';');
 | 
|---|
| 259 |             if (p)
 | 
|---|
| 260 |                 *p = 0;
 | 
|---|
| 261 |             bstripcr(s);
 | 
|---|
| 262 |             if (*s)
 | 
|---|
| 263 |                 info -> create = strdup(s);
 | 
|---|
| 264 |             else
 | 
|---|
| 265 |                 info -> create = NULL;
 | 
|---|
| 266 |             if (!fgets(s, 256, handle))
 | 
|---|
| 267 |                 break;
 | 
|---|
| 268 |             p = strchr(s, ';');
 | 
|---|
| 269 |             if (p)
 | 
|---|
| 270 |                 *p = 0;                 // Chop comment
 | 
|---|
| 271 | 
 | 
|---|
| 272 |             bstripcr(s);
 | 
|---|
| 273 |             if (*s)
 | 
|---|
| 274 |                 info -> createwdirs = strdup(s);
 | 
|---|
| 275 |             else
 | 
|---|
| 276 |                 info -> createwdirs = NULL;
 | 
|---|
| 277 |             if (!fgets(s, 256, handle))
 | 
|---|
| 278 |                 break;
 | 
|---|
| 279 |             p = strchr(s, ';');
 | 
|---|
| 280 |             if (p)
 | 
|---|
| 281 |                 *p = 0;
 | 
|---|
| 282 |             bstripcr(s);
 | 
|---|
| 283 |             if (*s)
 | 
|---|
| 284 |                 info -> createrecurse = strdup(s);
 | 
|---|
| 285 |             else
 | 
|---|
| 286 |                 info -> createrecurse = NULL;
 | 
|---|
| 287 |             if (!fgets(s, 256, handle))
 | 
|---|
| 288 |                 break;
 | 
|---|
| 289 |             p = strchr(s, ';');
 | 
|---|
| 290 |             if (p)
 | 
|---|
| 291 |                 *p = 0;
 | 
|---|
| 292 |             bstripcr(s);
 | 
|---|
| 293 |             if (*s)
 | 
|---|
| 294 |                 info -> move = strdup(s);
 | 
|---|
| 295 |             else
 | 
|---|
| 296 |                 info -> move = NULL;
 | 
|---|
| 297 |             if (!fgets(s, 256, handle))
 | 
|---|
| 298 |                 break;
 | 
|---|
| 299 |             p = strchr(s, ';');
 | 
|---|
| 300 |             if (p)
 | 
|---|
| 301 |                 *p = 0;
 | 
|---|
| 302 |             bstripcr(s);
 | 
|---|
| 303 |             if (*s)
 | 
|---|
| 304 |                 info -> movewdirs = strdup(s);
 | 
|---|
| 305 |             else
 | 
|---|
| 306 |                 info -> movewdirs = NULL;
 | 
|---|
| 307 |             if (!fgets(s, 256, handle))
 | 
|---|
| 308 |                 break;
 | 
|---|
| 309 |             p = strchr(s, ';');
 | 
|---|
| 310 |             if (p)
 | 
|---|
| 311 |                 *p = 0;
 | 
|---|
| 312 |             bstripcr(s);
 | 
|---|
| 313 |             info -> delete = strdup(s);
 | 
|---|
| 314 |             if (!fgets(s, 256, handle))
 | 
|---|
| 315 |                 break;
 | 
|---|
| 316 |             stripcr(s);
 | 
|---|
| 317 |             literal(s);
 | 
|---|
| 318 |             if (*s)
 | 
|---|
| 319 |             {
 | 
|---|
| 320 |                 info -> signature = strdup(s);
 | 
|---|
| 321 |                 if (!info -> signature)
 | 
|---|
| 322 |                     break;
 | 
|---|
| 323 |             }
 | 
|---|
| 324 |             else
 | 
|---|
| 325 |                 info -> signature = NULL;
 | 
|---|
| 326 |             if (!fgets(s, 256, handle))
 | 
|---|
| 327 |                 break;
 | 
|---|
| 328 |             stripcr(s);
 | 
|---|
| 329 |             info -> startlist = strdup(s);
 | 
|---|
| 330 |             if (!fgets(s, 256, handle))
 | 
|---|
| 331 |                 break;
 | 
|---|
| 332 |             stripcr(s);
 | 
|---|
| 333 |             if (*s)
 | 
|---|
| 334 |                 info -> endlist = strdup(s);
 | 
|---|
| 335 |             else
 | 
|---|
| 336 |                 info -> endlist = NULL;
 | 
|---|
| 337 |             if (!fgets(s, 256, handle))
 | 
|---|
| 338 |                 break;
 | 
|---|
| 339 |             p = strchr(s, ';');
 | 
|---|
| 340 |             if (p)
 | 
|---|
| 341 |                 *p = 0;
 | 
|---|
| 342 |             info -> osizepos = atoi(s);
 | 
|---|
| 343 |             if (!fgets(s, 256, handle))
 | 
|---|
| 344 |                 break;
 | 
|---|
| 345 |             p = strchr(s, ';');
 | 
|---|
| 346 |             if (p)
 | 
|---|
| 347 |                 *p = 0;
 | 
|---|
| 348 |             info -> nsizepos = atoi(s);
 | 
|---|
| 349 |             if (!fgets(s, 256, handle))
 | 
|---|
| 350 |                 break;
 | 
|---|
| 351 |             p = strchr(s, ';');
 | 
|---|
| 352 |             if (p)
 | 
|---|
| 353 |                 *p = 0;
 | 
|---|
| 354 |             info -> fdpos = atoi(s);
 | 
|---|
| 355 |             p = strchr(s, ',');
 | 
|---|
| 356 |             if (p)
 | 
|---|
| 357 |             {
 | 
|---|
| 358 |                 p++;
 | 
|---|
| 359 |                 info -> datetype = atoi(p);
 | 
|---|
| 360 |             }
 | 
|---|
| 361 |             if (!fgets(s, 256, handle))
 | 
|---|
| 362 |                 break;
 | 
|---|
| 363 |             p = strchr(s, ';');
 | 
|---|
| 364 |             if (p)
 | 
|---|
| 365 |                 *p = 0;
 | 
|---|
| 366 |             info -> fdflds = atoi(s);
 | 
|---|
| 367 |             if (!fgets(s, 256, handle))
 | 
|---|
| 368 |                 break;
 | 
|---|
| 369 |             p = strchr(s, ';');
 | 
|---|
| 370 |             if (p)
 | 
|---|
| 371 |                 *p = 0;
 | 
|---|
| 372 |             info -> fnpos = atoi(s);
 | 
|---|
| 373 |             p = strchr(s, ',');
 | 
|---|
| 374 |             if (p)
 | 
|---|
| 375 |             {
 | 
|---|
| 376 |                 p++;
 | 
|---|
| 377 |                 info -> nameislast = (BOOL) (*p && atol(p) == 0) ? FALSE : TRUE;
 | 
|---|
| 378 |                 p = strchr(p, ',');
 | 
|---|
| 379 |                 if (p)
 | 
|---|
| 380 |                 {
 | 
|---|
| 381 |                     p++;
 | 
|---|
| 382 |                     info -> nameisnext = (BOOL) (*p && atol(p) == 0) ? FALSE : TRUE;
 | 
|---|
| 383 |                     p = strchr(p, ',');
 | 
|---|
| 384 |                     if (p)
 | 
|---|
| 385 |                     {
 | 
|---|
| 386 |                         p++;
 | 
|---|
| 387 |                         info -> nameisfirst = (BOOL) (*p && atol(p) == 0) ? FALSE : TRUE;
 | 
|---|
| 388 |                     }
 | 
|---|
| 389 |                 }
 | 
|---|
| 390 |             }
 | 
|---|
| 391 |             // Ignore unknown lines - must be newer file format
 | 
|---|
| 392 |             for (x = NUMLINES; x < numlines; x++)
 | 
|---|
| 393 |             {
 | 
|---|
| 394 |                 if (!fgets(s, 256, handle))
 | 
|---|
| 395 |                     break;
 | 
|---|
| 396 |             }
 | 
|---|
| 397 | 
 | 
|---|
| 398 |             info -> next = NULL;
 | 
|---|
| 399 | 
 | 
|---|
| 400 |             if (!arcsighead)
 | 
|---|
| 401 |             {
 | 
|---|
| 402 |                 arcsighead = last = info;
 | 
|---|
| 403 |                 info -> prev = NULL;
 | 
|---|
| 404 |             }
 | 
|---|
| 405 |             else
 | 
|---|
| 406 |             {
 | 
|---|
| 407 |                 last -> next = info;
 | 
|---|
| 408 |                 info -> prev = last;
 | 
|---|
| 409 |                 last = info;
 | 
|---|
| 410 |             }
 | 
|---|
| 411 |             if (info -> extract && !*info -> extract)
 | 
|---|
| 412 |             {
 | 
|---|
| 413 |                 free(info -> extract);
 | 
|---|
| 414 |                 info -> extract = NULL;
 | 
|---|
| 415 |             }
 | 
|---|
| 416 |         } // if got definition
 | 
|---|
| 417 |         info = NULL;
 | 
|---|
| 418 |     }
 | 
|---|
| 419 |     fclose(handle);
 | 
|---|
| 420 |     if (info)
 | 
|---|
| 421 |     {
 | 
|---|
| 422 |         // fixme to complain about partial definition
 | 
|---|
| 423 |         if (info -> id)
 | 
|---|
| 424 |             free(info -> id);
 | 
|---|
| 425 |         if (info -> ext)
 | 
|---|
| 426 |             free(info -> ext);
 | 
|---|
| 427 |         if (info -> list)
 | 
|---|
| 428 |             free(info -> list);
 | 
|---|
| 429 |         if (info -> extract)
 | 
|---|
| 430 |             free(info -> extract);
 | 
|---|
| 431 |         if (info -> create)
 | 
|---|
| 432 |             free(info -> create);
 | 
|---|
| 433 |         if (info -> move)
 | 
|---|
| 434 |             free(info -> move);
 | 
|---|
| 435 |         if (info -> delete)
 | 
|---|
| 436 |             free(info -> delete);
 | 
|---|
| 437 |         if (info -> signature)
 | 
|---|
| 438 |             free(info -> signature);
 | 
|---|
| 439 |         if (info -> startlist)
 | 
|---|
| 440 |             free(info -> startlist);
 | 
|---|
| 441 |         if (info -> endlist)
 | 
|---|
| 442 |             free(info -> endlist);
 | 
|---|
| 443 |         if (info -> exwdirs)
 | 
|---|
| 444 |             free(info -> exwdirs);
 | 
|---|
| 445 |         if (info -> test)
 | 
|---|
| 446 |             free(info -> test);
 | 
|---|
| 447 |         if (info -> createrecurse)
 | 
|---|
| 448 |             free(info -> createrecurse);
 | 
|---|
| 449 |         if (info -> createwdirs)
 | 
|---|
| 450 |             free(info -> createwdirs);
 | 
|---|
| 451 |         if (info -> movewdirs)
 | 
|---|
| 452 |             free(info -> movewdirs);
 | 
|---|
| 453 |     }
 | 
|---|
| 454 |     if (!arcsighead)
 | 
|---|
| 455 |         return -4;
 | 
|---|
| 456 |     return 0;
 | 
|---|
| 457 | }
 | 
|---|
| 458 | 
 | 
|---|
| 459 | #pragma alloc_text(FMARCHIVE,SBoxDlgProc)
 | 
|---|
| 460 | 
 | 
|---|
| 461 | MRESULT EXPENTRY SBoxDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
| 462 | {
 | 
|---|
| 463 |     /* dlg proc that allows selecting an archiver entry */
 | 
|---|
| 464 | 
 | 
|---|
| 465 |     ARC_TYPE **info, *temp, *test;
 | 
|---|
| 466 |     SHORT sSelect, x;
 | 
|---|
| 467 |     CHAR text[256];
 | 
|---|
| 468 | 
 | 
|---|
| 469 |     switch (msg)
 | 
|---|
| 470 |     {
 | 
|---|
| 471 |     case WM_INITDLG:
 | 
|---|
| 472 |         if (!loadedarcs)
 | 
|---|
| 473 |             load_archivers();
 | 
|---|
| 474 |         if (!(ARC_TYPE **) mp2)
 | 
|---|
| 475 |         {
 | 
|---|
| 476 |             DosBeep(100, 100);
 | 
|---|
| 477 |             WinDismissDlg(hwnd, 0);
 | 
|---|
| 478 |             break;
 | 
|---|
| 479 |         }
 | 
|---|
| 480 |         info = (ARC_TYPE **) mp2;
 | 
|---|
| 481 |         if (*info)
 | 
|---|
| 482 |             *info = arcsighead;
 | 
|---|
| 483 |         WinSetWindowPtr(hwnd, 0L, (PVOID) info);
 | 
|---|
| 484 |         temp = arcsighead;
 | 
|---|
| 485 |         WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_DELETEALL, MPVOID, MPVOID);
 | 
|---|
| 486 |         /* this loop fills the listbox */
 | 
|---|
| 487 |         {
 | 
|---|
| 488 |             BOOL found = FALSE;
 | 
|---|
| 489 | 
 | 
|---|
| 490 |             while (temp)
 | 
|---|
| 491 |             {
 | 
|---|
| 492 |                 /*
 | 
|---|
| 493 |                  * this inner loop tests for a dupe signature entry and assures
 | 
|---|
| 494 |                  * that only the entry at the top of the list gets used for
 | 
|---|
| 495 |                  * conversion; editing any is okay
 | 
|---|
| 496 |                  */
 | 
|---|
| 497 |                 if (*info)
 | 
|---|
| 498 |                 {
 | 
|---|
| 499 |                     test = arcsighead;
 | 
|---|
| 500 |                     while (test && test != temp)
 | 
|---|
| 501 |                     {
 | 
|---|
| 502 |                         if (test -> signature && temp -> signature &&
 | 
|---|
| 503 |                             !strcmp(test -> signature, temp -> signature))
 | 
|---|
| 504 |                             goto ContinueHere;  // Got match
 | 
|---|
| 505 |                         test = test -> next;
 | 
|---|
| 506 |                     }
 | 
|---|
| 507 |                 }
 | 
|---|
| 508 | 
 | 
|---|
| 509 |                 if (!*info || (temp -> id && temp -> extract && temp -> create))
 | 
|---|
| 510 |                 {
 | 
|---|
| 511 |                     sSelect = (SHORT) WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_INSERTITEM,
 | 
|---|
| 512 |                                                    MPFROM2SHORT(LIT_END, 0),
 | 
|---|
| 513 |                                                       MPFROMP((temp -> id) ?
 | 
|---|
| 514 |                                                          temp -> id : "?"));
 | 
|---|
| 515 |                     if (!found && *szDefArc && temp -> id && !strcmp(szDefArc, temp -> id))
 | 
|---|
| 516 |                     {
 | 
|---|
| 517 |                         WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SELECTITEM,
 | 
|---|
| 518 |                                    MPFROMSHORT(sSelect), MPFROMSHORT(TRUE));
 | 
|---|
| 519 |                         found = TRUE;
 | 
|---|
| 520 |                     }
 | 
|---|
| 521 |                 }
 | 
|---|
| 522 |                 else
 | 
|---|
| 523 |                 {
 | 
|---|
| 524 |                     if (!temp -> id || !*temp -> id)
 | 
|---|
| 525 |                         WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_INSERTITEM,
 | 
|---|
| 526 |                                           MPFROM2SHORT(LIT_END, 0),
 | 
|---|
| 527 |                               MPFROMP(GetPString(IDS_UNKNOWNUNUSABLETEXT)));
 | 
|---|
| 528 |                     else
 | 
|---|
| 529 |                     {
 | 
|---|
| 530 |                         CHAR s[81];
 | 
|---|
| 531 | 
 | 
|---|
| 532 |                         sprintf(s, "%0.12s %s",
 | 
|---|
| 533 |                                 temp -> id,
 | 
|---|
| 534 |                                 GetPString(IDS_UNUSABLETEXT));
 | 
|---|
| 535 |                         WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_INSERTITEM,
 | 
|---|
| 536 |                                           MPFROM2SHORT(LIT_END, 0),
 | 
|---|
| 537 |                                           MPFROMP(s));
 | 
|---|
| 538 |                     }
 | 
|---|
| 539 |                 }
 | 
|---|
| 540 | 
 | 
|---|
| 541 |               ContinueHere:
 | 
|---|
| 542 | 
 | 
|---|
| 543 |                 temp = temp -> next;
 | 
|---|
| 544 |             }
 | 
|---|
| 545 |             if (found)
 | 
|---|
| 546 |                 PosOverOkay(hwnd);
 | 
|---|
| 547 |         }
 | 
|---|
| 548 |         break;
 | 
|---|
| 549 | 
 | 
|---|
| 550 |     case WM_COMMAND:
 | 
|---|
| 551 |         info = (ARC_TYPE **) WinQueryWindowPtr(hwnd, 0L);
 | 
|---|
| 552 |         switch (SHORT1FROMMP(mp1))
 | 
|---|
| 553 |         {
 | 
|---|
| 554 |         case DID_OK:
 | 
|---|
| 555 |             sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
 | 
|---|
| 556 |                                                 ASEL_LISTBOX,
 | 
|---|
| 557 |                                                 LM_QUERYSELECTION,
 | 
|---|
| 558 |                                                 MPFROMSHORT(LIT_FIRST),
 | 
|---|
| 559 |                                                 MPVOID);
 | 
|---|
| 560 |             if (sSelect >= 0)
 | 
|---|
| 561 |             {
 | 
|---|
| 562 |                 temp = arcsighead;
 | 
|---|
| 563 |                 if (*info)
 | 
|---|
| 564 |                 {
 | 
|---|
| 565 |                     *text = 0;
 | 
|---|
| 566 |                     WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_QUERYITEMTEXT,
 | 
|---|
| 567 |                                  MPFROM2SHORT(sSelect, 255), MPFROMP(text));
 | 
|---|
| 568 |                     if (*text)
 | 
|---|
| 569 |                     {
 | 
|---|
| 570 |                         while (temp)
 | 
|---|
| 571 |                         {
 | 
|---|
| 572 |                             if (temp -> id)
 | 
|---|
| 573 |                             {
 | 
|---|
| 574 |                                 if (!strcmp(text, temp -> id))
 | 
|---|
| 575 |                                     break;
 | 
|---|
| 576 |                             }
 | 
|---|
| 577 |                             temp = temp -> next;
 | 
|---|
| 578 |                         }
 | 
|---|
| 579 |                     }
 | 
|---|
| 580 |                     else
 | 
|---|
| 581 |                         temp = NULL;
 | 
|---|
| 582 |                 }
 | 
|---|
| 583 |                 else
 | 
|---|
| 584 |                 {
 | 
|---|
| 585 |                     x = 0;
 | 
|---|
| 586 |                     while (temp)
 | 
|---|
| 587 |                     {
 | 
|---|
| 588 |                         if (x >= sSelect)
 | 
|---|
| 589 |                             break;
 | 
|---|
| 590 |                         x++;
 | 
|---|
| 591 |                         temp = temp -> next;
 | 
|---|
| 592 |                     }
 | 
|---|
| 593 |                 }
 | 
|---|
| 594 |                 if (temp && (!*info || (temp -> id && temp -> extract &&
 | 
|---|
| 595 |                                         temp -> create)))
 | 
|---|
| 596 |                 {
 | 
|---|
| 597 |                     *info = temp;
 | 
|---|
| 598 |                 }
 | 
|---|
| 599 |                 else
 | 
|---|
| 600 |                 {
 | 
|---|
| 601 |                     WinSendDlgItemMsg(hwnd, ASEL_LISTBOX, LM_SELECTITEM,
 | 
|---|
| 602 |                                       MPFROMSHORT(LIT_NONE), FALSE);
 | 
|---|
| 603 |                     DosBeep(100, 100);
 | 
|---|
| 604 |                     temp = NULL;
 | 
|---|
| 605 |                     return 0;
 | 
|---|
| 606 |                 }
 | 
|---|
| 607 |             }
 | 
|---|
| 608 |             else
 | 
|---|
| 609 |             {
 | 
|---|
| 610 |                 DosBeep(100, 100);
 | 
|---|
| 611 |                 return 0;
 | 
|---|
| 612 |             }
 | 
|---|
| 613 |             WinDismissDlg(hwnd, TRUE);
 | 
|---|
| 614 |             return 0;
 | 
|---|
| 615 | 
 | 
|---|
| 616 |         case DID_CANCEL:
 | 
|---|
| 617 |             *info = NULL;
 | 
|---|
| 618 |             PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| 619 |             break;
 | 
|---|
| 620 | 
 | 
|---|
| 621 |         default:
 | 
|---|
| 622 |             break;
 | 
|---|
| 623 |         }
 | 
|---|
| 624 |         return 0;
 | 
|---|
| 625 | 
 | 
|---|
| 626 |     case WM_CONTROL:
 | 
|---|
| 627 |         if (SHORT1FROMMP(mp1) == ASEL_LISTBOX && SHORT2FROMMP(mp1) == LN_ENTER)
 | 
|---|
| 628 |             PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID);
 | 
|---|
| 629 |         return 0;
 | 
|---|
| 630 | 
 | 
|---|
| 631 |     case WM_CLOSE:
 | 
|---|
| 632 |         WinDismissDlg(hwnd, FALSE);
 | 
|---|
| 633 |         return 0;
 | 
|---|
| 634 | 
 | 
|---|
| 635 |     default:
 | 
|---|
| 636 |         break;
 | 
|---|
| 637 |     }
 | 
|---|
| 638 |     return WinDefDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| 639 | }
 | 
|---|
| 640 | 
 | 
|---|
| 641 | /*
 | 
|---|
| 642 |    02-08-96  23:55               1
 | 
|---|
| 643 |    8 Feb 96 23:55:32            2
 | 
|---|
| 644 |    8 Feb 96  11:55p             3
 | 
|---|
| 645 |    96-02-08 23:55:32             4
 | 
|---|
| 646 |  */
 | 
|---|
| 647 | 
 | 
|---|
| 648 | #pragma alloc_text(ARCCNRS,ArcDateTime)
 | 
|---|
| 649 | 
 | 
|---|
| 650 | BOOL ArcDateTime(CHAR * dt, INT type, CDATE * cdate, CTIME * ctime)
 | 
|---|
| 651 | {
 | 
|---|
| 652 |     INT x;
 | 
|---|
| 653 |     BOOL ret = FALSE;
 | 
|---|
| 654 |     CHAR *p, *pp, *pd;
 | 
|---|
| 655 | 
 | 
|---|
| 656 |     if (dt && cdate && ctime)
 | 
|---|
| 657 |     {
 | 
|---|
| 658 |         memset(cdate, 0, sizeof(CDATE));
 | 
|---|
| 659 |         memset(ctime, 0, sizeof(CTIME));
 | 
|---|
| 660 |         if (type)
 | 
|---|
| 661 |         {
 | 
|---|
| 662 |             p = dt;
 | 
|---|
| 663 |             while (*p && *p == ' ')
 | 
|---|
| 664 |                 p++;
 | 
|---|
| 665 |             pd = dt;
 | 
|---|
| 666 |             switch (type)
 | 
|---|
| 667 |             {
 | 
|---|
| 668 |             case 1:
 | 
|---|
| 669 |                 cdate -> month = atoi(pd);
 | 
|---|
| 670 |                 p = to_delim(pd, "-/.");
 | 
|---|
| 671 |                 if (p)
 | 
|---|
| 672 |                 {
 | 
|---|
| 673 |                     p++;
 | 
|---|
| 674 |                     cdate -> day = atoi(p);
 | 
|---|
| 675 |                     pd = p;
 | 
|---|
| 676 |                     p = to_delim(pd, "-/.");
 | 
|---|
| 677 |                     if (p)
 | 
|---|
| 678 |                     {
 | 
|---|
| 679 |                         p++;
 | 
|---|
| 680 |                         cdate -> year = atoi(p);
 | 
|---|
| 681 |                         if (cdate -> year > 80 && cdate -> year < 1900)
 | 
|---|
| 682 |                             cdate -> year += 1900;
 | 
|---|
| 683 |                         else if (cdate -> year < 1900)
 | 
|---|
| 684 |                             cdate -> year += 2000;
 | 
|---|
| 685 |                         ret = TRUE;
 | 
|---|
| 686 |                         p = strchr(p, ' ');
 | 
|---|
| 687 |                         if (p)
 | 
|---|
| 688 |                         {
 | 
|---|
| 689 |                             while (*p && *p == ' ')
 | 
|---|
| 690 |                                 p++;
 | 
|---|
| 691 |                             ctime -> hours = atoi(p);
 | 
|---|
| 692 |                             p = to_delim(pd, ":.");
 | 
|---|
| 693 |                             if (p)
 | 
|---|
| 694 |                             {
 | 
|---|
| 695 |                                 p++;
 | 
|---|
| 696 |                                 ctime -> minutes = atoi(p);
 | 
|---|
| 697 |                                 p = to_delim(pd, ":.");
 | 
|---|
| 698 |                                 if (p)
 | 
|---|
| 699 |                                 {
 | 
|---|
| 700 |                                     p++;
 | 
|---|
| 701 |                                     ctime -> seconds = atoi(p);
 | 
|---|
| 702 |                                 }
 | 
|---|
| 703 |                             }
 | 
|---|
| 704 |                         }
 | 
|---|
| 705 |                     }
 | 
|---|
| 706 |                 }
 | 
|---|
| 707 |                 break;
 | 
|---|
| 708 | 
 | 
|---|
| 709 |             case 2:
 | 
|---|
| 710 |                 cdate -> day = atoi(p);
 | 
|---|
| 711 |                 p = strchr(p, ' ');
 | 
|---|
| 712 |                 if (p)
 | 
|---|
| 713 |                 {
 | 
|---|
| 714 |                     p++;
 | 
|---|
| 715 |                     for (x = 0; x < 12; x++)
 | 
|---|
| 716 |                     {
 | 
|---|
| 717 |                         if (!strnicmp(p, GetPString(IDS_JANUARY + x), 3))
 | 
|---|
| 718 |                             break;
 | 
|---|
| 719 |                     }
 | 
|---|
| 720 |                     if (x < 12)
 | 
|---|
| 721 |                     {
 | 
|---|
| 722 |                         cdate -> month = x;
 | 
|---|
| 723 |                         p = strchr(p, ' ');
 | 
|---|
| 724 |                         if (p)
 | 
|---|
| 725 |                         {
 | 
|---|
| 726 |                             p++;
 | 
|---|
| 727 |                             cdate -> year = atoi(p);
 | 
|---|
| 728 |                             if (cdate -> year > 80 && cdate -> year < 1900)
 | 
|---|
| 729 |                                 cdate -> year += 1900;
 | 
|---|
| 730 |                             else if (cdate -> year < 1900)
 | 
|---|
| 731 |                                 cdate -> year += 2000;
 | 
|---|
| 732 |                             ret = TRUE;
 | 
|---|
| 733 |                             p = strchr(p, ' ');
 | 
|---|
| 734 |                             if (p)
 | 
|---|
| 735 |                             {
 | 
|---|
| 736 |                                 while (*p && *p == ' ')
 | 
|---|
| 737 |                                     p++;
 | 
|---|
| 738 |                                 ctime -> hours = atoi(p);
 | 
|---|
| 739 |                                 p = to_delim(pd, ":.");
 | 
|---|
| 740 |                                 if (p)
 | 
|---|
| 741 |                                 {
 | 
|---|
| 742 |                                     p++;
 | 
|---|
| 743 |                                     ctime -> minutes = atoi(p);
 | 
|---|
| 744 |                                     p = to_delim(pd, ":.");
 | 
|---|
| 745 |                                     if (p)
 | 
|---|
| 746 |                                     {
 | 
|---|
| 747 |                                         p++;
 | 
|---|
| 748 |                                         ctime -> seconds = atoi(p);
 | 
|---|
| 749 |                                     }
 | 
|---|
| 750 |                                 }
 | 
|---|
| 751 |                             }
 | 
|---|
| 752 |                         }
 | 
|---|
| 753 |                     }
 | 
|---|
| 754 |                 }
 | 
|---|
| 755 |                 break;
 | 
|---|
| 756 | 
 | 
|---|
| 757 |             case 3:
 | 
|---|
| 758 |                 cdate -> day = atoi(p);
 | 
|---|
| 759 |                 p = strchr(p, ' ');
 | 
|---|
| 760 |                 if (p)
 | 
|---|
| 761 |                 {
 | 
|---|
| 762 |                     p++;
 | 
|---|
| 763 |                     for (x = 0; x < 12; x++)
 | 
|---|
| 764 |                     {
 | 
|---|
| 765 |                         if (!strnicmp(p, GetPString(IDS_JANUARY + x), 3))
 | 
|---|
| 766 |                             break;
 | 
|---|
| 767 |                     }
 | 
|---|
| 768 |                     if (x < 12)
 | 
|---|
| 769 |                     {
 | 
|---|
| 770 |                         cdate -> month = x;
 | 
|---|
| 771 |                         p = strchr(p, ' ');
 | 
|---|
| 772 |                         if (p)
 | 
|---|
| 773 |                         {
 | 
|---|
| 774 |                             p++;
 | 
|---|
| 775 |                             cdate -> year = atoi(p);
 | 
|---|
| 776 |                             if (cdate -> year > 80 && cdate -> year < 1900)
 | 
|---|
| 777 |                                 cdate -> year += 1900;
 | 
|---|
| 778 |                             else if (cdate -> year < 1900)
 | 
|---|
| 779 |                                 cdate -> year += 2000;
 | 
|---|
| 780 |                             ret = TRUE;
 | 
|---|
| 781 |                             p = strchr(p, ' ');
 | 
|---|
| 782 |                             if (p)
 | 
|---|
| 783 |                             {
 | 
|---|
| 784 |                                 while (*p && *p == ' ')
 | 
|---|
| 785 |                                     p++;
 | 
|---|
| 786 |                                 ctime -> hours = atoi(p);
 | 
|---|
| 787 |                                 p = to_delim(pd, ":.");
 | 
|---|
| 788 |                                 if (p)
 | 
|---|
| 789 |                                 {
 | 
|---|
| 790 |                                     p++;
 | 
|---|
| 791 |                                     pp = p;
 | 
|---|
| 792 |                                     ctime -> minutes = atoi(p);
 | 
|---|
| 793 |                                     p = to_delim(pd, ":.");
 | 
|---|
| 794 |                                     if (p)
 | 
|---|
| 795 |                                     {
 | 
|---|
| 796 |                                         p++;
 | 
|---|
| 797 |                                         ctime -> seconds = atoi(p);
 | 
|---|
| 798 |                                         p += 2;
 | 
|---|
| 799 |                                         if (toupper(*p) == 'P')
 | 
|---|
| 800 |                                             ctime -> hours += 12;
 | 
|---|
| 801 |                                     }
 | 
|---|
| 802 |                                     else
 | 
|---|
| 803 |                                     {
 | 
|---|
| 804 |                                         p = pp;
 | 
|---|
| 805 |                                         p += 2;
 | 
|---|
| 806 |                                         if (toupper(*p) == 'P')
 | 
|---|
| 807 |                                             ctime -> hours += 12;
 | 
|---|
| 808 |                                     }
 | 
|---|
| 809 |                                 }
 | 
|---|
| 810 |                             }
 | 
|---|
| 811 |                         }
 | 
|---|
| 812 |                     }
 | 
|---|
| 813 |                 }
 | 
|---|
| 814 |                 break;
 | 
|---|
| 815 | 
 | 
|---|
| 816 |             case 4:
 | 
|---|
| 817 |                 cdate -> year = atoi(p);
 | 
|---|
| 818 |                 if (cdate -> year > 80 && cdate -> year < 1900)
 | 
|---|
| 819 |                     cdate -> year += 1900;
 | 
|---|
| 820 |                 else if (cdate -> year < 1900)
 | 
|---|
| 821 |                     cdate -> year += 2000;
 | 
|---|
| 822 |                 p = to_delim(pd, "-/.");
 | 
|---|
| 823 |                 if (p)
 | 
|---|
| 824 |                 {
 | 
|---|
| 825 |                     p++;
 | 
|---|
| 826 |                     cdate -> month = atoi(p);
 | 
|---|
| 827 |                     pd = p;
 | 
|---|
| 828 |                     p = to_delim(pd, "-/.");
 | 
|---|
| 829 |                     if (p)
 | 
|---|
| 830 |                     {
 | 
|---|
| 831 |                         p++;
 | 
|---|
| 832 |                         cdate -> day = atoi(p);
 | 
|---|
| 833 |                         ret = TRUE;
 | 
|---|
| 834 |                         p = strchr(p, ' ');
 | 
|---|
| 835 |                         if (p)
 | 
|---|
| 836 |                         {
 | 
|---|
| 837 |                             while (*p && *p == ' ')
 | 
|---|
| 838 |                                 p++;
 | 
|---|
| 839 |                             ctime -> hours = atoi(p);
 | 
|---|
| 840 |                             p = to_delim(pd, ":.");
 | 
|---|
| 841 |                             if (p)
 | 
|---|
| 842 |                             {
 | 
|---|
| 843 |                                 p++;
 | 
|---|
| 844 |                                 ctime -> minutes = atoi(p);
 | 
|---|
| 845 |                                 p = to_delim(pd, ":.");
 | 
|---|
| 846 |                                 if (p)
 | 
|---|
| 847 |                                 {
 | 
|---|
| 848 |                                     p++;
 | 
|---|
| 849 |                                     ctime -> seconds = atoi(p);
 | 
|---|
| 850 |                                 }
 | 
|---|
| 851 |                             }
 | 
|---|
| 852 |                         }
 | 
|---|
| 853 |                     }
 | 
|---|
| 854 |                 }
 | 
|---|
| 855 |                 break;
 | 
|---|
| 856 | 
 | 
|---|
| 857 |             case 5:
 | 
|---|
| 858 |                 cdate -> day = atoi(pd);
 | 
|---|
| 859 |                 p = to_delim(pd, "-/.");
 | 
|---|
| 860 |                 if (p)
 | 
|---|
| 861 |                 {
 | 
|---|
| 862 |                     p++;
 | 
|---|
| 863 |                     cdate -> month = atoi(p);
 | 
|---|
| 864 |                     pd = p;
 | 
|---|
| 865 |                     p = to_delim(pd, "-/.");
 | 
|---|
| 866 |                     if (p)
 | 
|---|
| 867 |                     {
 | 
|---|
| 868 |                         p++;
 | 
|---|
| 869 |                         cdate -> year = atoi(p);
 | 
|---|
| 870 |                         if (cdate -> year > 80 && cdate -> year < 1900)
 | 
|---|
| 871 |                             cdate -> year += 1900;
 | 
|---|
| 872 |                         else if (cdate -> year < 1900)
 | 
|---|
| 873 |                             cdate -> year += 2000;
 | 
|---|
| 874 |                         ret = TRUE;
 | 
|---|
| 875 |                         p = strchr(p, ' ');
 | 
|---|
| 876 |                         if (p)
 | 
|---|
| 877 |                         {
 | 
|---|
| 878 |                             while (*p && *p == ' ')
 | 
|---|
| 879 |                                 p++;
 | 
|---|
| 880 |                             ctime -> hours = atoi(p);
 | 
|---|
| 881 |                             p = to_delim(pd, ":.");
 | 
|---|
| 882 |                             if (p)
 | 
|---|
| 883 |                             {
 | 
|---|
| 884 |                                 p++;
 | 
|---|
| 885 |                                 ctime -> minutes = atoi(p);
 | 
|---|
| 886 |                                 p = to_delim(pd, ":.");
 | 
|---|
| 887 |                                 if (p)
 | 
|---|
| 888 |                                 {
 | 
|---|
| 889 |                                     p++;
 | 
|---|
| 890 |                                     ctime -> seconds = atoi(p);
 | 
|---|
| 891 |                                 }
 | 
|---|
| 892 |                             }
 | 
|---|
| 893 |                         }
 | 
|---|
| 894 |                     }
 | 
|---|
| 895 |                 }
 | 
|---|
| 896 |                 break;
 | 
|---|
| 897 | 
 | 
|---|
| 898 |             default:
 | 
|---|
| 899 |                 break;
 | 
|---|
| 900 |             }
 | 
|---|
| 901 |         }
 | 
|---|
| 902 |     }
 | 
|---|
| 903 |     return ret;
 | 
|---|
| 904 | }
 | 
|---|