Subversion Repositories SvarDOS

Rev

Rev 2020 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2020 Rev 2022
Line 37... Line 37...
37
DEALINGS IN THE SOFTWARE.
37
DEALINGS IN THE SOFTWARE.
38
 
38
 
39
****************************************************************************/
39
****************************************************************************/
40
 
40
 
41
/**
41
/**
42
 * Define the appropriate target here or within your compiler 
42
 * Define the appropriate target here or within your compiler
43
 */
43
 */
44
/* #define WIN32 */    /** Win32 console version **/
44
/* #define WIN32 */    /** Win32 console version **/
45
/* #define DOS */      /** DOS version           **/
45
/* #define DOS */      /** DOS version           **/
46
/* #define UNIX */
46
/* #define UNIX */
47
 
47
 
48
/** 
-
 
49
 * Used to determine whether catgets (LGPL under Win32 & DOS) is used or not.
-
 
50
 * Undefine, ie comment out, to use hard coded strings only.
-
 
51
 */
-
 
52
/* #define USE_CATGETS */
-
 
53
 
-
 
54
 
48
 
55
/* Include files */
49
/* Include files */
56
#include <stdlib.h>
50
#include <stdlib.h>
57
#include <stdio.h>
51
#include <stdio.h>
58
#include <string.h>
52
#include <string.h>
Line 83... Line 77...
83
*/
77
*/
84
 
78
 
85
/* These are defined in w32fDOS.h for DOS and enable /
79
/* These are defined in w32fDOS.h for DOS and enable /
86
   disable use of DOS extended int21h API for LFNs,
80
   disable use of DOS extended int21h API for LFNs,
87
   on Windows we use it to force using short name when
81
   on Windows we use it to force using short name when
88
   both a long and short name are available 
82
   both a long and short name are available
89
   (note, LFNs may still be shown when no SFN exists)
83
   (note, LFNs may still be shown when no SFN exists)
90
*/
84
*/
91
#define LFN_ENABLE 1
85
#define LFN_ENABLE 1
92
#define LFN_DISABLE 0
86
#define LFN_DISABLE 0
93
int LFN_Enable_Flag = LFN_ENABLE;
87
int LFN_Enable_Flag = LFN_ENABLE;
Line 110... Line 104...
110
 
104
 
111
/* DOS compiler treats L"" as a char * */
105
/* DOS compiler treats L"" as a char * */
112
const WORD UDOT[]    = { 0x2E, 0x00 };        //   L"."
106
const WORD UDOT[]    = { 0x2E, 0x00 };        //   L"."
113
const WORD UDOTDOT[] = { 0x2E, 0x2E, 0x00 };  //   L".."
107
const WORD UDOTDOT[] = { 0x2E, 0x2E, 0x00 };  //   L".."
114
 
108
 
115
#endif                  
109
#endif
116
 
110
 
117
 
111
 
118
/* Define getdrive so it returns current drive, 0=A,1=B,...           */
112
/* Define getdrive so it returns current drive, 0=A,1=B,...           */
119
#if defined _MSC_VER || defined __MSC /* MS Visual C/C++ 5 */
113
#if defined _MSC_VER || defined __MSC /* MS Visual C/C++ 5 */
120
#define getdrive() (_getdrive() - 1)
114
#define getdrive() (_getdrive() - 1)
Line 123... Line 117...
123
#endif
117
#endif
124
 
118
 
125
#include <conio.h>  /* for getch()   */
119
#include <conio.h>  /* for getch()   */
126
 
120
 
127
 
121
 
128
/* include support for message files */
-
 
129
#ifdef USE_CATGETS
-
 
130
#include "catgets.h"
-
 
131
#endif /* USE_CATGETS */
-
 
132
 
-
 
133
/* End Platform (OS) specific sections */
122
/* End Platform (OS) specific sections */
134
 
123
 
135
 
124
 
