~ubuntu-branches/ubuntu/natty/evolution-data-server/natty

« back to all changes in this revision

Viewing changes to libdb/test/scr005/chk.nl

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh -
2
 
#
3
 
# $Id$
4
 
#
5
 
# Check to make sure that there are no trailing newlines in __db_err calls.
6
 
 
7
 
d=../..
8
 
 
9
 
[ -f $d/README ] || {
10
 
        echo "FAIL: chk.nl can't find the source directory."
11
 
        exit 1
12
 
}
13
 
 
14
 
cat << END_OF_CODE > t.c
15
 
#include <sys/types.h>
16
 
 
17
 
#include <errno.h>
18
 
#include <stdio.h>
19
 
 
20
 
int chk(FILE *, char *);
21
 
 
22
 
int
23
 
main(argc, argv)
24
 
        int argc;
25
 
        char *argv[];
26
 
{
27
 
        FILE *fp;
28
 
        int exitv;
29
 
 
30
 
        for (exitv = 0; *++argv != NULL;) {
31
 
                if ((fp = fopen(*argv, "r")) == NULL) {
32
 
                        fprintf(stderr, "%s: %s\n", *argv, strerror(errno));
33
 
                        return (1);
34
 
                }
35
 
                if (chk(fp, *argv))
36
 
                        exitv = 1;
37
 
                (void)fclose(fp);
38
 
        }
39
 
        return (exitv);
40
 
}
41
 
 
42
 
int
43
 
chk(fp, name)
44
 
        FILE *fp;
45
 
        char *name;
46
 
{
47
 
        int ch, exitv, line, q;
48
 
 
49
 
        exitv = 0;
50
 
        for (ch = 'a', line = 1;;) {
51
 
                if ((ch = getc(fp)) == EOF)
52
 
                        return (exitv);
53
 
                if (ch == '\n') {
54
 
                        ++line;
55
 
                        continue;
56
 
                }
57
 
                if (ch != '_') continue;
58
 
                if ((ch = getc(fp)) != '_') continue;
59
 
                if ((ch = getc(fp)) != 'd') continue;
60
 
                if ((ch = getc(fp)) != 'b') continue;
61
 
                if ((ch = getc(fp)) != '_') continue;
62
 
                if ((ch = getc(fp)) != 'e') continue;
63
 
                if ((ch = getc(fp)) != 'r') continue;
64
 
                if ((ch = getc(fp)) != 'r') continue;
65
 
                while ((ch = getc(fp)) != '"') {
66
 
                        if (ch == EOF)
67
 
                                return (exitv);
68
 
                        if (ch == '\n')
69
 
                                ++line;
70
 
                }
71
 
                while ((ch = getc(fp)) != '"')
72
 
                        switch (ch) {
73
 
                        case EOF:
74
 
                                return (exitv);
75
 
                        case '\\n':
76
 
                                ++line;
77
 
                                break;
78
 
                        case '.':
79
 
                                if ((ch = getc(fp)) != '"')
80
 
                                        ungetc(ch, fp);
81
 
                                else {
82
 
                                        fprintf(stderr,
83
 
                                    "%s: <period> at line %d\n", name, line);
84
 
                                        exitv = 1;
85
 
                                }
86
 
                                break;
87
 
                        case '\\\\':
88
 
                                if ((ch = getc(fp)) != 'n')
89
 
                                        ungetc(ch, fp);
90
 
                                else if ((ch = getc(fp)) != '"')
91
 
                                        ungetc(ch, fp);
92
 
                                else {
93
 
                                        fprintf(stderr,
94
 
                                    "%s: <newline> at line %d\n", name, line);
95
 
                                        exitv = 1;
96
 
                                }
97
 
                                break;
98
 
                        }
99
 
        }
100
 
        return (exitv);
101
 
}
102
 
END_OF_CODE
103
 
 
104
 
cc t.c -o t
105
 
if ./t $d/*/*.[ch] $d/*/*.cpp $d/*/*.in ; then
106
 
        :
107
 
else
108
 
        echo "FAIL: found __db_err calls ending with periods/newlines."
109
 
        exit 1
110
 
fi
111
 
 
112
 
exit 0