Merge branch 'master' of https://git.code.sf.net/p/cdesktopenv/code
[oweals/cde.git] / cde / admin / IntegTools / dbTools / udbParseLib.awk
1  
2 # Awk Library file for parsing UDB files
3 #
4 function parseUdb() {
5         # nawk has already read the initial line.  
6         # Tokenize it before doing anything else.
7         tokenize() 
8         readDefaults(defaults)
9         # assign hp-ux ".db" file src and link defaults
10         # if none were designated.
11                 if ( SrcDefault == "" )
12                         SrcDefault = "a_out_location"
13                 if ( LnkDefault == "" )
14                         LnkDefault = "link_source"
15                 if ( TypDefault == "" )
16                         TypDefault = "type"
17                 if ( DestDefault == "" )
18                         DestDefault = "install_target"
19                 if ( ModeDefault == "" )
20                         ModeDefault = "mode"
21                 if ( OwnerDefault == "" )
22                         OwnerDefault = "owner"
23                 if ( GroupDefault == "" )
24                         GroupDefault = "group"
25                 readData()
26 }
27
28 # -------------------------------------------------------------
29 #  readDefaults
30 #    This routine reads the defaults at the front section 
31 #  of the universal database and salts the defaults away.
32 #
33 # -------------------------------------------------------------
34 function readDefaults(dflts)
35 {
36         if ( DeBug > 0 ) {
37                 Depth++
38                 for ( i=1; i < Depth; i++ )
39                         printf(" ") > DeBugFile
40                 print "Entering function readDefaults" > DeBugFile
41         }
42         do {
43                 os = getOS()
44                 if ( osQual != "defaults" )
45                         syntaxError("No defaults for: " BlockToken)
46                 if ( os == BlockToken || os == "default" )
47                         break
48                 skipToToken("}")
49         } while ( 1 )
50         fillDefaults()
51         if ( DeBug > 1 )
52                 print "Skipping remaining defaults" > DeBugFile
53         # skip remaining default specs
54         while ( lookAhead() == "{" ) {
55                 # This should be another default spec
56                 # skip it. (watch out for syntax errors)
57                 os = getOS()
58                 if ( osQual != "defaults" )
59                         syntaxError("Expected os:defaults found: \"" os ":" osQual "\"")
60                 if ( os == BlockToken && fileName == FILENAME )
61                         syntaxError("Only one \"defaults\" record allowed per os" )
62
63                 skipToToken("}");
64         }
65         if ( DeBug > 0 ) Depth--
66 }
67 # -------------------------------------------------------------
68 #  syntaxError
69 #      bail out
70 #
71 # (optionally) mail a message to an administrator if a syntax 
72 # error occurs in a database.
73 #
74 # -------------------------------------------------------------
75 function syntaxError(reason) {
76         if ( DeBug > 0 ) {
77                 Depth++
78                 for ( i=1; i < Depth; i++ )
79                         printf(" ") > DeBugFile
80                 print "Entering function syntaxError:" > DeBugFile
81         }
82         print "Syntax ERROR line: " NR " of file: " FILENAME 
83         if (reason)
84                 print " " reason
85         system( "rm -f /tmp/SyntaxError" )
86         system( "touch /tmp/SyntaxError" )
87         print "Syntax ERROR line: " NR " of file: " FILENAME > "/tmp/SyntaxError"
88         if (reason)
89                 print " " reason >> "/tmp/SyntaxError"
90         close( "/tmp/SyntaxError" )
91         if ( mailTo != "" ) {
92                 system( "mailx -s \"database syntax error\"  "mailTo"  < /tmp/SyntaxError" )
93         }
94         system( "rm -f /tmp/SyntaxError" )
95         exit 1
96 }
97 # -------------------------------------------------------------
98 #  fillDefaults
99 #    This routine reads the defaults in the OS
100 #  defaults section of the database.  It saves the defaults
101 #  in the "defaults" awk-style string array.
102 #
103 # -------------------------------------------------------------
104 function fillDefaults() {
105         if ( DeBug > 0 ) {
106                 Depth++
107                 for ( i=1; i < Depth; i++ )
108                         printf(" ") > DeBugFile
109                 print "Entering function fillDefaults:" > DeBugFile
110         }
111         tempDflt = ""
112         NumEntries = 1
113         do {
114                 if ( tempDflt != "" ) {
115                         keyword = tempDflt
116                         tempDflt = ""
117                 }
118                 else
119                         keyword = nextToken()
120         
121                 if ( keyword == "}" )
122                         break;
123                 if ( "=" != nextToken())
124                         syntaxError("Keyword: " keyword " not followed by \"=\" ");
125                 tempDflt = nextToken();
126                 if ( lookAhead() == "=" )
127                         defaults[keyword]=""
128                 else {
129                         if ( tempDflt == "<SRC>" ) {
130                                 SrcDefault = keyword;
131                                 tempDflt = ""
132                         }
133                         if ( tempDflt == "<LNK>" ) {
134                                 LnkDefault = keyword;
135                                 tempDflt = ""
136                         }
137                         if ( tempDflt == "<TYPE>" ) {
138                                 TypDefault = keyword;
139                                 tempDflt = "file"
140                         }
141                         if ( tempDflt == "<DEST>" ) {
142                                 DestDefault = keyword;
143                                 tempDflt = ""
144                         }
145                         if ( tempDflt == "<MODE>" ) {
146                                 ModeDefault = keyword;
147                                 tempDflt = "0444"
148                         }
149                         if ( tempDflt == "<OWNER>" ) {
150                                 OwnerDefault = keyword;
151                                 tempDflt = "bin"
152                         }
153                         if ( tempDflt == "<GROUP>" ) {
154                                 GroupDefault = keyword;
155                                 tempDflt = "bin"
156                         }
157                         defaults[keyword]= tempDflt
158
159                         tempDflt = ""
160                 }
161                 defOrder[NumEntries++] = keyword;
162         } while ( 1 )
163         if ( DeBug > 3 ) {
164                 DBGprintArray(defaults,"defaults") 
165                 print "SrcDefault =" SrcDefault  > DeBugFile
166                 print "LnkDefault =" LnkDefault  > DeBugFile
167                 print "TypDefault =" TypDefault  > DeBugFile
168         }
169         if ( DeBug > 0 ) Depth--
170 }
171 # -------------------------------------------------------------
172 #  getOS
173 #    This routine scans the database for an 
174 #  open brace, then a token, then a ":" indicating 
175 #  the start of an OS defaults section.
176 #
177 # -------------------------------------------------------------
178 function getOS()
179 {
180         if ( DeBug > 0 ) {
181                 Depth++
182                 for ( i=1; i < Depth; i++ )
183                         printf(" ") > DeBugFile
184                 print "Entering function getOS:" > DeBugFile
185         }
186         osQual = ""
187         gotOS = 0
188
189         if ( "{" != nextToken() )
190                 syntaxError("Missing initial {")
191         os = nextToken();
192         if ( lookAhead() == ":" ) {
193                 nextToken();
194                 osQual= nextToken();
195         } else 
196                 osQual= ""
197         if ( DeBug > 0 ) Depth--
198         return os
199 }
200 # -------------------------------------------------------------
201 #  nextToken
202 #    parse the incoming data stream into tokens.
203 #
204 # -------------------------------------------------------------
205 function nextToken() {
206         if ( DeBug > 0 ) {
207                 Depth++
208                 for ( i=1; i < Depth; i++ )
209                         printf(" ") > DeBugFile
210                 print "Entering function nextToken:" > DeBugFile
211         }
212         if ( EOF_Reached == 1 )
213                 syntaxError("Premature EOF");
214         tmpToken=tokens[TK++]
215         while ( TK > Ntokens || tokens[TK] == ";" ) {
216                 TK++
217                 if ( TK > Ntokens )
218                         if ( newLine() <= 0 ) {
219                                 EOF_Reached = 1;
220                                 break;
221                         }
222         }
223         if ( DeBug > 2 )
224                 print "Returning token: " tmpToken > DeBugFile
225         if ( DeBug > 0 ) Depth--
226         return tmpToken
227 }
228 # -------------------------------------------------------------
229 #  lookAhead
230 #     return the token at the head of the current list of
231 #  tokens, but do not bump the token count in TK
232 #
233 # -------------------------------------------------------------
234 function lookAhead() {
235         if ( DeBug > 0 ) {
236                 Depth++
237                 for ( i=1; i < Depth; i++ )
238                         printf(" ") > DeBugFile
239                 print "Entering function lookAhead" > DeBugFile
240         }
241         if ( DeBug > 0 ) Depth--
242         return tokens[TK];
243 }
244 # -------------------------------------------------------------
245 #  newLine, tokenize
246 #    read a new line of input and tokenize it.
247 #
248 # -------------------------------------------------------------
249 function newLine() {
250         if ( DeBug > 0 ) {
251                 Depth++
252                 for ( i=1; i < Depth; i++ )
253                         printf(" ") > DeBugFile
254                 print "Entering function newLine:" > DeBugFile
255         }
256         if ( (retval = getline) <= 0 ) {
257                 if ( DeBug > 0 ) Depth--
258                 return retval
259         }
260         retval =  tokenize()
261         if ( DeBug > 0 ) Depth--
262         return retval
263 }
264 function tokenize() {
265         if ( DeBug > 0 ) {
266                 Depth++
267                 for ( i=1; i < Depth; i++ )
268                         printf(" ") > DeBugFile
269                 print "Entering function tokenize:" > DeBugFile
270         }
271         # Skip blank/comment lines
272         while ( NF == 0 || $0 ~ /^[     ]*#/  ) {
273                 if ( (getline) <= 0 ) {
274                         if ( DeBug > 0 ) Depth--
275                         return 0
276                 }
277         }
278         
279
280         #
281         # Make sure syntactically meaningful characters are surrounded by
282         # white space.  (I gave up on gsub for this purpose).
283         #
284         last=1
285         Str=""                  # temp string for modified input line
286         tstStr=$0               # part of input line being tested
287         newStr=$0               # current input line image with modifications
288 ##########################################################################
289 # REPLACE THE FOLLOWING LINE WITH A WORK_AROUND FOR A PROBLEM WITH
290 # THE MATCH FUNCTION FOR THE SUN VERSION OF "nawk"
291 #
292 #       while ( match(tstStr,"[^\\\][:=}{;]") ) {
293 #
294         while ( match(tstStr,"[:=}{;]") ) {
295                 if ( RSTART-1 > 0 && substr(tstStr,RSTART-1,1) != "\\") {
296                         RSTART=RSTART-1
297                         LENGTH=LENGTH+1
298                 } else {
299                         #
300                         # The character was escaped with a backslash.
301                         # Patch things up -- continue testing the rest
302                         # of the line.
303                         # 
304                         Str=Str substr($0,last,RSTART+1) 
305                         last = last + RSTART + 1
306                         tstStr =substr($0,last)
307                         newStr = Str tstStr
308                         continue;       
309                 }
310 #######################   end of workaround ################################
311 ############################################################################
312                 if ( DeBug > 1 ) {
313                         print "Tokenize: Match found in: " tstStr
314                         print "RSTART= " RSTART " ; RLENGTH = " RLENGTH
315                 }
316                 # match found -- 
317                 # the temp string is now modified to contain:
318                 # 1) all characters up to the match and the first char of match
319                 # 2) blank before the  syntactically significant char
320                 # 3) the significant character
321                 # 4) blank following the significant character
322
323                 Str=Str substr($0,last,RSTART) " " substr($0,last+RSTART,1) " "
324                 last = last + RSTART + 1;
325                 #
326                 # Test remaining part of input line for additional occurances
327                 # of syntactically significant characters.
328                 #
329                 tstStr=substr($0,last)
330                 #
331                 # Our best guess for the new string is the part of the
332                 # input line already tested plus the part yet to be tested.
333                 #
334                 newStr=Str tstStr
335         }
336         #
337         # Check for any instances of syntax chars at the start of the line
338         #
339         sub("^[:=}{;]","& ",newStr);
340         $0 = newStr
341
342         #
343         # allow escaping of significant syntax characters
344         #
345         gsub("[\\\][{]","{")
346         gsub("\\\:",":")
347         gsub("\\\;",";")
348         gsub("\\\=","=")
349         gsub("[\\\][}]","}")
350
351         #
352         # Having insured that interesting chars are surrounded by blanks
353         # now tokenize the input line.
354         #
355
356         Ntokens = split($0,tokens)
357         TK = 1
358         if ( DeBug > 3 )
359                 DBGprintTokens()
360         if ( DeBug > 0 ) Depth--
361         return Ntokens
362 }
363 function DBGprintTokens()
364 {
365         for ( i = 1; i <= Ntokens ; i++ )
366                 print "tokens[" i "] = " tokens[i] > DeBugFile
367         return 0
368 }
369 function DBGprintArray(array,name) {
370         for ( i in array) {
371                 print name "[" i "] = " array[i]  > DeBugFile
372         }
373 }
374 # -------------------------------------------------------------
375 #  skipToToken
376 #     read until the passed in token is encountered
377 #
378 # -------------------------------------------------------------
379 function skipToToken(tok)
380 {
381         if ( DeBug > 0 ) {
382                 Depth++
383                 for ( i=1; i < Depth; i++ )
384                         printf(" ") > DeBugFile
385                 print "Entering function skipToToken:" > DeBugFile
386         }
387         while ( nextToken() != tok )
388                 ;
389         if ( DeBug > 0 ) Depth--
390 }
391 # -------------------------------------------------------------
392 #  readData
393 #
394 # -------------------------------------------------------------
395 function readData() {
396         if ( DeBug > 0 ) {
397                 Depth++
398                 for ( i=1; i < Depth; i++ )
399                         printf(" ") > DeBugFile
400                 print "Entering function readData" > DeBugFile
401         }
402         while ( EOF_Reached == 0 ) {
403                 if ( fileName != FILENAME ) {
404                         if ( DeBug > 1 ) {
405                                 print "====>Files Changed" > DeBugFile
406                                 print "fileName= " fileName > DeBugFile
407                                 print "FILENAME= " FILENAME > DeBugFile
408                         }
409                         fileName = FILENAME
410                         # skip over defaults section of the new file
411                         while ( lookAhead() == "{" ) {
412                                 # This should be another default spec
413                                 # skip it. (watch out for syntax errors)
414                                 os = getOS()
415                                 if ( osQual != "defaults" )
416                                         syntaxError("Expected os:defaults found: \"" os ":" osQual "\"")
417                                 #
418                                 # Relax this restriction since we are
419                                 # ignoring this defaults record
420                                 #if ( os == BlockToken )
421                                 #       syntaxError("Only one \"defaults\" record allowed per os" )
422
423                                 skipToToken("}");
424                         }
425                 }
426                 if ( getNextRecord(record) > 0 )
427                         PRTREC(record);
428                 # skip remaining os entries for this source
429                 # sorry no error checking.
430                 while ( EOF_Reached == 0 && lookAhead() == "{" )
431                         skipToToken("}")
432         if ( DeBug > 1 )
433                 print "EOF_Reached = " EOF_Reached > DeBugFile
434         }
435         if ( DeBug > 0 ) Depth--
436 }
437
438 # -------------------------------------------------------------
439 #  getNextRecord
440 #
441 #    this function fills the rec[] array with defaults
442 #
443 #    then it scans for a block that has a token maching
444 #    BlockToken, or accepts a block with the "default" 
445 #    token.  The "default" token is not accepted if 
446 #    defaults are disallowed.
447 #
448 #    finally fillRecord is called to read in the lines
449 #    in the block and override the entries in the rec[] array.
450 #
451 # -------------------------------------------------------------
452 function getNextRecord(rec) {
453         if ( DeBug > 0 ) {
454                 Depth++
455                 for ( i=1; i < Depth; i++ )
456                         printf(" ") > DeBugFile
457                 print "Entering function getNextRecord:" > DeBugFile
458         }
459         # fill with defaults
460         for ( i in defaults ) 
461                 rec[i] = defaults[i];
462         do {
463                 src = nextToken()
464                 if ( DeBug > 2 )
465                         print "src=" src > DeBugFile
466 # Allow special characters to appear in src names if they have been backslashed
467 #                       if ( src ~ /[{:=}]/ )
468 #                               syntaxError("Invalid source: \"" src "\"");
469                 do {
470                         os = getOS()
471                         if ( DeBug > 1 ) {
472                                 print "Got os " os " and qual= " osQual > DeBugFile
473                                 print "NR= " NR " : " $0 > DeBugFile
474                         }
475                         if (( os != BlockToken || osQual == "not" ) \
476                                 && ( os != "default" || UseDefaultBlocks != "Y" ) ) {
477
478                                 if ( DeBug > 2)
479                                         print "Skipping to end of os rec" > DeBugFile
480                                 skipToToken("}");
481                         }
482                         if ( EOF_Reached == 1 || fileName != FILENAME ){
483                                 if ( DeBug > 0 ) Depth--
484                                 return 0
485                         }
486                         if ( DeBug > 2 )
487                                 print "Look Ahead is: " tokens[TK] > DeBugFile
488                 } while ( lookAhead() == "{" )
489         } while (( os != BlockToken ) && ( os != "default" || UseDefaultBlocks != "Y"))
490                 if ( DeBug > 2)
491                         print "About to call fillRecord" > DeBugFile
492         fillRecord(rec)
493         if ( DeBug > 0 ) Depth--
494         return 1
495 }
496 function fillRecord(rec) {
497         if ( DeBug > 0 ) {
498                 Depth++
499                 for ( i=1; i < Depth; i++ )
500                         printf(" ") > DeBugFile
501                 print "Entering fillRecord:" > DeBugFile
502         }
503         tempEntry = ""
504         do {
505                 if ( tempEntry != "" ) {
506                         keyword = tempEntry;
507                         tempEntry = ""
508                 } else
509                         keyword = nextToken();
510                 if ( keyword == "}" )
511                         break;
512                 if ( "=" != nextToken())
513                         syntaxError("Keyword: " keyword " not followed by \"=\"");
514                 tempEntry = nextToken();
515                 if ( lookAhead() == "=" )
516                         rec[keyword] = ""
517                 else {
518                         rec[keyword] = tempEntry
519                         tempEntry = ""
520                 }
521         } while (1)
522         #
523         # check for source entry
524         # THIS IMPLIES KNOWLEDGE OF .db FILE ENTRIES!!
525         if ( DeBug > 2)
526                 print "TYPE= " rec[TypDefault]  > DeBugFile
527         if ( src == "-" )
528                 if ( rec[TypDefault]=="directory" || rec[TypDefault]=="empty_dir")
529                 {
530                         # no source required for a directory
531                         if ( rec[SrcDefault] != "" )
532                                 syntaxError(SrcDefault " \"" rec[SrcDefault] "\" specified for a directory.")
533                         if ( rec[LnkDefault] != "" )
534                                 syntaxError(LnkDefault " \"" rec[LnkDefault] "\" specfied for a directory.")
535    
536                         rec[SrcDefault] = src;
537                 } else if ( rec["status"] == "---cu-" ) {
538                         # This is used for some reason (X11-SERV.db)
539                         if ( rec[SrcDefault] != "" )
540                                 syntaxError( "File: \"" rec["install_target"] "\" with special status: \"---cu-\" should have no source.");
541                 } else
542                         syntaxError("Invalid source: \"" src "\" for type: \"" rec[TypDefault] )
543         else if ( rec[TypDefault] ~ /link/ )
544                 if ( src ~ /^\// || src ~ /^\./ ) {
545                         if ( rec[SrcDefault] != "")
546                                 syntaxError( SrcDefault ": \""  rec[SrcDefault] "\" specified for link: \"" src "\"")
547                         if ( rec[LnkDefault] == "" )
548                                 rec[LnkDefault]=src;
549                 } else
550                         syntaxError("Invalid source: \"" src "\" for type: \"" rec[TypDefault] "\"")
551         else if ( rec[TypDefault] == "file" || rec[TypDefault] == "control" )
552                 rec[SrcDefault] = src;
553         else
554                 syntaxError("Unrecognized type:\"" rec[TypDefault] "\"")
555
556         if ( DeBug > 0 ) Depth--
557         
558 }
559
560 # -------------------------------------------------------------
561 #  printDB
562 #       Print records in ".db" format
563 # -------------------------------------------------------------
564 function printDb(rec) {
565         if ( DeBug > 0 ) {
566                 Depth++
567                 for ( i=1; i < Depth; i++ )
568                         printf(" ") > DeBugFile
569                 print "Entering printDb:"        > DeBugFile
570         }
571         # NumEntries should be one greater than the number of defaults
572         # read in.
573         for ( i = 1; i< NumEntries; i++ ) {
574                 printf("%-40s %s %s\n",defOrder[i], ":",rec[defOrder[i]])
575         }               
576         print "#"
577         if ( DeBug > 0 ) Depth--
578 }
579
580
581 # -------------------------------------------------------------
582 #  printLst
583 #       Print records in ".lst" format
584 # -------------------------------------------------------------
585 function printLst(rec) {
586         if ( DeBug > 0 ) {
587                 Depth++
588                 for ( i=1; i < Depth; i++ )
589                         printf(" ") > DeBugFile
590                 print "Entering printLst:"       > DeBugFile
591         }
592         if ( rec[TypDefault] ~ /link/ ) 
593                 Source = LnkDefault
594         else
595                 Source = SrcDefault
596
597         printf("%s %s %s %s %s %s %s %s %s\n",
598                                    rec[ DestDefault],
599                                    rec[ ModeDefault ],
600                                    rec[ Source ],
601                                    rec[ TypDefault ],
602                                    rec[ OwnerDefault ],
603                                    rec[ GroupDefault ],
604                                    rec[ "status" ],
605                                    rec[ "processor" ],
606                                    rec[ "responsible_project" ] ) 
607                                 
608         if ( DeBug > 0 ) Depth--
609 }
610
611 # -------------------------------------------------------------
612 #  printGather
613 #       print records in one of the formats expected by Gather.ksh
614 #       (Jim Andreas print routine).
615 # -------------------------------------------------------------
616 function printGather(rec) {
617 # print "Entering printRecord:  "
618
619     if (( BlockToken == "hp-ux" ) && ( rec[ "processor" ] != "378" ))
620     {
621         if ( index( rec[ "processor" ], Machine ) == 0 )
622         {
623 #printf( "skipping %s, Machine %s machines %s\n", src, Machine, rec[ "processor" ] );
624             return
625         }
626     }
627     if ( action == "toSDD" )
628     {
629         if ( rec[ "type" ] == "file" )
630         {
631             printf("%s:F:%s:%s:%s:*::\n", 
632                 rec[ "install_target" ], rec[ "owner" ],
633                 rec[ "group" ], rec[ "mode" ])
634         }
635     }
636     else if ( action == "toReleaseTree" )
637     {
638       if ( ( rec[ "type" ] == "hard_link" ) ||
639              ( rec[ "type" ] == "sym_link" )  || 
640              ( rec[ "type" ] == "file" )   ) 
641       {
642
643 #
644 # if this is a link, then fudge a source file for Gather.ksh
645 # to check on.  Really we are linking two dest files together
646 # so the hack is to get around the check in Gather.ksh
647 #
648
649         if ( ( rec[ "type" ] == "hard_link" ) ||
650              ( rec[ "type" ] == "sym_link" ) )
651         {
652             printf( "   {s}%s {d}%s\n", "-", rec[ "install_target" ] );
653         }
654         else if ( length( src ) > 34 )
655                 printf( "   {s}%s {d}%s\n",   src, rec[ "install_target" ] );
656             else
657                 printf( "   {s}%-34s {d}%s\n", src, rec[ "install_target" ] );
658
659         if ( rec[ "install_rule_name" ] == "c-" )
660         {
661             printf( "compress -c < {s}%s > {d}%s\n", src, 
662                 rec[ "install_target" ] );
663         }
664         else if ( rec[ "type" ] == "sym_link" )
665         {
666             printf( "ln -s %s {d}%s\n", src, 
667                 rec[ "install_target" ] );
668         }
669         else if ( rec[ "type" ] == "hard_link" )
670         {
671             printf( "ln {d}%s {d}%s\n", src, 
672                 rec[ "install_target" ] );
673         }
674         else if ( rec[ "uncompress" ] == "true" )
675         {
676             printf( "uncompress -c < {s}%s > {d}%s\n", src, 
677                 rec[ "install_target" ] );
678         }
679         else if ( length( src ) > 34 )
680         {
681             printf( "cp {s}%s {d}%s\n", src, 
682                 rec[ "install_target" ] );
683         }
684         else
685         {
686             printf( "cp {s}%-34s {d}%s\n", src, 
687                 rec[ "install_target" ] );
688         }
689         printf( "%s %s %s\n", rec[ "owner" ], rec[ "group" ], rec[ "mode" ])
690         rec[ "install_rule_name" ] = "";
691         rec[ "uncompress" ] = "";
692       }
693     }
694     else if ( action == "toDeliverArgs" )
695     {
696         temp = rec[ "install_target" ];
697         m = n = index( temp, "/" );
698         while ( n != 0 )
699         {
700             temp = substr( temp, n+1 );
701             n = index( temp, "/" );
702             m += n;
703         }
704         dirnametarget = substr( rec[ "install_target" ], 1, m-1 );
705
706         if ( length( rec[ "install_target" ] ) > 40 )
707         {
708             printf("%s -d .%s\n", rec[ "install_target" ], dirnametarget );
709         }
710         else
711         {
712             printf("%-40s -d .%s\n", rec[ "install_target" ], dirnametarget );
713         }
714     }
715     else if ( action == "toCheckBuild" )
716     {
717 # print "Entering printRecord - toCheckBuild:  "
718         #
719         # skip any link info
720         #
721         if ( rec[ "type" ] == "file" )
722         {
723             #
724             # just print the source path for the checker tool
725             #
726             printf("%s\n", src );
727         }
728     }
729     else if ( action == "toFileList" )
730     {
731         #
732         # skip any link info
733         #
734         if ( rec[ "type" ] == "file" )
735         {
736             #
737             # print the source and install_target for the human person
738             #
739             if ( length( src ) > 40 || length( rec[ "install_target" ] ) > 40 )
740             {
741                 printf("%s -> %s %s\n", src,
742                    rec[ "install_target" ], rec[ "mode" ] );
743             }
744             else
745             {
746                 printf("%-40s -> %-40s %s\n", src,
747                    rec[ "install_target" ], rec[ "mode" ] );
748             }
749         }
750     }
751     else if ( action == "toTargetList" )
752     {
753         #
754         # skip any link info
755         #
756         if ( rec[ "type" ] == "file" )
757         {
758             #
759             # just print the install_target
760             #
761             printf("%s\n", rec[ "install_target" ] );
762         }
763     }
764 }
765