136
/* The default extended forms of the lines used. */
125
/* The default extended forms of the lines used. */
137
#define VERTBAR_STR  "\xB3   "                 /* |    */
126
#define VERTBAR_STR  "\xB3   "                 /* |    */
Line 142... Line 131...
142
const char *UMARKER = "\xEF\xBB\xBF";   /* 0xFEFF, Indicate UTF-8 Unicode */
131
const char *UMARKER = "\xEF\xBB\xBF";   /* 0xFEFF, Indicate UTF-8 Unicode */
143
#define UVERTBAR_STR  "\xE2\x94\x82   "                                         /* |    */
132
#define UVERTBAR_STR  "\xE2\x94\x82   "                                         /* |    */
144
#define UTBAR_HORZBAR_STR "\xE2\x94\x9C\xE2\x94\x80\xE2\x94\x80\xE2\x94\x80"    /* +--- */
133
#define UTBAR_HORZBAR_STR "\xE2\x94\x9C\xE2\x94\x80\xE2\x94\x80\xE2\x94\x80"    /* +--- */
145
#define UCBAR_HORZBAR_STR "\xE2\x94\x94\xE2\x94\x80\xE2\x94\x80\xE2\x94\x80"    /* \--- */
134
#define UCBAR_HORZBAR_STR "\xE2\x94\x94\xE2\x94\x80\xE2\x94\x80\xE2\x94\x80"    /* \--- */
146
/*
135
/*
147
const unichar UVERTBAR_STR[]      = { 0x2502, 0x20, 0x20, 0x20 };       
136
const unichar UVERTBAR_STR[]      = { 0x2502, 0x20, 0x20, 0x20 };
148
const unichar UTBAR_HORZBAR_STR[] = { 0x251C, 0x2500, 0x2500, 0x2500 };
137
const unichar UTBAR_HORZBAR_STR[] = { 0x251C, 0x2500, 0x2500, 0x2500 };
149
const unichar UCBAR_HORZBAR_STR[] = { 0x2514, 0x2500, 0x2500, 0x2500 };
138
const unichar UCBAR_HORZBAR_STR[] = { 0x2514, 0x2500, 0x2500, 0x2500 };
150
*/
139
*/
151
 
140
 
152
 
141
 
Line 178... Line 167...
178
unsigned long totalSubDirCnt = 0;
167
unsigned long totalSubDirCnt = 0;
179
 
168
 
180
 
169
 
181
/* text window size, used to determine when to pause,
170
/* text window size, used to determine when to pause,
182
   Note: rows is total rows available - 2
171
   Note: rows is total rows available - 2
183
   1 is for pause message and then one to prevent auto scroll up 
172
   1 is for pause message and then one to prevent auto scroll up
184
*/
173
*/
185
short cols=80, rows=23;   /* determined these on startup (when possible)  */
174
short cols=80, rows=23;   /* determined these on startup (when possible)  */
186
 
175
 
187
 
176
 
188
#ifdef USE_CATGETS
-
 
189
  char *catsFile = "tree";   /* filename of our message catalog           */
-
 
190
#endif /* USE_CATGETS */
-
 
191
 
-
 
192
 
177
 
193
/* Global constants */
178
/* Global constants */
194
#define SERIALLEN 16      /* Defines max size of volume & serial number   */
179
#define SERIALLEN 16      /* Defines max size of volume & serial number   */
195
#define VOLLEN 128
180
#define VOLLEN 128
196
 
181
 
Line 226... Line 211...
226
char version[MAXLINE] =       "Version %s\n"; /* Must include the %s for version string. */
211
char version[MAXLINE] =       "Version %s\n"; /* Must include the %s for version string. */
227
char writtenBy[MAXLINE] =     "Written by: Kenneth J. Davis\n";
212
char writtenBy[MAXLINE] =     "Written by: Kenneth J. Davis\n";
228
char writtenDate[MAXLINE] =   "Date:       2000, 2001, 2004\n";
213
char writtenDate[MAXLINE] =   "Date:       2000, 2001, 2004\n";
229
char contact[MAXLINE] =       "Contact:    jeremyd@computer.org\n";
214
char contact[MAXLINE] =       "Contact:    jeremyd@computer.org\n";
230
char copyright[MAXLINE] =     "Copyright (c): Public Domain [United States Definition]\n";
215
char copyright[MAXLINE] =     "Copyright (c): Public Domain [United States Definition]\n";
231
#ifdef USE_CATGETS
-
 
232
char catsCopyright[MAXLINE] = "Uses Jim Hall's <jhall@freedos.org> Cats Library\n  version 3.8 Copyright (C) 1999,2000 Jim Hall\n";
-
 
233
#endif
-
 
234
 
216
 
