Subversion Repositories SvarDOS

Rev

Rev 2035 | Rev 2038 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2035 Rev 2037
Line 304... Line 304...
304
   May display N too many lines before pause if line is
304
   May display N too many lines before pause if line is
305
   printed that exceeds cols [N=linelen%cols] and lacks
305
   printed that exceeds cols [N=linelen%cols] and lacks
306
   any newlines (but this should not occur in tree).
306
   any newlines (but this should not occur in tree).
307
*/
307
*/
308
#include <stdarg.h>  /* va_list, va_start, va_end */
308
#include <stdarg.h>  /* va_list, va_start, va_end */
309
int pprintf(const char *msg, ...)
309
static int pprintf(const char *msg, ...) {
310
{
-
 
311
  static int lineCnt = -1;
310
  static int lineCnt = -1;
312
  static int lineCol = 0;
311
  static int lineCol = 0;
313
  va_list argptr;
312
  va_list argptr;
314
  int cnt;
313
  int cnt;
315
  char buffer[MAXBUF];
314
  char buffer[MAXBUF];
Line 362... Line 361...
362
  return cnt;
361
  return cnt;
363
}
362
}
364
 
363
 
365
 
364
 
366
/* Displays to user valid options then exits program indicating no error */
365
/* Displays to user valid options then exits program indicating no error */
367
void showUsage(void)
366
static void showUsage(void) {
368
{
-
 
369
  printf("%s%s%s%s", treeDescription, newLine, treeUsage, newLine);
367
  printf("%s%s%s%s", treeDescription, newLine, treeUsage, newLine);
370
  printf("%s%s%s", treeFOption, treeAOption, newLine);
368
  printf("%s%s%s", treeFOption, treeAOption, newLine);
371
  exit(1);
369
  exit(1);
372
}
370
}
373
 
371
 
374
 
372
 
375
/* Displays error message then exits indicating error */
373
/* Displays error message then exits indicating error */
376
void showInvalidUsage(char * badOption)
374
static void showInvalidUsage(char * badOption) {
377
{
-
 
378
  printf(invalidOption, badOption);
375
  printf(invalidOption, badOption);
379
  printf("%s%s", useTreeHelp, newLine);
376
  printf("%s%s", useTreeHelp, newLine);
380
  exit(1);
377
  exit(1);
381
}
378
}
382
 
379
 
383
 
380
 
384
/* Displays author, copyright, etc info, then exits indicating no error. */
381
/* Displays author, copyright, etc info, then exits indicating no error. */
385
void showVersionInfo(void)
382
static void showVersionInfo(void) {
386
{
-
 
387
  printf("%s%s%s%s%s", treeDescription, newLine, treeGoal, treePlatforms, newLine);
383
  printf("%s%s%s%s%s", treeDescription, newLine, treeGoal, treePlatforms, newLine);
388
  printf(version, VERSION);
384
  printf(version, VERSION);
389
  printf("%s%s%s%s%s", writtenBy, writtenDate, contact, newLine, newLine);
385
  printf("%s%s%s%s%s", writtenBy, writtenDate, contact, newLine, newLine);
390
  printf("%s%s", copyright, newLine);
386
  printf("%s%s", copyright, newLine);
391
  exit(1);
387
  exit(1);
392
}
388
}
393
 
389
 
394
 
390
 
395
/* Displays error messge for invalid drives and exits */
391
/* Displays error messge for invalid drives and exits */
396
void showInvalidDrive(void)
392
static void showInvalidDrive(void) {
397
{
-
 
398
  printf(invalidDrive);
393
  printf(invalidDrive);
399
  exit(1);
394
  exit(1);
400
}
395
}
401
 
396
 
402
 
397
 
403
/* Takes a fullpath, splits into drive (C:, or \\server\share) and path */
398
/* Takes a fullpath, splits into drive (C:, or \\server\share) and path */
404
void splitpath(char *fullpath, char *drive, char *path);
399
static void splitpath(char *fullpath, char *drive, char *path);
405
 
