~ubuntu-branches/ubuntu/oneiric/gnupg2/oneiric-updates

« back to all changes in this revision

Viewing changes to tools/crlf.c

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* crlf.c
2
 
 * Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
3
 
 *
4
 
 * This file is free software; as a special exception the author gives
5
 
 * unlimited permission to copy and/or distribute it, with or without
6
 
 * modifications, as long as this notice is preserved.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful, but
9
 
 * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10
 
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 
 */
12
 
 
13
 
#include <stdio.h>
14
 
 
15
 
int
16
 
main(int argc, char **argv)
17
 
{
18
 
    int c, lc;
19
 
    int off=0;
20
 
 
21
 
    if( argc > 1 ) {
22
 
        fprintf(stderr, "no arguments, please\n");
23
 
        return 1;
24
 
    }
25
 
 
26
 
    lc = -1;
27
 
    while( (c=getchar()) != EOF ) {
28
 
      #if 0
29
 
        if( c == '\r' && lc == ' ' )
30
 
            fprintf(stderr,"SP,CR at %d\n", off );
31
 
        if( c == '\n' && lc == ' ' )
32
 
            fprintf(stderr,"SP,LF at %d\n", off );
33
 
      #endif
34
 
        if( c == '\n' && lc == '\r' )
35
 
            putchar(c);
36
 
        else if( c == '\n' ) {
37
 
            putchar('\r');
38
 
            putchar(c);
39
 
        }
40
 
        else if( c != '\n' && lc == '\r' ) {
41
 
            putchar('\n');
42
 
            putchar(c);
43
 
        }
44
 
        else
45
 
            putchar(c);
46
 
 
47
 
        lc = c;
48
 
        off++;
49
 
    }
50
 
 
51
 
    return 0;
52
 
}
53