io.c (27419) | io.c (48566) |
---|---|
1/* 2 * Copyright (c) 1985 Sun Microsystems, Inc. 3 * Copyright (c) 1980, 1993 4 * The Regents of the University of California. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 24 unchanged lines hidden (view full) --- 33 * SUCH DAMAGE. 34 */ 35 36#ifndef lint 37#if 0 38static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; 39#endif 40static const char rcsid[] = | 1/* 2 * Copyright (c) 1985 Sun Microsystems, Inc. 3 * Copyright (c) 1980, 1993 4 * The Regents of the University of California. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 24 unchanged lines hidden (view full) --- 33 * SUCH DAMAGE. 34 */ 35 36#ifndef lint 37#if 0 38static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; 39#endif 40static const char rcsid[] = |
41 "$Id$"; | 41 "$Id: io.c,v 1.3 1997/07/15 09:50:59 charnier Exp $"; |
42#endif /* not lint */ 43 44#include <ctype.h> 45#include <err.h> 46#include <stdio.h> 47#include <stdlib.h> 48#include <string.h> 49#include "indent_globs.h" --- 29 unchanged lines hidden (view full) --- 79 else { 80 ps.bl_line = true; 81 n_real_blanklines++; 82 } 83 } 84 else if (!inhibit_formatting) { 85 suppress_blanklines = 0; 86 ps.bl_line = false; | 42#endif /* not lint */ 43 44#include <ctype.h> 45#include <err.h> 46#include <stdio.h> 47#include <stdlib.h> 48#include <string.h> 49#include "indent_globs.h" --- 29 unchanged lines hidden (view full) --- 79 else { 80 ps.bl_line = true; 81 n_real_blanklines++; 82 } 83 } 84 else if (!inhibit_formatting) { 85 suppress_blanklines = 0; 86 ps.bl_line = false; |
87 if (prefix_blankline_requested && not_first_line) | 87 if (prefix_blankline_requested && not_first_line) { |
88 if (swallow_optional_blanklines) { 89 if (n_real_blanklines == 1) 90 n_real_blanklines = 0; 91 } 92 else { 93 if (n_real_blanklines == 0) 94 n_real_blanklines = 1; 95 } | 88 if (swallow_optional_blanklines) { 89 if (n_real_blanklines == 1) 90 n_real_blanklines = 0; 91 } 92 else { 93 if (n_real_blanklines == 0) 94 n_real_blanklines = 1; 95 } |
96 } |
|
96 while (--n_real_blanklines >= 0) 97 putc('\n', output); 98 n_real_blanklines = 0; 99 if (ps.ind_level == 0) 100 ps.ind_stmt = 0; /* this is a class A kludge. dont do 101 * additional statement indentation if we are 102 * at bracket level 0 */ 103 --- 129 unchanged lines hidden (view full) --- 233 putc('\n', output); 234 cur_col = 1; 235 ++ps.out_lines; 236 } 237 while (e_com > com_st && isspace(e_com[-1])) 238 e_com--; 239 cur_col = pad_output(cur_col, target); 240 if (!ps.box_com) { | 97 while (--n_real_blanklines >= 0) 98 putc('\n', output); 99 n_real_blanklines = 0; 100 if (ps.ind_level == 0) 101 ps.ind_stmt = 0; /* this is a class A kludge. dont do 102 * additional statement indentation if we are 103 * at bracket level 0 */ 104 --- 129 unchanged lines hidden (view full) --- 234 putc('\n', output); 235 cur_col = 1; 236 ++ps.out_lines; 237 } 238 while (e_com > com_st && isspace(e_com[-1])) 239 e_com--; 240 cur_col = pad_output(cur_col, target); 241 if (!ps.box_com) { |
241 if (star_comment_cont && (com_st[1] != '*' || e_com <= com_st + 1)) | 242 if (star_comment_cont && (com_st[1] != '*' || e_com <= com_st + 1)) { |
242 if (com_st[1] == ' ' && com_st[0] == ' ' && e_com > com_st + 1) 243 com_st[1] = '*'; 244 else 245 fwrite(" * ", com_st[0] == '\t' ? 2 : com_st[0] == '*' ? 1 : 3, 1, output); | 243 if (com_st[1] == ' ' && com_st[0] == ' ' && e_com > com_st + 1) 244 com_st[1] = '*'; 245 else 246 fwrite(" * ", com_st[0] == '\t' ? 2 : com_st[0] == '*' ? 1 : 3, 1, output); |
247 } |
|
246 } 247 fwrite(com_st, e_com - com_st, 1, output); 248 ps.comment_delta = ps.n_comment_delta; 249 cur_col = count_spaces(cur_col, com_st); 250 ++ps.com_lines; /* count lines with comments */ 251 } 252 if (ps.use_ff) 253 putc('\014', output); --- 376 unchanged lines hidden --- | 248 } 249 fwrite(com_st, e_com - com_st, 1, output); 250 ps.comment_delta = ps.n_comment_delta; 251 cur_col = count_spaces(cur_col, com_st); 252 ++ps.com_lines; /* count lines with comments */ 253 } 254 if (ps.use_ff) 255 putc('\014', output); --- 376 unchanged lines hidden --- |