400
 
406
/**
401
/**
407
 * Takes a given path, strips any \ or / that may appear on the end.
402
 * Takes a given path, strips any \ or / that may appear on the end.
408
 * Returns a pointer to its static buffer containing path
403
 * Returns a pointer to its static buffer containing path
409
 * without trailing slash and any necessary display conversions.
404
 * without trailing slash and any necessary display conversions.
410
 */
405
 */
411
char *fixPathForDisplay(char *path);
406
static char *fixPathForDisplay(char *path);
412
 
407
 
413
/* Displays error message for invalid path; Does NOT exit */
408
/* Displays error message for invalid path; Does NOT exit */
414
void showInvalidPath(char *path)
409
static void showInvalidPath(char *path) {
415
{
-
 
416
  char partialPath[MAXBUF], dummy[MAXBUF];
410
  char partialPath[MAXBUF], dummy[MAXBUF];
417
 
411
 
418
  pprintf("%s\n", path);
412
  pprintf("%s\n", path);
419
  splitpath(path, dummy, partialPath);
413
  splitpath(path, dummy, partialPath);
420
  pprintf(invalidPath, fixPathForDisplay(partialPath));
414
  pprintf(invalidPath, fixPathForDisplay(partialPath));
421
}
415
}
422
 
416
 
423
/* Displays error message for out of memory; Does NOT exit */
417
/* Displays error message for out of memory; Does NOT exit */
424
void showOutOfMemory(char *path)
418
static void showOutOfMemory(char *path) {
425
{
-
 
426
  pprintf(outOfMemory, path);
419
  pprintf(outOfMemory, path);
427
}
420
}
428
 
421
 
429
/* Displays buffer exceeded message and exits */
422
/* Displays buffer exceeded message and exits */
430
void showBufferOverrun(WORD maxSize)
423
static void showBufferOverrun(WORD maxSize) {
431
{
-
 
432
  printf(bufferToSmall, maxSize);
424
  printf(bufferToSmall, maxSize);
433
  exit(1);
425
  exit(1);
434
}
426
}
435
 
427
 
436
 
428
 
Line 448... Line 440...
448
 * the rest of the fullpath including the slash are placed in
440
 * the rest of the fullpath including the slash are placed in
449
 * path, eg "\mysubdir"; where fullpath is "\\KJD\myshare\mysubdir".
441
 * path, eg "\mysubdir"; where fullpath is "\\KJD\myshare\mysubdir".
450
 * None of these may be NULL, and drive and path must be large
442
 * None of these may be NULL, and drive and path must be large
451
 * enough to hold fullpath.
443
 * enough to hold fullpath.
452
 */
444
 */
453
void splitpath(char *fullpath, char *drive, char *path)
445
static void splitpath(char *fullpath, char *drive, char *path) {
454
{
-
 
455
  char *src = fullpath;
446
  char *src = fullpath;
456
  char oldchar;
447
  char oldchar;
457
 
448
 
458
  /* If either network share or path only starting at root directory */
449
  /* If either network share or path only starting at root directory */
459
  if ( (*src == '\\') || (*src == '/') )
450
  if ( (*src == '\\') || (*src == '/') )
Line 520... Line 511...
520
  }
511
  }
521
}
512
}
522
 
513
 
523
 
514
 
524
/* Converts given path to full path */
515
/* Converts given path to full path */
525
void getProperPath(char *fullpath)
516
static void getProperPath(char *fullpath) {
526
{
-
 
527
  char drive[MAXBUF];
517
  char drive[MAXBUF];
528
  char path[MAXBUF];
518
  char path[MAXBUF];
529
 
519
 
530
  splitpath(fullpath, drive, path);
520
  splitpath(fullpath, drive, path);
531
 
521
 
Line 550... Line 540...
550
  /* else leave alone, it has both a drive and path specified */
540
  /* else leave alone, it has both a drive and path specified */
551
}
541
}
552
 
542
 
553
 
543
 
