Source code of Windows XP (NT5)
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.

89 lines
2.2 KiB

  1. /*
  2. Modifications:
  3. 12.12.94 Joe Holman Changed SourceCompare definitions so warning
  4. no longer occurs at compile time.
  5. */
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <search.h>
  10. #include <windows.h>
  11. #include <time.h>
  12. #include "general.h"
  13. FILE* logFile;
  14. char* product;
  15. void Header(argv)
  16. char* argv[];
  17. {
  18. PRINT1("\n=========== CATEGORIES ==============\n")
  19. PRINT2("Input BOM: %s\n",argv[2]);
  20. PRINT2("Product: %s\n",argv[3]);
  21. PRINT1("======================================\n\n");
  22. }
  23. void Usage()
  24. {
  25. printf("PURPOSE: Displays a list of sourceids for the specified product.\n");
  26. printf("\n");
  27. printf("PARAMETERS:\n");
  28. printf("\n");
  29. printf("[LogFile] - Path to append a log of actions and errors.\n");
  30. printf("[InBom] - Path of BOM to operate with.\n");
  31. printf("[Product] - Product to display categories for.\n");
  32. printf(" ALL = All products specified in the BOM.\n");
  33. printf(" NTFLOP = Windows NT on floppy\n");
  34. printf(" LMFLOP = Lan Manager on floppy\n");
  35. printf(" NTCD = Windows NT on CD\n");
  36. printf(" LMCD = Lan Manager on CD\n");
  37. printf(" SDK = Software Development Kit\n");
  38. }
  39. int __cdecl SourceCompare(const void *, const void *);
  40. int __cdecl main(argc,argv)
  41. int argc;
  42. char* argv[];
  43. {
  44. Entry *e;
  45. int records,i;
  46. char *buf;
  47. char oldSource[MAX_PATH];
  48. if (argc!=4) { Usage(); return(1); }
  49. if ((logFile=fopen(argv[1],"a"))==NULL)
  50. {
  51. printf("ERROR: Couldn't open log file %s\n",argv[1]);
  52. return(1);
  53. }
  54. Header(argv);
  55. LoadFile(argv[2],&buf,&e,&records,argv[3]);
  56. qsort(e,records,sizeof(Entry),SourceCompare);
  57. strcpy(oldSource,"bogus");
  58. for (i=0;i<records;i++)
  59. if ((i==0) || _stricmp(e[i].source,oldSource))
  60. {
  61. PRINT2("INFO: Source: %s\n",e[i].source);
  62. strcpy(oldSource,e[i].source);
  63. }
  64. fflush(logFile);
  65. fclose(logFile);
  66. free(e);
  67. free(buf);
  68. return(0);
  69. }
  70. int __cdecl SourceCompare(const void *v1, const void *v2) {
  71. Entry *e1 = (Entry *) v1;
  72. Entry *e2 = (Entry *) v2;
  73. return(_stricmp(e1->source,e2->source));
  74. }