1 /* $NetBSD: asa.c,v 1.11 1997/09/20 14:55:00 lukem Exp $ */
2 /* $FreeBSD: src/usr.bin/asa/asa.c,v 1.5 2002/05/15 03:31:40 tjr Exp $ */
3 /* $DragonFly: src/usr.bin/asa/asa.c,v 1.1 2004/06/20 02:52:15 hmp Exp $ */
5 * Copyright (c) 1993,94 Winning Strategies, Inc.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Winning Strategies, Inc.
19 * 4. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 static void asa(FILE *);
40 static void usage(void);
43 main(int argc, char *argv[])
49 while ((ch = getopt(argc, argv, "")) != -1) {
64 while ((fn = *argv++) != NULL) {
65 if ((fp = fopen(fn, "r")) == NULL) {
82 fprintf(stderr, "usage: asa [file...]\n");
92 if ((buf = fgetln(f, &len)) != NULL) {
93 if (buf[len - 1] == '\n')
95 /* special case the first line */
105 if (len > 1 && buf[0] && buf[1])
106 printf("%.*s", (int)(len - 1), buf + 1);
108 while ((buf = fgetln(f, &len)) != NULL) {
109 if (buf[len - 1] == '\n')
128 if (len > 1 && buf[0] && buf[1])
129 printf("%.*s", (int)(len - 1), buf + 1);