File: printer_function_with_view_indentation.k

package info (click to toggle)
kimwitu-doc 10a-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,192 kB
  • ctags: 341
  • sloc: makefile: 164; yacc: 125; ansic: 40; lex: 18; sh: 2
file content (15 lines) | stat: -rw-r--r-- 365 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdio.h>
#include "unpk.h"

void printer(char *s, uview v) {
    char c; int j;
    static indent=0;	/* static here, or static at file level */

    switch(v) {
    case v_left:	indent--; break;
    case v_right:	indent++; break;
    case v_nl:		putchar('\n');
			for (j=indent; j>0; j--) putchar('\t');
			break;
    default:		printf("%s", s); break;
}}