Commit c8c024d9 c8c024d98a8a7f19c9f65284c0eea5ecaae52143 by Sergey Poznyakoff

New file

1 parent 146ae80d
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2005 Free Software Foundation, Inc.
3
4 GNU Mailutils is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 GNU Mailutils is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with GNU Mailutils; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 MA 02110-1301 USA */
18
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
22 #include <errno.h>
23 #include <unistd.h>
24 #include <getline.h>
25 #include <mailutils/argcv.h>
26
27 int
28 main(int argc, char **argv)
29 {
30 char *delim = "";
31 char *comment = "#";
32 char *buf = NULL;
33 size_t n = 0;
34
35 while (getline (&buf, &n, stdin) > 0)
36 {
37 int status, i, c;
38 char **v;
39 char *s;
40
41 status = argcv_get (buf, delim, comment, &c, &v);
42 if (status)
43 {
44 fprintf (stderr, "cannot parse: %s\n", mu_strerror (status));
45 continue;
46 }
47 status = argcv_string (c, v, &s);
48 if (status)
49 fprintf (stderr, "cannot create string: %s\n", mu_strerror (status));
50 else
51 {
52 printf ("%d: %s\n", c, s);
53 free (s);
54 }
55 argcv_free (c, v);
56 }
57 free (buf);
58 exit (0);
59 }
1 # This file is part of Mailutils testsuite.
2 # Copyright (C) 2005, Free Software Foundation
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 #
18 1 2 3
19 3: 1 2 3
20
21 quoted\ space
22 1: "quoted space"
23
24 a "tab character"
25 2: a tab\tcharacter
26
27 \157\143\164\141\154\40and\x20\x68\x65\x78
28 1: "octal and hex"
29
30 \157\143\164\141\154\40 and \x20\x68\x65\x78
31 3: "octal " and " hex"
32
33 A\x3-\48\39
34 1: A\003-\0048\0039
35
36 message: ASCII upper part
37 ×ÅÒÈÎÑÑ ÐÏÌÏ×ÉÎÁ ÔÁÂÌÉÃÙ
38 3: \327\305\322\310\316\321\321 \320\317\314\317\327\311\316\301 \324\301\302\314\311\303\331
39