Print this page
8564 developer/build/onbld shouldn't require ghostscript
Reviewed by: Alexander Pyhalov <apyhalov@gmail.com>


   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 
  23 #
  24 # Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  25 # Copyright 2008, 2010, Richard Lowe
  26 # Copyright 2012 Marcel Telka <marcel@telka.sk>
  27 # Copyright 2014 Bart Coddens <bart.coddens@gmail.com>
  28 # Copyright 2017 Nexenta Systems, Inc.
  29 # Copyright 2016 Joyent, Inc.
  30 # Copyright 2016 RackTop Systems.
  31 #
  32 
  33 #
  34 # This script takes a file list and a workspace and builds a set of html files
  35 # suitable for doing a code review of source changes via a web page.
  36 # Documentation is available via the manual page, webrev.1, or just
  37 # type 'webrev -h'.
  38 #
  39 # Acknowledgements to contributors to webrev are listed in the webrev(1)
  40 # man page.
  41 #
  42 
  43 REMOVED_COLOR=brown
  44 CHANGED_COLOR=blue
  45 NEW_COLOR=blue
  46 
  47 HTML='<?xml version="1.0"?>
  48 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  49     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


1263           <frameset rows="*,60">
1264             <frameset cols="50%,50%">
1265               <frame src="$TNAME.lhs.html" scrolling="auto" name="lhs"></frame>
1266               <frame src="$TNAME.rhs.html" scrolling="auto" name="rhs"></frame>
1267             </frameset>
1268           <frame src="${RTOP}ancnav.html" scrolling="no" marginwidth="0"
1269            marginheight="0" name="nav"></frame>
1270           <noframes>
1271             <body id="SUNWwebrev">
1272               Alas 'frames' webrev requires that your browser supports frames
1273               and has the feature enabled.
1274             </body>
1275           </noframes>
1276           </frameset>
1277         </html>
1278         EOF
1279 }
1280 
1281 
1282 #
1283 # fix_postscript
1284 #
1285 # Merge codereview output files to a single conforming postscript file, by:
1286 #       - removing all extraneous headers/trailers
1287 #       - making the page numbers right
1288 #       - removing pages devoid of contents which confuse some
1289 #         postscript readers.
1290 #
1291 # From Casper.
1292 #
1293 function fix_postscript
1294 {
1295         infile=$1
1296 
1297         cat > /tmp/$$.crmerge.pl << \EOF
1298 
1299         print scalar(<>);         # %!PS-Adobe---
1300         print "%%Orientation: Landscape\n";
1301 
1302         $pno = 0;
1303         $doprint = 1;
1304 
1305         $page = "";
1306 
1307         while (<>) {
1308                 next if (/^%%Pages:\s*\d+/);
1309 
1310                 if (/^%%Page:/) {
1311                         if ($pno == 0 || $page =~ /\)S/) {
1312                                 # Header or single page containing text
1313                                 print "%%Page: ? $pno\n" if ($pno > 0);
1314                                 print $page;
1315                                 $pno++;
1316                         } else {
1317                                 # Empty page, skip it.
1318                         }
1319                         $page = "";
1320                         $doprint = 1;
1321                         next;
1322                 }
1323 
1324                 # Skip from %%Trailer of one document to Endprolog
1325                 # %%Page of the next
1326                 $doprint = 0 if (/^%%Trailer/);
1327                 $page .= $_ if ($doprint);
1328         }
1329 
1330         if ($page =~ /\)S/) {
1331                 print "%%Page: ? $pno\n";
1332                 print $page;
1333         } else {
1334                 $pno--;
1335         }
1336         print "%%Trailer\n%%Pages: $pno\n";
1337 EOF
1338 
1339         $PERL /tmp/$$.crmerge.pl < $infile
1340 }
1341 
1342 
1343 #
1344 # input_cmd | insert_anchors | output_cmd
1345 #
1346 # Flag blocks of difference with sequentially numbered invisible
1347 # anchors.  These are used to drive the frames version of the
1348 # sdiffs output.
1349 #
1350 # NOTE: Anchor zero flags the top of the file irrespective of changes,
1351 # an additional anchor is also appended to flag the bottom.
1352 #
1353 # The script detects changed lines as any line that has a "<span
1354 # class=" string embedded (unchanged lines have no class set and are
1355 # not part of a <span>.  Blank lines (without a sequence number)
1356 # are also detected since they flag lines that have been inserted or
1357 # deleted.
1358 #
1359 function insert_anchors
1360 {
1361         $AWK '
1362         function ia() {
1363                 printf "<a name=\"%d\" id=\"anc%d\"></a>", anc, anc++;


2340 
2341         exit 2
2342 }
2343 
2344 #
2345 #
2346 # Main program starts here
2347 #
2348 #
2349 
2350 trap "rm -f /tmp/$$.* ; exit" 0 1 2 3 15
2351 
2352 set +o noclobber
2353 
2354 PATH=$(/bin/dirname "$(whence $0)"):$PATH
2355 
2356 [[ -z $WDIFF ]] && WDIFF=`look_for_prog wdiff`
2357 [[ -z $WX ]] && WX=`look_for_prog wx`
2358 [[ -z $GIT ]] && GIT=`look_for_prog git`
2359 [[ -z $WHICH_SCM ]] && WHICH_SCM=`look_for_prog which_scm`
2360 [[ -z $CODEREVIEW ]] && CODEREVIEW=`look_for_prog codereview`
2361 [[ -z $PS2PDF ]] && PS2PDF=`look_for_prog ps2pdf`
2362 [[ -z $PERL ]] && PERL=`look_for_prog perl`
2363 [[ -z $RSYNC ]] && RSYNC=`look_for_prog rsync`
2364 [[ -z $SCCS ]] && SCCS=`look_for_prog sccs`
2365 [[ -z $AWK ]] && AWK=`look_for_prog nawk`
2366 [[ -z $AWK ]] && AWK=`look_for_prog gawk`
2367 [[ -z $AWK ]] && AWK=`look_for_prog awk`
2368 [[ -z $SCP ]] && SCP=`look_for_prog scp`
2369 [[ -z $SED ]] && SED=`look_for_prog sed`
2370 [[ -z $SFTP ]] && SFTP=`look_for_prog sftp`
2371 [[ -z $SORT ]] && SORT=`look_for_prog sort`
2372 [[ -z $MKTEMP ]] && MKTEMP=`look_for_prog mktemp`
2373 [[ -z $GREP ]] && GREP=`look_for_prog grep`
2374 [[ -z $FIND ]] && FIND=`look_for_prog find`
2375 [[ -z $MANDOC ]] && MANDOC=`look_for_prog mandoc`
2376 [[ -z $COL ]] && COL=`look_for_prog col`
2377 
2378 # set name of trash directory for remote webrev deletion
2379 TRASH_DIR=".trash"
2380 [[ -n $WEBREV_TRASH_DIR ]] && TRASH_DIR=$WEBREV_TRASH_DIR
2381 
2382 if [[ ! -x $PERL ]]; then
2383         print -u2 "Error: No perl interpreter found.  Exiting."
2384         exit 1
2385 fi
2386 
2387 if [[ ! -x $WHICH_SCM ]]; then
2388         print -u2 "Error: Could not find which_scm.  Exiting."
2389         exit 1
2390 fi
2391 
2392 #
2393 # These aren't fatal, but we want to note them to the user.
2394 # We don't warn on the absence of 'wx' until later when we've
2395 # determined that we actually need to try to invoke it.
2396 #
2397 [[ ! -x $CODEREVIEW ]] && print -u2 "WARNING: codereview(1) not found."
2398 [[ ! -x $PS2PDF ]] && print -u2 "WARNING: ps2pdf(1) not found."
2399 [[ ! -x $WDIFF ]] && print -u2 "WARNING: wdiff not found."
2400 
2401 # Declare global total counters.
2402 integer TOTL TINS TDEL TMOD TUNC
2403 
2404 # default remote host for upload/delete
2405 typeset -r DEFAULT_REMOTE_HOST="cr.opensolaris.org"
2406 # prefixes for upload targets
2407 typeset -r rsync_prefix="rsync://"
2408 typeset -r ssh_prefix="ssh://"
2409 
2410 cflag=
2411 Cflag=
2412 Dflag=
2413 flist_mode=
2414 flist_file=
2415 hflag=
2416 iflag=
2417 Iflag=
2418 lflag=


3046 
3047 #
3048 # Summarize what we're going to do.
3049 #
3050 print "      Workspace: ${PRETTY_CWS:-$CWS}"
3051 if [[ -n $parent_webrev ]]; then
3052         print "Compare against: webrev at $parent_webrev"
3053 else
3054         print "Compare against: ${PRETTY_PWS:-$PWS}"
3055 fi
3056 
3057 [[ -n $INCLUDE_FILE ]] && print "      Including: $INCLUDE_FILE"
3058 print "      Output to: $WDIR"
3059 
3060 #
3061 # Save the file list in the webrev dir
3062 #
3063 [[ ! $FLIST -ef $WDIR/file.list ]] && cp $FLIST $WDIR/file.list
3064 
3065 rm -f $WDIR/$WNAME.patch
3066 rm -f $WDIR/$WNAME.ps
3067 rm -f $WDIR/$WNAME.pdf
3068 
3069 touch $WDIR/$WNAME.patch
3070 
3071 print "   Output Files:"
3072 
3073 #
3074 # Clean up the file list: Remove comments, blank lines and env variables.
3075 #
3076 $SED -e "s/#.*$//" -e "/=/d" -e "/^[   ]*$/d" $FLIST > /tmp/$$.flist.clean
3077 FLIST=/tmp/$$.flist.clean
3078 
3079 #
3080 # First pass through the files: generate the per-file webrev HTML-files.
3081 #
3082 cat $FLIST | while read LINE
3083 do
3084         set - $LINE
3085         P=$1
3086 
3087         #


3287                         print " man-udiffs\c"
3288                         if [[ -x $WDIFF ]]; then
3289                                 $WDIFF -c "$COMM" -t "$WNAME Wdiff $DIR/$F" \
3290                                     $ofile.man.txt $nfile.man.txt > \
3291                                     $WDIR/$DIR/$F.man.wdiff.html 2>/dev/null
3292                                 if [[ $? -eq 0 ]]; then
3293                                         print " man-wdiffs\c"
3294                                 else
3295                                         print " man-wdiffs[fail]\c"
3296                                 fi
3297                         fi
3298                         sdiff_to_html $ofile.man.txt $nfile.man.txt $F.man $DIR \
3299                             "$COMM" > $WDIR/$DIR/$F.man.sdiff.html
3300                         print " man-sdiffs\c"
3301                         print " man-frames\c"
3302                 fi
3303                 rm -f $ofile.man.txt $nfile.man.txt
3304                 rm -f $WDIR/$DIR/$F.man.cdiff $WDIR/$DIR/$F.man.udiff
3305         fi
3306 
3307         #
3308         # Now we generate the postscript for this file.  We generate diffs
3309         # only in the event that there is delta, or the file is new (it seems
3310         # tree-killing to print out the contents of deleted files).
3311         #
3312         if [[ -f $nfile ]]; then
3313                 ocr=$ofile
3314                 [[ ! -f $ofile ]] && ocr=/dev/null
3315 
3316                 if [[ -z $mv_but_nodiff ]]; then
3317                         textcomm=`getcomments text $P $PP`
3318                         if [[ -x $CODEREVIEW ]]; then
3319                                 $CODEREVIEW -y "$textcomm" \
3320                                     -e $ocr $nfile \
3321                                     > /tmp/$$.psfile 2>/dev/null &&
3322                                     cat /tmp/$$.psfile >> $WDIR/$WNAME.ps
3323                                 if [[ $? -eq 0 ]]; then
3324                                         print " ps\c"
3325                                 else
3326                                         print " ps[fail]\c"
3327                                 fi
3328                         fi
3329                 fi
3330         fi
3331 
3332         if [[ -f $ofile ]]; then
3333                 source_to_html Old $PP < $ofile > $WDIR/$DIR/$F-.html
3334                 print " old\c"
3335         fi
3336 
3337         if [[ -f $nfile ]]; then
3338                 source_to_html New $P < $nfile > $WDIR/$DIR/$F.html
3339                 print " new\c"
3340         fi
3341 
3342         cd $OWD
3343 
3344         print
3345 done
3346 
3347 frame_nav_js > $WDIR/ancnav.js
3348 frame_navigation > $WDIR/ancnav.html
3349 
3350 if [[ ! -f $WDIR/$WNAME.ps ]]; then
3351         print " Generating PDF: Skipped: no output available"
3352 elif [[ -x $CODEREVIEW && -x $PS2PDF ]]; then
3353         print " Generating PDF: \c"
3354         fix_postscript $WDIR/$WNAME.ps | $PS2PDF - > $WDIR/$WNAME.pdf
3355         print "Done."
3356 else
3357         print " Generating PDF: Skipped: missing 'ps2pdf' or 'codereview'"
3358 fi
3359 
3360 # If we're in OpenSolaris mode and there's a closed dir under $WDIR,
3361 # delete it - prevent accidental publishing of closed source
3362 
3363 if [[ -n "$Oflag" ]]; then
3364         $FIND $WDIR -type d -name closed -exec /bin/rm -rf {} \;
3365 fi
3366 
3367 # Now build the index.html file that contains
3368 # links to the source files and their diffs.
3369 
3370 cd $CWS
3371 
3372 # Save total changed lines for Code Inspection.
3373 print "$TOTL" > $WDIR/TotalChangedLines
3374 
3375 print "     index.html: \c"
3376 INDEXFILE=$WDIR/index.html
3377 exec 3<&1                        # duplicate stdout to FD3.
3378 exec 1<&-                        # Close stdout.
3379 exec > $INDEXFILE            # Open stdout to index file.


3420 PREPDATE=$(LC_ALL=C /usr/bin/date +%Y-%b-%d\ %R\ %z\ %Z)
3421 print "<tr><th>Prepared by:</th><td>$preparer on $PREPDATE</td></tr>"
3422 print "<tr><th>Workspace:</th><td>${PRETTY_CWS:-$CWS}"
3423 print "</td></tr>"
3424 print "<tr><th>Compare against:</th><td>"
3425 if [[ -n $parent_webrev ]]; then
3426         print "webrev at $parent_webrev"
3427 else
3428         print "${PRETTY_PWS:-$PWS}"
3429 fi
3430 print "</td></tr>"
3431 print "<tr><th>Summary of changes:</th><td>"
3432 printCI $TOTL $TINS $TDEL $TMOD $TUNC
3433 print "</td></tr>"
3434 
3435 if [[ -f $WDIR/$WNAME.patch ]]; then
3436         wpatch_url="$(print $WNAME.patch | url_encode)"
3437         print "<tr><th>Patch of changes:</th><td>"
3438         print "<a href=\"$wpatch_url\">$WNAME.patch</a></td></tr>"
3439 fi
3440 if [[ -f $WDIR/$WNAME.pdf ]]; then
3441         wpdf_url="$(print $WNAME.pdf | url_encode)"
3442         print "<tr><th>Printable review:</th><td>"
3443         print "<a href=\"$wpdf_url\">$WNAME.pdf</a></td></tr>"
3444 fi
3445 
3446 if [[ -n "$iflag" ]]; then
3447         print "<tr><th>Author comments:</th><td><div>"
3448         cat /tmp/$$.include
3449         print "</div></td></tr>"
3450 fi
3451 print "</table>"
3452 print "</div>"
3453 
3454 #
3455 # Second pass through the files: generate the rest of the index file
3456 #
3457 cat $FLIST | while read LINE
3458 do
3459         set - $LINE
3460         P=$1
3461 
3462         if [[ $# == 2 ]]; then
3463                 PP=$2
3464                 oldname="$PP"




   9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10 # or http://www.opensolaris.org/os/licensing.
  11 # See the License for the specific language governing permissions
  12 # and limitations under the License.
  13 #
  14 # When distributing Covered Code, include this CDDL HEADER in each
  15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16 # If applicable, add the following below this CDDL HEADER, with the
  17 # fields enclosed by brackets "[]" replaced with your own identifying
  18 # information: Portions Copyright [yyyy] [name of copyright owner]
  19 #
  20 # CDDL HEADER END
  21 #
  22 
  23 #
  24 # Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  25 # Copyright 2008, 2010, Richard Lowe
  26 # Copyright 2012 Marcel Telka <marcel@telka.sk>
  27 # Copyright 2014 Bart Coddens <bart.coddens@gmail.com>
  28 # Copyright 2017 Nexenta Systems, Inc.
  29 # Copyright 2019 Joyent, Inc.
  30 # Copyright 2016 RackTop Systems.
  31 #
  32 
  33 #
  34 # This script takes a file list and a workspace and builds a set of html files
  35 # suitable for doing a code review of source changes via a web page.
  36 # Documentation is available via the manual page, webrev.1, or just
  37 # type 'webrev -h'.
  38 #
  39 # Acknowledgements to contributors to webrev are listed in the webrev(1)
  40 # man page.
  41 #
  42 
  43 REMOVED_COLOR=brown
  44 CHANGED_COLOR=blue
  45 NEW_COLOR=blue
  46 
  47 HTML='<?xml version="1.0"?>
  48 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  49     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


1263           <frameset rows="*,60">
1264             <frameset cols="50%,50%">
1265               <frame src="$TNAME.lhs.html" scrolling="auto" name="lhs"></frame>
1266               <frame src="$TNAME.rhs.html" scrolling="auto" name="rhs"></frame>
1267             </frameset>
1268           <frame src="${RTOP}ancnav.html" scrolling="no" marginwidth="0"
1269            marginheight="0" name="nav"></frame>
1270           <noframes>
1271             <body id="SUNWwebrev">
1272               Alas 'frames' webrev requires that your browser supports frames
1273               and has the feature enabled.
1274             </body>
1275           </noframes>
1276           </frameset>
1277         </html>
1278         EOF
1279 }
1280 
1281 
1282 #





























































1283 # input_cmd | insert_anchors | output_cmd
1284 #
1285 # Flag blocks of difference with sequentially numbered invisible
1286 # anchors.  These are used to drive the frames version of the
1287 # sdiffs output.
1288 #
1289 # NOTE: Anchor zero flags the top of the file irrespective of changes,
1290 # an additional anchor is also appended to flag the bottom.
1291 #
1292 # The script detects changed lines as any line that has a "<span
1293 # class=" string embedded (unchanged lines have no class set and are
1294 # not part of a <span>.  Blank lines (without a sequence number)
1295 # are also detected since they flag lines that have been inserted or
1296 # deleted.
1297 #
1298 function insert_anchors
1299 {
1300         $AWK '
1301         function ia() {
1302                 printf "<a name=\"%d\" id=\"anc%d\"></a>", anc, anc++;


2279 
2280         exit 2
2281 }
2282 
2283 #
2284 #
2285 # Main program starts here
2286 #
2287 #
2288 
2289 trap "rm -f /tmp/$$.* ; exit" 0 1 2 3 15
2290 
2291 set +o noclobber
2292 
2293 PATH=$(/bin/dirname "$(whence $0)"):$PATH
2294 
2295 [[ -z $WDIFF ]] && WDIFF=`look_for_prog wdiff`
2296 [[ -z $WX ]] && WX=`look_for_prog wx`
2297 [[ -z $GIT ]] && GIT=`look_for_prog git`
2298 [[ -z $WHICH_SCM ]] && WHICH_SCM=`look_for_prog which_scm`


2299 [[ -z $PERL ]] && PERL=`look_for_prog perl`
2300 [[ -z $RSYNC ]] && RSYNC=`look_for_prog rsync`
2301 [[ -z $SCCS ]] && SCCS=`look_for_prog sccs`
2302 [[ -z $AWK ]] && AWK=`look_for_prog nawk`
2303 [[ -z $AWK ]] && AWK=`look_for_prog gawk`
2304 [[ -z $AWK ]] && AWK=`look_for_prog awk`
2305 [[ -z $SCP ]] && SCP=`look_for_prog scp`
2306 [[ -z $SED ]] && SED=`look_for_prog sed`
2307 [[ -z $SFTP ]] && SFTP=`look_for_prog sftp`
2308 [[ -z $SORT ]] && SORT=`look_for_prog sort`
2309 [[ -z $MKTEMP ]] && MKTEMP=`look_for_prog mktemp`
2310 [[ -z $GREP ]] && GREP=`look_for_prog grep`
2311 [[ -z $FIND ]] && FIND=`look_for_prog find`
2312 [[ -z $MANDOC ]] && MANDOC=`look_for_prog mandoc`
2313 [[ -z $COL ]] && COL=`look_for_prog col`
2314 
2315 # set name of trash directory for remote webrev deletion
2316 TRASH_DIR=".trash"
2317 [[ -n $WEBREV_TRASH_DIR ]] && TRASH_DIR=$WEBREV_TRASH_DIR
2318 
2319 if [[ ! -x $PERL ]]; then
2320         print -u2 "Error: No perl interpreter found.  Exiting."
2321         exit 1
2322 fi
2323 
2324 if [[ ! -x $WHICH_SCM ]]; then
2325         print -u2 "Error: Could not find which_scm.  Exiting."
2326         exit 1
2327 fi
2328 







2329 [[ ! -x $WDIFF ]] && print -u2 "WARNING: wdiff not found."
2330 
2331 # Declare global total counters.
2332 integer TOTL TINS TDEL TMOD TUNC
2333 
2334 # default remote host for upload/delete
2335 typeset -r DEFAULT_REMOTE_HOST="cr.opensolaris.org"
2336 # prefixes for upload targets
2337 typeset -r rsync_prefix="rsync://"
2338 typeset -r ssh_prefix="ssh://"
2339 
2340 cflag=
2341 Cflag=
2342 Dflag=
2343 flist_mode=
2344 flist_file=
2345 hflag=
2346 iflag=
2347 Iflag=
2348 lflag=


2976 
2977 #
2978 # Summarize what we're going to do.
2979 #
2980 print "      Workspace: ${PRETTY_CWS:-$CWS}"
2981 if [[ -n $parent_webrev ]]; then
2982         print "Compare against: webrev at $parent_webrev"
2983 else
2984         print "Compare against: ${PRETTY_PWS:-$PWS}"
2985 fi
2986 
2987 [[ -n $INCLUDE_FILE ]] && print "      Including: $INCLUDE_FILE"
2988 print "      Output to: $WDIR"
2989 
2990 #
2991 # Save the file list in the webrev dir
2992 #
2993 [[ ! $FLIST -ef $WDIR/file.list ]] && cp $FLIST $WDIR/file.list
2994 
2995 rm -f $WDIR/$WNAME.patch


2996 
2997 touch $WDIR/$WNAME.patch
2998 
2999 print "   Output Files:"
3000 
3001 #
3002 # Clean up the file list: Remove comments, blank lines and env variables.
3003 #
3004 $SED -e "s/#.*$//" -e "/=/d" -e "/^[   ]*$/d" $FLIST > /tmp/$$.flist.clean
3005 FLIST=/tmp/$$.flist.clean
3006 
3007 #
3008 # First pass through the files: generate the per-file webrev HTML-files.
3009 #
3010 cat $FLIST | while read LINE
3011 do
3012         set - $LINE
3013         P=$1
3014 
3015         #


3215                         print " man-udiffs\c"
3216                         if [[ -x $WDIFF ]]; then
3217                                 $WDIFF -c "$COMM" -t "$WNAME Wdiff $DIR/$F" \
3218                                     $ofile.man.txt $nfile.man.txt > \
3219                                     $WDIR/$DIR/$F.man.wdiff.html 2>/dev/null
3220                                 if [[ $? -eq 0 ]]; then
3221                                         print " man-wdiffs\c"
3222                                 else
3223                                         print " man-wdiffs[fail]\c"
3224                                 fi
3225                         fi
3226                         sdiff_to_html $ofile.man.txt $nfile.man.txt $F.man $DIR \
3227                             "$COMM" > $WDIR/$DIR/$F.man.sdiff.html
3228                         print " man-sdiffs\c"
3229                         print " man-frames\c"
3230                 fi
3231                 rm -f $ofile.man.txt $nfile.man.txt
3232                 rm -f $WDIR/$DIR/$F.man.cdiff $WDIR/$DIR/$F.man.udiff
3233         fi
3234 

























3235         if [[ -f $ofile ]]; then
3236                 source_to_html Old $PP < $ofile > $WDIR/$DIR/$F-.html
3237                 print " old\c"
3238         fi
3239 
3240         if [[ -f $nfile ]]; then
3241                 source_to_html New $P < $nfile > $WDIR/$DIR/$F.html
3242                 print " new\c"
3243         fi
3244 
3245         cd $OWD
3246 
3247         print
3248 done
3249 
3250 frame_nav_js > $WDIR/ancnav.js
3251 frame_navigation > $WDIR/ancnav.html
3252 










3253 # If we're in OpenSolaris mode and there's a closed dir under $WDIR,
3254 # delete it - prevent accidental publishing of closed source
3255 
3256 if [[ -n "$Oflag" ]]; then
3257         $FIND $WDIR -type d -name closed -exec /bin/rm -rf {} \;
3258 fi
3259 
3260 # Now build the index.html file that contains
3261 # links to the source files and their diffs.
3262 
3263 cd $CWS
3264 
3265 # Save total changed lines for Code Inspection.
3266 print "$TOTL" > $WDIR/TotalChangedLines
3267 
3268 print "     index.html: \c"
3269 INDEXFILE=$WDIR/index.html
3270 exec 3<&1                        # duplicate stdout to FD3.
3271 exec 1<&-                        # Close stdout.
3272 exec > $INDEXFILE            # Open stdout to index file.


3313 PREPDATE=$(LC_ALL=C /usr/bin/date +%Y-%b-%d\ %R\ %z\ %Z)
3314 print "<tr><th>Prepared by:</th><td>$preparer on $PREPDATE</td></tr>"
3315 print "<tr><th>Workspace:</th><td>${PRETTY_CWS:-$CWS}"
3316 print "</td></tr>"
3317 print "<tr><th>Compare against:</th><td>"
3318 if [[ -n $parent_webrev ]]; then
3319         print "webrev at $parent_webrev"
3320 else
3321         print "${PRETTY_PWS:-$PWS}"
3322 fi
3323 print "</td></tr>"
3324 print "<tr><th>Summary of changes:</th><td>"
3325 printCI $TOTL $TINS $TDEL $TMOD $TUNC
3326 print "</td></tr>"
3327 
3328 if [[ -f $WDIR/$WNAME.patch ]]; then
3329         wpatch_url="$(print $WNAME.patch | url_encode)"
3330         print "<tr><th>Patch of changes:</th><td>"
3331         print "<a href=\"$wpatch_url\">$WNAME.patch</a></td></tr>"
3332 fi





3333 
3334 if [[ -n "$iflag" ]]; then
3335         print "<tr><th>Author comments:</th><td><div>"
3336         cat /tmp/$$.include
3337         print "</div></td></tr>"
3338 fi
3339 print "</table>"
3340 print "</div>"
3341 
3342 #
3343 # Second pass through the files: generate the rest of the index file
3344 #
3345 cat $FLIST | while read LINE
3346 do
3347         set - $LINE
3348         P=$1
3349 
3350         if [[ $# == 2 ]]; then
3351                 PP=$2
3352                 oldname="$PP"