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.

964 lines
23 KiB

  1. #++
  2. # Barbara Kess
  3. # Copyright (c) 1998 Microsoft Corporation
  4. #
  5. # Module Name:
  6. # makelist.pl
  7. #
  8. # Abstract:
  9. #
  10. #
  11. #--
  12. #
  13. # Set global vars
  14. #
  15. #Flush output buffer for remote.exe
  16. select(STDOUT); $|=1;
  17. # Get the parameters
  18. %Params = &GetArguments(@ARGV);
  19. if ( exists $Params{"i"} ) {
  20. @list = &IntersectLists( %Params );
  21. }
  22. elsif ( exists $Params{"u"} ) {
  23. @list = &UnionLists( %Params );
  24. }
  25. elsif ( exists $Params{"d"} ) {
  26. @list = &DiffLists( %Params );
  27. }
  28. elsif ( exists $Params{"c"} ) {
  29. @list = &CreateListFromDirectory( %Params );
  30. }
  31. elsif ( exists $Params{"n"} ) {
  32. @list = &DosnetToList(%Params);
  33. }
  34. elsif ( exists $Params{"m"} ) {
  35. @list = &FileToList( %Params );
  36. }
  37. elsif ( exists $Params{"a"} ) {
  38. @list = &SourceDestDiff( %Params );
  39. }
  40. elsif ( exists $Params{"q"} ) {
  41. @list = &ExDosnetToList( %Params );
  42. }
  43. elsif ( exists $Params{"b"} ) {
  44. @list = &MediaToList( %Params );
  45. }
  46. elsif ( exists $Params{"r"} ) {
  47. @list = &DrvindexToList( %Params );
  48. }
  49. if ( exists $Params{"h"} ) {
  50. @header=&GetHeader( @{$Params{"h"}}[0] );
  51. &PrintListWithHeader(\@header,\@list, @{$Params{"o"}}[0]);
  52. }
  53. else {
  54. &PrintList(\@list, @{$Params{"o"}}[0]);
  55. }
  56. sub IntersectLists
  57. {
  58. my ( %params ) = @_;
  59. my (@file_list, @file_l, @list, %MARK);
  60. $first = 1;
  61. foreach $file ( @{$params{"i"}} ) {
  62. #open file put it into an array
  63. unless ( open( FHANDLE, $file)) {
  64. &LogMsg('err',"Unable to open $file");
  65. }
  66. if ($first == 1) {
  67. @file_list = <FHANDLE>;
  68. close (FHANDLE);
  69. $i=0;
  70. foreach $item (@file_list) {
  71. chop $file_list[$i];
  72. $i++;
  73. }
  74. $first = 0;
  75. }
  76. else {
  77. @list = <FHANDLE>;
  78. close (HANDLE);
  79. $i=0;
  80. foreach $item (@list) {
  81. chop $list[$i];
  82. $i++;
  83. }
  84. foreach $item (@file_list) {
  85. $MARK{lc $item} = 1;
  86. }
  87. foreach $item (@list) {
  88. if ( $MARK{lc $item} == 1) {
  89. $MARK{lc $item} = 2;
  90. }
  91. }
  92. foreach $item (keys %MARK) {
  93. if ( $MARK{$item} == 2 ) {
  94. push @file_l, $item;
  95. }
  96. }
  97. }
  98. }
  99. return (@file_l);
  100. }
  101. sub UnionLists
  102. {
  103. my ( %params ) = @_;
  104. my (@file_list, @file_l, @list, %MARK);
  105. $first = 1;
  106. foreach $file ( @{$params{"u"}} ) {
  107. #open file put it into an array
  108. unless ( open( FHANDLE, $file)) {
  109. &LogMsg('err',"Unable to open $file");
  110. }
  111. if ($first == 1) {
  112. @file_list = <FHANDLE>;
  113. close (FHANDLE);
  114. $first = 0;
  115. $i=0;
  116. foreach $item (@file_list) {
  117. chop $file_list[$i];
  118. $i++;
  119. }
  120. }
  121. else {
  122. @list = <FHANDLE>;
  123. close (FHANDLE);
  124. $i=0;
  125. foreach $item (@list) {
  126. chop $list[$i];
  127. $i++;
  128. }
  129. foreach $item (@file_list) {
  130. $MARK{lc $item} = 1;
  131. }
  132. foreach $item (@list) {
  133. $MARK{lc $item} = 1;
  134. }
  135. foreach $item (keys %MARK) {
  136. if ( $MARK{$item} == 1 ) {
  137. push @file_l, $item;
  138. }
  139. }
  140. }
  141. }
  142. return (@file_l);
  143. }
  144. sub DiffLists
  145. {
  146. my ( %params ) = @_;
  147. my (@file_list, @file_l, @list, %MARK);
  148. $first = 1;
  149. foreach $file ( @{$params{"d"}} ) {
  150. #open file put it into an array
  151. unless ( open( FHANDLE, $file)) {
  152. &LogMsg('err',"Unable to open $file");
  153. }
  154. if ($first == 1) {
  155. @file_list = <FHANDLE>;
  156. close (FHANDLE);
  157. $first = 0;
  158. $i=0;
  159. foreach $item (@file_list) {
  160. chop $file_list[$i];
  161. $i++;
  162. }
  163. }
  164. else {
  165. @list = <FHANDLE>;
  166. close (FHANDLE);
  167. $i=0;
  168. foreach $item (@list) {
  169. chop $list[$i];
  170. $i++;
  171. }
  172. foreach $item (@file_list) {
  173. $MARK{lc $item}=1;
  174. }
  175. foreach $item (@list) {
  176. $MARK{lc $item}=0;
  177. }
  178. foreach $item (keys %MARK) {
  179. if ($MARK{$item} == 1) {
  180. push @file_l, $item;
  181. }
  182. }
  183. }
  184. }
  185. return (@file_l);
  186. }
  187. sub CreateListFromDirectory
  188. {
  189. my ( %params ) = @_;
  190. my (@dir_list, @dir_l,$dir, %MARK);
  191. $dir = @{$Params{"c"}}[0];
  192. unless ( opendir(DIRECTORY, $dir) ) {
  193. print "ERROR: Cannot open $dir\n";
  194. }
  195. @dir_list = readdir(DIRECTORY);
  196. closedir(DIRECTORY);
  197. $i=0;
  198. foreach $item (@dir_list) {
  199. chop $file_list[$i];
  200. $i++;
  201. }
  202. foreach $item (@dir_list) {
  203. # if this file is not a directory, put it in the list
  204. unless (opendir (DIRECTORY, "$dir\\$item") ) {
  205. $MARK{lc $item}++;
  206. }
  207. closedir(DIRECTORY);
  208. }
  209. @dir_l = grep($MARK{lc $_},@dir_list);
  210. return(@dir_l);
  211. }
  212. sub DosnetToList
  213. {
  214. # $dosnet is the name of the dosnet file
  215. # $path is a flag telling whether or not to include path
  216. # information in the output file
  217. # (i.e., filename=d:\binaries\filename)
  218. # @search_paths tells where to search
  219. # $check is a flag. If it is 1, then check the search paths,
  220. # otherwise use the current directory as the path
  221. my ( %params ) = @_;
  222. $dosnet = @{$params{"n"}}[0];
  223. my (@d_list);
  224. @d_list = &MakeListFromDosnet($dosnet);
  225. return (@d_list);
  226. }
  227. sub MediaToList
  228. {
  229. # $media is the name of the _media file
  230. # $path is a flag telling whether or not to include path
  231. # information in the output file
  232. # (i.e., filename=d:\binaries\filename)
  233. # @search_paths tells where to search
  234. # $check is a flag. If it is 1, then check the search paths,
  235. # otherwise use the current directory as the path
  236. my ( %params ) = @_;
  237. $media = @{$params{"b"}}[0];
  238. my (@d_list);
  239. @d_list = &MakeListFromMedia($media);
  240. return (@d_list);
  241. }
  242. sub ExDosnetToList
  243. {
  244. # $exdosnet is the name of the dosnet file
  245. # $path is a flag telling whether or not to include path
  246. # information in the output file
  247. # (i.e., filename=d:\binaries\filename)
  248. # @search_paths tells where to search
  249. # $check is a flag. If it is 1, then check the search paths,
  250. # otherwise use the current directory as the path
  251. my ( %params ) = @_;
  252. $exdosnet = @{$params{"q"}}[0];
  253. my (@d_list);
  254. @d_list = &MakeListFromExDosnet($exdosnet);
  255. return (@d_list);
  256. }
  257. sub DrvindexToList
  258. {
  259. # $drvindex is the name of the drvindex file
  260. # $path is a flag telling whether or not to include path
  261. # information in the output file
  262. # (i.e., filename=d:\binaries\filename)
  263. # @search_paths tells where to search
  264. # $check is a flag. If it is 1, then check the search paths,
  265. # otherwise use the current directory as the path
  266. my ( %params ) = @_;
  267. $drvindex = @{$params{"r"}}[0];
  268. my (@d_list);
  269. @d_list = &MakeListFromDrvindex($drvindex);
  270. return (@d_list);
  271. }
  272. sub PrintList
  273. {
  274. my ($list,$outfile) = @_;
  275. # Print the items in the list
  276. open( OUTFILE, ">$outfile");
  277. $count=0;
  278. for ($i=0; $i<@{$list};$i++) {
  279. $item = lc $list->[$i];
  280. print OUTFILE "$item\n";
  281. $count++;
  282. }
  283. # print "$outfile has $count items\n";
  284. close (OUTFILE);
  285. }
  286. sub PrintListWithHeader
  287. {
  288. my ($header,$list,$outfile) = @_;
  289. # Print the items in the list
  290. open( OUTFILE, ">$outfile");
  291. for ($i=0; $i<@{$header};$i++) {
  292. print OUTFILE "$header->[$i]\n";
  293. }
  294. $count=0;
  295. for ($i=0; $i<@{$list};$i++) {
  296. $item = lc $list->[$i];
  297. print OUTFILE "$item\n";
  298. $count++;
  299. }
  300. print "$outfile has $count items\n\n";
  301. close (OUTFILE);
  302. }
  303. sub SourceDestDiff
  304. {
  305. my ( %params ) = @_;
  306. my ( @file_list, @diff_list );
  307. $file_name = @{$params{"a"}}[0];
  308. #Open file and put it into an array
  309. unless ( open( FHANDLE, $file_name) ) {
  310. &LogMsg('err',"Unable to open $file_name\n");
  311. }
  312. @file_list = <FHANDLE>;
  313. close (FHANDLE);
  314. $i=0;
  315. foreach $item (@file_list) {
  316. $item =~ /(\S+),(\S+)/;
  317. if ($1 ne $2) {
  318. push @diff_list, $1;
  319. }
  320. }
  321. return (@diff_list);
  322. }
  323. sub FileToList
  324. {
  325. my ( %params ) = @_;
  326. my (@file_list, $path, @final_list);
  327. $file_name = @{$params{"m"}}[0];
  328. #Open file and put it into an array
  329. unless ( open( FILENAME, $file_name) ) {
  330. &LogMsg('err',"Unable to open $file_name\n");
  331. }
  332. @file_list = <FILENAME>;
  333. close (FILENAME);
  334. $i=0;
  335. foreach $item (@file_list) {
  336. chop $file_list[$i];
  337. $i++;
  338. }
  339. # Put the path info in
  340. if ( $params{"p"} ) {
  341. # Look for the file in the search path
  342. if ( $params{"x"} ) {
  343. foreach $item (@file_list) {
  344. $found = 0;
  345. foreach $search (@{$params{"s"}}) {
  346. if ( !$found && (-e "$search\\$item") ) {
  347. $found = 1;
  348. push @final_list, "<HASH>$search\\$item=$search\\$item";
  349. }
  350. }
  351. }
  352. }
  353. # Use the first search path as the path
  354. else {
  355. $path = @{$params{"s"}}[0];
  356. foreach $item (@file_list) {
  357. push @final_list, "<HASH>$path\\$item=$path\\$item";
  358. }
  359. }
  360. return(@final_list);
  361. }
  362. else {
  363. return (@file_list);
  364. }
  365. }
  366. sub LogFileInit
  367. #+
  368. # Initialize the log file
  369. #
  370. {
  371. $ThisScript = "makelist";
  372. $logfile=$ENV{"TMP"}."\\$ThisScript.log";
  373. system("del $logfile");
  374. }
  375. sub MakeListFromDosnet
  376. #+
  377. # Accepts a dosnet.inf file and returns an array
  378. # of all the files that occur under the [Files] sections
  379. #
  380. #-
  381. {
  382. my($FileName)=@_;
  383. my(@dosnet,@return_array);
  384. #Open Dosnet File and put it into an array
  385. unless ( open( DOSNET, $FileName) ) {
  386. &LogMsg('err',"Unable to open $FileName\n");
  387. }
  388. @dosnet = <DOSNET>;
  389. close (DOSNET);
  390. $found = 0;
  391. foreach $item (@dosnet) {
  392. # Search for [Files]
  393. if ( $item =~ /\[Files\]/ ) {
  394. &LogMsg('dbg', "Found \[Files\]");
  395. $found = 1;
  396. }
  397. # Quit adding files to the list when a new section is encountered
  398. elsif ( $found && ($item =~ /\[/ ) ) {
  399. $found = 0;
  400. }
  401. elsif ( $found) {
  402. undef($file_name);
  403. # Return the non-white space characters that occur
  404. # after "d1,"
  405. $item =~ /d\d,(\S+)/;
  406. if ($1) {
  407. $file_name = $1;
  408. }
  409. # Check for a comma after the file name and get everything
  410. # before the comma
  411. $file_name =~ /(\S+),/;
  412. if ($1) {
  413. $file_name=$1;
  414. }
  415. # If a file was found, put it in the hash
  416. if ($file_name) {
  417. push @return_array, lc $file_name;
  418. }
  419. }
  420. }
  421. return (@return_array);
  422. }
  423. sub MakeListFromMedia
  424. #+
  425. # Accepts a _media.inx file and returns an array
  426. # of all the files that occur under the [Files] sections
  427. #
  428. #-
  429. {
  430. my($FileName)=@_;
  431. my(@media,@return_array);
  432. #Open _media File and put it into an array
  433. unless ( open( MEDIA, $FileName) ) {
  434. &LogMsg('err',"Unable to open $FileName\n");
  435. }
  436. @media = <MEDIA>;
  437. close (MEDIA);
  438. $found = 0;
  439. foreach $item (@media) {
  440. # Search for [SourceDisksFiles]
  441. if ( $item =~ /\[SourceDisksFiles\]/ ) {
  442. &LogMsg('dbg', "Found \[SourceDisksFiles\]");
  443. $found = 1;
  444. }
  445. # Quit adding files to the list when a new section is encountered
  446. elsif ( $found && ($item =~ /\[/ ) ) {
  447. $found = 0;
  448. }
  449. elsif ( $found) {
  450. undef($file_name);
  451. $file_name = $item;
  452. # Check for an '=' after the file name and get everything
  453. # before the '='
  454. $file_name =~ /(\S+ +)=/;
  455. if ($1) {
  456. $file_name=$1;
  457. }
  458. $file_name =~ s/ //;
  459. # If a file was found, put it in the hash
  460. if ((length($file_name)>1)&&!($file_name =~ /^;/)) {
  461. push @return_array, lc $file_name;
  462. }
  463. }
  464. }
  465. foreach $item (@media) {
  466. # Search for [SourceDisksFiles.x86]
  467. if ( $item =~ /\[SourceDisksFiles.x86\]/ ) {
  468. &LogMsg('dbg', "Found \[SourceDisksFiles.x86\]");
  469. $found = 1;
  470. }
  471. # Quit adding files to the list when a new section is encountered
  472. elsif ( $found && ($item =~ /\[/ ) ) {
  473. $found = 0;
  474. }
  475. elsif ( $found) {
  476. undef($file_name);
  477. $file_name = $item;
  478. # Check for an '=' after the file name and get everything
  479. # before the '='
  480. $file_name =~ /(\S+ +)=/;
  481. if ($1) {
  482. $file_name=$1;
  483. }
  484. $file_name =~ s/ //;
  485. # If a file was found, put it in the hash
  486. if ((length($file_name)>1)&&!($file_name =~ /^;/)) {
  487. push @return_array, lc $file_name;
  488. }
  489. }
  490. }
  491. foreach $item (@media) {
  492. # Search for [SourceDisksFiles.amd64]
  493. if ( $item =~ /\[SourceDisksFiles.amd64\]/ ) {
  494. &LogMsg('dbg', "Found \[SourceDisksFiles.amd64\]");
  495. $found = 1;
  496. }
  497. # Quit adding files to the list when a new section is encountered
  498. elsif ( $found && ($item =~ /\[/ ) ) {
  499. $found = 0;
  500. }
  501. elsif ( $found) {
  502. undef($file_name);
  503. $file_name = $item;
  504. # Check for an '=' after the file name and get everything
  505. # before the '='
  506. $file_name =~ /(\S+ +)=/;
  507. if ($1) {
  508. $file_name=$1;
  509. }
  510. $file_name =~ s/ //;
  511. # If a file was found, put it in the hash
  512. if ((length($file_name)>1)&&!($file_name =~ /^;/)) {
  513. push @return_array, lc $file_name;
  514. }
  515. }
  516. }
  517. foreach $item (@media) {
  518. # Search for [SourceDisksFiles.ia64]
  519. if ( $item =~ /\[SourceDisksFiles.ia64\]/ ) {
  520. &LogMsg('dbg', "Found \[SourceDisksFiles.ia64\]");
  521. $found = 1;
  522. }
  523. # Quit adding files to the list when a new section is encountered
  524. elsif ( $found && ($item =~ /\[/ ) ) {
  525. $found = 0;
  526. }
  527. elsif ( $found) {
  528. undef($file_name);
  529. $file_name = $item;
  530. # Check for an '=' after the file name and get everything
  531. # before the '='
  532. $file_name =~ /(\S+ +)=/;
  533. if ($1) {
  534. $file_name=$1;
  535. }
  536. $file_name =~ s/ //;
  537. # If a file was found, put it in the hash
  538. if ((length($file_name)>1)&&!($file_name =~ /^;/)) {
  539. push @return_array, lc $file_name;
  540. }
  541. }
  542. }
  543. return (@return_array);
  544. }
  545. sub MakeListFromExDosnet
  546. #+
  547. # Accepts an exdosnet.inf file and returns an array
  548. # of all the files that occur under the [Files] sections
  549. #
  550. #-
  551. {
  552. my($FileName)=@_;
  553. my(@exdosnet,@return_array);
  554. #Open ExDosnet File and put it into an array
  555. unless ( open( EXDOSNET, $FileName) ) {
  556. &LogMsg('err',"Unable to open $FileName\n");
  557. }
  558. @exdosnet = <EXDOSNET>;
  559. close (EXDOSNET);
  560. $found = 0;
  561. foreach $item (@exdosnet) {
  562. # Search for [Files]
  563. if ( $item =~ /\[Files\]/ ) {
  564. &LogMsg('dbg', "Found \[Files\]");
  565. $found = 1;
  566. }
  567. # Quit adding files to the list when a new section is encountered
  568. elsif ( $found && ($item =~ /\[/ ) ) {
  569. $found = 0;
  570. }
  571. elsif ( $found) {
  572. undef($file_name);
  573. # Return the non-white space characters that occur
  574. # after "d1,"
  575. # $item =~ /d\d,(\S+)/;
  576. # if ($1) {
  577. # $file_name = $1;
  578. # }
  579. $file_name = $item;
  580. chomp $file_name;
  581. # printf("\$item='%s' \$file_name='%s'\n", $item, $file_name);
  582. # Check for a comma after the file name and get everything
  583. # before the comma
  584. # $file_name =~ /(\S+),/;
  585. # if ($1) {
  586. # $file_name=$1;
  587. # }
  588. # If a file was found, put it in the hash
  589. if ($file_name) {
  590. push @return_array, lc $file_name; }
  591. }
  592. }
  593. return (@return_array);
  594. }
  595. sub MakeListFromDrvindex
  596. #+
  597. # Accepts a drvindex.inf file and returns an array
  598. # of all the files that occur under the [driver] sections
  599. #
  600. #-
  601. {
  602. my($FileName)=@_;
  603. my(@dosnet,@return_array);
  604. #Open Dosnet File and put it into an array
  605. unless ( open( DOSNET, $FileName) ) {
  606. &LogMsg('err',"Unable to open $FileName\n");
  607. }
  608. @dosnet = <DOSNET>;
  609. close (DOSNET);
  610. $found = 0;
  611. foreach $item (@dosnet) {
  612. # Search for [driver]
  613. if ( $item =~ /\[driver\]/ ) {
  614. &LogMsg('dbg', "Found \[driver\]");
  615. $found = 1;
  616. }
  617. # Quit adding files to the list when a new section is encountered
  618. elsif ( $found && ($item =~ /\[/ ) ) {
  619. $found = 0;
  620. }
  621. elsif ( $found) {
  622. undef($file_name);
  623. # Return the non-white space characters that occur
  624. $item =~ /(\S+)/;
  625. if ($1) {
  626. $file_name=$1;
  627. }
  628. # If a file was found, put it in the hash
  629. if ($file_name) {
  630. push @return_array, lc $file_name;
  631. }
  632. }
  633. }
  634. return (@return_array);
  635. }
  636. #
  637. # Sub(routine)s below
  638. #
  639. # Parse arguments passed to bincomp into %Parameters
  640. sub GetArguments {
  641. my(@ArgList)=@_;
  642. my(%params,$arg,%flag_counts_possible,%flag_counts_actual);
  643. # The flag_counts has tells how many arguments should follow
  644. # each flag.
  645. %flag_counts_possible=('a',1,'b',1,'c',1,'d',3,'h',1,'i','list','m',1,'n',1,'q',1,
  646. 'o',1, 'p',0,'r',1,'s','list','x',0, 'u','list');
  647. %flag_counts_actual=('a',0,'b',0,'c',0,'d',0,'h',0,'i',0,'m',0,'n',0,'q',0,'o',0,
  648. 'p',0,'r',0,'s',0,'x',0,'u',0);
  649. foreach $arg (@ArgList) {
  650. # If this is a flag, set the flag variable, so
  651. # next time through it will parse the correct
  652. # argument
  653. if( substr(lc($arg),0,1) eq "-") {
  654. $flag=substr($arg,1,1);
  655. if ($flag eq "?") {
  656. &PrintUsage;
  657. }
  658. elsif (! exists $flag_counts_possible{$flag}) {
  659. print "ERROR: $flag is an incorrect flag or switch\n";
  660. &PrintUsage;
  661. }
  662. # Set the flag equal to one
  663. elsif ( ( $flag_counts_possible{$flag} ne "list" ) &&
  664. ( $flag_counts_possible{$flag} == 0 ) ) {
  665. push @{$params{$flag}}, 1;
  666. }
  667. }
  668. elsif ( $flag_counts_possible{$flag} eq "list" ) {
  669. push @{$params{$flag}}, $arg;
  670. $flag_counts_actual{$flag}++;
  671. }
  672. elsif ( $flag_counts_actual{$flag} < $flag_counts_possible{$flag} ) {
  673. push @{$params{$flag}}, $arg;
  674. $flag_counts_actual{$flag}++;
  675. }
  676. else {
  677. print "ERROR: Incorrect parameters\n";
  678. &PrintUsage;
  679. }
  680. }
  681. #&PrintParameters(%params);
  682. return %params;
  683. }
  684. # Create Catalog header
  685. sub GetHeader {
  686. my($fname)=@_;
  687. my(@HeadA);
  688. push @HeadA, "[CatalogHeader]";
  689. push @HeadA, "Name=$fname";
  690. push @HeadA, "PublicVersion=0x0000001";
  691. push @HeadA, "EncodingType=0x00010001";
  692. push @HeadA, "CATATTR1=0x10010001:OSAttr:2:5.X";
  693. push @HeadA, "";
  694. push @HeadA, "[CatalogFiles]";
  695. return @HeadA;
  696. }
  697. # --------------------------------------
  698. # Print Usage info
  699. # --------------------------------------
  700. sub PrintUsage {
  701. print <<EOT;
  702. Usage: makelist -i lists -o outfile [-h catfile]
  703. makelist -u lists -o outfile [-h catfile]
  704. makelist -d list1 lists -o outfile [-h catfile]
  705. makelist -n dosnetfile -o outfile [-h catfile]
  706. makelist -q excdosntfile -o outfile [-h catfile]
  707. makelist -r drvindexfile -o outfile [-h catfile]
  708. makelist -c directory -o outfile [-h catfile]
  709. -i lists Take the intersection of one or more lists
  710. and print it to outfile. Each list is in
  711. a file.
  712. -u lists Take the union of one or more lists. Each list
  713. is in a file.
  714. -d list1 lists
  715. Subtract lists from list 1 and print the
  716. remaining elements to outfile
  717. -n dosnetfile
  718. Create a list from a dosnet.inf file
  719. -q excdosntfile
  720. Create a list from a excdosnt.inf file
  721. -r drvindexfile
  722. Create a list from a drvindex.inf file
  723. -b mediafile
  724. Create a list from media.inx file
  725. -c directory
  726. Create a list from a directory
  727. -o outfile
  728. Output file
  729. -h catfile
  730. Make this a CDF file for catfile (catfile will be
  731. included in the header of the output file). This
  732. will work on 5.X OS's.
  733. makelist -m file -s search_paths [-px] -o outfile [-h catfile]
  734. -h catfile
  735. -m Create a list from a file
  736. -o Output file
  737. -p Put path info into the list
  738. -s Search paths
  739. -x Check the search paths
  740. -h Put catalog header info in the file
  741. makelist -a source_dest -o outfile
  742. -a List in the format source,dest
  743. -o Outputs source name for files whose source name is
  744. not the same as the destination
  745. EOT
  746. exit;
  747. }
  748. # Output formatting/logging
  749. sub LogMsg {
  750. my($type,$msg) = @_;
  751. my($fmsg);
  752. $fmsg = $ThisScript."[".$type."]: ".$msg;
  753. if( $type ne "dbg" ) {
  754. system("echo $fmsg >> $logfile");
  755. }
  756. if( ($type ne "dbg") || $DBG ) {
  757. print $fmsg."\n";
  758. }
  759. if($type eq "err") {
  760. exit;
  761. }
  762. return;
  763. }
  764. # Print parameters
  765. sub PrintParameters {
  766. my(%params)=@_;
  767. my($ar);
  768. print "Printing input parameters\n";
  769. foreach $item (keys %params) {
  770. print "Flag $item : ";
  771. $ar = \@{$params{$item}};
  772. for ($i=0; $i< @{$ar}; $i++) {
  773. print " $ar->[$i] ";
  774. }
  775. print "\n";
  776. }
  777. }