/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1992-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* asa.c
* Written by David Korn
* AT&T Labs
* Tue Mar 25 11:03:23 EST 2003
*/
static const char usage[] =
"[-?\n@(#)$Id: asa (AT&T Research) 2003-03-25 $\n]"
"[-author?David Korn <dgk@research.att.com>]"
"[-license?http://www.research.att.com/sw/tools/reuse]"
"[+NAME?asa - interpret carriage-control characters]"
"[+DESCRIPTION?\basa\b writes its input files to standard output mapping "
"carriage control characters to line-printer control sequences.]"
"[+?The first character of each line or record is removed from the input and "
"is processed as follows before the rest of the line is output:]{"
"[+0?A new-line is output.]"
"[+1?Advance to the next page.]"
"[++?Overwrite the previous line.]"
"[+\aspace\a?Just output the remainder of the line.]"
"}"
"[+?Any other character as the first character is treated as if "
"it were a space.]"
"[+?If no \afile\a operands are given or if the \afile\a is \b-\b, \basa\b "
"reads from standard input. The start of the file is defined as the "
"current offset.]"
"[r]#[reclen?If \areclen\a is greater than zero, the file is assumed to "
"consist of fixed length records of length \areclen\a.]"
"\n"
"\n[file ... ]\n"
"\n"
"[+EXIT STATUS?]{"
"[+0?Success.]"
"[+>0?An error occurred.]"
"}"
"[+SEE ALSO?\blpr\b(1)]"
;
#include <cmd.h>
{
register char *cp;
register int n, c = 0;
while(1)
{
if(reclen>0)
else
if(!cp)
break;
if(reclen<=0)
else
while(--n>0 && cp[n]==' ');
switch(*cp)
{
case '\n':
break;
case '0':
break;
case '1':
if(c)
{
c = '\f';
}
break;
case '+':
c = '\r';
break;
}
if(c)
if(n>0)
c = '\n';
}
if(c)
return(0);
}
int
{
register char *cp;
register int n, reclen=0;
{
case 'r':
break;
case ':':
break;
case '?':
break;
}
if(error_info.errors)
argv++;
do
{
{
continue;
}
return(error_info.errors);
}