comparison src/utils.cc @ 338:82d30a23c979

[project @ 1994-02-07 07:09:33 by jwe]
author jwe
date Mon, 07 Feb 1994 07:21:43 +0000
parents 781f2e240975
children 4115f7713851
comparison
equal deleted inserted replaced
337:3e74ab6e24ba 338:82d30a23c979
590 delete [] nm; 590 delete [] nm;
591 return retval; 591 return retval;
592 } 592 }
593 593
594 /* 594 /*
595 * See if there is an M-file in the path. If so, return the full path 595 * See if there is an function file in the path. If so, return the
596 * to the file. 596 * full path to the file.
597 */ 597 */
598 char * 598 char *
599 m_file_in_path (const char *name) 599 fcn_file_in_path (const char *name)
600 { 600 {
601 return file_in_path (name, ".m"); 601 char *fcn_file = file_in_path (name, (char *) NULL);
602 return (fcn_file) ? fcn_file : file_in_path (name, ".m");
602 } 603 }
603 604
604 /* 605 /*
605 * Return a pretty pathname. If the first part of the pathname is the 606 * Return a pretty pathname. If the first part of the pathname is the
606 * same as $HOME, then replace that with `~'. 607 * same as $HOME, then replace that with `~'.
1409 1410
1410 return status; 1411 return status;
1411 } 1412 }
1412 1413
1413 char ** 1414 char **
1414 get_m_file_names (int& num, const char *dir, int no_suffix) 1415 get_fcn_file_names (int& num, const char *dir, int no_suffix)
1415 { 1416 {
1416 static int num_max = 256; 1417 static int num_max = 256;
1417 char **retval = new char * [num_max]; 1418 char **retval = new char * [num_max];
1418 int i = 0; 1419 int i = 0;
1419 1420
1459 1460
1460 return retval; 1461 return retval;
1461 } 1462 }
1462 1463
1463 char ** 1464 char **
1464 get_m_file_names (int& num, int no_suffix) 1465 get_fcn_file_names (int& num, int no_suffix)
1465 { 1466 {
1466 static int num_max = 1024; 1467 static int num_max = 1024;
1467 char **retval = new char * [num_max]; 1468 char **retval = new char * [num_max];
1468 int i = 0; 1469 int i = 0;
1469 1470
1473 if (ptr != (char **) NULL) 1474 if (ptr != (char **) NULL)
1474 { 1475 {
1475 while (*ptr != (char *) NULL) 1476 while (*ptr != (char *) NULL)
1476 { 1477 {
1477 int tmp_num; 1478 int tmp_num;
1478 char **names = get_m_file_names (tmp_num, *ptr, no_suffix); 1479 char **names = get_fcn_file_names (tmp_num, *ptr, no_suffix);
1479 1480
1480 if (i + tmp_num >= num_max - 1) 1481 if (i + tmp_num >= num_max - 1)
1481 { 1482 {
1482 // Reallocate the array. Only copy pointers, not the strings they 1483 // Reallocate the array. Only copy pointers, not the strings they
1483 // point to, then only delete the original array of pointers, and not 1484 // point to, then only delete the original array of pointers, and not