1*7c478bd9Sstevel@tonic-gate#!/usr/bin/ksh -p 2*7c478bd9Sstevel@tonic-gate# 3*7c478bd9Sstevel@tonic-gate# CDDL HEADER START 4*7c478bd9Sstevel@tonic-gate# 5*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only 7*7c478bd9Sstevel@tonic-gate# (the "License"). You may not use this file except in compliance 8*7c478bd9Sstevel@tonic-gate# with the License. 9*7c478bd9Sstevel@tonic-gate# 10*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 12*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 13*7c478bd9Sstevel@tonic-gate# and limitations under the License. 14*7c478bd9Sstevel@tonic-gate# 15*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 16*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 18*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 19*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 20*7c478bd9Sstevel@tonic-gate# 21*7c478bd9Sstevel@tonic-gate# CDDL HEADER END 22*7c478bd9Sstevel@tonic-gate# 23*7c478bd9Sstevel@tonic-gate# 24*7c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 25*7c478bd9Sstevel@tonic-gate# 26*7c478bd9Sstevel@tonic-gate# Copyright 2005 Sun Microsystems, Inc. All rights reserved. 27*7c478bd9Sstevel@tonic-gate# Use is subject to license terms. 28*7c478bd9Sstevel@tonic-gate# 29*7c478bd9Sstevel@tonic-gate# This script takes a file list and a workspace 30*7c478bd9Sstevel@tonic-gate# and builds a set of html files suitable for doing 31*7c478bd9Sstevel@tonic-gate# a code review of source changes via a web page. 32*7c478bd9Sstevel@tonic-gate# 33*7c478bd9Sstevel@tonic-gate# Here's how you use it: 34*7c478bd9Sstevel@tonic-gate# 35*7c478bd9Sstevel@tonic-gate# $ webrev file.list 36*7c478bd9Sstevel@tonic-gate# 37*7c478bd9Sstevel@tonic-gate# Alternatively, just run "webrev -l" and it'll extract 38*7c478bd9Sstevel@tonic-gate# a file list from the output of "putback -n" that will 39*7c478bd9Sstevel@tonic-gate# include any files updated, created, or currently sccs 40*7c478bd9Sstevel@tonic-gate# checked out. The script creates a "webrev" directory 41*7c478bd9Sstevel@tonic-gate# in the workspace directory that contains all the generated 42*7c478bd9Sstevel@tonic-gate# html files. It also stashes a copy of the file list in 43*7c478bd9Sstevel@tonic-gate# there. 44*7c478bd9Sstevel@tonic-gate# 45*7c478bd9Sstevel@tonic-gate# 46*7c478bd9Sstevel@tonic-gate# 1) If you run "webrev -l" it'll extract a file list from 47*7c478bd9Sstevel@tonic-gate# the output of "putback -n" that will include any files 48*7c478bd9Sstevel@tonic-gate# updated, created, or currently checked out. This is 49*7c478bd9Sstevel@tonic-gate# the easiest way to use webrev. If you use the "-l" 50*7c478bd9Sstevel@tonic-gate# option to generate the file list then skip to step (4). 51*7c478bd9Sstevel@tonic-gate# Note: if the workspace is large (e.g. all of Solaris usr/src 52*7c478bd9Sstevel@tonic-gate# then this might take a while. You can run "webrev -l -f flp" 53*7c478bd9Sstevel@tonic-gate# to have webrev extract a file list from the output of 54*7c478bd9Sstevel@tonic-gate# "putback -n -f flp". 55*7c478bd9Sstevel@tonic-gate# 56*7c478bd9Sstevel@tonic-gate# The file list created by "webrev -l" is stashed in the 57*7c478bd9Sstevel@tonic-gate# webrev directory as "file.list". 58*7c478bd9Sstevel@tonic-gate# 59*7c478bd9Sstevel@tonic-gate# If you would like more control over the file list then 60*7c478bd9Sstevel@tonic-gate# create a file containing a list of all the files to 61*7c478bd9Sstevel@tonic-gate# be included in your review with paths relative to your 62*7c478bd9Sstevel@tonic-gate# workspace directory, e.g. 63*7c478bd9Sstevel@tonic-gate# 64*7c478bd9Sstevel@tonic-gate# usr/src/uts/common/fs/nfs/nfs_subr.c 65*7c478bd9Sstevel@tonic-gate# usr/src/uts/common/fs/nfs/nfs_export.c 66*7c478bd9Sstevel@tonic-gate# usr/src/cmd/fs.d/nfs/mountd/mountd.c 67*7c478bd9Sstevel@tonic-gate# : 68*7c478bd9Sstevel@tonic-gate# 69*7c478bd9Sstevel@tonic-gate# Include the paths of any files added, deleted, or modified. 70*7c478bd9Sstevel@tonic-gate# You can keep this list of files in the webrev directory 71*7c478bd9Sstevel@tonic-gate# that the script creates in your workspace directory 72*7c478bd9Sstevel@tonic-gate# (CODEMGR_WS). 73*7c478bd9Sstevel@tonic-gate# 74*7c478bd9Sstevel@tonic-gate# 2) The script needs to be able locate your workspace and 75*7c478bd9Sstevel@tonic-gate# its parent. If you have already activated your workspace 76*7c478bd9Sstevel@tonic-gate# with the "ws" command then the script will use the 77*7c478bd9Sstevel@tonic-gate# CODEMGR_WS environment variable. If you are not working 78*7c478bd9Sstevel@tonic-gate# within a workspace activation, then you'll need to set 79*7c478bd9Sstevel@tonic-gate# the environment variable within the file list, e.g. 80*7c478bd9Sstevel@tonic-gate# 81*7c478bd9Sstevel@tonic-gate# CODEMGR_WS=/home/brent/myws 82*7c478bd9Sstevel@tonic-gate# 83*7c478bd9Sstevel@tonic-gate# usr/src/uts/common/fs/nfs/nfs_subr.c 84*7c478bd9Sstevel@tonic-gate# usr/src/uts/common/fs/nfs/nfs_export.c 85*7c478bd9Sstevel@tonic-gate# usr/src/cmd/fs.d/nfs/mountd/mountd.c 86*7c478bd9Sstevel@tonic-gate# : 87*7c478bd9Sstevel@tonic-gate# 88*7c478bd9Sstevel@tonic-gate# If you would like to compare against some other workspace 89*7c478bd9Sstevel@tonic-gate# that is not the parent, then you can set the CODEMGR_PARENT 90*7c478bd9Sstevel@tonic-gate# environment variable in the file list, e.g. 91*7c478bd9Sstevel@tonic-gate# 92*7c478bd9Sstevel@tonic-gate# CODEMGR_WS=/home/brent/myws 93*7c478bd9Sstevel@tonic-gate# CODEMGR_PARENT=/ws/on297-gate 94*7c478bd9Sstevel@tonic-gate# 95*7c478bd9Sstevel@tonic-gate# usr/src/uts/common/fs/nfs/nfs_subr.c 96*7c478bd9Sstevel@tonic-gate# usr/src/uts/common/fs/nfs/nfs_export.c 97*7c478bd9Sstevel@tonic-gate# usr/src/cmd/fs.d/nfs/mountd/mountd.c 98*7c478bd9Sstevel@tonic-gate# : 99*7c478bd9Sstevel@tonic-gate# 100*7c478bd9Sstevel@tonic-gate# 3) Run this script with the name of the file containing 101*7c478bd9Sstevel@tonic-gate# the file list as an argument, e.g. 102*7c478bd9Sstevel@tonic-gate# 103*7c478bd9Sstevel@tonic-gate# $ webrev file.list 104*7c478bd9Sstevel@tonic-gate# 105*7c478bd9Sstevel@tonic-gate# If you supply "-" as the name of the file, then stdin 106*7c478bd9Sstevel@tonic-gate# will be used. 107*7c478bd9Sstevel@tonic-gate# 108*7c478bd9Sstevel@tonic-gate# If you use the "-w" flag, i.e. "webrev -w file.list" 109*7c478bd9Sstevel@tonic-gate# then webrev will assume the file list is in the format 110*7c478bd9Sstevel@tonic-gate# expected by the "wx" package: pathname lines alternating 111*7c478bd9Sstevel@tonic-gate# with SCCS comment lines separated by blank lines, e.g. 112*7c478bd9Sstevel@tonic-gate# 113*7c478bd9Sstevel@tonic-gate# usr/src/uts/common/fs/nfs/nfs_subr.c 114*7c478bd9Sstevel@tonic-gate# 115*7c478bd9Sstevel@tonic-gate# 1206578 Fix spelling error in comment 116*7c478bd9Sstevel@tonic-gate# 117*7c478bd9Sstevel@tonic-gate# usr/src/uts/common/fs/nfs/nfs_export.c 118*7c478bd9Sstevel@tonic-gate# 119*7c478bd9Sstevel@tonic-gate# 4039272 cstyle fixes 120*7c478bd9Sstevel@tonic-gate# 121*7c478bd9Sstevel@tonic-gate# usr/src/cmd/fs.d/nfs/mountd/mountd.c 122*7c478bd9Sstevel@tonic-gate# 123*7c478bd9Sstevel@tonic-gate# 1927634 mountd daemon doesn't handle expletives 124*7c478bd9Sstevel@tonic-gate# 125*7c478bd9Sstevel@tonic-gate# Embedded bug ids (any sequence of 5 or more digits) 126*7c478bd9Sstevel@tonic-gate# will be converted to a URL (see URL environment variable 127*7c478bd9Sstevel@tonic-gate# below). 128*7c478bd9Sstevel@tonic-gate# 129*7c478bd9Sstevel@tonic-gate# 4) For each file in the list, the script will compare it 130*7c478bd9Sstevel@tonic-gate# with the version in the parent workspace (CODEMGR_PARENT) 131*7c478bd9Sstevel@tonic-gate# and generate context and side-by-side diffs (sdiffs) as 132*7c478bd9Sstevel@tonic-gate# HTML files as well as HTML renderings of the old and new 133*7c478bd9Sstevel@tonic-gate# files with prepended line numbers for easy cross-checking 134*7c478bd9Sstevel@tonic-gate# with diffs. 135*7c478bd9Sstevel@tonic-gate# 136*7c478bd9Sstevel@tonic-gate# The HTML files will have additional formatting to 137*7c478bd9Sstevel@tonic-gate# color code the source lines: 138*7c478bd9Sstevel@tonic-gate# 139*7c478bd9Sstevel@tonic-gate# unchanged : black 140*7c478bd9Sstevel@tonic-gate# removed : brown 141*7c478bd9Sstevel@tonic-gate# changed : blue 142*7c478bd9Sstevel@tonic-gate# new : bold blue 143*7c478bd9Sstevel@tonic-gate# 144*7c478bd9Sstevel@tonic-gate# 145*7c478bd9Sstevel@tonic-gate# 5) Webrev will create a directory $CODEMGR_WS/webrev 146*7c478bd9Sstevel@tonic-gate# and create the HTML files in a hierarchy beneath 147*7c478bd9Sstevel@tonic-gate# this directory. Links to these HTML files will be 148*7c478bd9Sstevel@tonic-gate# built into an index.html file in the "webrev" directory. 149*7c478bd9Sstevel@tonic-gate# If you would like the "webrev" directory to appear 150*7c478bd9Sstevel@tonic-gate# somewhere other than $CODEMGR_WS, then set the WDIR 151*7c478bd9Sstevel@tonic-gate# environment variable, e.g. 152*7c478bd9Sstevel@tonic-gate# 153*7c478bd9Sstevel@tonic-gate# WDIR=/tmp webrev -l 154*7c478bd9Sstevel@tonic-gate# 155*7c478bd9Sstevel@tonic-gate# Each file will be listed on a line with a link to 156*7c478bd9Sstevel@tonic-gate# its Cdiffs, Udiffs, Sdiffs, Old, and New versions. A blank 157*7c478bd9Sstevel@tonic-gate# line will be inserted between filenames that do not exist 158*7c478bd9Sstevel@tonic-gate# within the same directory as a grouping aid. 159*7c478bd9Sstevel@tonic-gate# SCCS comments for each delta will be included 160*7c478bd9Sstevel@tonic-gate# automatically. Bug numbers (any sequence of 5 or more 161*7c478bd9Sstevel@tonic-gate# digits) in the comment will be replaced by a URL to 162*7c478bd9Sstevel@tonic-gate# your local bug server. You may need to modify the URL 163*7c478bd9Sstevel@tonic-gate# below: 164*7c478bd9Sstevel@tonic-gate# 165*7c478bd9Sstevel@tonic-gate if [[ -z $WEBREV_BUGURL ]]; then 166*7c478bd9Sstevel@tonic-gate URL='http://monaco.sfbay.sun.com/detail.jsp?cr=' 167*7c478bd9Sstevel@tonic-gate else 168*7c478bd9Sstevel@tonic-gate URL="$WEBREV_BUGURL" 169*7c478bd9Sstevel@tonic-gate fi 170*7c478bd9Sstevel@tonic-gate# 171*7c478bd9Sstevel@tonic-gate# Likewise, ARC cases will be replaced by a URL starting with: 172*7c478bd9Sstevel@tonic-gate# 173*7c478bd9Sstevel@tonic-gate URL2="http://sac.eng.sun.com/" 174*7c478bd9Sstevel@tonic-gate# 175*7c478bd9Sstevel@tonic-gate# As a review aid, you can add value to the index 176*7c478bd9Sstevel@tonic-gate# file by including text that explains the changes in front 177*7c478bd9Sstevel@tonic-gate# of the links for each file. You might also add links 178*7c478bd9Sstevel@tonic-gate# to the one-pager, project plan, or other documents 179*7c478bd9Sstevel@tonic-gate# helpful to the reviewer. 180*7c478bd9Sstevel@tonic-gate# 181*7c478bd9Sstevel@tonic-gate# 6) View the index.html file with your web browser to 182*7c478bd9Sstevel@tonic-gate# verify that its what you want your reviewers to see. 183*7c478bd9Sstevel@tonic-gate# The browser must support HTML tables and colored fonts. 184*7c478bd9Sstevel@tonic-gate# Then send an Email invitation to your reviewers including 185*7c478bd9Sstevel@tonic-gate# the URL to the index.html file in your workspace. If you 186*7c478bd9Sstevel@tonic-gate# use an "http:" URL then you can omit the "index.html" 187*7c478bd9Sstevel@tonic-gate# filename, e.g. 188*7c478bd9Sstevel@tonic-gate# 189*7c478bd9Sstevel@tonic-gate# To: bob, jane, wendy 190*7c478bd9Sstevel@tonic-gate# Subject: Please review fix for bug 1234576 191*7c478bd9Sstevel@tonic-gate# 192*7c478bd9Sstevel@tonic-gate# I'd be grateful if would review my bugfix. 193*7c478bd9Sstevel@tonic-gate# All the relevant information can be obtained 194*7c478bd9Sstevel@tonic-gate# with the following URL: 195*7c478bd9Sstevel@tonic-gate# 196*7c478bd9Sstevel@tonic-gate# http://jurassic.eng/home/brent/myws/webrev 197*7c478bd9Sstevel@tonic-gate# 198*7c478bd9Sstevel@tonic-gate# Thanks 199*7c478bd9Sstevel@tonic-gate# Brent 200*7c478bd9Sstevel@tonic-gate# 201*7c478bd9Sstevel@tonic-gate############### 202*7c478bd9Sstevel@tonic-gate# 203*7c478bd9Sstevel@tonic-gate# Acknowledgements to Rob Thurlow, Mike Eisler, Lin Ling, 204*7c478bd9Sstevel@tonic-gate# Rod Evans, Mike Kupfer, Greg Onufer, Glenn Skinner, 205*7c478bd9Sstevel@tonic-gate# Oleg Larin, David Robinson, Matthew Cross, David L. Paktor, 206*7c478bd9Sstevel@tonic-gate# Neal Gafter, John Beck, Darren Moffat, Norm Shulman, Bill Watson, 207*7c478bd9Sstevel@tonic-gate# Pedro Rubio and Bill Shannon for valuable feedback and insight in 208*7c478bd9Sstevel@tonic-gate# building this script. 209*7c478bd9Sstevel@tonic-gate# 210*7c478bd9Sstevel@tonic-gate# Have fun! 211*7c478bd9Sstevel@tonic-gate# Brent Callaghan 11/28/96 212*7c478bd9Sstevel@tonic-gate############### 213*7c478bd9Sstevel@tonic-gate# 214*7c478bd9Sstevel@tonic-gate# Change Log 215*7c478bd9Sstevel@tonic-gate# 216*7c478bd9Sstevel@tonic-gate# 3/28/97 Add support for specifying stdin as a "-" argument. 217*7c478bd9Sstevel@tonic-gate# 218*7c478bd9Sstevel@tonic-gate# 6/15/97 Fix to allow file overwrite for users who set "noclobber" 219*7c478bd9Sstevel@tonic-gate# 220*7c478bd9Sstevel@tonic-gate# 8/19/97 Fix illegal "&" escape sequences (from Greg Onufer) 221*7c478bd9Sstevel@tonic-gate# 222*7c478bd9Sstevel@tonic-gate# 10/29/97 Create all HTML files under a "webrev" directory 223*7c478bd9Sstevel@tonic-gate# Add -bw flags to "sdiff" 224*7c478bd9Sstevel@tonic-gate# 225*7c478bd9Sstevel@tonic-gate# 3/9/98 Improvements to better handle Java code. 226*7c478bd9Sstevel@tonic-gate# Fix for quoting of code in <pre> blocks. 227*7c478bd9Sstevel@tonic-gate# Fix some color bugs. SCCS fix with not 228*7c478bd9Sstevel@tonic-gate# getting appropriate parent version depending 229*7c478bd9Sstevel@tonic-gate# on whether child version is checked out or 230*7c478bd9Sstevel@tonic-gate# not (from Bill Shannon). 231*7c478bd9Sstevel@tonic-gate# 232*7c478bd9Sstevel@tonic-gate# 3/13/98 Added code from Bill Shannon's "spc" script 233*7c478bd9Sstevel@tonic-gate# To add SCCS comments automatically to index.html. 234*7c478bd9Sstevel@tonic-gate# 235*7c478bd9Sstevel@tonic-gate# 3/18/98 Added -l option to generate file list automatically. 236*7c478bd9Sstevel@tonic-gate# 237*7c478bd9Sstevel@tonic-gate# 4/4/98 Added -w option to support Bonwick's wx package 238*7c478bd9Sstevel@tonic-gate# active file list which can included pending 239*7c478bd9Sstevel@tonic-gate# SCCS comments. 240*7c478bd9Sstevel@tonic-gate# Reorganized layout of index file so that SCCS comments 241*7c478bd9Sstevel@tonic-gate# now come after the file diffs line. This looks much 242*7c478bd9Sstevel@tonic-gate# better. Also, reduced the text point size in diffs 243*7c478bd9Sstevel@tonic-gate# so that more source code can be viewed. 244*7c478bd9Sstevel@tonic-gate# 245*7c478bd9Sstevel@tonic-gate# 3/6/98 Handle files in the root directory of the workspace. 246*7c478bd9Sstevel@tonic-gate# 247*7c478bd9Sstevel@tonic-gate# 10/15/98 Fix minor bugs in sdiff color coding. 248*7c478bd9Sstevel@tonic-gate# Replace long runs of unchanged lines in sdiff 249*7c478bd9Sstevel@tonic-gate# by a horiz rule. 250*7c478bd9Sstevel@tonic-gate# Link bugids in SCCS & wx comments to web page via URL. 251*7c478bd9Sstevel@tonic-gate# Bracket HTML page with <html> ... </html>. 252*7c478bd9Sstevel@tonic-gate# Add HTML comment to index file to help in placing 253*7c478bd9Sstevel@tonic-gate# change comments. 254*7c478bd9Sstevel@tonic-gate# 255*7c478bd9Sstevel@tonic-gate# 10/22/98 Fixed a bug affecting wx comments output. 256*7c478bd9Sstevel@tonic-gate# File names in index file are now bold. 257*7c478bd9Sstevel@tonic-gate# Basename of child workspace is used as the title. 258*7c478bd9Sstevel@tonic-gate# 259*7c478bd9Sstevel@tonic-gate# 12/22/98 Allow user to specify WDIR target directory for 260*7c478bd9Sstevel@tonic-gate# "webrev" directory. 261*7c478bd9Sstevel@tonic-gate# 262*7c478bd9Sstevel@tonic-gate# 2/8/99 Allow file comparison with a parent that is not 263*7c478bd9Sstevel@tonic-gate# a workspace - just a raw directory hierarchy of 264*7c478bd9Sstevel@tonic-gate# files created by a workspace snapshot tool like 265*7c478bd9Sstevel@tonic-gate# freezept (from Matthew Cross). 266*7c478bd9Sstevel@tonic-gate# 267*7c478bd9Sstevel@tonic-gate# 3/18/99 Allow the -l option to extract values for 268*7c478bd9Sstevel@tonic-gate# CODEMGR_WS and for CODEMGR_PARENT if they 269*7c478bd9Sstevel@tonic-gate# are not already defined. Play the file list 270*7c478bd9Sstevel@tonic-gate# out through stdout once it's created 271*7c478bd9Sstevel@tonic-gate# (from David L. Paktor). 272*7c478bd9Sstevel@tonic-gate# 273*7c478bd9Sstevel@tonic-gate# 3/18/99 Correctly handle the case where no changes are found 274*7c478bd9Sstevel@tonic-gate# 275*7c478bd9Sstevel@tonic-gate# 4/7/99 Handle case of relative name for -w filename. 276*7c478bd9Sstevel@tonic-gate# 277*7c478bd9Sstevel@tonic-gate# 8/20/99 Fix handling of file.list 278*7c478bd9Sstevel@tonic-gate# 279*7c478bd9Sstevel@tonic-gate# 10/25/99 Additions or deletions to the beginning of a file 280*7c478bd9Sstevel@tonic-gate# caused the lines to go out of synch. Added new 281*7c478bd9Sstevel@tonic-gate# code to handle this case. Thanks to Glenn Skinner 282*7c478bd9Sstevel@tonic-gate# for reporting the bug. 283*7c478bd9Sstevel@tonic-gate# 284*7c478bd9Sstevel@tonic-gate# 4/21/00 Added date of webrev run to last line of index page 285*7c478bd9Sstevel@tonic-gate# (suggestion by David Robinson) 286*7c478bd9Sstevel@tonic-gate# 287*7c478bd9Sstevel@tonic-gate# 8/2/00 Changed "sort" to "sort -u" to eliminate 288*7c478bd9Sstevel@tonic-gate# duplicates in putback output. Thanks to 289*7c478bd9Sstevel@tonic-gate# Bill Shannon. 290*7c478bd9Sstevel@tonic-gate# 291*7c478bd9Sstevel@tonic-gate# 11/21/00 Added filenames to the HTML page titles. 292*7c478bd9Sstevel@tonic-gate# (suggestion by David Robinson) 293*7c478bd9Sstevel@tonic-gate# 294*7c478bd9Sstevel@tonic-gate# 11/21/00 Fixed a problem with lost sccs comments in a 295*7c478bd9Sstevel@tonic-gate# new file. Also added a default for the -w wxfile 296*7c478bd9Sstevel@tonic-gate# flag. Thanks to Darren Moffat for these. 297*7c478bd9Sstevel@tonic-gate# 298*7c478bd9Sstevel@tonic-gate# 11/22/00 Fix to detect and handle renames correctly. 299*7c478bd9Sstevel@tonic-gate# 300*7c478bd9Sstevel@tonic-gate# 1/17/01 Allow the use of a file list program (flp) to 301*7c478bd9Sstevel@tonic-gate# be specified as an argument to -l. For example: 302*7c478bd9Sstevel@tonic-gate# "webrev -l -f ~/aux.flp". An flp is a program 303*7c478bd9Sstevel@tonic-gate# that generates a file list. Thanks to Norm Shulman. 304*7c478bd9Sstevel@tonic-gate# 305*7c478bd9Sstevel@tonic-gate# 2/1/01 Invoke context diff from CDIFFCMD environment 306*7c478bd9Sstevel@tonic-gate# variable. This allows an alternative diff 307*7c478bd9Sstevel@tonic-gate# command line to be invoked if set in the environment. 308*7c478bd9Sstevel@tonic-gate# Thanks to John Beck (a fan of udiff). 309*7c478bd9Sstevel@tonic-gate# 310*7c478bd9Sstevel@tonic-gate# 2/2/01 Change "sort -k1,1" to "sort -k 1,1" 311*7c478bd9Sstevel@tonic-gate# Bugfix from Neal Gafter 312*7c478bd9Sstevel@tonic-gate# 313*7c478bd9Sstevel@tonic-gate# 4/27/01 Added webrev script date to index page 314*7c478bd9Sstevel@tonic-gate# Suggestion from John Beck 315*7c478bd9Sstevel@tonic-gate# 316*7c478bd9Sstevel@tonic-gate# 4/27/01 Protect HTML sensitive characters in SCCS 317*7c478bd9Sstevel@tonic-gate# delta comments. Bug reported by Pedro Rubio 318*7c478bd9Sstevel@tonic-gate# 319*7c478bd9Sstevel@tonic-gate# 7/24/01 Modify page title to be workspace name - suggestion 320*7c478bd9Sstevel@tonic-gate# from Bill Watson. 321*7c478bd9Sstevel@tonic-gate# 322*7c478bd9Sstevel@tonic-gate# Following variable is set to SCCS delta date 20YY/MM/DD. 323*7c478bd9Sstevel@tonic-gate# Note this will have to be changed in 2100 or when SCCS has support for 324*7c478bd9Sstevel@tonic-gate# 4 digit years; whichever is the sooner! 325*7c478bd9Sstevel@tonic-gate# 326*7c478bd9Sstevel@tonic-gate WEBREV_UPDATED=20%E% 327*7c478bd9Sstevel@tonic-gate# 328*7c478bd9Sstevel@tonic-gate############### 329*7c478bd9Sstevel@tonic-gate 330*7c478bd9Sstevel@tonic-gateREMOVED_COLOR=brown 331*7c478bd9Sstevel@tonic-gateCHANGED_COLOR=blue 332*7c478bd9Sstevel@tonic-gateNEW_COLOR=blue 333*7c478bd9Sstevel@tonic-gate 334*7c478bd9Sstevel@tonic-gate# 335*7c478bd9Sstevel@tonic-gate# Make a piece of source code safe for display in an HTML <pre> block. 336*7c478bd9Sstevel@tonic-gate# 337*7c478bd9Sstevel@tonic-gatehtml_quote() 338*7c478bd9Sstevel@tonic-gate{ 339*7c478bd9Sstevel@tonic-gate sed -e "s/&/\&/g" -e "s/</\</g" -e "s/>/\>/g" "$@" | expand 340*7c478bd9Sstevel@tonic-gate} 341*7c478bd9Sstevel@tonic-gate 342*7c478bd9Sstevel@tonic-gatesdiff_to_html() 343*7c478bd9Sstevel@tonic-gate{ 344*7c478bd9Sstevel@tonic-gate# 345*7c478bd9Sstevel@tonic-gate# This function takes two files as arguments, obtains their diff, 346*7c478bd9Sstevel@tonic-gate# and processes the diff output to present the files as an HTML 347*7c478bd9Sstevel@tonic-gate# document with the files displayed side-by-side, differences 348*7c478bd9Sstevel@tonic-gate# shown in color. 349*7c478bd9Sstevel@tonic-gate# 350*7c478bd9Sstevel@tonic-gate# This HTML generated by this function assumes that the browser 351*7c478bd9Sstevel@tonic-gate# can handle HTML 3.0 tables and colored text as implemented 352*7c478bd9Sstevel@tonic-gate# in Netscape 2.0. The output is "wide" so it will be necessary 353*7c478bd9Sstevel@tonic-gate# to widen the browser window when viewing the output. 354*7c478bd9Sstevel@tonic-gate# 355*7c478bd9Sstevel@tonic-gate# The function takes two files as arguments 356*7c478bd9Sstevel@tonic-gate# and the HTML will be delivered on stdout, e.g. 357*7c478bd9Sstevel@tonic-gate# 358*7c478bd9Sstevel@tonic-gate# $ sdiff_html prog.c- prog.c > prog.diffs.html 359*7c478bd9Sstevel@tonic-gate# 360*7c478bd9Sstevel@tonic-gate# In addition if WEBREV_FRAMES == 'yes' then framed_sdiff() is called 361*7c478bd9Sstevel@tonic-gate# which creates $2.frames.html in the webrev tree. 362*7c478bd9Sstevel@tonic-gate# 363*7c478bd9Sstevel@tonic-gate# FYI: This function is rather unusual in its use of awk. 364*7c478bd9Sstevel@tonic-gate# The initial diff run produces conventional diff output 365*7c478bd9Sstevel@tonic-gate# showing changed lines mixed with editing codes. The 366*7c478bd9Sstevel@tonic-gate# changes lines are ignored - we're interested in the 367*7c478bd9Sstevel@tonic-gate# editing codes, e.g. 368*7c478bd9Sstevel@tonic-gate# 369*7c478bd9Sstevel@tonic-gate# 8c8 370*7c478bd9Sstevel@tonic-gate# 57a61 371*7c478bd9Sstevel@tonic-gate# 63c66,76 372*7c478bd9Sstevel@tonic-gate# 68,93d80 373*7c478bd9Sstevel@tonic-gate# 106d90 374*7c478bd9Sstevel@tonic-gate# 108,110d91 375*7c478bd9Sstevel@tonic-gate# 376*7c478bd9Sstevel@tonic-gate# These editing codes are parsed by the awk script and used to 377*7c478bd9Sstevel@tonic-gate# generate another awk script that generates HTML, e.g the 378*7c478bd9Sstevel@tonic-gate# above lines would turn into something like this: 379*7c478bd9Sstevel@tonic-gate# 380*7c478bd9Sstevel@tonic-gate# BEGIN { printf "<pre>\n" } 381*7c478bd9Sstevel@tonic-gate# function sp(n) {for (i=0;i<n;i++)printf "\n"} 382*7c478bd9Sstevel@tonic-gate# function wl(n) {printf "<FONT COLOR=%s>%3d %s </FONT>\n", n, NR, $0} 383*7c478bd9Sstevel@tonic-gate# NR==8 {wl("#7A7ADD");next} 384*7c478bd9Sstevel@tonic-gate# NR==54 {wl("#7A7ADD");sp(3);next} 385*7c478bd9Sstevel@tonic-gate# NR==56 {wl("#7A7ADD");next} 386*7c478bd9Sstevel@tonic-gate# NR==57 {wl("black");printf "\n"; next} 387*7c478bd9Sstevel@tonic-gate# : : 388*7c478bd9Sstevel@tonic-gate# 389*7c478bd9Sstevel@tonic-gate# This script is then run on the original source file to generate 390*7c478bd9Sstevel@tonic-gate# the HTML that corresponds to the source file. 391*7c478bd9Sstevel@tonic-gate# 392*7c478bd9Sstevel@tonic-gate# The two HTML files are then combined into a single piece of 393*7c478bd9Sstevel@tonic-gate# HTML that uses an HTML table construct to present the files 394*7c478bd9Sstevel@tonic-gate# side by side. You'll notice that the changes are color-coded: 395*7c478bd9Sstevel@tonic-gate# 396*7c478bd9Sstevel@tonic-gate# black - unchanged lines 397*7c478bd9Sstevel@tonic-gate# blue - changed lines 398*7c478bd9Sstevel@tonic-gate# bold blue - new lines 399*7c478bd9Sstevel@tonic-gate# brown - deleted lines 400*7c478bd9Sstevel@tonic-gate# 401*7c478bd9Sstevel@tonic-gate# Blank lines are inserted in each file to keep unchanged 402*7c478bd9Sstevel@tonic-gate# lines in sync (side-by-side). This format is familiar 403*7c478bd9Sstevel@tonic-gate# to users of sdiff(1) or Teamware's filemerge tool. 404*7c478bd9Sstevel@tonic-gate 405*7c478bd9Sstevel@tonic-gatediff -b $1 $2 > /tmp/$$.diffs 406*7c478bd9Sstevel@tonic-gate 407*7c478bd9Sstevel@tonic-gate# 408*7c478bd9Sstevel@tonic-gate# Now we have the diffs, generate the HTML for the old file. 409*7c478bd9Sstevel@tonic-gate# 410*7c478bd9Sstevel@tonic-gate 411*7c478bd9Sstevel@tonic-gateTNAME=$2 412*7c478bd9Sstevel@tonic-gate 413*7c478bd9Sstevel@tonic-gatenawk ' 414*7c478bd9Sstevel@tonic-gateBEGIN { 415*7c478bd9Sstevel@tonic-gate printf "function sp(n) {for (i=0;i<n;i++)printf \"\\n\"}\n" 416*7c478bd9Sstevel@tonic-gate printf "function wl(n) {printf \"<FONT COLOR=%%s>%%3d %%s </FONT>\\n\", n, NR, $0}\n" 417*7c478bd9Sstevel@tonic-gate printf "function bl() {printf \"%%3d %%s\\n\", NR, $0}\n" 418*7c478bd9Sstevel@tonic-gate} 419*7c478bd9Sstevel@tonic-gate/^</ {next} 420*7c478bd9Sstevel@tonic-gate/^>/ {next} 421*7c478bd9Sstevel@tonic-gate/^---/ {next} 422*7c478bd9Sstevel@tonic-gate{ 423*7c478bd9Sstevel@tonic-gate split($1, a, /[cad]/) ; 424*7c478bd9Sstevel@tonic-gate if (index($1, "a")) { 425*7c478bd9Sstevel@tonic-gate if (a[1] == 0) { 426*7c478bd9Sstevel@tonic-gate n = split(a[2], r, /,/); 427*7c478bd9Sstevel@tonic-gate if (n == 1) 428*7c478bd9Sstevel@tonic-gate printf "BEGIN\t\t{sp(1)}\n" 429*7c478bd9Sstevel@tonic-gate else 430*7c478bd9Sstevel@tonic-gate printf "BEGIN\t\t{sp(%d)}\n",\ 431*7c478bd9Sstevel@tonic-gate (r[2] - r[1]) + 1 432*7c478bd9Sstevel@tonic-gate next 433*7c478bd9Sstevel@tonic-gate } 434*7c478bd9Sstevel@tonic-gate 435*7c478bd9Sstevel@tonic-gate printf "NR==%s\t\t{", a[1] 436*7c478bd9Sstevel@tonic-gate n = split(a[2], r, /,/); 437*7c478bd9Sstevel@tonic-gate s = r[1]; 438*7c478bd9Sstevel@tonic-gate if (n == 1) 439*7c478bd9Sstevel@tonic-gate printf "bl();printf \"\\n\"; next}\n" 440*7c478bd9Sstevel@tonic-gate else { 441*7c478bd9Sstevel@tonic-gate n = r[2] - r[1] 442*7c478bd9Sstevel@tonic-gate printf "bl();sp(%d);next}\n",\ 443*7c478bd9Sstevel@tonic-gate (r[2] - r[1]) + 1 444*7c478bd9Sstevel@tonic-gate } 445*7c478bd9Sstevel@tonic-gate next 446*7c478bd9Sstevel@tonic-gate } 447*7c478bd9Sstevel@tonic-gate if (index($1, "d")) { 448*7c478bd9Sstevel@tonic-gate n = split(a[1], r, /,/); 449*7c478bd9Sstevel@tonic-gate n1 = r[1] 450*7c478bd9Sstevel@tonic-gate n2 = r[2] 451*7c478bd9Sstevel@tonic-gate if (n == 1) 452*7c478bd9Sstevel@tonic-gate printf "NR==%s\t\t{wl(\"'$REMOVED_COLOR'\") ; next}\n" , n1 453*7c478bd9Sstevel@tonic-gate else 454*7c478bd9Sstevel@tonic-gate printf "NR==%s,NR==%s\t{wl(\"'$REMOVED_COLOR'\") ; next}\n" , n1, n2 455*7c478bd9Sstevel@tonic-gate next 456*7c478bd9Sstevel@tonic-gate } 457*7c478bd9Sstevel@tonic-gate if (index($1, "c")) { 458*7c478bd9Sstevel@tonic-gate n = split(a[1], r, /,/); 459*7c478bd9Sstevel@tonic-gate n1 = r[1] 460*7c478bd9Sstevel@tonic-gate n2 = r[2] 461*7c478bd9Sstevel@tonic-gate final = n2 462*7c478bd9Sstevel@tonic-gate d1 = 0 463*7c478bd9Sstevel@tonic-gate if (n == 1) 464*7c478bd9Sstevel@tonic-gate printf "NR==%s\t\t{wl(\"'$CHANGED_COLOR'\");" , n1 465*7c478bd9Sstevel@tonic-gate else { 466*7c478bd9Sstevel@tonic-gate d1 = n2 - n1 467*7c478bd9Sstevel@tonic-gate printf "NR==%s,NR==%s\t{wl(\"'$CHANGED_COLOR'\");" , n1, n2 468*7c478bd9Sstevel@tonic-gate } 469*7c478bd9Sstevel@tonic-gate m = split(a[2], r, /,/); 470*7c478bd9Sstevel@tonic-gate n1 = r[1] 471*7c478bd9Sstevel@tonic-gate n2 = r[2] 472*7c478bd9Sstevel@tonic-gate if (m > 1) { 473*7c478bd9Sstevel@tonic-gate d2 = n2 - n1 474*7c478bd9Sstevel@tonic-gate if (d2 > d1) { 475*7c478bd9Sstevel@tonic-gate if (n > 1) printf "if (NR==%d)", final 476*7c478bd9Sstevel@tonic-gate printf "sp(%d);", d2 - d1 477*7c478bd9Sstevel@tonic-gate } 478*7c478bd9Sstevel@tonic-gate } 479*7c478bd9Sstevel@tonic-gate printf "next}\n" ; 480*7c478bd9Sstevel@tonic-gate 481*7c478bd9Sstevel@tonic-gate next 482*7c478bd9Sstevel@tonic-gate } 483*7c478bd9Sstevel@tonic-gate} 484*7c478bd9Sstevel@tonic-gateEND { printf "{printf \"%%3d %%s\\n\", NR, $0 }\n" } 485*7c478bd9Sstevel@tonic-gate' /tmp/$$.diffs > /tmp/$$.file1 486*7c478bd9Sstevel@tonic-gate 487*7c478bd9Sstevel@tonic-gatehtml_quote $1 | nawk -f /tmp/$$.file1 > /tmp/$$.file1.html 488*7c478bd9Sstevel@tonic-gate 489*7c478bd9Sstevel@tonic-gate# 490*7c478bd9Sstevel@tonic-gate# Now generate the HTML for the new file 491*7c478bd9Sstevel@tonic-gate# 492*7c478bd9Sstevel@tonic-gate 493*7c478bd9Sstevel@tonic-gatenawk ' 494*7c478bd9Sstevel@tonic-gateBEGIN { 495*7c478bd9Sstevel@tonic-gate printf "function sp(n) {for (i=0;i<n;i++)printf \"\\n\"}\n" 496*7c478bd9Sstevel@tonic-gate printf "function wl(n) {printf \"<FONT COLOR=%%s>%%3d %%s </FONT>\\n\", n, NR, $0}\n" 497*7c478bd9Sstevel@tonic-gate printf "function wlb(n) {printf \"<FONT COLOR=%%s><b>%%3d %%s</b></FONT>\\n\", n, NR, $0}\n" 498*7c478bd9Sstevel@tonic-gate printf "function bl() {printf \"%%3d %%s\\n\", NR, $0}\n" 499*7c478bd9Sstevel@tonic-gate} 500*7c478bd9Sstevel@tonic-gate/^</ {next} 501*7c478bd9Sstevel@tonic-gate/^>/ {next} 502*7c478bd9Sstevel@tonic-gate/^---/ {next} 503*7c478bd9Sstevel@tonic-gate{ 504*7c478bd9Sstevel@tonic-gate split($1, a, /[cad]/) ; 505*7c478bd9Sstevel@tonic-gate if (index($1, "d")) { 506*7c478bd9Sstevel@tonic-gate if (a[2] == 0) { 507*7c478bd9Sstevel@tonic-gate n = split(a[1], r, /,/); 508*7c478bd9Sstevel@tonic-gate if (n == 1) 509*7c478bd9Sstevel@tonic-gate printf "BEGIN\t\t{sp(1)}\n" 510*7c478bd9Sstevel@tonic-gate else 511*7c478bd9Sstevel@tonic-gate printf "BEGIN\t\t{sp(%d)}\n",\ 512*7c478bd9Sstevel@tonic-gate (r[2] - r[1]) + 1 513*7c478bd9Sstevel@tonic-gate next 514*7c478bd9Sstevel@tonic-gate } 515*7c478bd9Sstevel@tonic-gate 516*7c478bd9Sstevel@tonic-gate printf "NR==%s\t\t{", a[2] 517*7c478bd9Sstevel@tonic-gate n = split(a[1], r, /,/); 518*7c478bd9Sstevel@tonic-gate s = r[1]; 519*7c478bd9Sstevel@tonic-gate if (n == 1) 520*7c478bd9Sstevel@tonic-gate printf "bl();printf \"\\n\"; next}\n" 521*7c478bd9Sstevel@tonic-gate else { 522*7c478bd9Sstevel@tonic-gate n = r[2] - r[1] 523*7c478bd9Sstevel@tonic-gate printf "bl();sp(%d);next}\n",\ 524*7c478bd9Sstevel@tonic-gate (r[2] - r[1]) + 1 525*7c478bd9Sstevel@tonic-gate } 526*7c478bd9Sstevel@tonic-gate next 527*7c478bd9Sstevel@tonic-gate } 528*7c478bd9Sstevel@tonic-gate if (index($1, "a")) { 529*7c478bd9Sstevel@tonic-gate n = split(a[2], r, /,/); 530*7c478bd9Sstevel@tonic-gate n1 = r[1] 531*7c478bd9Sstevel@tonic-gate n2 = r[2] 532*7c478bd9Sstevel@tonic-gate if (n == 1) 533*7c478bd9Sstevel@tonic-gate printf "NR==%s\t\t{wlb(\"'$NEW_COLOR'\") ; next}\n" , n1 534*7c478bd9Sstevel@tonic-gate else 535*7c478bd9Sstevel@tonic-gate printf "NR==%s,NR==%s\t{wlb(\"'$NEW_COLOR'\") ; next}\n" , n1, n2 536*7c478bd9Sstevel@tonic-gate next 537*7c478bd9Sstevel@tonic-gate } 538*7c478bd9Sstevel@tonic-gate if (index($1, "c")) { 539*7c478bd9Sstevel@tonic-gate n = split(a[2], r, /,/); 540*7c478bd9Sstevel@tonic-gate n1 = r[1] 541*7c478bd9Sstevel@tonic-gate n2 = r[2] 542*7c478bd9Sstevel@tonic-gate final = n2 543*7c478bd9Sstevel@tonic-gate d2 = 0; 544*7c478bd9Sstevel@tonic-gate if (n == 1) { 545*7c478bd9Sstevel@tonic-gate final = n1 546*7c478bd9Sstevel@tonic-gate printf "NR==%s\t\t{wl(\"'$CHANGED_COLOR'\");" , n1 547*7c478bd9Sstevel@tonic-gate } else { 548*7c478bd9Sstevel@tonic-gate d2 = n2 - n1 549*7c478bd9Sstevel@tonic-gate printf "NR==%s,NR==%s\t{wl(\"'$CHANGED_COLOR'\");" , n1, n2 550*7c478bd9Sstevel@tonic-gate } 551*7c478bd9Sstevel@tonic-gate m = split(a[1], r, /,/); 552*7c478bd9Sstevel@tonic-gate n1 = r[1] 553*7c478bd9Sstevel@tonic-gate n2 = r[2] 554*7c478bd9Sstevel@tonic-gate if (m > 1) { 555*7c478bd9Sstevel@tonic-gate d1 = n2 - n1 556*7c478bd9Sstevel@tonic-gate if (d1 > d2) { 557*7c478bd9Sstevel@tonic-gate if (n > 1) printf "if (NR==%d)", final 558*7c478bd9Sstevel@tonic-gate printf "sp(%d);", d1 - d2 559*7c478bd9Sstevel@tonic-gate } 560*7c478bd9Sstevel@tonic-gate } 561*7c478bd9Sstevel@tonic-gate printf "next}\n" ; 562*7c478bd9Sstevel@tonic-gate next 563*7c478bd9Sstevel@tonic-gate } 564*7c478bd9Sstevel@tonic-gate} 565*7c478bd9Sstevel@tonic-gateEND { printf "{printf \"%%3d %%s\\n\", NR, $0 }\n" } 566*7c478bd9Sstevel@tonic-gate' /tmp/$$.diffs > /tmp/$$.file2 567*7c478bd9Sstevel@tonic-gate 568*7c478bd9Sstevel@tonic-gatehtml_quote $2 | nawk -f /tmp/$$.file2 > /tmp/$$.file2.html 569*7c478bd9Sstevel@tonic-gate 570*7c478bd9Sstevel@tonic-gate# Now combine into a table 571*7c478bd9Sstevel@tonic-gate 572*7c478bd9Sstevel@tonic-gateecho "<body bgcolor=#EEEEEE>" 573*7c478bd9Sstevel@tonic-gateecho "<title> Sdiff $TNAME </title>" 574*7c478bd9Sstevel@tonic-gateecho "<table><tr valign=top>" 575*7c478bd9Sstevel@tonic-gateecho "<td><pre>" 576*7c478bd9Sstevel@tonic-gate 577*7c478bd9Sstevel@tonic-gatestrip_unchanged /tmp/$$.file1.html 578*7c478bd9Sstevel@tonic-gate 579*7c478bd9Sstevel@tonic-gateecho "</pre></td><td><pre>" 580*7c478bd9Sstevel@tonic-gate 581*7c478bd9Sstevel@tonic-gatestrip_unchanged /tmp/$$.file2.html 582*7c478bd9Sstevel@tonic-gate 583*7c478bd9Sstevel@tonic-gateecho "</pre></td>" 584*7c478bd9Sstevel@tonic-gateecho "</tr></table>" 585*7c478bd9Sstevel@tonic-gate 586*7c478bd9Sstevel@tonic-gateif [[ $WEBREV_FRAMES == 'yes' ]]; then 587*7c478bd9Sstevel@tonic-gate framed_sdiff $TNAME /tmp/$$.file1.html /tmp/$$.file2.html 588*7c478bd9Sstevel@tonic-gatefi 589*7c478bd9Sstevel@tonic-gate 590*7c478bd9Sstevel@tonic-gate} 591*7c478bd9Sstevel@tonic-gate 592*7c478bd9Sstevel@tonic-gate#################################### 593*7c478bd9Sstevel@tonic-gate 594*7c478bd9Sstevel@tonic-gatefunction framed_sdiff 595*7c478bd9Sstevel@tonic-gate{ 596*7c478bd9Sstevel@tonic-gate# Expects html files created by sdiff_to_html which it then augments 597*7c478bd9Sstevel@tonic-gate# with HTML navigation anchors. 598*7c478bd9Sstevel@tonic-gate# 599*7c478bd9Sstevel@tonic-gate# NOTE: We rely on standard usage of $TNAME and $WDIR/$DIR. 600*7c478bd9Sstevel@tonic-gate# 601*7c478bd9Sstevel@tonic-gate typeset TNAME=$1 602*7c478bd9Sstevel@tonic-gate typeset file1=$2 603*7c478bd9Sstevel@tonic-gate typeset file2=$3 604*7c478bd9Sstevel@tonic-gate typeset RTOP 605*7c478bd9Sstevel@tonic-gate # Make the rhs/lhs files and output the frameset file. 606*7c478bd9Sstevel@tonic-gate insert_anchors $file1 > $WDIR/$DIR/$TNAME.lhs.html 607*7c478bd9Sstevel@tonic-gate insert_anchors $file2 > $WDIR/$DIR/$TNAME.rhs.html 608*7c478bd9Sstevel@tonic-gate # Enable html files to access WDIR via a relative path. 609*7c478bd9Sstevel@tonic-gate RTOP=$(relative_cws) 610*7c478bd9Sstevel@tonic-gate cat > $WDIR/$DIR/$TNAME.frames.html <<-EOF 611*7c478bd9Sstevel@tonic-gate <html><head> 612*7c478bd9Sstevel@tonic-gate <title>Framed Sdiff for $TNAME</title> 613*7c478bd9Sstevel@tonic-gate </head> 614*7c478bd9Sstevel@tonic-gate <FRAMESET ROWS="*,50"> 615*7c478bd9Sstevel@tonic-gate <FRAMESET COLS="50%,50%"> 616*7c478bd9Sstevel@tonic-gate <FRAME SRC="$TNAME.lhs.html" SCROLLING="auto" NAME="lhs"> 617*7c478bd9Sstevel@tonic-gate <FRAME SRC="$TNAME.rhs.html" SCROLLING="auto" NAME="rhs"> 618*7c478bd9Sstevel@tonic-gate </FRAMESET> 619*7c478bd9Sstevel@tonic-gate <FRAME SRC="${RTOP}ancnav.html" SCROLLING="no" MARGINWIDTH="0" 620*7c478bd9Sstevel@tonic-gate MARGINHEIGHT="0"> 621*7c478bd9Sstevel@tonic-gate <NOFRAMES> 622*7c478bd9Sstevel@tonic-gate <P>Alas FRAMES webrev requires that your browser supports FRAMES 623*7c478bd9Sstevel@tonic-gate and has the feature enabled. 624*7c478bd9Sstevel@tonic-gate <a href="index.html">Return to webrev index</a>.</p> 625*7c478bd9Sstevel@tonic-gate </NOFRAMES> 626*7c478bd9Sstevel@tonic-gate </FRAMESET> 627*7c478bd9Sstevel@tonic-gate </html> 628*7c478bd9Sstevel@tonic-gate EOF 629*7c478bd9Sstevel@tonic-gate} 630*7c478bd9Sstevel@tonic-gate 631*7c478bd9Sstevel@tonic-gate#################################### 632*7c478bd9Sstevel@tonic-gate 633*7c478bd9Sstevel@tonic-gatestrip_unchanged() 634*7c478bd9Sstevel@tonic-gate{ 635*7c478bd9Sstevel@tonic-gate# Removes chunks of sdiff documents that have not 636*7c478bd9Sstevel@tonic-gate# changed. This makes it easier for a code reviewer 637*7c478bd9Sstevel@tonic-gate# to find the bits that have changed. 638*7c478bd9Sstevel@tonic-gate# 639*7c478bd9Sstevel@tonic-gate# Deleted lines of text are replaced by an 640*7c478bd9Sstevel@tonic-gate# horizontal rule. Some identical lines are 641*7c478bd9Sstevel@tonic-gate# retained before and after the changed lines 642*7c478bd9Sstevel@tonic-gate# to provide some context. The number of these 643*7c478bd9Sstevel@tonic-gate# lines is controlled by the variable C in the 644*7c478bd9Sstevel@tonic-gate# nawk script below. 645*7c478bd9Sstevel@tonic-gate# 646*7c478bd9Sstevel@tonic-gate# The script detects changed lines as any line 647*7c478bd9Sstevel@tonic-gate# that has a "FONT COLOR=" string embedded (unchanged 648*7c478bd9Sstevel@tonic-gate# lines use the default color and have no FONT directive). 649*7c478bd9Sstevel@tonic-gate# Blank lines (without a sequence number) are also detected 650*7c478bd9Sstevel@tonic-gate# since they flag lines that have been inserted or deleted. 651*7c478bd9Sstevel@tonic-gate 652*7c478bd9Sstevel@tonic-gatenawk ' 653*7c478bd9Sstevel@tonic-gate 654*7c478bd9Sstevel@tonic-gateBEGIN { C = c = 20 } 655*7c478bd9Sstevel@tonic-gateNF == 0 || /FONT COLOR=/ { 656*7c478bd9Sstevel@tonic-gate if (c > C) { 657*7c478bd9Sstevel@tonic-gate c -= C 658*7c478bd9Sstevel@tonic-gate inx = 0 659*7c478bd9Sstevel@tonic-gate if (c > C) { 660*7c478bd9Sstevel@tonic-gate print "\n<hr>" 661*7c478bd9Sstevel@tonic-gate inx = c % C 662*7c478bd9Sstevel@tonic-gate c = C 663*7c478bd9Sstevel@tonic-gate } 664*7c478bd9Sstevel@tonic-gate 665*7c478bd9Sstevel@tonic-gate for (i = 0; i < c; i++) 666*7c478bd9Sstevel@tonic-gate print ln[(inx + i) % C] 667*7c478bd9Sstevel@tonic-gate } 668*7c478bd9Sstevel@tonic-gate c = 0; 669*7c478bd9Sstevel@tonic-gate print 670*7c478bd9Sstevel@tonic-gate next 671*7c478bd9Sstevel@tonic-gate} 672*7c478bd9Sstevel@tonic-gate{ if (c >= C) { 673*7c478bd9Sstevel@tonic-gate ln[c % C] = $0 674*7c478bd9Sstevel@tonic-gate c++; 675*7c478bd9Sstevel@tonic-gate next; 676*7c478bd9Sstevel@tonic-gate } 677*7c478bd9Sstevel@tonic-gate c++; 678*7c478bd9Sstevel@tonic-gate print 679*7c478bd9Sstevel@tonic-gate} 680*7c478bd9Sstevel@tonic-gateEND { if (c > (C * 2)) print "\n<hr>" } 681*7c478bd9Sstevel@tonic-gate 682*7c478bd9Sstevel@tonic-gate' $1 683*7c478bd9Sstevel@tonic-gate} 684*7c478bd9Sstevel@tonic-gate#################################### 685*7c478bd9Sstevel@tonic-gate 686*7c478bd9Sstevel@tonic-gatefunction insert_anchors 687*7c478bd9Sstevel@tonic-gate{ 688*7c478bd9Sstevel@tonic-gate# Flag blocks of difference with sequentially numbered invisible 689*7c478bd9Sstevel@tonic-gate# anchors. These are used to drive the WEBREV_FRAMES version of the 690*7c478bd9Sstevel@tonic-gate# sdiffs output. 691*7c478bd9Sstevel@tonic-gate# 692*7c478bd9Sstevel@tonic-gate# NOTE: Anchor zero flags the top of the file irrespective of changes, 693*7c478bd9Sstevel@tonic-gate# an additional anchor is also appended to flag the bottom. 694*7c478bd9Sstevel@tonic-gate# 695*7c478bd9Sstevel@tonic-gate# The script detects changed lines as any line that has a "<FONT 696*7c478bd9Sstevel@tonic-gate# COLOR=" string embedded (unchanged lines use the default color and 697*7c478bd9Sstevel@tonic-gate# have no FONT directive). Blank lines (without a sequence number) 698*7c478bd9Sstevel@tonic-gate# are also detected since they flag lines that have been inserted or 699*7c478bd9Sstevel@tonic-gate# deleted. 700*7c478bd9Sstevel@tonic-gate# 701*7c478bd9Sstevel@tonic-gate# In addition, here is a good place to top and tail the document for 702*7c478bd9Sstevel@tonic-gate# use in its parent frame. We add a lot of blank lines to tackily 703*7c478bd9Sstevel@tonic-gate# assist the last anchors to have an effect on the screen. 704*7c478bd9Sstevel@tonic-gate 705*7c478bd9Sstevel@tonic-gateprint '<html>\n<body bgcolor="#EEEEEE">\n<pre>' 706*7c478bd9Sstevel@tonic-gate 707*7c478bd9Sstevel@tonic-gatenawk ' 708*7c478bd9Sstevel@tonic-gatefunction ia() { 709*7c478bd9Sstevel@tonic-gate printf "<A NAME=\"%d\"></A>", anc++; 710*7c478bd9Sstevel@tonic-gate} 711*7c478bd9Sstevel@tonic-gateBEGIN { 712*7c478bd9Sstevel@tonic-gate anc=0; 713*7c478bd9Sstevel@tonic-gate inblock=1; 714*7c478bd9Sstevel@tonic-gate ia(); 715*7c478bd9Sstevel@tonic-gate} 716*7c478bd9Sstevel@tonic-gateNF == 0 || /^<FONT COLOR=/ { 717*7c478bd9Sstevel@tonic-gate if (inblock == 0) { 718*7c478bd9Sstevel@tonic-gate ia(); 719*7c478bd9Sstevel@tonic-gate inblock=1; 720*7c478bd9Sstevel@tonic-gate } 721*7c478bd9Sstevel@tonic-gate print; 722*7c478bd9Sstevel@tonic-gate next; 723*7c478bd9Sstevel@tonic-gate} 724*7c478bd9Sstevel@tonic-gate{ 725*7c478bd9Sstevel@tonic-gate inblock=0; 726*7c478bd9Sstevel@tonic-gate print; 727*7c478bd9Sstevel@tonic-gate} 728*7c478bd9Sstevel@tonic-gateEND { 729*7c478bd9Sstevel@tonic-gate ia(); 730*7c478bd9Sstevel@tonic-gate print "<center><font color=\"red\"><b>--- EOF ---</b></font></center>"; 731*7c478bd9Sstevel@tonic-gate for(i=0;i<8;i++) printf "\n\n\n\n\n\n\n\n\n\n"; 732*7c478bd9Sstevel@tonic-gate} 733*7c478bd9Sstevel@tonic-gate' $1 734*7c478bd9Sstevel@tonic-gate 735*7c478bd9Sstevel@tonic-gateprint '</pre>\n</html>' 736*7c478bd9Sstevel@tonic-gate} 737*7c478bd9Sstevel@tonic-gate 738*7c478bd9Sstevel@tonic-gate#################################### 739*7c478bd9Sstevel@tonic-gate 740*7c478bd9Sstevel@tonic-gatefunction relative_cws 741*7c478bd9Sstevel@tonic-gate{ 742*7c478bd9Sstevel@tonic-gate# 743*7c478bd9Sstevel@tonic-gate# Print a relative return path from PWD to CWS. for example if 744*7c478bd9Sstevel@tonic-gate# PWD=/ws/onnv-gate/usr/src/tools/scripts and CWS=/ws/onnv-gate this 745*7c478bd9Sstevel@tonic-gate# function would print "../../../../". 746*7c478bd9Sstevel@tonic-gate# 747*7c478bd9Sstevel@tonic-gate# In the event that CWS is not in PWD a warning is printed to stderr, 748*7c478bd9Sstevel@tonic-gate# WDIR is returned and thus the resulting webrev is not relocatable. 749*7c478bd9Sstevel@tonic-gate# 750*7c478bd9Sstevel@tonic-gate typeset cur="${PWD##$CWS(/)}" ret 751*7c478bd9Sstevel@tonic-gate if [[ $PWD == $cur ]]; then # Should never happen. 752*7c478bd9Sstevel@tonic-gate print -u2 "\nWarning: relative_cws: \"$PWD\" not relative to \"$CWS\"." 753*7c478bd9Sstevel@tonic-gate print -u2 "Check input paths. Framed webrev will not be relocatable!" 754*7c478bd9Sstevel@tonic-gate print $WDIR 755*7c478bd9Sstevel@tonic-gate else 756*7c478bd9Sstevel@tonic-gate while [[ -n ${cur} ]] 757*7c478bd9Sstevel@tonic-gate do 758*7c478bd9Sstevel@tonic-gate cur=${cur%%*(/)*([!/])} 759*7c478bd9Sstevel@tonic-gate ret="../$ret" 760*7c478bd9Sstevel@tonic-gate done 761*7c478bd9Sstevel@tonic-gate print $ret 762*7c478bd9Sstevel@tonic-gate fi 763*7c478bd9Sstevel@tonic-gate} 764*7c478bd9Sstevel@tonic-gate 765*7c478bd9Sstevel@tonic-gate#################################### 766*7c478bd9Sstevel@tonic-gate 767*7c478bd9Sstevel@tonic-gatefunction frame_navigation 768*7c478bd9Sstevel@tonic-gate{ 769*7c478bd9Sstevel@tonic-gate# Output anchor navigation file for framed sdiffs. 770*7c478bd9Sstevel@tonic-gatecat << \EOF 771*7c478bd9Sstevel@tonic-gate<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 772*7c478bd9Sstevel@tonic-gate<html><head><title>Anchor Navigation</title> 773*7c478bd9Sstevel@tonic-gate<meta http-equiv="Content-Script-Type" content="text/javascript"> 774*7c478bd9Sstevel@tonic-gate<meta http-equiv="Content-Type" content="text/html"> 775*7c478bd9Sstevel@tonic-gate <style> 776*7c478bd9Sstevel@tonic-gate div.button td { background: #900;} 777*7c478bd9Sstevel@tonic-gate div.button a { color: white } 778*7c478bd9Sstevel@tonic-gate div.button a:hover { background: black; color: white } 779*7c478bd9Sstevel@tonic-gate </style> 780*7c478bd9Sstevel@tonic-gate <script language="JavaScript"> 781*7c478bd9Sstevel@tonic-gate<!-- 782*7c478bd9Sstevel@tonic-gatevar anc=0; 783*7c478bd9Sstevel@tonic-gatevar myInt; 784*7c478bd9Sstevel@tonic-gatevar scrolling=0; 785*7c478bd9Sstevel@tonic-gatevar sfactor; 786*7c478bd9Sstevel@tonic-gatevar scount=10; 787*7c478bd9Sstevel@tonic-gate 788*7c478bd9Sstevel@tonic-gatefunction scrollByPix() { 789*7c478bd9Sstevel@tonic-gate if (scount<=0) { 790*7c478bd9Sstevel@tonic-gate sfactor*=1.2; 791*7c478bd9Sstevel@tonic-gate scount=10; 792*7c478bd9Sstevel@tonic-gate } 793*7c478bd9Sstevel@tonic-gate parent.lhs.scrollBy(0,sfactor); 794*7c478bd9Sstevel@tonic-gate parent.rhs.scrollBy(0,sfactor); 795*7c478bd9Sstevel@tonic-gate scount--; 796*7c478bd9Sstevel@tonic-gate} 797*7c478bd9Sstevel@tonic-gate 798*7c478bd9Sstevel@tonic-gatefunction scrollByAnc(num) { 799*7c478bd9Sstevel@tonic-gate if (num < 0) { 800*7c478bd9Sstevel@tonic-gate anc=0; 801*7c478bd9Sstevel@tonic-gate num=0; 802*7c478bd9Sstevel@tonic-gate } 803*7c478bd9Sstevel@tonic-gate if (num >= parent.lhs.document.anchors.length) { 804*7c478bd9Sstevel@tonic-gate anc=parent.lhs.document.anchors.length - 1; 805*7c478bd9Sstevel@tonic-gate num=anc; 806*7c478bd9Sstevel@tonic-gate } 807*7c478bd9Sstevel@tonic-gate parent.lhs.location.replace(parent.lhs.location.pathname + "#" + num); 808*7c478bd9Sstevel@tonic-gate parent.rhs.location.replace(parent.rhs.location.pathname + "#" + num); 809*7c478bd9Sstevel@tonic-gate anc=num; 810*7c478bd9Sstevel@tonic-gate if (num <= 0) { 811*7c478bd9Sstevel@tonic-gate document.diff.sync.value="BOF"; 812*7c478bd9Sstevel@tonic-gate } else if (num < parent.lhs.document.anchors.length - 1) { 813*7c478bd9Sstevel@tonic-gate document.diff.sync.value=num; 814*7c478bd9Sstevel@tonic-gate } else { 815*7c478bd9Sstevel@tonic-gate document.diff.sync.value="EOF"; 816*7c478bd9Sstevel@tonic-gate } 817*7c478bd9Sstevel@tonic-gate // Scroll back a little to expose previous lines. 818*7c478bd9Sstevel@tonic-gate parent.lhs.scrollBy(0,-30); 819*7c478bd9Sstevel@tonic-gate parent.rhs.scrollBy(0,-30); 820*7c478bd9Sstevel@tonic-gate} 821*7c478bd9Sstevel@tonic-gate 822*7c478bd9Sstevel@tonic-gatefunction stopScroll() { 823*7c478bd9Sstevel@tonic-gate if (scrolling==1) { 824*7c478bd9Sstevel@tonic-gate clearInterval(myInt); 825*7c478bd9Sstevel@tonic-gate scrolling=0; 826*7c478bd9Sstevel@tonic-gate } 827*7c478bd9Sstevel@tonic-gate} 828*7c478bd9Sstevel@tonic-gate 829*7c478bd9Sstevel@tonic-gatefunction startScroll() { 830*7c478bd9Sstevel@tonic-gate stopScroll(); 831*7c478bd9Sstevel@tonic-gate scrolling=1; 832*7c478bd9Sstevel@tonic-gate myInt=setInterval("scrollByPix()",10); 833*7c478bd9Sstevel@tonic-gate} 834*7c478bd9Sstevel@tonic-gate 835*7c478bd9Sstevel@tonic-gatefunction handlePress(b) { 836*7c478bd9Sstevel@tonic-gate switch (b) { 837*7c478bd9Sstevel@tonic-gate case 1 : 838*7c478bd9Sstevel@tonic-gate scrollByAnc(-1); 839*7c478bd9Sstevel@tonic-gate break; 840*7c478bd9Sstevel@tonic-gate case 2 : 841*7c478bd9Sstevel@tonic-gate scrollByAnc(anc-1); 842*7c478bd9Sstevel@tonic-gate break; 843*7c478bd9Sstevel@tonic-gate case 3 : 844*7c478bd9Sstevel@tonic-gate sfactor=-3; 845*7c478bd9Sstevel@tonic-gate startScroll(); 846*7c478bd9Sstevel@tonic-gate break; 847*7c478bd9Sstevel@tonic-gate case 4 : 848*7c478bd9Sstevel@tonic-gate sfactor=3; 849*7c478bd9Sstevel@tonic-gate startScroll(); 850*7c478bd9Sstevel@tonic-gate break; 851*7c478bd9Sstevel@tonic-gate case 5 : 852*7c478bd9Sstevel@tonic-gate scrollByAnc(anc+1); 853*7c478bd9Sstevel@tonic-gate break; 854*7c478bd9Sstevel@tonic-gate case 6 : 855*7c478bd9Sstevel@tonic-gate scrollByAnc(parent.lhs.document.anchors.length); 856*7c478bd9Sstevel@tonic-gate break; 857*7c478bd9Sstevel@tonic-gate } 858*7c478bd9Sstevel@tonic-gate} 859*7c478bd9Sstevel@tonic-gate 860*7c478bd9Sstevel@tonic-gatefunction handleRelease(b) { 861*7c478bd9Sstevel@tonic-gate stopScroll(); 862*7c478bd9Sstevel@tonic-gate} 863*7c478bd9Sstevel@tonic-gate 864*7c478bd9Sstevel@tonic-gatefunction ValidateDiffNum(){ 865*7c478bd9Sstevel@tonic-gate i=Number(document.diff.sync.value); 866*7c478bd9Sstevel@tonic-gate if (isNaN(i)) { 867*7c478bd9Sstevel@tonic-gate document.diff.sync.value=anc; 868*7c478bd9Sstevel@tonic-gate } else { 869*7c478bd9Sstevel@tonic-gate scrollByAnc(i); 870*7c478bd9Sstevel@tonic-gate } 871*7c478bd9Sstevel@tonic-gate return false; 872*7c478bd9Sstevel@tonic-gate} 873*7c478bd9Sstevel@tonic-gate 874*7c478bd9Sstevel@tonic-gate//--> 875*7c478bd9Sstevel@tonic-gate </script> 876*7c478bd9Sstevel@tonic-gate </head> 877*7c478bd9Sstevel@tonic-gate <body> 878*7c478bd9Sstevel@tonic-gate <noscript lang="javascript"> 879*7c478bd9Sstevel@tonic-gate <center> 880*7c478bd9Sstevel@tonic-gate <p><big>Framed Navigation controls require Javascript</big><br> 881*7c478bd9Sstevel@tonic-gate Either this browser is incompatable or javascript is not enabled</p> 882*7c478bd9Sstevel@tonic-gate </center> 883*7c478bd9Sstevel@tonic-gate </noscript> 884*7c478bd9Sstevel@tonic-gate <table width="100%" border="0" align="center"> 885*7c478bd9Sstevel@tonic-gate <tr><th valign="middle" width="25%"><i>Diff navigation:</i></th> 886*7c478bd9Sstevel@tonic-gate <td align="centre" valign="top" width="50%"> 887*7c478bd9Sstevel@tonic-gate <div class="button"> 888*7c478bd9Sstevel@tonic-gate <table border="0" cellpadding="2" align="center"><tr> 889*7c478bd9Sstevel@tonic-gate <td align="center" valign="left"> 890*7c478bd9Sstevel@tonic-gate <a onMouseDown="handlePress(1);return true;" 891*7c478bd9Sstevel@tonic-gate onMouseUp="handleRelease(1);return true;" 892*7c478bd9Sstevel@tonic-gate onMouseOut="handleRelease(1);return true;" 893*7c478bd9Sstevel@tonic-gate onClick="return false;" 894*7c478bd9Sstevel@tonic-gate title="Go to Beginning Of file">BOF</a></td> 895*7c478bd9Sstevel@tonic-gate <td align="center" valign="middle"> 896*7c478bd9Sstevel@tonic-gate <a onMouseDown="handlePress(3);return true;" 897*7c478bd9Sstevel@tonic-gate onMouseUp="handleRelease(3);return true;" 898*7c478bd9Sstevel@tonic-gate onMouseOut="handleRelease(3);return true;" 899*7c478bd9Sstevel@tonic-gate title="Scroll Up: Press and Hold to accelerate" 900*7c478bd9Sstevel@tonic-gate onClick="return false;">Scroll frames Up</a></td> 901*7c478bd9Sstevel@tonic-gate <td align="center" valign="right"> 902*7c478bd9Sstevel@tonic-gate <a onMouseDown="handlePress(2);return true;" 903*7c478bd9Sstevel@tonic-gate onMouseUp="handleRelease(2);return true;" 904*7c478bd9Sstevel@tonic-gate onMouseOut="handleRelease(2);return true;" 905*7c478bd9Sstevel@tonic-gate title="Go to previous Diff" 906*7c478bd9Sstevel@tonic-gate onClick="return false;">Prev Diff</a> 907*7c478bd9Sstevel@tonic-gate </td></tr> 908*7c478bd9Sstevel@tonic-gate <tr> 909*7c478bd9Sstevel@tonic-gate <td align="center" valign="left"> 910*7c478bd9Sstevel@tonic-gate <a onMouseDown="handlePress(6);return true;" 911*7c478bd9Sstevel@tonic-gate onMouseUp="handleRelease(6);return true;" 912*7c478bd9Sstevel@tonic-gate onMouseOut="handleRelease(6);return true;" 913*7c478bd9Sstevel@tonic-gate onClick="return false;" 914*7c478bd9Sstevel@tonic-gate title="Go to End Of File">EOF</a></td> 915*7c478bd9Sstevel@tonic-gate <td align="center" valign="middle"> 916*7c478bd9Sstevel@tonic-gate <a onMouseDown="handlePress(4);return true;" 917*7c478bd9Sstevel@tonic-gate onMouseUp="handleRelease(4);return true;" 918*7c478bd9Sstevel@tonic-gate onMouseOut="handleRelease(4);return true;" 919*7c478bd9Sstevel@tonic-gate title="Scroll Down: Press and Hold to accelerate" 920*7c478bd9Sstevel@tonic-gate onClick="return false;">Scroll frames Down</a></td> 921*7c478bd9Sstevel@tonic-gate <td align="center" valign="right"> 922*7c478bd9Sstevel@tonic-gate <a onMouseDown="handlePress(5);return true;" 923*7c478bd9Sstevel@tonic-gate onMouseUp="handleRelease(5);return true;" 924*7c478bd9Sstevel@tonic-gate onMouseOut="handleRelease(5);return true;" 925*7c478bd9Sstevel@tonic-gate title="Go to next Diff" 926*7c478bd9Sstevel@tonic-gate onClick="return false;">Next Diff</a></td> 927*7c478bd9Sstevel@tonic-gate </tr></table> 928*7c478bd9Sstevel@tonic-gate </dev> 929*7c478bd9Sstevel@tonic-gate </TD> 930*7c478bd9Sstevel@tonic-gate <th valign="middle" width="25%"> 931*7c478bd9Sstevel@tonic-gate <form name="diff" onsubmit="return ValidateDiffNum();"> 932*7c478bd9Sstevel@tonic-gate <input name="sync" value="BOF" size="8" type="text"> 933*7c478bd9Sstevel@tonic-gate </form> 934*7c478bd9Sstevel@tonic-gate </th> 935*7c478bd9Sstevel@tonic-gate </TR> 936*7c478bd9Sstevel@tonic-gate </table> 937*7c478bd9Sstevel@tonic-gate </body> 938*7c478bd9Sstevel@tonic-gate</html> 939*7c478bd9Sstevel@tonic-gateEOF 940*7c478bd9Sstevel@tonic-gate} 941*7c478bd9Sstevel@tonic-gate 942*7c478bd9Sstevel@tonic-gate#################################### 943*7c478bd9Sstevel@tonic-gate 944*7c478bd9Sstevel@tonic-gatediff_to_html() 945*7c478bd9Sstevel@tonic-gate{ 946*7c478bd9Sstevel@tonic-gateTNAME=$1 947*7c478bd9Sstevel@tonic-gateDIFFTYPE=$2 948*7c478bd9Sstevel@tonic-gate 949*7c478bd9Sstevel@tonic-gatehtml_quote | nawk ' 950*7c478bd9Sstevel@tonic-gateBEGIN {printf "<body bgcolor=\"#EEEEEE\"><title>'$DIFFTYPE'diff '$TNAME'</title><pre>\n"} 951*7c478bd9Sstevel@tonic-gate/^-------/ { printf "<center><h1>%s</h1></center>\n", $0; next } 952*7c478bd9Sstevel@tonic-gate/^\*\*\*\*/ { printf "<hr>\n"; next} 953*7c478bd9Sstevel@tonic-gate/^\*\*\*/ { printf "<FONT COLOR=\"red\" SIZE=+1><b>%s</b></FONT>\n", $0 ; next} 954*7c478bd9Sstevel@tonic-gate/^---/ { printf "<FONT COLOR=\"green\" SIZE=+1><b>%s</b></FONT>\n", $0 ; next} 955*7c478bd9Sstevel@tonic-gate/^\+/ {printf "<FONT COLOR=\"'$NEW_COLOR'\"><b>%s</b></FONT>\n", $0; next} 956*7c478bd9Sstevel@tonic-gate/^!/ {printf "<FONT COLOR=\"'$CHANGED_COLOR'\">%s</FONT>\n", $0; next} 957*7c478bd9Sstevel@tonic-gate/^-/ {printf "<FONT COLOR=\"'$REMOVED_COLOR'\">%s</FONT>\n", $0; next} 958*7c478bd9Sstevel@tonic-gate {printf "<FONT COLOR=\"black\">%s</FONT>\n", $0; next} 959*7c478bd9Sstevel@tonic-gateEND {printf "</pre></FONT></body>\n"} 960*7c478bd9Sstevel@tonic-gate' 961*7c478bd9Sstevel@tonic-gate} 962*7c478bd9Sstevel@tonic-gate 963*7c478bd9Sstevel@tonic-gate#################################### 964*7c478bd9Sstevel@tonic-gate 965*7c478bd9Sstevel@tonic-gatesource_to_html() 966*7c478bd9Sstevel@tonic-gate{ 967*7c478bd9Sstevel@tonic-gateWHICH=$1 968*7c478bd9Sstevel@tonic-gateTNAME=$2 969*7c478bd9Sstevel@tonic-gate 970*7c478bd9Sstevel@tonic-gatehtml_quote | nawk ' 971*7c478bd9Sstevel@tonic-gateBEGIN {printf "<body bgcolor=\"#EEEEEE\"><title>'"$WHICH $TNAME"'</title><pre>\n"} 972*7c478bd9Sstevel@tonic-gate {line += 1 ; printf "%3d %s\n", line, $0 } 973*7c478bd9Sstevel@tonic-gate' 974*7c478bd9Sstevel@tonic-gate} 975*7c478bd9Sstevel@tonic-gate 976*7c478bd9Sstevel@tonic-gate#################################### 977*7c478bd9Sstevel@tonic-gate# Find the first delta in the child that's not in the parent. 978*7c478bd9Sstevel@tonic-gate# Get the newest delta from the parent, get all deltas from the 979*7c478bd9Sstevel@tonic-gate# child starting with that delta, and then get all info starting 980*7c478bd9Sstevel@tonic-gate# with the second oldest delta in that list (the first delta 981*7c478bd9Sstevel@tonic-gate# unique to the child). 982*7c478bd9Sstevel@tonic-gate# 983*7c478bd9Sstevel@tonic-gate# This code adapted from Bill Shannon's "spc" script 984*7c478bd9Sstevel@tonic-gate 985*7c478bd9Sstevel@tonic-gatedeltacomments() 986*7c478bd9Sstevel@tonic-gate{ 987*7c478bd9Sstevel@tonic-gatepfile=$PWS/$1 988*7c478bd9Sstevel@tonic-gatecfile=$CWS/$2 989*7c478bd9Sstevel@tonic-gate 990*7c478bd9Sstevel@tonic-gateif [ -f $pfile ]; then 991*7c478bd9Sstevel@tonic-gate psid=$(sccs prs -d:I: $pfile 2>/dev/null) 992*7c478bd9Sstevel@tonic-gateelse 993*7c478bd9Sstevel@tonic-gate psid=1.1 994*7c478bd9Sstevel@tonic-gatefi 995*7c478bd9Sstevel@tonic-gate 996*7c478bd9Sstevel@tonic-gateset -A sids $(sccs prs -l -r$psid -d:I: $cfile 2>/dev/null) 997*7c478bd9Sstevel@tonic-gateN=${#sids[@]} 998*7c478bd9Sstevel@tonic-gate 999*7c478bd9Sstevel@tonic-gateif [[ $N -ge 2 ]]; then 1000*7c478bd9Sstevel@tonic-gate sid1=${sids[$((N-2))]} # Gets 2nd to last sid 1001*7c478bd9Sstevel@tonic-gate 1002*7c478bd9Sstevel@tonic-gate echo "<ul>" 1003*7c478bd9Sstevel@tonic-gate sccs prs -l -r$sid1 $cfile 2>/dev/null | 1004*7c478bd9Sstevel@tonic-gate html_quote | 1005*7c478bd9Sstevel@tonic-gate sed -e 's|[0-9]\{5,\}|<a href='$URL'&>&</a>|g' \ 1006*7c478bd9Sstevel@tonic-gate -e 's|\([A-Z]\{1,2\}ARC\)[ /]\([0-9]\{4\}/[0-9]\{3\}\)|<a href='$URL2'\1/\2>\1 \2</a>|g'| 1007*7c478bd9Sstevel@tonic-gate nawk '/^COMMENTS:/ {p=1; printf "<li>"; continue} 1008*7c478bd9Sstevel@tonic-gate NF == 0 { continue } 1009*7c478bd9Sstevel@tonic-gate /^D / {p=0} 1010*7c478bd9Sstevel@tonic-gate {if (p==0) continue; print $0 "<br>"}' 1011*7c478bd9Sstevel@tonic-gate echo "</ul>" 1012*7c478bd9Sstevel@tonic-gatefi 1013*7c478bd9Sstevel@tonic-gate} 1014*7c478bd9Sstevel@tonic-gate 1015*7c478bd9Sstevel@tonic-gate#################################### 1016*7c478bd9Sstevel@tonic-gate# Given the pathname of a file, find its location 1017*7c478bd9Sstevel@tonic-gate# in a "wx" active file list and print the following 1018*7c478bd9Sstevel@tonic-gate# sccs comment. Embedded bugids (sequence of 5 or 1019*7c478bd9Sstevel@tonic-gate# more digits) are turned into URLs. 1020*7c478bd9Sstevel@tonic-gate 1021*7c478bd9Sstevel@tonic-gatewxcomments() 1022*7c478bd9Sstevel@tonic-gate{ 1023*7c478bd9Sstevel@tonic-gate 1024*7c478bd9Sstevel@tonic-gate echo "<blockquote><pre>" 1025*7c478bd9Sstevel@tonic-gate nawk ' 1026*7c478bd9Sstevel@tonic-gate $1 == "'$1'" { 1027*7c478bd9Sstevel@tonic-gate do getline ; while (NF > 0) 1028*7c478bd9Sstevel@tonic-gate getline 1029*7c478bd9Sstevel@tonic-gate while (NF > 0) { print ; getline } 1030*7c478bd9Sstevel@tonic-gate exit 1031*7c478bd9Sstevel@tonic-gate }' < $WXFILE | html_quote | 1032*7c478bd9Sstevel@tonic-gate sed -e 's|[0-9]\{5,\}|<a href='$URL'&>&</a>|g' \ 1033*7c478bd9Sstevel@tonic-gate -e 's|\([A-Z]\{1,2\}ARC\)[ /]\([0-9]\{4\}/[0-9]\{3\}\)|<a href='$URL2'\1/\2>\1 \2</a>|g' 1034*7c478bd9Sstevel@tonic-gate echo "</pre></blockquote>" 1035*7c478bd9Sstevel@tonic-gate} 1036*7c478bd9Sstevel@tonic-gate 1037*7c478bd9Sstevel@tonic-gate##################################### 1038*7c478bd9Sstevel@tonic-gate# Calculate number of changes. 1039*7c478bd9Sstevel@tonic-gate# 1040*7c478bd9Sstevel@tonic-gate 1041*7c478bd9Sstevel@tonic-gatefunction difflines 1042*7c478bd9Sstevel@tonic-gate{ 1043*7c478bd9Sstevel@tonic-gate integer tot chg del ins unc err 1044*7c478bd9Sstevel@tonic-gate typeset filename 1045*7c478bd9Sstevel@tonic-gate 1046*7c478bd9Sstevel@tonic-gate diff -e $1 $2 | eval $( nawk ' 1047*7c478bd9Sstevel@tonic-gate ## Change range of lines: N,Nc 1048*7c478bd9Sstevel@tonic-gate /^[0-9]*,[0-9]*c$/ { 1049*7c478bd9Sstevel@tonic-gate n=split(substr($1,1,length($1)-1), counts, ","); 1050*7c478bd9Sstevel@tonic-gate if (n != 2) { 1051*7c478bd9Sstevel@tonic-gate error=2 1052*7c478bd9Sstevel@tonic-gate exit; 1053*7c478bd9Sstevel@tonic-gate } 1054*7c478bd9Sstevel@tonic-gate ## 3,5c means lines 3 , 4 and 5 are changed, a total of 3 lines. 1055*7c478bd9Sstevel@tonic-gate ## following would be 5 - 3 = 2! Hence +1 for correction. 1056*7c478bd9Sstevel@tonic-gate r=(counts[2]-counts[1])+1; 1057*7c478bd9Sstevel@tonic-gate ## Now count replacement lines: each represents a change instead 1058*7c478bd9Sstevel@tonic-gate ## of a delete, so increment c and decrement r. 1059*7c478bd9Sstevel@tonic-gate while (getline != /^\.$/) { 1060*7c478bd9Sstevel@tonic-gate c++; 1061*7c478bd9Sstevel@tonic-gate r--; 1062*7c478bd9Sstevel@tonic-gate } 1063*7c478bd9Sstevel@tonic-gate ## If there were more replacement lines than original lines, 1064*7c478bd9Sstevel@tonic-gate ## then r will be negative; in this case there are no deletions, 1065*7c478bd9Sstevel@tonic-gate ## but there are r changes that should be counted as adds, and 1066*7c478bd9Sstevel@tonic-gate ## since r is negative, subtract it from a and add it to c. 1067*7c478bd9Sstevel@tonic-gate if (r < 0) { 1068*7c478bd9Sstevel@tonic-gate a-=r; 1069*7c478bd9Sstevel@tonic-gate c+=r; 1070*7c478bd9Sstevel@tonic-gate } 1071*7c478bd9Sstevel@tonic-gate ## If there were more original lines than replacement lines, then 1072*7c478bd9Sstevel@tonic-gate ## r will be positive; in this case, increment d by that much. 1073*7c478bd9Sstevel@tonic-gate if (r > 0) { 1074*7c478bd9Sstevel@tonic-gate d+=r; 1075*7c478bd9Sstevel@tonic-gate } 1076*7c478bd9Sstevel@tonic-gate next; 1077*7c478bd9Sstevel@tonic-gate } 1078*7c478bd9Sstevel@tonic-gate 1079*7c478bd9Sstevel@tonic-gate ## Change lines: Nc 1080*7c478bd9Sstevel@tonic-gate /^[0-9].*c$/ { 1081*7c478bd9Sstevel@tonic-gate ## The first line is a replacement; any more are additions. 1082*7c478bd9Sstevel@tonic-gate if (getline != /^\.$/) { 1083*7c478bd9Sstevel@tonic-gate c++; 1084*7c478bd9Sstevel@tonic-gate while (getline != /^\.$/) a++; 1085*7c478bd9Sstevel@tonic-gate } 1086*7c478bd9Sstevel@tonic-gate next; 1087*7c478bd9Sstevel@tonic-gate } 1088*7c478bd9Sstevel@tonic-gate 1089*7c478bd9Sstevel@tonic-gate ## Add lines: both Na and N,Na 1090*7c478bd9Sstevel@tonic-gate /^[0-9].*a$/ { 1091*7c478bd9Sstevel@tonic-gate while (getline != /^\.$/) a++; 1092*7c478bd9Sstevel@tonic-gate next; 1093*7c478bd9Sstevel@tonic-gate } 1094*7c478bd9Sstevel@tonic-gate 1095*7c478bd9Sstevel@tonic-gate ## Delete range of lines: N,Nd 1096*7c478bd9Sstevel@tonic-gate /^[0-9]*,[0-9]*d$/ { 1097*7c478bd9Sstevel@tonic-gate n=split(substr($1,1,length($1)-1), counts, ","); 1098*7c478bd9Sstevel@tonic-gate if (n != 2) { 1099*7c478bd9Sstevel@tonic-gate error=2 1100*7c478bd9Sstevel@tonic-gate exit; 1101*7c478bd9Sstevel@tonic-gate } 1102*7c478bd9Sstevel@tonic-gate ## 3,5d means lines 3 , 4 and 5 are deleted, a total of 3 lines. 1103*7c478bd9Sstevel@tonic-gate ## following would be 5 - 3 = 2! Hence +1 for correction. 1104*7c478bd9Sstevel@tonic-gate r=(counts[2]-counts[1])+1; 1105*7c478bd9Sstevel@tonic-gate d+=r; 1106*7c478bd9Sstevel@tonic-gate next; 1107*7c478bd9Sstevel@tonic-gate } 1108*7c478bd9Sstevel@tonic-gate 1109*7c478bd9Sstevel@tonic-gate ## Delete line: Nd 1110*7c478bd9Sstevel@tonic-gate ## For example 10d says line 10 is deleted. 1111*7c478bd9Sstevel@tonic-gate /^[0-9]*d$/ {d++; next} 1112*7c478bd9Sstevel@tonic-gate 1113*7c478bd9Sstevel@tonic-gate ## Should not get here! 1114*7c478bd9Sstevel@tonic-gate { 1115*7c478bd9Sstevel@tonic-gate error=1; 1116*7c478bd9Sstevel@tonic-gate exit; 1117*7c478bd9Sstevel@tonic-gate } 1118*7c478bd9Sstevel@tonic-gate 1119*7c478bd9Sstevel@tonic-gate ## Finish off - print results 1120*7c478bd9Sstevel@tonic-gate END{ 1121*7c478bd9Sstevel@tonic-gate printf("tot=%d;chg=%d;del=%d;ins=%d;err=%d\n", 1122*7c478bd9Sstevel@tonic-gate (c+d+a), c, d, a, error); 1123*7c478bd9Sstevel@tonic-gate }' ) 1124*7c478bd9Sstevel@tonic-gate 1125*7c478bd9Sstevel@tonic-gate # End of nawk, Check to see if any trouble occurred. 1126*7c478bd9Sstevel@tonic-gate if (( $? > 0 || err > 0 )); then 1127*7c478bd9Sstevel@tonic-gate print "Unexpected Error occurred reading \`diff -e $1 $2\`: \$?=$?, err=" $err 1128*7c478bd9Sstevel@tonic-gate else 1129*7c478bd9Sstevel@tonic-gate # Accumulate totals 1130*7c478bd9Sstevel@tonic-gate (( TOTL += tot )) 1131*7c478bd9Sstevel@tonic-gate (( TCHG += chg )) 1132*7c478bd9Sstevel@tonic-gate (( TDEL += del )) 1133*7c478bd9Sstevel@tonic-gate (( TINS += ins )) 1134*7c478bd9Sstevel@tonic-gate # Calculate unchanged lines 1135*7c478bd9Sstevel@tonic-gate wc -l $1 | read unc filename 1136*7c478bd9Sstevel@tonic-gate if (( unc > 0 )); then 1137*7c478bd9Sstevel@tonic-gate (( unc -= del + chg )) 1138*7c478bd9Sstevel@tonic-gate (( TUNC += unc )) 1139*7c478bd9Sstevel@tonic-gate fi 1140*7c478bd9Sstevel@tonic-gate # print summary 1141*7c478bd9Sstevel@tonic-gate printCI $tot $ins $del $chg $unc 1142*7c478bd9Sstevel@tonic-gate fi 1143*7c478bd9Sstevel@tonic-gate} 1144*7c478bd9Sstevel@tonic-gate 1145*7c478bd9Sstevel@tonic-gate##################################### 1146*7c478bd9Sstevel@tonic-gate# Print out Code Inspection figures similar to sccs-prt(1) format. 1147*7c478bd9Sstevel@tonic-gate# 1148*7c478bd9Sstevel@tonic-gatefunction printCI 1149*7c478bd9Sstevel@tonic-gate{ 1150*7c478bd9Sstevel@tonic-gate integer tot=$1 ins=$2 del=$3 chg=$4 unc=$5 1151*7c478bd9Sstevel@tonic-gate typeset str 1152*7c478bd9Sstevel@tonic-gate if (( tot == 1 )); then 1153*7c478bd9Sstevel@tonic-gate str="line" 1154*7c478bd9Sstevel@tonic-gate else 1155*7c478bd9Sstevel@tonic-gate str="lines" 1156*7c478bd9Sstevel@tonic-gate fi 1157*7c478bd9Sstevel@tonic-gate printf "%d %s changed : %d/%d/%d/%d %s\n" \ 1158*7c478bd9Sstevel@tonic-gate $tot $str $ins $del $chg $unc "(inserted/deleted/modified/unchanged)" 1159*7c478bd9Sstevel@tonic-gate} 1160*7c478bd9Sstevel@tonic-gate 1161*7c478bd9Sstevel@tonic-gate##################################### 1162*7c478bd9Sstevel@tonic-gate# 1163*7c478bd9Sstevel@tonic-gate# Start Here 1164*7c478bd9Sstevel@tonic-gate# 1165*7c478bd9Sstevel@tonic-gate##################################### 1166*7c478bd9Sstevel@tonic-gate 1167*7c478bd9Sstevel@tonic-gatetrap "rm -f /tmp/$$.* ; exit" 0 1 2 3 15 1168*7c478bd9Sstevel@tonic-gate 1169*7c478bd9Sstevel@tonic-gateset +o noclobber 1170*7c478bd9Sstevel@tonic-gate 1171*7c478bd9Sstevel@tonic-gateWDIFF=${WDIFF:-/ws/onnv-gate/public/bin/wdiff} 1172*7c478bd9Sstevel@tonic-gate 1173*7c478bd9Sstevel@tonic-gateFLIST=$1 1174*7c478bd9Sstevel@tonic-gate 1175*7c478bd9Sstevel@tonic-gate# By default enable frame diff. 1176*7c478bd9Sstevel@tonic-gateWEBREV_FRAMES=${WEBREV_FRAMES:-yes} 1177*7c478bd9Sstevel@tonic-gate 1178*7c478bd9Sstevel@tonic-gate# Declare global total counters. 1179*7c478bd9Sstevel@tonic-gateinteger TOTL TINS TDEL TCHG TUNC 1180*7c478bd9Sstevel@tonic-gate 1181*7c478bd9Sstevel@tonic-gateif [ "$FLIST" = "-" ]; then 1182*7c478bd9Sstevel@tonic-gate FLIST=/tmp/$$.flist 1183*7c478bd9Sstevel@tonic-gate cat > $FLIST 1184*7c478bd9Sstevel@tonic-gatefi 1185*7c478bd9Sstevel@tonic-gate 1186*7c478bd9Sstevel@tonic-gate# If the -l flag is given instead of the name of 1187*7c478bd9Sstevel@tonic-gate# a file list, then generate the file list by 1188*7c478bd9Sstevel@tonic-gate# extracting file names from a putback -n. 1189*7c478bd9Sstevel@tonic-gate# Some names may come from the "update/create" 1190*7c478bd9Sstevel@tonic-gate# messages and others from the "currently checked out" 1191*7c478bd9Sstevel@tonic-gate# warning. Renames are detected here too. 1192*7c478bd9Sstevel@tonic-gate# Extract values for CODEMGR_WS and CODEMGR_PARENT 1193*7c478bd9Sstevel@tonic-gate# from the output of the putback -n as well, but remove 1194*7c478bd9Sstevel@tonic-gate# them if they are already defined. 1195*7c478bd9Sstevel@tonic-gate 1196*7c478bd9Sstevel@tonic-gateif [ "$FLIST" = "-l" ]; then 1197*7c478bd9Sstevel@tonic-gate 1198*7c478bd9Sstevel@tonic-gate FLIST=/tmp/$$.filelist 1199*7c478bd9Sstevel@tonic-gate print "Generating file list ...\c" 1200*7c478bd9Sstevel@tonic-gate 1201*7c478bd9Sstevel@tonic-gate putback -n $2 $3 2>&1 | 1202*7c478bd9Sstevel@tonic-gate awk '/^update:|^create:/{print $2} 1203*7c478bd9Sstevel@tonic-gate /^Parent workspace:/{printf("CODEMGR_PARENT=%s\n",$3)} \ 1204*7c478bd9Sstevel@tonic-gate /^Child workspace:/{printf("CODEMGR_WS=%s\n",$3)} \ 1205*7c478bd9Sstevel@tonic-gate /^The following files/{p=1 ; continue} 1206*7c478bd9Sstevel@tonic-gate /^rename/{old=$3} 1207*7c478bd9Sstevel@tonic-gate $1 == "to:"{print $2, old} 1208*7c478bd9Sstevel@tonic-gate /^"/ {continue} 1209*7c478bd9Sstevel@tonic-gate NF == 0 {p=0 ; continue} 1210*7c478bd9Sstevel@tonic-gate {if (p==1) print $1}' | 1211*7c478bd9Sstevel@tonic-gate sort -r -k 1,1 -u | sort > $FLIST 1212*7c478bd9Sstevel@tonic-gate 1213*7c478bd9Sstevel@tonic-gate print " Done\n" 1214*7c478bd9Sstevel@tonic-gatefi 1215*7c478bd9Sstevel@tonic-gate 1216*7c478bd9Sstevel@tonic-gate# If the -w flag is given then assume the file 1217*7c478bd9Sstevel@tonic-gate# list is in Bonwick's "wx" command format, i.e. 1218*7c478bd9Sstevel@tonic-gate# pathname lines alternating with SCCS comment 1219*7c478bd9Sstevel@tonic-gate# lines with blank lines as separators. 1220*7c478bd9Sstevel@tonic-gate# Use the SCCS comments later in building 1221*7c478bd9Sstevel@tonic-gate# the index.html file. 1222*7c478bd9Sstevel@tonic-gate 1223*7c478bd9Sstevel@tonic-gateif [ "$FLIST" = "-w" ]; then 1224*7c478bd9Sstevel@tonic-gate shift 1225*7c478bd9Sstevel@tonic-gate WXFILE=$1 1226*7c478bd9Sstevel@tonic-gate 1227*7c478bd9Sstevel@tonic-gate # If the wx file pathname is relative 1228*7c478bd9Sstevel@tonic-gate # then make it absolute because the 1229*7c478bd9Sstevel@tonic-gate # webrev does a "cd" later on. 1230*7c478bd9Sstevel@tonic-gate # 1231*7c478bd9Sstevel@tonic-gate # If no wx file pathname is given, then 1232*7c478bd9Sstevel@tonic-gate # it defaults to "wx/active" in the 1233*7c478bd9Sstevel@tonic-gate # workspace directory. 1234*7c478bd9Sstevel@tonic-gate 1235*7c478bd9Sstevel@tonic-gate if [ -z "${WXFILE}" ]; then 1236*7c478bd9Sstevel@tonic-gate WXFILE=${CODEMGR_WS}/wx/active 1237*7c478bd9Sstevel@tonic-gate elif [ ${WXFILE%%/*} ]; then 1238*7c478bd9Sstevel@tonic-gate WXFILE=$PWD/$WXFILE 1239*7c478bd9Sstevel@tonic-gate fi 1240*7c478bd9Sstevel@tonic-gate 1241*7c478bd9Sstevel@tonic-gate FLIST=/tmp/$$.filelist 1242*7c478bd9Sstevel@tonic-gate nawk '{ c = 1; print; 1243*7c478bd9Sstevel@tonic-gate while (getline) { 1244*7c478bd9Sstevel@tonic-gate if (NF == 0) { c = -c; continue } 1245*7c478bd9Sstevel@tonic-gate if (c > 0) print 1246*7c478bd9Sstevel@tonic-gate } 1247*7c478bd9Sstevel@tonic-gate }' $WXFILE > $FLIST 1248*7c478bd9Sstevel@tonic-gatefi 1249*7c478bd9Sstevel@tonic-gate 1250*7c478bd9Sstevel@tonic-gateif [ ! -f $FLIST ]; then 1251*7c478bd9Sstevel@tonic-gate echo "$FLIST: no such file" 1252*7c478bd9Sstevel@tonic-gate 1253*7c478bd9Sstevel@tonic-gate echo "Usage: webrev <file>" 1254*7c478bd9Sstevel@tonic-gate echo " webrev -" 1255*7c478bd9Sstevel@tonic-gate echo " webrev -w [<wx file>]" 1256*7c478bd9Sstevel@tonic-gate echo " webrev -l [-f flp]" 1257*7c478bd9Sstevel@tonic-gate exit 1 1258*7c478bd9Sstevel@tonic-gatefi 1259*7c478bd9Sstevel@tonic-gate 1260*7c478bd9Sstevel@tonic-gate 1261*7c478bd9Sstevel@tonic-gate# Remove workspace variables from the flist 1262*7c478bd9Sstevel@tonic-gate# file if they're already set in the environment. 1263*7c478bd9Sstevel@tonic-gate# We want the environment variables to take 1264*7c478bd9Sstevel@tonic-gate# precedence over any set in the file list. 1265*7c478bd9Sstevel@tonic-gate 1266*7c478bd9Sstevel@tonic-gateif [ "$CODEMGR_WS" != "" ]; then 1267*7c478bd9Sstevel@tonic-gate egrep -v '^CODEMGR_WS=' $FLIST > $FLIST.$$ 1268*7c478bd9Sstevel@tonic-gate mv $FLIST.$$ $FLIST 1269*7c478bd9Sstevel@tonic-gatefi 1270*7c478bd9Sstevel@tonic-gateif [ "$CODEMGR_PARENT" != "" ]; then 1271*7c478bd9Sstevel@tonic-gate egrep -v '^CODEMGR_PARENT=' $FLIST > $FLIST.$$ 1272*7c478bd9Sstevel@tonic-gate mv $FLIST.$$ $FLIST 1273*7c478bd9Sstevel@tonic-gatefi 1274*7c478bd9Sstevel@tonic-gate 1275*7c478bd9Sstevel@tonic-gate 1276*7c478bd9Sstevel@tonic-gate# Now do an "eval" to set env variables that 1277*7c478bd9Sstevel@tonic-gate# are listed in the file list. 1278*7c478bd9Sstevel@tonic-gate 1279*7c478bd9Sstevel@tonic-gateeval `sed -e "s/#.*$//" $FLIST | grep = ` 1280*7c478bd9Sstevel@tonic-gate 1281*7c478bd9Sstevel@tonic-gate 1282*7c478bd9Sstevel@tonic-gateif [ "$CODEMGR_WS" = "" ]; then 1283*7c478bd9Sstevel@tonic-gate echo "CODEMGR_WS not set." 1284*7c478bd9Sstevel@tonic-gate echo "Activate a workspace or set in $FLIST" 1285*7c478bd9Sstevel@tonic-gate exit 1 1286*7c478bd9Sstevel@tonic-gatefi 1287*7c478bd9Sstevel@tonic-gate 1288*7c478bd9Sstevel@tonic-gateif [ ! -d $CODEMGR_WS ]; then 1289*7c478bd9Sstevel@tonic-gate echo "$CODEMGR_WS: no such workspace" 1290*7c478bd9Sstevel@tonic-gate exit 1 1291*7c478bd9Sstevel@tonic-gatefi 1292*7c478bd9Sstevel@tonic-gate 1293*7c478bd9Sstevel@tonic-gate# Observe true directory name of CODEMGR_WS, as used later in webrev title. 1294*7c478bd9Sstevel@tonic-gateCODEMGR_WS=$(cd $CODEMGR_WS;print $PWD) 1295*7c478bd9Sstevel@tonic-gate 1296*7c478bd9Sstevel@tonic-gateif [ "$CODEMGR_PARENT" = "" ]; then 1297*7c478bd9Sstevel@tonic-gate CODEMGR_PARENT=`workspace parent` 1298*7c478bd9Sstevel@tonic-gatefi 1299*7c478bd9Sstevel@tonic-gate 1300*7c478bd9Sstevel@tonic-gateif [ ! -d $CODEMGR_PARENT ]; then 1301*7c478bd9Sstevel@tonic-gate echo "$CODEMGR_PARENT: no such parent workspace" 1302*7c478bd9Sstevel@tonic-gate exit 1 1303*7c478bd9Sstevel@tonic-gatefi 1304*7c478bd9Sstevel@tonic-gate 1305*7c478bd9Sstevel@tonic-gateecho 1306*7c478bd9Sstevel@tonic-gateecho CODEMGR_WS=$CODEMGR_WS 1307*7c478bd9Sstevel@tonic-gateecho CODEMGR_PARENT=$CODEMGR_PARENT 1308*7c478bd9Sstevel@tonic-gateecho 1309*7c478bd9Sstevel@tonic-gate 1310*7c478bd9Sstevel@tonic-gateCWS=$CODEMGR_WS 1311*7c478bd9Sstevel@tonic-gatePWS=$CODEMGR_PARENT 1312*7c478bd9Sstevel@tonic-gateWDIR=${WDIR:-$CWS}/webrev 1313*7c478bd9Sstevel@tonic-gateif [ ${WDIR%%/*} ]; then 1314*7c478bd9Sstevel@tonic-gate WDIR=$PWD/$WDIR 1315*7c478bd9Sstevel@tonic-gatefi 1316*7c478bd9Sstevel@tonic-gateif [ ! -d $WDIR ]; then 1317*7c478bd9Sstevel@tonic-gate mkdir $WDIR 1318*7c478bd9Sstevel@tonic-gatefi 1319*7c478bd9Sstevel@tonic-gate 1320*7c478bd9Sstevel@tonic-gate# Save the file list in the webrev dir 1321*7c478bd9Sstevel@tonic-gate 1322*7c478bd9Sstevel@tonic-gateif [ ! $FLIST -ef $WDIR/file.list ]; then 1323*7c478bd9Sstevel@tonic-gate cp $FLIST $WDIR/file.list 1324*7c478bd9Sstevel@tonic-gatefi 1325*7c478bd9Sstevel@tonic-gate 1326*7c478bd9Sstevel@tonic-gate# Remove comments, blank lines and env variables from the file list 1327*7c478bd9Sstevel@tonic-gate 1328*7c478bd9Sstevel@tonic-gatesed -e "s/#.*$//" -e "/=/d" -e "/^[ ]*$/d" $FLIST | 1329*7c478bd9Sstevel@tonic-gate 1330*7c478bd9Sstevel@tonic-gate# ... and read lines from the cleaned-up file list 1331*7c478bd9Sstevel@tonic-gate 1332*7c478bd9Sstevel@tonic-gatewhile read LINE 1333*7c478bd9Sstevel@tonic-gatedo 1334*7c478bd9Sstevel@tonic-gate set - $LINE 1335*7c478bd9Sstevel@tonic-gate P=$1 1336*7c478bd9Sstevel@tonic-gate 1337*7c478bd9Sstevel@tonic-gate # Normally, each line in the file list is 1338*7c478bd9Sstevel@tonic-gate # just a pathname of a file that has 1339*7c478bd9Sstevel@tonic-gate # been modified or created in the child. 1340*7c478bd9Sstevel@tonic-gate # A file that is renamed in the child workspace 1341*7c478bd9Sstevel@tonic-gate # has two names on the line: new name followed 1342*7c478bd9Sstevel@tonic-gate # by the old name. 1343*7c478bd9Sstevel@tonic-gate 1344*7c478bd9Sstevel@tonic-gate if [ $# = 2 ]; then 1345*7c478bd9Sstevel@tonic-gate PP=$2 # old filename 1346*7c478bd9Sstevel@tonic-gate OLDNAME=" (was $PP)" 1347*7c478bd9Sstevel@tonic-gate PDIR=${PP%/*} 1348*7c478bd9Sstevel@tonic-gate if [ "$PDIR" == "$PP" ]; then 1349*7c478bd9Sstevel@tonic-gate PDIR="." # File at root of workspace 1350*7c478bd9Sstevel@tonic-gate fi 1351*7c478bd9Sstevel@tonic-gate 1352*7c478bd9Sstevel@tonic-gate PF=${PP##*/} 1353*7c478bd9Sstevel@tonic-gate 1354*7c478bd9Sstevel@tonic-gate DIR=${P%/*} 1355*7c478bd9Sstevel@tonic-gate if [ "$DIR" == "$P" ]; then 1356*7c478bd9Sstevel@tonic-gate DIR="." # File at root of workspace 1357*7c478bd9Sstevel@tonic-gate fi 1358*7c478bd9Sstevel@tonic-gate 1359*7c478bd9Sstevel@tonic-gate F=${P##*/} 1360*7c478bd9Sstevel@tonic-gate else 1361*7c478bd9Sstevel@tonic-gate OLDNAME="" 1362*7c478bd9Sstevel@tonic-gate DIR=${P%/*} 1363*7c478bd9Sstevel@tonic-gate if [ "$DIR" == "$P" ]; then 1364*7c478bd9Sstevel@tonic-gate DIR="." # File at root of workspace 1365*7c478bd9Sstevel@tonic-gate fi 1366*7c478bd9Sstevel@tonic-gate 1367*7c478bd9Sstevel@tonic-gate F=${P##*/} 1368*7c478bd9Sstevel@tonic-gate 1369*7c478bd9Sstevel@tonic-gate PP=$P 1370*7c478bd9Sstevel@tonic-gate PDIR=$DIR 1371*7c478bd9Sstevel@tonic-gate PF=$F 1372*7c478bd9Sstevel@tonic-gate fi 1373*7c478bd9Sstevel@tonic-gate 1374*7c478bd9Sstevel@tonic-gate 1375*7c478bd9Sstevel@tonic-gate 1376*7c478bd9Sstevel@tonic-gate if [ ! -d $CWS/$DIR ]; then 1377*7c478bd9Sstevel@tonic-gate echo " $CWS/$DIR: no such directory" 1378*7c478bd9Sstevel@tonic-gate continue 1379*7c478bd9Sstevel@tonic-gate fi 1380*7c478bd9Sstevel@tonic-gate 1381*7c478bd9Sstevel@tonic-gate print " $P$OLDNAME\n\t\c" 1382*7c478bd9Sstevel@tonic-gate 1383*7c478bd9Sstevel@tonic-gate # Make the webrev mirror directory if necessary 1384*7c478bd9Sstevel@tonic-gate 1385*7c478bd9Sstevel@tonic-gate if [ ! -d $WDIR/$DIR ]; then 1386*7c478bd9Sstevel@tonic-gate mkdir -p $WDIR/$DIR 1387*7c478bd9Sstevel@tonic-gate fi 1388*7c478bd9Sstevel@tonic-gate 1389*7c478bd9Sstevel@tonic-gate # cd to the directory so the names are short 1390*7c478bd9Sstevel@tonic-gate 1391*7c478bd9Sstevel@tonic-gate cd $CWS/$DIR 1392*7c478bd9Sstevel@tonic-gate 1393*7c478bd9Sstevel@tonic-gate # If the child's version doesn't exist then 1394*7c478bd9Sstevel@tonic-gate # get a readonly copy. 1395*7c478bd9Sstevel@tonic-gate 1396*7c478bd9Sstevel@tonic-gate if [ ! -f $F -a -f SCCS/s.$F ]; then 1397*7c478bd9Sstevel@tonic-gate sccs get -s $F 1398*7c478bd9Sstevel@tonic-gate fi 1399*7c478bd9Sstevel@tonic-gate 1400*7c478bd9Sstevel@tonic-gate # Get the parent's version of the file. First see 1401*7c478bd9Sstevel@tonic-gate # whether the child's version is checked out and 1402*7c478bd9Sstevel@tonic-gate # get the parent's version with keywords expanded 1403*7c478bd9Sstevel@tonic-gate # or unexpanded as appropriate. 1404*7c478bd9Sstevel@tonic-gate 1405*7c478bd9Sstevel@tonic-gate if [ -f $PWS/$PDIR/SCCS/s.$PF -o -f $PWS/$PDIR/SCCS/p.$PF ]; then 1406*7c478bd9Sstevel@tonic-gate if [ -f SCCS/p.$F ]; then 1407*7c478bd9Sstevel@tonic-gate sccs get -s -p -k $PWS/$PDIR/$PF > $WDIR/$DIR/$F- 1408*7c478bd9Sstevel@tonic-gate else 1409*7c478bd9Sstevel@tonic-gate sccs get -s -p $PWS/$PDIR/$PF > $WDIR/$DIR/$F- 1410*7c478bd9Sstevel@tonic-gate fi 1411*7c478bd9Sstevel@tonic-gate else 1412*7c478bd9Sstevel@tonic-gate if [ -f $PWS/$PDIR/$PF ]; then 1413*7c478bd9Sstevel@tonic-gate # Parent is not a real workspace, but just a raw 1414*7c478bd9Sstevel@tonic-gate # directory tree - use the file that's there as 1415*7c478bd9Sstevel@tonic-gate # the old file. 1416*7c478bd9Sstevel@tonic-gate 1417*7c478bd9Sstevel@tonic-gate cp $PWS/$PDIR/$PF $WDIR/$DIR/$F- 1418*7c478bd9Sstevel@tonic-gate fi 1419*7c478bd9Sstevel@tonic-gate fi 1420*7c478bd9Sstevel@tonic-gate 1421*7c478bd9Sstevel@tonic-gate if [ ! -f $F -a ! -f $WDIR/$DIR/$F- ]; then 1422*7c478bd9Sstevel@tonic-gate echo "*** Error: file not in parent or child" 1423*7c478bd9Sstevel@tonic-gate continue 1424*7c478bd9Sstevel@tonic-gate fi 1425*7c478bd9Sstevel@tonic-gate 1426*7c478bd9Sstevel@tonic-gate # If we have old and new versions of the file 1427*7c478bd9Sstevel@tonic-gate # then run the appropriate diffs. 1428*7c478bd9Sstevel@tonic-gate 1429*7c478bd9Sstevel@tonic-gate if [ -f $F -a -f $WDIR/$DIR/$F- ]; then 1430*7c478bd9Sstevel@tonic-gate ${CDIFFCMD:-diff -b -C 5} $WDIR/$DIR/$F- $F > $WDIR/$DIR/$F.cdiff 1431*7c478bd9Sstevel@tonic-gate diff_to_html $F "C" < $WDIR/$DIR/$F.cdiff > $WDIR/$DIR/$F.cdiff.html 1432*7c478bd9Sstevel@tonic-gate print " cdiffs\c" 1433*7c478bd9Sstevel@tonic-gate 1434*7c478bd9Sstevel@tonic-gate ${UDIFFCMD:-diff -b -U 5} $WDIR/$DIR/$F- $F > $WDIR/$DIR/$F.udiff 1435*7c478bd9Sstevel@tonic-gate diff_to_html $F "U" < $WDIR/$DIR/$F.udiff > $WDIR/$DIR/$F.udiff.html 1436*7c478bd9Sstevel@tonic-gate print " udiffs\c" 1437*7c478bd9Sstevel@tonic-gate 1438*7c478bd9Sstevel@tonic-gate if [[ -x $WDIFF ]]; then 1439*7c478bd9Sstevel@tonic-gate $WDIFF -t "Wdiff $DIR/$F" $WDIR/$DIR/$F- $F > $WDIR/$DIR/$F.wdiff.html 1440*7c478bd9Sstevel@tonic-gate print " wdiffs\c" 1441*7c478bd9Sstevel@tonic-gate fi 1442*7c478bd9Sstevel@tonic-gate 1443*7c478bd9Sstevel@tonic-gate sdiff_to_html $WDIR/$DIR/$F- $F > $WDIR/$DIR/$F.sdiff.html 1444*7c478bd9Sstevel@tonic-gate print " sdiffs\c" 1445*7c478bd9Sstevel@tonic-gate 1446*7c478bd9Sstevel@tonic-gate if [[ $WEBREV_FRAMES == 'yes' ]]; then 1447*7c478bd9Sstevel@tonic-gate print " frames\c" 1448*7c478bd9Sstevel@tonic-gate fi 1449*7c478bd9Sstevel@tonic-gate 1450*7c478bd9Sstevel@tonic-gate rm -f $WDIR/$DIR/$F.cdiff $WDIR/$DIR/$F.udiff 1451*7c478bd9Sstevel@tonic-gate 1452*7c478bd9Sstevel@tonic-gate difflines $WDIR/$DIR/$F- $F > $WDIR/$DIR/$F.count 1453*7c478bd9Sstevel@tonic-gate elif [ -f $F ]; then 1454*7c478bd9Sstevel@tonic-gate # new file: count added lines 1455*7c478bd9Sstevel@tonic-gate difflines /dev/null $F > $WDIR/$DIR/$F.count 1456*7c478bd9Sstevel@tonic-gate elif [ -f $WDIR/$DIR/$F- ]; then 1457*7c478bd9Sstevel@tonic-gate # old file: count deleted lines 1458*7c478bd9Sstevel@tonic-gate difflines $WDIR/$DIR/$F- /dev/null > $WDIR/$DIR/$F.count 1459*7c478bd9Sstevel@tonic-gate fi 1460*7c478bd9Sstevel@tonic-gate 1461*7c478bd9Sstevel@tonic-gate if [ -f $WDIR/$DIR/$F- ]; then 1462*7c478bd9Sstevel@tonic-gate source_to_html Old $PF < $WDIR/$DIR/$F- > $WDIR/$DIR/$F-.html 1463*7c478bd9Sstevel@tonic-gate rm -f $WDIR/$DIR/$F- 1464*7c478bd9Sstevel@tonic-gate print " old\c" 1465*7c478bd9Sstevel@tonic-gate fi 1466*7c478bd9Sstevel@tonic-gate 1467*7c478bd9Sstevel@tonic-gate if [ -f $F ]; then 1468*7c478bd9Sstevel@tonic-gate source_to_html New $F < $F > $WDIR/$DIR/$F.html 1469*7c478bd9Sstevel@tonic-gate print " new\c" 1470*7c478bd9Sstevel@tonic-gate fi 1471*7c478bd9Sstevel@tonic-gate 1472*7c478bd9Sstevel@tonic-gate echo 1473*7c478bd9Sstevel@tonic-gatedone 1474*7c478bd9Sstevel@tonic-gate 1475*7c478bd9Sstevel@tonic-gateif [[ $WEBREV_FRAMES == 'yes' ]]; then 1476*7c478bd9Sstevel@tonic-gate frame_navigation > $WDIR/ancnav.html 1477*7c478bd9Sstevel@tonic-gatefi 1478*7c478bd9Sstevel@tonic-gate 1479*7c478bd9Sstevel@tonic-gate# Now build the index.html file that contains 1480*7c478bd9Sstevel@tonic-gate# links to the source files and their diffs. 1481*7c478bd9Sstevel@tonic-gate 1482*7c478bd9Sstevel@tonic-gatecd $CWS 1483*7c478bd9Sstevel@tonic-gate 1484*7c478bd9Sstevel@tonic-gate# Save total changed lines for Code Inspection. 1485*7c478bd9Sstevel@tonic-gateecho "$TOTL" > $WDIR/TotalChangedLines 1486*7c478bd9Sstevel@tonic-gate 1487*7c478bd9Sstevel@tonic-gateINDEXFILE=$WDIR/index.html 1488*7c478bd9Sstevel@tonic-gateexec 3<&1 # duplicate stdout to FD3. 1489*7c478bd9Sstevel@tonic-gateexec 1<&- # Close stdout. 1490*7c478bd9Sstevel@tonic-gateexec > $INDEXFILE # Open stdout to index file. 1491*7c478bd9Sstevel@tonic-gate 1492*7c478bd9Sstevel@tonic-gateecho "<html>" 1493*7c478bd9Sstevel@tonic-gateecho '<body bgcolor="#EEEEEE">' 1494*7c478bd9Sstevel@tonic-gateecho "<title>${CWS##*/}</title>" 1495*7c478bd9Sstevel@tonic-gateecho "<center><h1>${CWS##*/}</h1></center>" 1496*7c478bd9Sstevel@tonic-gateecho "<p>" 1497*7c478bd9Sstevel@tonic-gateecho "Parent workspace is $PWS <br>" 1498*7c478bd9Sstevel@tonic-gateecho "Child workspace is $CWS <br>" 1499*7c478bd9Sstevel@tonic-gateprintCI $TOTL $TINS $TDEL $TCHG $TUNC 1500*7c478bd9Sstevel@tonic-gateecho "<hr>" 1501*7c478bd9Sstevel@tonic-gateecho "<code>" 1502*7c478bd9Sstevel@tonic-gate 1503*7c478bd9Sstevel@tonic-gatesed -e "s/#.*$//" -e "/=/d" -e "/^[ ]*$/d" $FLIST | 1504*7c478bd9Sstevel@tonic-gate 1505*7c478bd9Sstevel@tonic-gate# ... and read lines from the cleaned-up file list 1506*7c478bd9Sstevel@tonic-gate 1507*7c478bd9Sstevel@tonic-gatewhile read LINE 1508*7c478bd9Sstevel@tonic-gatedo 1509*7c478bd9Sstevel@tonic-gate set - $LINE 1510*7c478bd9Sstevel@tonic-gate P=$1 1511*7c478bd9Sstevel@tonic-gate 1512*7c478bd9Sstevel@tonic-gate if [ $# = 2 ]; then 1513*7c478bd9Sstevel@tonic-gate PP=$2 1514*7c478bd9Sstevel@tonic-gate OLDNAME=" <i>(was $PP)</i>" 1515*7c478bd9Sstevel@tonic-gate else 1516*7c478bd9Sstevel@tonic-gate PP=$P 1517*7c478bd9Sstevel@tonic-gate OLDNAME="" 1518*7c478bd9Sstevel@tonic-gate fi 1519*7c478bd9Sstevel@tonic-gate 1520*7c478bd9Sstevel@tonic-gate # Avoid processing the same file twice. 1521*7c478bd9Sstevel@tonic-gate # It's possible for renamed files to 1522*7c478bd9Sstevel@tonic-gate # appear twice in the file list 1523*7c478bd9Sstevel@tonic-gate 1524*7c478bd9Sstevel@tonic-gate F=$WDIR/$P 1525*7c478bd9Sstevel@tonic-gate 1526*7c478bd9Sstevel@tonic-gate # Group files in 1527*7c478bd9Sstevel@tonic-gate # the same directory 1528*7c478bd9Sstevel@tonic-gate 1529*7c478bd9Sstevel@tonic-gate D=${F%/*} 1530*7c478bd9Sstevel@tonic-gate if [ "$D" != "$PD" ]; then 1531*7c478bd9Sstevel@tonic-gate echo "<p>" 1532*7c478bd9Sstevel@tonic-gate else 1533*7c478bd9Sstevel@tonic-gate echo "<br>" 1534*7c478bd9Sstevel@tonic-gate fi 1535*7c478bd9Sstevel@tonic-gate echo 1536*7c478bd9Sstevel@tonic-gate echo 1537*7c478bd9Sstevel@tonic-gate PD=$D 1538*7c478bd9Sstevel@tonic-gate 1539*7c478bd9Sstevel@tonic-gate # If there's a diffs file, make diffs links 1540*7c478bd9Sstevel@tonic-gate 1541*7c478bd9Sstevel@tonic-gate if [ -f $F.cdiff.html ]; then 1542*7c478bd9Sstevel@tonic-gate echo "<a href=$P.cdiff.html>Cdiffs</a>" 1543*7c478bd9Sstevel@tonic-gate echo "<a href=$P.udiff.html>Udiffs</a>" 1544*7c478bd9Sstevel@tonic-gate 1545*7c478bd9Sstevel@tonic-gate if [ -x $WDIFF ]; then 1546*7c478bd9Sstevel@tonic-gate echo "<a href=$P.wdiff.html>Wdiffs</a>" 1547*7c478bd9Sstevel@tonic-gate fi 1548*7c478bd9Sstevel@tonic-gate 1549*7c478bd9Sstevel@tonic-gate echo "<a href=$P.sdiff.html>Sdiffs</a>" 1550*7c478bd9Sstevel@tonic-gate 1551*7c478bd9Sstevel@tonic-gate if [[ $WEBREV_FRAMES == 'yes' ]]; then 1552*7c478bd9Sstevel@tonic-gate print "<a href=\"$P.frames.html\">Frames</a>" 1553*7c478bd9Sstevel@tonic-gate fi 1554*7c478bd9Sstevel@tonic-gate else 1555*7c478bd9Sstevel@tonic-gate echo "------ ------ ------" 1556*7c478bd9Sstevel@tonic-gate 1557*7c478bd9Sstevel@tonic-gate if [ -x $WDIFF ]; then 1558*7c478bd9Sstevel@tonic-gate echo " ------" 1559*7c478bd9Sstevel@tonic-gate fi 1560*7c478bd9Sstevel@tonic-gate 1561*7c478bd9Sstevel@tonic-gate if [[ $WEBREV_FRAMES == 'yes' ]]; then 1562*7c478bd9Sstevel@tonic-gate print " ------" 1563*7c478bd9Sstevel@tonic-gate fi 1564*7c478bd9Sstevel@tonic-gate fi 1565*7c478bd9Sstevel@tonic-gate 1566*7c478bd9Sstevel@tonic-gate # If there's an old file, make the link 1567*7c478bd9Sstevel@tonic-gate 1568*7c478bd9Sstevel@tonic-gate if [ -f $F-.html ]; then 1569*7c478bd9Sstevel@tonic-gate echo "<a href=$P-.html>Old</a>" 1570*7c478bd9Sstevel@tonic-gate else 1571*7c478bd9Sstevel@tonic-gate echo "---" 1572*7c478bd9Sstevel@tonic-gate fi 1573*7c478bd9Sstevel@tonic-gate 1574*7c478bd9Sstevel@tonic-gate # If there's an new file, make the link 1575*7c478bd9Sstevel@tonic-gate 1576*7c478bd9Sstevel@tonic-gate if [ -f $F.html ]; then 1577*7c478bd9Sstevel@tonic-gate echo "<a href=$P.html>New</a>" 1578*7c478bd9Sstevel@tonic-gate else 1579*7c478bd9Sstevel@tonic-gate echo "---" 1580*7c478bd9Sstevel@tonic-gate fi 1581*7c478bd9Sstevel@tonic-gate echo "<b>$P</b>$OLDNAME<p>" 1582*7c478bd9Sstevel@tonic-gate 1583*7c478bd9Sstevel@tonic-gate # Insert delta comments 1584*7c478bd9Sstevel@tonic-gate 1585*7c478bd9Sstevel@tonic-gate if [ "$WXFILE" ]; then 1586*7c478bd9Sstevel@tonic-gate wxcomments $P 1587*7c478bd9Sstevel@tonic-gate else 1588*7c478bd9Sstevel@tonic-gate deltacomments $PP $P 1589*7c478bd9Sstevel@tonic-gate fi 1590*7c478bd9Sstevel@tonic-gate 1591*7c478bd9Sstevel@tonic-gate # Add additional comments comment 1592*7c478bd9Sstevel@tonic-gate 1593*7c478bd9Sstevel@tonic-gate echo "<!-- Add comments to explain changes in $P here -->" 1594*7c478bd9Sstevel@tonic-gate 1595*7c478bd9Sstevel@tonic-gate # Add count of changes. 1596*7c478bd9Sstevel@tonic-gate 1597*7c478bd9Sstevel@tonic-gate if [ -f $F.count ]; then 1598*7c478bd9Sstevel@tonic-gate echo "<blockquote>" 1599*7c478bd9Sstevel@tonic-gate cat $F.count 1600*7c478bd9Sstevel@tonic-gate echo "</blockquote>" 1601*7c478bd9Sstevel@tonic-gate rm $F.count 1602*7c478bd9Sstevel@tonic-gate fi 1603*7c478bd9Sstevel@tonic-gatedone 1604*7c478bd9Sstevel@tonic-gate 1605*7c478bd9Sstevel@tonic-gateecho "</code>" 1606*7c478bd9Sstevel@tonic-gateecho 1607*7c478bd9Sstevel@tonic-gateecho 1608*7c478bd9Sstevel@tonic-gateecho "<P><HR><FONT SIZE=2>" 1609*7c478bd9Sstevel@tonic-gateecho "This code review page prepared with <b>webrev</b> (vers $WEBREV_UPDATED) on `date`." 1610*7c478bd9Sstevel@tonic-gateecho "</FONT>" 1611*7c478bd9Sstevel@tonic-gateecho "</html>" 1612*7c478bd9Sstevel@tonic-gate 1613*7c478bd9Sstevel@tonic-gateexec 1<&- # Close FD 1. 1614*7c478bd9Sstevel@tonic-gateexec 1<&3 # dup FD 3 to restore stdout. 1615*7c478bd9Sstevel@tonic-gateexec 3<&- # close FD 3. 1616*7c478bd9Sstevel@tonic-gate 1617*7c478bd9Sstevel@tonic-gateprint "\n$WDIR created." 1618