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

« back to all changes in this revision

Viewing changes to camel/camel-index-control.c

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-10-08 12:58:16 UTC
  • mfrom: (181.1.7 quantal)
  • Revision ID: package-import@ubuntu.com-20121008125816-i3n76e8c0m64e7xp
Tags: 3.6.0-0ubuntu2
* Fix LP: #1038047 part 1 - Don't abort in e_source_registry_new* when a
  problem occurs connecting to the Dbus service
  - add debian/patches/dont-abort-in-e_source_registry_new.patch
  - update debian/patches/series
* Fix LP: #1038047 part 2 - libedataserver depends on
  evolution-data-server-common to ensure that the GSettings schemas are
  present
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
G_GNUC_NORETURN static void
24
24
do_usage (gchar *argv0)
25
25
{
26
 
        fprintf(stderr, "Usage: %s [ compress | dump | info ] file(s) ...\n", argv0);
27
 
        fprintf(stderr, " compress - compress (an) index file(s)\n");
28
 
        fprintf(stderr, " dump - dump (an) index file's content to stdout\n");
29
 
        fprintf(stderr, " info - dump summary info to stdout\n");
 
26
        fprintf (stderr, "Usage: %s [ compress | dump | info ] file(s) ...\n", argv0);
 
27
        fprintf (stderr, " compress - compress (an) index file(s)\n");
 
28
        fprintf (stderr, " dump - dump (an) index file's content to stdout\n");
 
29
        fprintf (stderr, " info - dump summary info to stdout\n");
30
30
        exit (1);
31
31
}
32
32
 
38
38
        CamelIndex *idx;
39
39
 
40
40
        for (i = 2; i < argc; i++) {
41
 
                printf("Opening index file: %s\n", argv[i]);
 
41
                printf ("Opening index file: %s\n", argv[i]);
42
42
                idx = (CamelIndex *) camel_text_index_new (argv[i], O_RDWR);
43
43
                if (idx) {
44
 
                        printf(" Compressing ...\n");
 
44
                        printf (" Compressing ...\n");
45
45
                        if (camel_index_compress (idx) == -1) {
46
46
                                g_object_unref (idx);
47
47
                                return 1;
48
48
                        }
49
49
                        g_object_unref (idx);
50
50
                } else {
51
 
                        printf(" Failed: %s\n", g_strerror (errno));
 
51
                        printf (" Failed: %s\n", g_strerror (errno));
52
52
                        return 1;
53
53
                }
54
54
        }
63
63
        CamelIndex *idx;
64
64
 
65
65
        for (i = 2; i < argc; i++) {
66
 
                printf("Opening index file: %s\n", argv[i]);
 
66
                printf ("Opening index file: %s\n", argv[i]);
67
67
                idx = (CamelIndex *) camel_text_index_new (argv[i], O_RDONLY);
68
68
                if (idx) {
69
 
                        printf(" Dumping ...\n");
 
69
                        printf (" Dumping ...\n");
70
70
                        camel_text_index_dump ((CamelTextIndex *) idx);
71
71
                        g_object_unref (idx);
72
72
                } else {
73
 
                        printf(" Failed: %s\n", g_strerror (errno));
 
73
                        printf (" Failed: %s\n", g_strerror (errno));
74
74
                        return 1;
75
75
                }
76
76
        }
85
85
        CamelIndex *idx;
86
86
 
87
87
        for (i = 2; i < argc; i++) {
88
 
                printf("Opening index file: %s\n", argv[i]);
 
88
                printf ("Opening index file: %s\n", argv[i]);
89
89
                idx = (CamelIndex *) camel_text_index_new (argv[i], O_RDONLY);
90
90
                if (idx) {
91
91
                        camel_text_index_info ((CamelTextIndex *) idx);
92
92
                        g_object_unref (idx);
93
93
                } else {
94
 
                        printf(" Failed: %s\n", g_strerror (errno));
 
94
                        printf (" Failed: %s\n", g_strerror (errno));
95
95
                        return 0;
96
96
                }
97
97
        }
106
106
        CamelIndex *idx;
107
107
 
108
108
        for (i = 2; i < argc; i++) {
109
 
                printf("Opening index file: %s\n", argv[i]);
 
109
                printf ("Opening index file: %s\n", argv[i]);
110
110
                idx = (CamelIndex *) camel_text_index_new (argv[i], O_RDONLY);
111
111
                if (idx) {
112
112
                        camel_text_index_validate ((CamelTextIndex *) idx);
113
113
                        g_object_unref (idx);
114
114
                } else {
115
 
                        printf(" Failed: %s\n", g_strerror (errno));
 
115
                        printf (" Failed: %s\n", g_strerror (errno));
116
116
                        return 0;
117
117
                }
118
118
        }
128
128
 
129
129
        camel_init (NULL, 0);
130
130
 
131
 
        if (!strcmp(argv[1], "compress"))
 
131
        if (!strcmp (argv[1], "compress"))
132
132
                return do_compress (argc, argv);
133
 
        else if (!strcmp(argv[1], "dump"))
 
133
        else if (!strcmp (argv[1], "dump"))
134
134
                return do_dump (argc, argv);
135
 
        else if (!strcmp(argv[1], "info"))
 
135
        else if (!strcmp (argv[1], "info"))
136
136
                return do_info (argc, argv);
137
 
        else if (!strcmp(argv[1], "check"))
 
137
        else if (!strcmp (argv[1], "check"))
138
138
                return do_check (argc, argv);
139
 
        else if (!strcmp(argv[1], "perf"))
 
139
        else if (!strcmp (argv[1], "perf"))
140
140
                return do_perf (argc, argv);
141
141
 
142
142
        do_usage (argv[0]);
164
164
 
165
165
        dir = opendir (path);
166
166
        if (dir == NULL) {
167
 
                perror("open dir");
 
167
                perror ("open dir");
168
168
                return 1;
169
169
        }
170
170
 
171
171
        idx = (CamelIndex *) camel_text_index_new (
172
 
                "/tmp/index", O_TRUNC|O_CREAT|O_RDWR);
 
172
                "/tmp/index", O_TRUNC | O_CREAT | O_RDWR);
173
173
        if (idx == NULL) {
174
 
                perror("open index");
 
174
                perror ("open index");
175
175
                closedir (dir);
176
176
                return 1;
177
177
        }
183
183
        camel_stream_filter_add ((CamelStreamFilter *) filter, filter_index);
184
184
 
185
185
        while ((d = readdir (dir))) {
186
 
                printf("indexing '%s'\n", d->d_name);
 
186
                printf ("indexing '%s'\n", d->d_name);
187
187
 
188
188
                idn = camel_index_add_name (idx, d->d_name);
189
189
                camel_mime_filter_index_set_name (
190
190
                        CAMEL_MIME_FILTER_INDEX (filter_index), idn);
191
 
                name = g_strdup_printf("%s/%s", path, d->d_name);
 
191
                name = g_strdup_printf ("%s/%s", path, d->d_name);
192
192
                stream = camel_stream_fs_new_with_name (name, O_RDONLY, 0, NULL);
193
193
                camel_stream_write_to_stream (stream, filter, NULL, NULL);
194
194
                g_object_unref (stream);