554
/* Parses the command line and sets global variables. */
544
/* Parses the command line and sets global variables. */
555
void parseArguments(int argc, char *argv[])
545
static void parseArguments(int argc, char *argv[]) {
556
{
-
 
557
  int i;     /* temp loop variable */
546
  int i;     /* temp loop variable */
558
 
547
 
559
  /* if no drive specified on command line, use current */
548
  /* if no drive specified on command line, use current */
560
  sprintf(path, "%c:.", 'A'+ getdrive());
549
  sprintf(path, "%c:.", 'A'+ getdrive());
561
 
550
 
Line 653... Line 642...
653
 * error message is displayed and the program exits.
642
 * error message is displayed and the program exits.
654
 * Volume and/or serial # returned may be blank if the path specified
643
 * Volume and/or serial # returned may be blank if the path specified
655
 * does not contain them, or an error retrieving
644
 * does not contain them, or an error retrieving
656
 * (ie UNC paths under DOS), but path is valid.
645
 * (ie UNC paths under DOS), but path is valid.
657
 */
646
 */
658
void GetVolumeAndSerial(char *volume, char *serial, char *path)
647
static void GetVolumeAndSerial(char *volume, char *serial, char *path) {
659
{
-
 
660
  char rootPath[MAXBUF];
648
  char rootPath[MAXBUF];
661
  char dummy[MAXBUF];
649
  char dummy[MAXBUF];
662
  union serialNumber {
650
  union serialNumber {
663
    DWORD serialFull;
651
    DWORD serialFull;
664
    struct {
652
    struct {
Line 728... Line 716...
728
 * Path must end in slash \ or /
716
 * Path must end in slash \ or /
729
 * On error (invalid path) displays message and returns -1L.
717
 * On error (invalid path) displays message and returns -1L.
730
 * Stores additional directory data in ddata if non-NULL
718
 * Stores additional directory data in ddata if non-NULL
731
 * and path is valid.
719
 * and path is valid.
732
 */
720
 */
733
long hasSubdirectories(char *path, DIRDATA *ddata)
721
static long hasSubdirectories(char *path, DIRDATA *ddata) {
734
{
-
 
735
  static WIN32_FIND_DATA findData;
722
  static WIN32_FIND_DATA findData;
736
  HANDLE hnd;
723
  HANDLE hnd;
737
  static char buffer[MAXBUF];
724
  static char buffer[MAXBUF];
738
  int hasSubdirs = 0;
725
  int hasSubdirs = 0;
739
 
726
 
Line 797... Line 784...
797
 * parentpath must end in \ or / or be NULL, however
784
 * parentpath must end in \ or / or be NULL, however
798
 * parent should only be NULL for initialpath
785
 * parent should only be NULL for initialpath
799
 * if subdir does not end in slash, one is added to stored subdir
786
 * if subdir does not end in slash, one is added to stored subdir
800
 * dsubdir is subdir already modified so ready to display to user
787
 * dsubdir is subdir already modified so ready to display to user
801
 */
788
 */
802
SUBDIRINFO *newSubdirInfo(SUBDIRINFO *parent, char *subdir, char *dsubdir)
789
static SUBDIRINFO *newSubdirInfo(SUBDIRINFO *parent, char *subdir, char *dsubdir) {
803
{
-
 
804
  int parentLen, subdirLen;
790
  int parentLen, subdirLen;
805
  SUBDIRINFO *temp;
791
  SUBDIRINFO *temp;
806
 
792
 
807
  /* Get length of parent directory */
793
  /* Get length of parent directory */
808
  if (parent == NULL)
794
  if (parent == NULL)
Line 859... Line 845...
859
 * characters and '\0', moreSubdirsFollow specifies if
845
 * characters and '\0', moreSubdirsFollow specifies if
860
 * this is the last subdirectory in a given directory
846
 * this is the last subdirectory in a given directory
861
 * or if more follow (hence if a | is needed).
847
 * or if more follow (hence if a | is needed).
862
 * padding must not be NULL
848
 * padding must not be NULL
863
 */
849
 */
864
char * addPadding(char *padding, int moreSubdirsFollow)
850
static char * addPadding(char *padding, int moreSubdirsFollow) {
865
{
-
 
866
    if (moreSubdirsFollow)
851
  if (moreSubdirsFollow) {
867
    {
-
 
868
      /* 1st char is | or a vertical bar */
852
    /* 1st char is | or a vertical bar */
869
      if (charSet == EXTENDEDCHARS)
853
    if (charSet == EXTENDEDCHARS) {
870
        strcat(padding, VERTBAR_STR);
854
      strcat(padding, VERTBAR_STR);
871
      else
855
    } else {
872
        strcat(padding, "|   ");
856
      strcat(padding, "|   ");
873
    }
857
    }
874
    else
858
  } else {
875
      strcat(padding, "    ");
859
    strcat(padding, "    ");
-
 
860
  }
876
 
861
 
877
    return padding;
862
  return(padding);
878
}
863
}
879
 
864
 
880
/**
865
/**
881
 * Removes the last padding added (last 4 characters added).
866
 * Removes the last padding added (last 4 characters added).
882
 * Does nothing if less than 4 characters in string.
867
 * Does nothing if less than 4 characters in string.
883
 * padding must not be NULL
868
 * padding must not be NULL
884
 * Returns the pointer to padding.
869
 * Returns the pointer to padding.
885
 */
870
 */
886
char * removePadding(char *padding)
871
static char *removePadding(char *padding) {
887
{
-
 
888
  size_t len = strlen(padding);
872
  size_t len = strlen(padding);
889
 
873
 
890
  if (len < 4) return padding;
874
  if (len < 4) return padding;
891
  *(padding + len - 4) = '\0';
875
  *(padding + len - 4) = '\0';
892
 
876
 
Line 896... Line 880...
896
/**
880
/**
897
 * Takes a given path, strips any \ or / that may appear on the end.
881
 * Takes a given path, strips any \ or / that may appear on the end.
898
 * Returns a pointer to its static buffer containing path
882
 * Returns a pointer to its static buffer containing path
899
 * without trailing slash and any necessary display conversions.
883
 * without trailing slash and any necessary display conversions.
900
 */
884
 */
901
char *fixPathForDisplay(char *path)
885
static char *fixPathForDisplay(char *path) {
902
{
-
 
903
  static char buffer[MAXBUF];
886
  static char buffer[MAXBUF];
904
  int pathlen;
887
  int pathlen;
905
 
888
 
906
  strcpy(buffer, path);
889
  strcpy(buffer, path);
907
  pathlen = strlen(buffer);
890
  pathlen = strlen(buffer);
908
  if (pathlen > 1)
891
  if (pathlen > 1) {
909
  {
-
 
910
    pathlen--;
892
    pathlen--;
911
    if ((buffer[pathlen] == '\\') || (buffer[pathlen] == '/'))
893
    if ((buffer[pathlen] == '\\') || (buffer[pathlen] == '/')) {
912
      buffer[pathlen] = '\0'; // strip off trailing slash on end
894
      buffer[pathlen] = '\0'; // strip off trailing slash on end
-
 
895
    }
913
  }
896
  }
914
 
897
 
915
  return buffer;
898
  return buffer;
916
}
899
}
917
 
900
 
Line 925... Line 908...
925
 * currentpath is an ASCIIZ string of path to display
908
 * currentpath is an ASCIIZ string of path to display
926
 *             assumed to be a displayable path (ie. OEM or UTF-8)
909
 *             assumed to be a displayable path (ie. OEM or UTF-8)
927
 * padding is an ASCIIZ string to display prior to entry.
910
 * padding is an ASCIIZ string to display prior to entry.
928
 * moreSubdirsFollow is -1 for initial path else >= 0.
911
 * moreSubdirsFollow is -1 for initial path else >= 0.
929
 */
912
 */
930
void showCurrentPath(char *currentpath, char *padding, int moreSubdirsFollow, DIRDATA *ddata)
913
static void showCurrentPath(char *currentpath, char *padding, int moreSubdirsFollow, DIRDATA *ddata) {
931
{
-
 
932
  if (padding != NULL)
914
  if (padding != NULL)
933
    pprintf("%s", padding);
915
    pprintf("%s", padding);
934
 
916
 
935
  /* print lead padding except for initial directory */
917
  /* print lead padding except for initial directory */
936
  if (moreSubdirsFollow >= 0)
918
  if (moreSubdirsFollow >= 0)
Line 939... Line 921...
939
    {
921
    {
940
      if (moreSubdirsFollow)
922
      if (moreSubdirsFollow)
941
        pprintf("%s", TBAR_HORZBAR_STR);
923
        pprintf("%s", TBAR_HORZBAR_STR);
942
      else
924
      else
943
        pprintf("%s", CBAR_HORZBAR_STR);
925
        pprintf("%s", CBAR_HORZBAR_STR);
944
    }
-
 
945
    else
926
    } else {
946
    {
-
 
947
      if (moreSubdirsFollow)
927
      if (moreSubdirsFollow)
948
        pprintf("+---");
928
        pprintf("+---");
949
      else
929
      else
950
        pprintf("\\---");
930
        pprintf("\\---");
951
    }
931
    }
Line 968... Line 948...
968
 
948
 
969
/**
949
/**
970
 * Displays summary information about directory.
950
 * Displays summary information about directory.
971
 * Expects to be called after displayFiles (optionally called)
951
 * Expects to be called after displayFiles (optionally called)
972
 */
952
 */
973
static void displaySummary(char *padding, int hasMoreSubdirs, DIRDATA *ddata)
953
static void displaySummary(char *padding, int hasMoreSubdirs, DIRDATA *ddata) {
974
{
-
 
975
  addPadding(padding, hasMoreSubdirs);
954
  addPadding(padding, hasMoreSubdirs);
976
 
955
 
977
  if (dspSumDirs)
956
  if (dspSumDirs) {
978
  {
-
 
979
    if (showFiles == SHOWFILESON)
957
    if (showFiles == SHOWFILESON) {
980
    {
-
 
981
      /* print File summary with lead padding, add filesize to it */
958
      /* print File summary with lead padding, add filesize to it */
982
      pprintf("%s%lu files\n", padding, ddata->fileCnt);
959
      pprintf("%s%lu files\n", padding, ddata->fileCnt);
983
    }
960
    }
984
 
961
 
985
    /* print Directory summary with lead padding */
962
    /* print Directory summary with lead padding */
Line 997... Line 974...
997
 * Path must end in slash \ or /
974
 * Path must end in slash \ or /
998
 * Returns -1 on error,
975
 * Returns -1 on error,
999
 *          0 if no files, but no errors either,
976
 *          0 if no files, but no errors either,
1000
 *      or  1 if files displayed, no errors.
977
 *      or  1 if files displayed, no errors.
1001
 */
978
 */
1002
int displayFiles(char *path, char *padding, int hasMoreSubdirs, DIRDATA *ddata)
979
static int displayFiles(char *path, char *padding, int hasMoreSubdirs, DIRDATA *ddata) {
1003
{
-
 
1004
  static char buffer[MAXBUF];
980
  static char buffer[MAXBUF];
1005
  WIN32_FIND_DATA entry; /* current directory entry info    */
981
  WIN32_FIND_DATA entry; /* current directory entry info    */
1006
  HANDLE dir;         /* Current directory entry working with      */
982
  HANDLE dir;         /* Current directory entry working with      */
1007
  unsigned long filesShown = 0;
983
  unsigned long filesShown = 0;
1008
 
984
 
Line 1081... Line 1057...
1081
 * was found, and if so copies appropriate data into subdir and dsubdir.
1057
 * was found, and if so copies appropriate data into subdir and dsubdir.
1082
 * It will repeat until a valid subdirectory is found or no more
1058
 * It will repeat until a valid subdirectory is found or no more
1083
 * are found, at which point it closes the FindFile search handle and
1059
 * are found, at which point it closes the FindFile search handle and
1084
 * return INVALID_HANDLE_VALUE.  If successful, returns FindFile handle.
1060
 * return INVALID_HANDLE_VALUE.  If successful, returns FindFile handle.
1085
 */
1061
 */
1086
HANDLE cycleFindResults(HANDLE findnexthnd, WIN32_FIND_DATA_BOTH *entry, char *subdir, char *dsubdir)
1062
static HANDLE cycleFindResults(HANDLE findnexthnd, WIN32_FIND_DATA_BOTH *entry, char *subdir, char *dsubdir) {
1087
{
-
 
1088
  /* cycle through directory until 1st non . or .. directory is found. */
1063
  /* cycle through directory until 1st non . or .. directory is found. */
1089
  do
1064
  do
1090
  {
1065
  {
1091
    /* skip files & hidden or system directories */
1066
    /* skip files & hidden or system directories */
1092
    if ((((entry->ad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) ||
1067
    if ((((entry->ad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) ||
Line 1130... Line 1105...
1130
 * findclose when directory has finished processing, and can be
1105
 * findclose when directory has finished processing, and can be
1131
 * passed to findnextsubdir to find subsequent subdirectories.
1106
 * passed to findnextsubdir to find subsequent subdirectories.
1132
 * Returns INVALID_HANDLE_VALUE on error.
1107
 * Returns INVALID_HANDLE_VALUE on error.
1133
 * currentpath must end in \
1108
 * currentpath must end in \
1134
 */
1109
 */
1135
HANDLE findFirstSubdir(char *currentpath, char *subdir, char *dsubdir)
1110
static HANDLE findFirstSubdir(char *currentpath, char *subdir, char *dsubdir) {
1136
{
-
 
1137
  static char buffer[MAXBUF];
1111
  static char buffer[MAXBUF];
1138
  HANDLE dir;         /* Current directory entry working with      */
1112
  HANDLE dir;         /* Current directory entry working with      */
1139
 
1113
 
1140
  /* get handle for files in current directory (using wildcard spec) */
1114
  /* get handle for files in current directory (using wildcard spec) */
1141
  strcpy(buffer, currentpath);
1115
  strcpy(buffer, currentpath);
Line 1160... Line 1134...
1160
 * dsubdir is the name to display (lfn or sfn as appropriate)
1134
 * dsubdir is the name to display (lfn or sfn as appropriate)
1161
 * currentpath must end in \
1135
 * currentpath must end in \
1162
 * If a subdirectory is found, returns 0, otherwise returns 1
1136
 * If a subdirectory is found, returns 0, otherwise returns 1
1163
 * (either error or no more files).
1137
 * (either error or no more files).
1164
 */
1138
 */
1165
int findNextSubdir(HANDLE findnexthnd, char *subdir, char *dsubdir)
1139
static int findNextSubdir(HANDLE findnexthnd, char *subdir, char *dsubdir) {
1166
{
-
 
1167
  /* clear result path */
1140
  /* clear result path */
1168
  strcpy(subdir, "");
1141
  strcpy(subdir, "");
1169
 
1142
 
1170
  if (FindNextFile(findnexthnd, &findSubdir_entry.ad) == 0) return 1; // no subdirs found
1143
  if (FindNextFile(findnexthnd, &findSubdir_entry.ad) == 0) return 1; // no subdirs found
1171
 
1144
 
Line 1180... Line 1153...
1180
 * a non-recursive function using a Stack.
1153
 * a non-recursive function using a Stack.
1181
 * initialpath must be large enough to hold an added slash \ or /
1154
 * initialpath must be large enough to hold an added slash \ or /
1182
 * if it does not already end in one.
1155
 * if it does not already end in one.
1183
 * Returns the count of subdirs in initialpath.
1156
 * Returns the count of subdirs in initialpath.
1184
 */
1157
 */
1185
long traverseTree(char *initialpath)
1158
static long traverseTree(char *initialpath) {
1186
{
-
 
1187
  long subdirsInInitialpath;
1159
  long subdirsInInitialpath;
1188
  char padding[MAXPADLEN] = "";
1160
  char padding[MAXPADLEN] = "";
1189
  char subdir[MAXBUF];
1161
  char subdir[MAXBUF];
1190
  char dsubdir[MAXBUF];
1162
  char dsubdir[MAXBUF];
1191
  SUBDIRINFO *sdi;
1163
  SUBDIRINFO *sdi;
Line 1282... Line 1254...
1282
 * returns a pointer to its internal buffer, so strcpy soon after use.
1254
 * returns a pointer to its internal buffer, so strcpy soon after use.
1283
 * Can only handle lines up to MAXLINE chars.
1255
 * Can only handle lines up to MAXLINE chars.
1284
 * This is required because most messages are passed as
1256
 * This is required because most messages are passed as
1285
 * string arguments to printf, and not actually parsed by it.
1257
 * string arguments to printf, and not actually parsed by it.
1286
 */
1258
 */
1287
char *processLine(char *line)
1259
static char *processLine(char *line) {
1288
{
-
 
1289
  static char buffer[MAXLINE+MAXLINE];
1260
  static char buffer[MAXLINE+MAXLINE];
1290
  char *src = line, *dst = buffer;
1261
  char *src = line, *dst = buffer;
1291
 
1262
 
1292
  if (line == NULL) return NULL;
1263
  if (line == NULL) return NULL;
1293
 
1264
 
Line 1328... Line 1299...
1328
 
1299
 
1329
  return buffer;
1300
  return buffer;
1330
}
1301
}
1331
 
1302
 
1332
 
1303
 
1333
void FixOptionText(void)
1304
static void FixOptionText(void) {
1334
{
-
 
1335
  char buffer[MAXLINE];  /* sprintf can have problems with src==dest */
1305
  char buffer[MAXLINE];  /* sprintf can have problems with src==dest */
1336
 
1306
 
1337
  /* Handle %c for options within messages using Set 8 */
1307
  /* Handle %c for options within messages using Set 8 */
1338
  strcpy(buffer, treeUsage);
1308
  strcpy(buffer, treeUsage);
1339
  sprintf(treeUsage, buffer, optionchar1, OptShowFiles[0], optionchar1, OptUseASCII[0]);
1309
  sprintf(treeUsage, buffer, optionchar1, OptShowFiles[0], optionchar1, OptUseASCII[0]);
Line 1345... Line 1315...
1345
  sprintf(useTreeHelp, buffer, optionchar1);
1315
  sprintf(useTreeHelp, buffer, optionchar1);
1346
}
1316
}
1347
 
1317
 
1348
 
1318
 
1349
/* Loads all messages from the message catalog. */
1319
/* Loads all messages from the message catalog. */
1350
void loadAllMessages(void)
1320
static void loadAllMessages(void) {
1351
{
-
 
1352
  /* Changes %c in certain lines with proper option characters. */
1321
  /* Changes %c in certain lines with proper option characters. */
1353
  FixOptionText();
1322
  FixOptionText();
1354
}
1323
}
1355
 
1324
 
1356
 
1325
 
1357
int main(int argc, char *argv[])
1326
int main(int argc, char **argv) {
1358
{
-
 
1359
  char serial[SERIALLEN]; /* volume serial #  0000:0000 */
1327
  char serial[SERIALLEN]; /* volume serial #  0000:0000 */
1360
  char volume[VOLLEN];    /* volume name (label), possibly none */
1328
  char volume[VOLLEN];    /* volume name (label), possibly none */
1361
 
1329
 
1362
  /* Load all text from message catalog (or uses hard coded text) */
1330
  /* Load all text from message catalog (or uses hard coded text) */
1363
  loadAllMessages();
1331
  loadAllMessages();