235
/* showInvalidDrive [Set 5] */
217
/* showInvalidDrive [Set 5] */
236
char invalidDrive[MAXLINE] = "Invalid drive specification\n";
218
char invalidDrive[MAXLINE] = "Invalid drive specification\n";
237
 
219
 
238
/* showInvalidPath [Set 6] */
220
/* showInvalidPath [Set 6] */
Line 266... Line 248...
266
const char OptSort[2]      = { 'O', 'o' };  /* sort Output */
248
const char OptSort[2]      = { 'O', 'o' };  /* sort Output */
267
 
249
 
268
 
250
 
269
/* Procedures */
251
/* Procedures */
270
 
252
 
271
/* Convert src from given codepage to UTF-16, 
253
/* Convert src from given codepage to UTF-16,
272
 * returns nonzero on success, 0 on any error
254
 * returns nonzero on success, 0 on any error
273
 * cp is the codepage of source string, should be either CP_ACP (ansi)
255
 * cp is the codepage of source string, should be either CP_ACP (ansi)
274
 * or CP_OEM (DOS, e.g. cp437).
256
 * or CP_OEM (DOS, e.g. cp437).
275
 */
257
 */
276
#define convertCPtoUTF16(cp, src, dst, dstsize) \
258
#define convertCPtoUTF16(cp, src, dst, dstsize) \
Line 494... Line 476...
494
{
476
{
495
  printf("%s%s%s%s%s", treeDescription, newLine, treeGoal, treePlatforms, newLine);
477
  printf("%s%s%s%s%s", treeDescription, newLine, treeGoal, treePlatforms, newLine);
496
  printf(version, VERSION);
478
  printf(version, VERSION);
497
  printf("%s%s%s%s%s", writtenBy, writtenDate, contact, newLine, newLine);
479
  printf("%s%s%s%s%s", writtenBy, writtenDate, contact, newLine, newLine);
498
  printf("%s%s", copyright, newLine);
480
  printf("%s%s", copyright, newLine);
499
#ifdef USE_CATGETS
-
 
500
  printf("%s%s", catsCopyright, newLine);
-
 
501
#endif
-
 
502
  exit(1);
481
  exit(1);
503
}
482
}
504
 
483
 
505
 
484
 
506
/* Displays error messge for invalid drives and exits */
485
/* Displays error messge for invalid drives and exits */
Line 761... Line 740...
761
 
740
 
762
 
741
 
763
/**
742
/**
764
 * Fills in the serial and volume variables with the serial #
743
 * Fills in the serial and volume variables with the serial #
765
 * and volume found using path.
744
 * and volume found using path.
766
 * If there is an error getting the volume & serial#, then an 
745
 * If there is an error getting the volume & serial#, then an
767
 * error message is displayed and the program exits.
746
 * error message is displayed and the program exits.
768
 * Volume and/or serial # returned may be blank if the path specified
747
 * Volume and/or serial # returned may be blank if the path specified
769
 * does not contain them, or an error retrieving 
748
 * does not contain them, or an error retrieving
770
 * (ie UNC paths under DOS), but path is valid.
749
 * (ie UNC paths under DOS), but path is valid.
771
 */
750
 */
