Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/5/84; site reed.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!ihnp4!zehntel!tektronix!reed!mikec
From: mikec@reed.UUCP (Michael Cooper)
Newsgroups: net.sources
Subject: listc -- a program to list C code in a formatted manner.
Message-ID: <739@reed.UUCP>
Date: Fri, 30-Nov-84 21:50:34 EST
Article-I.D.: reed.739
Posted: Fri Nov 30 21:50:34 1984
Date-Received: Sun, 2-Dec-84 05:26:23 EST
Distribution: net
Organization: Tabr Sietch - Portland, Oregon
Lines: 446

[ This line is not equal; it is being sacrificed. ]

listc is a program to print C source files in a formated manner.
This is done using indenting, level tracking, page breaks, etc.
For a full description refer to the manual.

					Michael Cooper

______________________________________________________________________________
{decvax, ucbvax, pur-ee, uw-beaver, masscomp, cbosg,
 mit-ems, psu-cs, uoregon, orstcs, ihnp4, uf-cgrl}!tektronix
						      \
						       +---!reed!mikec
{teneron, ogcvax, muddcs, cadic, oresoft, grpwre,     /
 				 isonvax, nsc-pdc}---+

#----------C--U--T-----H--E--R--E---------------C--U--T-------H--E--R--E-------
# This is a shell archive.  Remove anything before this line, then
# unpack it by saving it in a file and typing sh file.  (Files
# unpacked will be owned by you and have default permissions.)
#
# Date Created: Fri Nov 30 18:43:30 PST 1984
# Contents of archive:
# Makefile README listc.1 listc.c
echo x - listc.1
sed 's/^x//' >listc.1 <<'!Funky!Stuff!'
x.TH LISTC 1 
x.SH NAME
xlistc \- list C source code
x.SH SYNOPSIS
x.B listc 
x[ 
x.B \-h 
x.UL 
xheader
x.B \-i# 
x.B \-l 
x.B \-L 
x.B \-f
x.B \-e 
x] 
x.B file1 
x.B file2 ... 
x.B filen
x.br
x.SH DESCRIPTION
x.I listc
xprints a listing of C source code using line numbering and level
xtracking.  
xIt is based on a version originally written in Whitesmith's
xC and then converted to run under standard C.  
xThis version is not derived from the original.  
xOnly the basic format is.  
xUnlike the original, though,
xit currently does not support a cross referencing option.  This
xmay be a while.
x.PP
xThe following options are currently supported:
x.TP 10
x.B "l"		
xTurn off the line numbering.
x.TP 10
x.B "L"		
xTurn off the level tracking.
x.TP 10
x.B "i#"		
xIndent # spaces before every line.
x.TP 10
x.B "h header"	
xPlace header in place of the file name.
x.TP 10
x.B "f"
xUse newlines instead of formfeeds.
x.TP 10
x.B "e"		
xEnhance the braces [ {} ] in a file.
x.br
x.sp 1
x.SH "SEE ALSO"
xpr(1)
x.sp 1
x.SH DIAGNOSTICS
xThere are no diagnostics.
x.sp 1
x.SH AUTHOR
xMichael Cooper (tektronix!reed!mikec)
!Funky!Stuff!
echo x - Makefile
cat >Makefile <<'!Funky!Stuff!'
#
# Makefile for listc
#
# 11-22-84	reed!mikec
#

CC = cc
CFLAGS = -O -s
# destination directory
BIN = /bin
# put in a define for HELP if you want a help summary printed along
# with a usage message.  Just a usage message is printed if this is not
# defined.
DEFS=

listc: listc.c
	${CC} ${CFLAGS} ${DEFS} listc.c -o listc


install: listc 
	mv listc ${BIN}

man: listc.1
	nroff -man listc.1 > listc.man

all: listc man
!Funky!Stuff!
echo x - README
cat >README <<'!Funky!Stuff!'
11-22-84						Michael Cooper

This directory contains the source to listc.  To compile it, just
type 'make'.  Look at Makefile for local dependancies. 

Please send comments/changes/fixes to:

{decvax, ucbvax, pur-ee, uw-beaver, masscomp, cbosg,
 mit-ems, psu-cs, uoregon, orstcs, ihnp4, uf-cgrl}!tektronix
						      \
						       +---!reed!mikec
{teneron, ogcvax, muddcs, cadic, oresoft, grpwre,     /
 				 isonvax, nsc-pdc}---+
!Funky!Stuff!
echo x - listc.c
cat >listc.c <<'!Funky!Stuff!'
/*
**
**	LISTC:		Make nice listings of C source files.
**
**  options:
**
**	-l		turn off line numbering.
**	-L		turn off level tracking.
**	-i#		indent # spaces before every line.
**	-h header	place header in place of the file name.
**	-f		turn off formfeeds and use '\n'.
**	-e		enhance the braces in a file ({}).
**
**  usage: listc [-h header -i# -l -L -f -e] file1 file2 ... filen
**
**
**	Michael Cooper
**	tektronix!reed!mikec
**
*/

#include 
#include 
#include 
#include 

#define MAXLINE 135
#define PAGESIZE 54

int     linenum,
        level,
        pagenum,
        inum,
        hflag,
        iflag,
        Lflag,
        eflag,
        fflag,
        lflag;

char    line[MAXLINE],
       *sheader;
char   *ctime ();


FILE * fp;

main (argc, argv)
int     argc;
char   *argv[];
{
	int     lines,
	        x,
	        i;
	hflag = inum = x = eflag = fflag = Lflag = iflag = lflag = 0;

	if (argc == 1)
		help ();

	for(x=1; x