write.c (29431) | write.c (29433) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Jef Poskanzer and Craig Leres of the Lawrence Berkeley Laboratory. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 31 unchanged lines hidden (view full) --- 40 The Regents of the University of California. All rights reserved.\n"; 41#endif /* not lint */ 42 43#ifndef lint 44#if 0 45static char sccsid[] = "@(#)write.c 8.1 (Berkeley) 6/6/93"; 46#endif 47static const char rcsid[] = | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Jef Poskanzer and Craig Leres of the Lawrence Berkeley Laboratory. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 31 unchanged lines hidden (view full) --- 40 The Regents of the University of California. All rights reserved.\n"; 41#endif /* not lint */ 42 43#ifndef lint 44#if 0 45static char sccsid[] = "@(#)write.c 8.1 (Berkeley) 6/6/93"; 46#endif 47static const char rcsid[] = |
48 "$Id: write.c,v 1.8 1997/09/15 00:08:19 ache Exp $"; | 48 "$Id: write.c,v 1.9 1997/09/15 00:17:38 ache Exp $"; |
49#endif /* not lint */ 50 51#include <sys/param.h> 52#include <sys/signal.h> 53#include <sys/stat.h> 54#include <sys/file.h> 55#include <sys/time.h> 56#include <ctype.h> --- 250 unchanged lines hidden (view full) --- 307 308#define PUTC(c) if (putchar(c) == EOF) err(1, NULL); 309 310 for (; *s != '\0'; ++s) { 311 if (*s == '\n') { 312 PUTC('\r'); 313 } else if (((*s & 0x80) && *s < 0xA0) || 314 /* disable upper controls */ | 49#endif /* not lint */ 50 51#include <sys/param.h> 52#include <sys/signal.h> 53#include <sys/stat.h> 54#include <sys/file.h> 55#include <sys/time.h> 56#include <ctype.h> --- 250 unchanged lines hidden (view full) --- 307 308#define PUTC(c) if (putchar(c) == EOF) err(1, NULL); 309 310 for (; *s != '\0'; ++s) { 311 if (*s == '\n') { 312 PUTC('\r'); 313 } else if (((*s & 0x80) && *s < 0xA0) || 314 /* disable upper controls */ |
315 (!isprint(*s) && !isspace(*s) && *s != '\007') | 315 (!isprint(*s) && !isspace(*s) && 316 *s != '\a' && *s != '\b') |
316 ) { 317 if (*s & 0x80) { 318 *s &= ~0x80; 319 PUTC('M'); 320 PUTC('-'); 321 } 322 if (iscntrl(*s)) { 323 *s ^= 0x40; 324 PUTC('^'); 325 } 326 } 327 PUTC(*s); 328 } 329 return; 330#undef PUTC 331} | 317 ) { 318 if (*s & 0x80) { 319 *s &= ~0x80; 320 PUTC('M'); 321 PUTC('-'); 322 } 323 if (iscntrl(*s)) { 324 *s ^= 0x40; 325 PUTC('^'); 326 } 327 } 328 PUTC(*s); 329 } 330 return; 331#undef PUTC 332} |