Changeset 287 for trunk/dll/avl.c


Ignore:
Timestamp:
Jan 1, 2006, 12:01:21 AM (20 years ago)
Author:
root
Message:

indent -i2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/avl.c

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