772
void GetVolumeAndSerial(char *volume, char *serial, char *path)
751
void GetVolumeAndSerial(char *volume, char *serial, char *path)
773
{
752
{
774
  char rootPath[MAXBUF];
753
  char rootPath[MAXBUF];
Line 897... Line 876...
897
  if (ddata != NULL)  // don't bother if user doesn't want them
876
  if (ddata != NULL)  // don't bother if user doesn't want them
898
  {
877
  {
899
    /* The root directory of a volume (including non root paths
878
    /* The root directory of a volume (including non root paths
900
       corresponding to mount points) may not have a current (.) and
879
       corresponding to mount points) may not have a current (.) and
901
       parent (..) entry.  So we can't get attributes for initial
880
       parent (..) entry.  So we can't get attributes for initial
902
       path in above loop from the FindFile call as it may not show up 
881
       path in above loop from the FindFile call as it may not show up
903
       (no . entry).  So instead we explicitly get them here.
882
       (no . entry).  So instead we explicitly get them here.
904
    */
883
    */
905
    if ((ddata->dwDirAttributes = GetFileAttributes(path)) == (DWORD)-1)
884
    if ((ddata->dwDirAttributes = GetFileAttributes(path)) == (DWORD)-1)
906
    {
885
    {
907
      //printf("ERROR: unable to get file attr, %i\n", GetLastError());
886
      //printf("ERROR: unable to get file attr, %i\n", GetLastError());
Line 939... Line 918...
939
  subdirLen = strlen(subdir);
918
  subdirLen = strlen(subdir);
940
  if ((subdirLen < 1) || ( (*(subdir+subdirLen-1) != '\\') && (*(subdir+subdirLen-1) != '/') ) )
919
  if ((subdirLen < 1) || ( (*(subdir+subdirLen-1) != '\\') && (*(subdir+subdirLen-1) != '/') ) )
941
    subdirLen++;
920
    subdirLen++;
942
 
921
 
943
  SUBDIRINFO *temp = (SUBDIRINFO *)malloc(sizeof(SUBDIRINFO));
922
  SUBDIRINFO *temp = (SUBDIRINFO *)malloc(sizeof(SUBDIRINFO));
944
  if (temp == NULL) 
923
  if (temp == NULL)
945
  {
924
  {
946
    showOutOfMemory(subdir);
925
    showOutOfMemory(subdir);
947
    return NULL;
926
    return NULL;
948
  }
927
  }
949
  if ( ((temp->currentpath = (char *)malloc(parentLen+subdirLen+1)) == NULL) ||
928
  if ( ((temp->currentpath = (char *)malloc(parentLen+subdirLen+1)) == NULL) ||
Line 978... Line 957...
978
}
957
}
979
 
958
 
980
/**
959
/**
981
 * Extends the padding with the necessary 4 characters.
960
 * Extends the padding with the necessary 4 characters.
982
 * Returns the pointer to the padding.
961
 * Returns the pointer to the padding.
983
 * padding should be large enough to hold the additional 
962
 * padding should be large enough to hold the additional
984
 * characters and '\0', moreSubdirsFollow specifies if
963
 * characters and '\0', moreSubdirsFollow specifies if
985
 * this is the last subdirectory in a given directory
964
 * this is the last subdirectory in a given directory
986
 * or if more follow (hence if a | is needed).
965
 * or if more follow (hence if a | is needed).
987
 * padding must not be NULL
966
 * padding must not be NULL
988
 * Warning: if charSet == UNICODECHARS, then padding
967
 * Warning: if charSet == UNICODECHARS, then padding
Line 1120... Line 1099...
1120
  /* display directory name */
1099
  /* display directory name */
1121
  pprintf("%s\n", currentpath);
1100
  pprintf("%s\n", currentpath);
1122
}
1101
}
1123
 
1102
 
1124
 
1103
 
1125
/** 
1104
/**
1126
 * Displays summary information about directory.
1105
 * Displays summary information about directory.
1127
 * Expects to be called after displayFiles (optionally called)
1106
 * Expects to be called after displayFiles (optionally called)
1128
 */
1107
 */
1129
void displaySummary(char *path, char *padding, int hasMoreSubdirs, DIRDATA *ddata)
1108
void displaySummary(char *path, char *padding, int hasMoreSubdirs, DIRDATA *ddata)
1130
{
1109
{
Line 1146... Line 1125...
1146
  }
1125
  }
1147
 
1126
 
1148
  removePadding(padding);
1127
  removePadding(padding);
1149
}
1128
}
1150
 
1129
 
1151
/** 
1130
/**
1152
 * Displays files in directory specified by path.
1131
 * Displays files in directory specified by path.
1153
 * Path must end in slash \ or /
1132
 * Path must end in slash \ or /
1154
 * Returns -1 on error,
1133
 * Returns -1 on error,
1155
 *          0 if no files, but no errors either,
1134
 *          0 if no files, but no errors either,
1156
 *      or  1 if files displayed, no errors.
1135
 *      or  1 if files displayed, no errors.
Line 1170... Line 1149...
1170
    return -1;
1149
    return -1;
1171
 
1150
 
1172
  addPadding(padding, hasMoreSubdirs);
1151
  addPadding(padding, hasMoreSubdirs);
1173
 
1152
 
1174
  /* cycle through directory printing out files. */
1153
  /* cycle through directory printing out files. */
1175
  do 
1154
  do
1176
  {
1155
  {
1177
    /* print padding followed by filename */
1156
    /* print padding followed by filename */
1178
    if ( ((entry.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) &&
1157
    if ( ((entry.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) &&
1179
         ( ((entry.dwFileAttributes & (FILE_ATTRIBUTE_HIDDEN |
1158
         ( ((entry.dwFileAttributes & (FILE_ATTRIBUTE_HIDDEN |
1180
         FILE_ATTRIBUTE_SYSTEM)) == 0)  || dspAll) )
1159
         FILE_ATTRIBUTE_SYSTEM)) == 0)  || dspAll) )
Line 1330... Line 1309...
1330
      else
1309
      else
1331
      {
1310
      {
1332
        /* set display name */
1311
        /* set display name */
1333
        if ((LFN_Enable_Flag == LFN_DISABLE) && (entry.ud.cAlternateFileName[0] != '\0') )
1312
        if ((LFN_Enable_Flag == LFN_DISABLE) && (entry.ud.cAlternateFileName[0] != '\0') )
1334
          convertUTF16toUTF8(entry.ud.cAlternateFileName, dsubdir, MAXBUF);
1313
          convertUTF16toUTF8(entry.ud.cAlternateFileName, dsubdir, MAXBUF);
1335
        else 
1314
        else
1336
          convertUTF16toUTF8(entry.ud.cFileName, dsubdir, MAXBUF);
1315
          convertUTF16toUTF8(entry.ud.cFileName, dsubdir, MAXBUF);
1337
 
1316
 
1338
        /* set canical name to use for further FindFile calls */
1317
        /* set canical name to use for further FindFile calls */
1339
        /* use short file name if exists as lfn may contain unicode values converted
1318
        /* use short file name if exists as lfn may contain unicode values converted
1340
         * to default character (eg. ?) and so not a valid path.
1319
         * to default character (eg. ?) and so not a valid path.
Line 1374... Line 1353...
1374
          if (charSet == UNICODECHARS)
1353
          if (charSet == UNICODECHARS)
1375
            charToUTF8(CP_OEMCP, entry.ad.cAlternateFileName, dsubdir, MAXBUF);
1354
            charToUTF8(CP_OEMCP, entry.ad.cAlternateFileName, dsubdir, MAXBUF);
1376
          else
1355
          else
1377
            strcpy(dsubdir, entry.ad.cAlternateFileName);
1356
            strcpy(dsubdir, entry.ad.cAlternateFileName);
1378
        }
1357
        }
1379
        else 
1358
        else
1380
        {
1359
        {
1381
          if (charSet == UNICODECHARS)
1360
          if (charSet == UNICODECHARS)
1382
            charToUTF8(CP_ACP, entry.ad.cFileName, dsubdir, MAXBUF);
1361
            charToUTF8(CP_ACP, entry.ad.cFileName, dsubdir, MAXBUF);
1383
          else
1362
          else
1384
          {
1363
          {
Line 1451... Line 1430...
1451
 
1430
 
1452
  return cycleFindResults(dir, findSubdir_entry, subdir, dsubdir);
1431
  return cycleFindResults(dir, findSubdir_entry, subdir, dsubdir);
1453
}
1432
}
1454
 
1433
 
1455
/**
1434
/**
1456
 * Given a search HANDLE, will find the next subdirectory, 
1435
 * Given a search HANDLE, will find the next subdirectory,
1457
 * setting subdir to the found directory name.
1436
 * setting subdir to the found directory name.
1458
 * dsubdir is the name to display (lfn or sfn as appropriate)
1437
 * dsubdir is the name to display (lfn or sfn as appropriate)
1459
 * currentpath must end in \
1438
 * currentpath must end in \
1460
 * If a subdirectory is found, returns 0, otherwise returns 1
1439
 * If a subdirectory is found, returns 0, otherwise returns 1
1461
 * (either error or no more files).
1440
 * (either error or no more files).
Line 1651... Line 1630...
1651
  strcpy(buffer, useTreeHelp);
1630
  strcpy(buffer, useTreeHelp);
1652
  sprintf(useTreeHelp, buffer, optionchar1);
1631
  sprintf(useTreeHelp, buffer, optionchar1);
1653
}
1632
}
1654
 
1633
 
1655
 
1634
 
1656
/* Loads all messages from the message catalog.
1635
/* Loads all messages from the message catalog. */
1657
 * If USE_CATGETS is undefined or failure finding catalog then
-
 
1658
 * hard coded strings are used
-
 
1659
 */
-
 
1660
void loadAllMessages(void)
1636
void loadAllMessages(void)
1661
{
1637
{
1662
  #ifdef USE_CATGETS
-
 
1663
    nl_catd cat;              /* store id of our message catalog global       */
-
 
1664
    char buffer[MAXLINE];
-
 
1665
    char *bufPtr;
-
 
1666
 
-
 
1667
    /* Open the message catalog, keep hard coded values on error. */
-
 
1668
    if ((cat = catopen (catsFile, MCLoadAll)) == -1) 
-
 
1669
    {
-
 
1670
      FixOptionText(); /* Changes %c in certain lines with default option characters. */
-
 
1671
      return;
-
 
1672
    }
-
 
1673
 
-
 
1674
    /* common to many functions [Set 1] */
-
 
1675
    bufPtr = catgets (cat, 1, 1, newLine);
-
 
1676
    if (bufPtr != newLine) strcpy(newLine, processLine(bufPtr));
-
 
1677
 
-
 
1678
    /* main [Set 1] */
-
 
1679
    bufPtr = catgets (cat, 1, 2, pathListingNoLabel);
-
 
1680
    if (bufPtr != pathListingNoLabel) strcpy(pathListingNoLabel, processLine(bufPtr));
-
 
1681
    bufPtr = catgets (cat, 1, 3, pathListingWithLabel);
-
 
1682
    if (bufPtr != pathListingWithLabel) strcpy(pathListingWithLabel, processLine(bufPtr));
-
 
1683
    bufPtr = catgets (cat, 1, 4, serialNumber);
-
 
1684
    if (bufPtr != serialNumber) strcpy(serialNumber, processLine(bufPtr));
-
 
1685
    bufPtr = catgets (cat, 1, 5, noSubDirs);
-
 
1686
    if (bufPtr != noSubDirs) strcpy(noSubDirs, processLine(bufPtr));
-
 
1687
    bufPtr = catgets (cat, 1, 6, pauseMsg);
-
 
1688
    if (bufPtr != pauseMsg) strcpy(pauseMsg, processLine(bufPtr));
-
 
1689
 
-
 
1690
    /* showUsage [Set 2] */
-
 
1691
    bufPtr = catgets (cat, 2, 1, treeDescription);
-
 
1692
    if (bufPtr != treeDescription) strcpy(treeDescription, processLine(bufPtr));
-
 
1693
    bufPtr = catgets (cat, 2, 2, treeUsage);
-
 
1694
    if (bufPtr != treeUsage) strcpy(treeUsage, processLine(bufPtr));
-
 
1695
    bufPtr = catgets (cat, 2, 3, treeFOption);
-
 
1696
    if (bufPtr != treeFOption) strcpy(treeFOption, processLine(bufPtr));
-
 
1697
    bufPtr = catgets (cat, 2, 4, treeAOption);
-
 
1698
    if (bufPtr != treeAOption) strcpy(treeAOption, processLine(bufPtr));
-
 
1699
 
-
 
1700
    /* showInvalidUsage [Set 3] */
-
 
1701
    bufPtr = catgets (cat, 3, 1, invalidOption);
-
 
1702
    if (bufPtr != invalidOption) strcpy(invalidOption, processLine(bufPtr));
-
 
1703
    bufPtr = catgets (cat, 3, 2, useTreeHelp);
-
 
1704
    if (bufPtr != useTreeHelp) strcpy(useTreeHelp, processLine(bufPtr));
-
 
1705
 
-
 
1706
    /* showVersionInfo [Set 4] */
-
 
1707
    /* also uses treeDescription from Set 2 */
-
 
1708
    bufPtr = catgets (cat, 4, 1, treeGoal);
-
 
1709
    if (bufPtr != treeGoal) strcpy(treeGoal, processLine(bufPtr));
-
 
1710
    bufPtr = catgets (cat, 4, 2, treePlatforms);
-
 
1711
    if (bufPtr != treePlatforms) strcpy(treePlatforms, processLine(bufPtr));
-
 
1712
    bufPtr = catgets (cat, 4, 3, version);
-
 
1713
    if (bufPtr != version) strcpy(version, processLine(bufPtr));
-
 
1714
    bufPtr = catgets (cat, 4, 4, writtenBy);
-
 
1715
    if (bufPtr != writtenBy) strcpy(writtenBy, processLine(bufPtr));
-
 
1716
    bufPtr = catgets (cat, 4, 5, writtenDate);
-
 
1717
    if (bufPtr != writtenDate) strcpy(writtenDate, processLine(bufPtr));
-
 
1718
    bufPtr = catgets (cat, 4, 6, contact);
-
 
1719
    if (bufPtr != contact) strcpy(contact, processLine(bufPtr));
-
 
1720
    bufPtr = catgets (cat, 4, 7, copyright);
-
 
1721
    if (bufPtr != copyright) strcpy(copyright, processLine(bufPtr));
-
 
1722
//ifdef USE_CATGETS
-
 
1723
    bufPtr = catgets (cat, 4, 8, catsCopyright);
-
 
1724
    if (bufPtr != catsCopyright) strcpy(catsCopyright, processLine(bufPtr));
-
 
1725
//endif
-
 
1726
 
-
 
1727
    /* showInvalidDrive [Set 5] */
-
 
1728
    bufPtr = catgets (cat, 5, 1, invalidDrive);
-
 
1729
    if (bufPtr != invalidDrive) strcpy(invalidDrive, processLine(bufPtr));
-
 
1730
 
-
 
1731
    /* showInvalidPath [Set 6] */
-
 
1732
    bufPtr = catgets (cat, 6, 1, invalidPath);
-
 
1733
    if (bufPtr != invalidPath) strcpy(invalidPath, processLine(bufPtr));
-
 
1734
 
-
 
1735
    /* Misc Error messages [Set 7] */
-
 
1736
    /* showBufferOverrun */
-
 
1737
    /* %u required to show what the buffer's current size is. */
-
 
1738
    bufPtr = catgets (cat, 7, 1, bufferToSmall);
-
 
1739
    if (bufPtr != bufferToSmall) strcpy(bufferToSmall, processLine(bufPtr));
-
 
1740
    /* showOutOfMemory */
-
 
1741
    /* %s required to display what directory we were processing when ran out of memory. */
-
 
1742
    bufPtr = catgets (cat, 7, 2, outOfMemory);
-
 
1743
    if (bufPtr != outOfMemory) strcpy(outOfMemory, processLine(bufPtr));
-
 
1744
 
-
 
1745
    /* parseArguments - options [Set 8] */
-
 
1746
    /* Note all of these are single characters (only 1st character used) */
-
 
1747
    bufPtr = catgets (cat, 8, 1, NULL);
-
 
1748
    if (bufPtr != NULL) optionchar1 = bufPtr[0];
-
 
1749
    bufPtr = catgets (cat, 8, 2, NULL);
-
 
1750
    if (bufPtr != NULL) optionchar2 = bufPtr[0];
-
 
1751
    bufPtr = catgets (cat, 8, 3, NULL);
-
 
1752
 
-
 
1753
    /* close the message catalog */
-
 
1754
    catclose (cat);
-
 
1755
  #endif
-
 
1756
 
-
 
1757
  /* Changes %c in certain lines with proper option characters. */
1638
  /* Changes %c in certain lines with proper option characters. */
1758
  FixOptionText();
1639
  FixOptionText();
1759
}
1640
}
1760
 
1641
 
1761
 
1642
 
1762
/* Initialize function pointers for Win32 API functions not always available */
1643
/* Initialize function pointers for Win32 API functions not always available */
1763
void initFuncPtrs(void)
1644
void initFuncPtrs(void)
1764
{
1645
{
1765
#ifdef WIN32
1646
#ifdef WIN32
1766
  /* Attempt to get Unicode version of Win32 APIs 
1647
  /* Attempt to get Unicode version of Win32 APIs
1767
   * Because they are in Kernel32, we assume it's always loaded
1648
   * Because they are in Kernel32, we assume it's always loaded
1768
   * and so don't need to use LoadLibrary/FreeLibrary to maintain a reference count.
1649
   * and so don't need to use LoadLibrary/FreeLibrary to maintain a reference count.
1769
   */
1650
   */
1770
  HMODULE hKERNEL32 = GetModuleHandle("KERNEL32");
1651
  HMODULE hKERNEL32 = GetModuleHandle("KERNEL32");
1771
  if (hKERNEL32 == NULL) printf("ERROR: unable to get KERNEL32 handle, %i\n", GetLastError());
1652
  if (hKERNEL32 == NULL) printf("ERROR: unable to get KERNEL32 handle, %i\n", GetLastError());