~ubuntu-branches/ubuntu/raring/maradns/raring

« back to all changes in this revision

Viewing changes to deadwood-2.4.10/sqa/sqa_incomplete_last_line/incomplete.last.line.c

  • Committer: Bazaar Package Importer
  • Author(s): Kai Hendry
  • Date: 2010-01-24 12:17:40 UTC
  • mfrom: (1.1.13 upstream) (10.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100124121740-a4e1fjobwaouz443
Tags: 1.4.02-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Make a file one with an incomplete last line */
 
2
 
 
3
#include <stdio.h>
 
4
 
 
5
main() {
 
6
        int a,n;
 
7
        n = 0;
 
8
        for(;;) {
 
9
                a = getc(stdin);
 
10
                if(feof(stdin)) {
 
11
                        exit(0);
 
12
                }
 
13
                if(n == 1) {
 
14
                        printf("\n");
 
15
                        n = 0;
 
16
                }
 
17
                if(a != '\n') {
 
18
                        printf("%c",a);
 
19
                } else {
 
20
                        n = 1;
 
21
                }
 
22
        }
 
23
}