Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
1.8 KiB

  1. //
  2. // outline.c
  3. //
  4. // these are the file outline routines
  5. //
  6. //
  7. #include <string.h>
  8. #if defined(OS2)
  9. #define INCL_NOCOMMON
  10. #define INCL_DOSPROCESS
  11. #define INCL_DOSSEMAPHORES
  12. #define INCL_DOSFILEMGR
  13. #define INCL_DOSERRORS
  14. #define INCL_DOSMISC
  15. #include <os2.h>
  16. #else
  17. #include <windows.h>
  18. #endif
  19. #include <dos.h>
  20. #include "hungary.h"
  21. #include "bsc.h"
  22. #include "bscsup.h"
  23. // forward ref
  24. VOID BSC_API
  25. OutlineMod(IMOD imod, MBF mbf)
  26. // print the outline for this module
  27. //
  28. {
  29. IMS ims, imsMac;
  30. IINST iinst;
  31. BSCPrintf("\n%s\n", LszNameFrMod(imod));
  32. MsRangeOfMod(imod, &ims, &imsMac);
  33. for ( ;ims < imsMac; ims++) {
  34. iinst = IinstOfIms(ims);
  35. if (FInstFilter (iinst, mbf)) {
  36. BSCPrintf(" ");
  37. DumpInst(iinst);
  38. BSCPrintf("\n");
  39. }
  40. }
  41. }
  42. BOOL BSC_API
  43. FOutlineModuleLsz (LSZ lszName, MBF mbf)
  44. // generate an outline for all files matching the given name/pattern
  45. // showing only those items which match the required attribute
  46. //
  47. {
  48. IMOD imod, imodMac;
  49. BOOL fRet = FALSE;
  50. if (!lszName)
  51. return FALSE;
  52. imodMac = ImodMac();
  53. // we match base names only
  54. lszName = LszBaseName(lszName);
  55. for (imod = 0; imod < imodMac; imod++) {
  56. if (FWildMatch(lszName, LszBaseName(LszNameFrMod(imod)))) {
  57. OutlineMod (imod, mbf);
  58. fRet = TRUE;
  59. }
  60. }
  61. return fRet;
  62. }
  63. LSZ BSC_API
  64. LszBaseName (LSZ lsz)
  65. // return the base name part of a path
  66. //
  67. {
  68. LSZ lszBase;
  69. // check for empty string
  70. if (!lsz || !lsz[0]) return lsz;
  71. // remove drive
  72. if (lsz[1] == ':') lsz += 2;
  73. // remove up to trailing backslash
  74. if (lszBase = strrchr(lsz, '\\')) lsz = lszBase+1;
  75. // then remove up to trailing slash
  76. if (lszBase = strrchr(lsz, '/')) lsz = lszBase+1;
  77. return lsz;
  78. }