|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T r
Length: 1747 (0x6d3)
Types: TextFile
Names: »rfctxtfold.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z«
└─⟦e5a54fb17⟧
└─⟦this⟧ »pp-5.0/Lib/format/rfctxtfold.c«
/* rfctxtfold.c - does simple folding for a string */
# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/format/RCS/rfctxtfold.c,v 5.0 90/09/20 16:06:03 pp Exp Locker: pp $";
# endif
/*
* $Header: /cs/research/pp/hubris/pp-beta/Lib/format/RCS/rfctxtfold.c,v 5.0 90/09/20 16:06:03 pp Exp Locker: pp $
*
* $Log: rfctxtfold.c,v $
* Revision 5.0 90/09/20 16:06:03 pp
* rcsforce : 5.0 public release
*
*/
#include "util.h"
/* ------------- Begin Routines ---------------------------------------- */
void rfctxtfold (input, output, linelen)
char *input;
char *output;
int linelen;
{
int n = 0,
nsav = 0;
char *insav = NULLCP,
*outsav = NULLCP;
*output = NULL;
if (input == NULLCP) return;
while (*input) {
switch (*input) {
case '\t':
n += 7;
case ' ':
if (n == linelen && *(input+1)) {
/* -- max len reached & more to come -- */
input++;
*output ++ = '\n';
*output ++ = '\t';
n = 8;
break;
}
else if (n > linelen && *(input+1)) {
/* -- max len exceeded & more to come -- */
if (nsav && insav) {
/* --- *** ---
if values have been previously saved
then go back to the previous spaces
--- *** --- */
n = 8;
input = ++insav;
*outsav ++ = '\n';
*outsav ++ = '\t';
output = outsav;
nsav = 0;
insav = outsav = NULLCP;
}
else
goto rfctxtfold_save;
}
else {
rfctxtfold_save:;
/* -- save info and then fall -- */
nsav = n;
insav = input;
outsav = output;
}
default:
*output ++ = *input ++;
n ++;
break;
}
}
if (n > 0 && *(output - 1) != '\n')
*output ++ = '\n';
*output = NULL;
}