4 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
5 # Use is subject to license terms.
9 # The contents of this file are subject to the terms of the
10 # Common Development and Distribution License (the "License").
11 # You may not use this file except in compliance with the License.
13 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
14 # or http://www.opensolaris.org/os/licensing.
15 # See the License for the specific language governing permissions
16 # and limitations under the License.
18 # When distributing Covered Code, include this CDDL HEADER in each
19 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
20 # If applicable, add the following below this CDDL HEADER, with the
21 # fields enclosed by brackets "[]" replaced with your own identifying
22 # information: Portions Copyright [yyyy] [name of copyright owner]
26 #ident "%Z%%M% %I% %E% SMI"
30 # Replacement for /usr/bin/nl in the sgs/messages piglatin tests.
32 # usage: sgsmsg_piglatin_nl start_index
34 # where start_index is the staring number
37 # The sgs/messages test target used to use /usr/bin/nl as part
38 # of the process of adding a piglatin translation to the file.
39 # The invocations looked like:
45 # This adds line numbers to the beginning of each non-empty line
46 # from stdin, counting by 2, and starting at either 1 or 2, depending
47 # on whether the master file, or the piglatin file is being processed.
49 # The output format is "%6d\t%s". Empty lines are replaced with
50 # 7 space characters in the output, and the line number is not
53 # The problem with nl is that it has a 2K buffer for input lines,
54 # and our catalog files can have some very long lines, thanks to
55 # the elfedit module help strings. This perl script emulates nl
56 # to the extent required to replace it in the sgs piglatin tests,
57 # while not breaking lines longer than 2K characters.
62 use vars
qw($script $lineno);
64 $script = 'sgsmsg_piglatin_nl';
66 die "usage: $script start_index\n" if ($ARGV[0] eq '');
67 $lineno = int($ARGV[0]);
71 if (($_ ne "") && ($_ ne "\n")) {
72 printf ("%6d\t%s", $lineno, $_);