/* (void) initline(Line *m) (void) extend_line(Line *l, int n) (void) cpytitlestr(char *str, Line *ttl, int i, int pass) Copyright (c) 1992 by CRC */ #include "creatdct.h" /* ------------------------------------------------------------------------ */ /* (void) initline(Line *l) */ void initline(l) register Line *l ; { l->n = 0 ; l->s[0] = '\0' ; } /* ------------------------------------------------------------------------ */ /* (void) extendline(Line *l, int n) Extends (pads with blanks) line l to have length n if n > current length of line; otherwise, does nothing. */ void extend_line(l,n) Line *l ; int n ; { register int i ; if (l->n >= n) return ; for (i= l->n; is[i] = ' ' ; l->s[i] = '\0' ; l->n = n ; } /* ------------------------------------------------------------------------ */ /* (void) cpytitlestr(char *str, Line *ttl, int i, int pass) copies i-th title from Line ttl into string str. str contains no leading nor trailing blanks. if pass==1, title information is copied using col and w, otherwise tcol and tw are used. */ void cpytitlestr(str,ttl,i,pass) char *str ; Line *ttl ; int i ; int pass ; { int col, endcol ; char c ; char tok[MAXWIDTH] ; col = (pass==1 ? vars[i].col : vars[i].tcol) ; endcol = col + (pass==1 ? vars[i].w : vars[i].tw) ; c = ttl->s[endcol] ; ttl->s[endcol] = '\0' ; strcpy(tok, &(ttl->s[col])) ; ttl->s[endcol] = c ; strcpy(str,skipblnk(tok)) ; righttrim(str) ; }