colcrt.c (102084) | colcrt.c (102944) |
---|---|
1/* 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 30 unchanged lines hidden (view full) --- 39 40#if 0 41#ifndef lint 42static char sccsid[] = "@(#)colcrt.c 8.1 (Berkeley) 6/6/93"; 43#endif 44#endif 45 46#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 30 unchanged lines hidden (view full) --- 39 40#if 0 41#ifndef lint 42static char sccsid[] = "@(#)colcrt.c 8.1 (Berkeley) 6/6/93"; 43#endif 44#endif 45 46#include <sys/cdefs.h> |
47__FBSDID("$FreeBSD: head/usr.bin/colcrt/colcrt.c 102084 2002-08-19 03:07:56Z jmallett $"); | 47__FBSDID("$FreeBSD: head/usr.bin/colcrt/colcrt.c 102944 2002-09-04 23:29:10Z dwmalone $"); |
48 49#include <err.h> 50#include <stdio.h> 51#include <stdlib.h> 52#include <string.h> 53#include <unistd.h> 54/* 55 * colcrt - replaces col for crts with new nroff esp. when using tbl. --- 20 unchanged lines hidden (view full) --- 76FILE *f; 77 78static void move(int, int); 79static void pflush(int); 80static int plus(char, char); 81static void usage(void); 82 83int | 48 49#include <err.h> 50#include <stdio.h> 51#include <stdlib.h> 52#include <string.h> 53#include <unistd.h> 54/* 55 * colcrt - replaces col for crts with new nroff esp. when using tbl. --- 20 unchanged lines hidden (view full) --- 76FILE *f; 77 78static void move(int, int); 79static void pflush(int); 80static int plus(char, char); 81static void usage(void); 82 83int |
84main(argc, argv) 85 int argc; 86 char *argv[]; | 84main(int argc, char *argv[]) |
87{ 88 int c; 89 char *cp, *dp; 90 int ch; 91 92 while ((ch = getopt(argc, argv, "-2")) != -1) 93 switch (ch) { 94 case '-': --- 91 unchanged lines hidden (view full) --- 186 } 187 } 188 } while (argc > 0); 189 fflush(stdout); 190 exit(0); 191} 192 193static void | 85{ 86 int c; 87 char *cp, *dp; 88 int ch; 89 90 while ((ch = getopt(argc, argv, "-2")) != -1) 91 switch (ch) { 92 case '-': --- 91 unchanged lines hidden (view full) --- 184 } 185 } 186 } while (argc > 0); 187 fflush(stdout); 188 exit(0); 189} 190 191static void |
194usage() | 192usage(void) |
195{ 196 fprintf(stderr, "usage: colcrt [-] [-2] [file ...]\n"); 197 exit(1); 198} 199 200static int | 193{ 194 fprintf(stderr, "usage: colcrt [-] [-2] [file ...]\n"); 195 exit(1); 196} 197 198static int |
201plus(c, d) 202 char c, d; | 199plus(char c, char d) |
203{ 204 205 return ((c == '|' && d == '-') || d == '_'); 206} 207 208int first; 209 210static void | 200{ 201 202 return ((c == '|' && d == '-') || d == '_'); 203} 204 205int first; 206 207static void |
211pflush(ol) 212 int ol; | 208pflush(int ol) |
213{ | 209{ |
214 register int i; 215 register char *cp; | 210 int i; 211 char *cp; |
216 char lastomit; 217 int l; 218 219 l = ol; 220 lastomit = 0; 221 if (l > 266) 222 l = 266; 223 else --- 14 unchanged lines hidden (view full) --- 238 bcopy(page[ol], page, (267 - ol) * 132); 239 bzero(page[267- ol], ol * 132); 240 outline -= ol; 241 outcol = 0; 242 first = 1; 243} 244 245static void | 212 char lastomit; 213 int l; 214 215 l = ol; 216 lastomit = 0; 217 if (l > 266) 218 l = 266; 219 else --- 14 unchanged lines hidden (view full) --- 234 bcopy(page[ol], page, (267 - ol) * 132); 235 bzero(page[267- ol], ol * 132); 236 outline -= ol; 237 outcol = 0; 238 first = 1; 239} 240 241static void |
246move(l, m) 247 int l, m; | 242move(int l, int m) |
248{ | 243{ |
249 register char *cp, *dp; | 244 char *cp, *dp; |
250 251 for (cp = page[l], dp = page[m]; *cp; cp++, dp++) { 252 switch (*cp) { 253 case '|': 254 if (*dp != ' ' && *dp != '|' && *dp != 0) 255 return; 256 break; 257 case ' ': --- 14 unchanged lines hidden --- | 245 246 for (cp = page[l], dp = page[m]; *cp; cp++, dp++) { 247 switch (*cp) { 248 case '|': 249 if (*dp != ' ' && *dp != '|' && *dp != 0) 250 return; 251 break; 252 case ' ': --- 14 unchanged lines hidden --- |