Last change
on this file was
5212,
checked in by westram, 17 years ago
|
- missing \n
- removed unused code
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
834 bytes
|
Line | |
---|
1 | #include <stdio.h> |
---|
2 | #include <stdlib.h> |
---|
3 | #include <string.h> |
---|
4 | #include <arbdb.h> |
---|
5 | #include <arbdbt.h> |
---|
6 | |
---|
7 | int main(int argc,char **argv) |
---|
8 | { |
---|
9 | if (argc == 1) { |
---|
10 | fprintf(stderr, "Usage: arb_message \"the message\"\n"); |
---|
11 | return -1; |
---|
12 | } |
---|
13 | |
---|
14 | const char *progname = argv[0]; |
---|
15 | if (!progname || progname[0] == 0) { |
---|
16 | progname = "arb_message"; |
---|
17 | } |
---|
18 | |
---|
19 | char *the_message = strdup(argv[1]); |
---|
20 | char *unencoded_lf = 0; |
---|
21 | while ((unencoded_lf = strstr(the_message, "\\n")) != 0) { |
---|
22 | unencoded_lf[0] = '\n'; |
---|
23 | strcpy(unencoded_lf+1, unencoded_lf+2); |
---|
24 | } |
---|
25 | |
---|
26 | GBDATA *gb_main = GB_open(":","r"); |
---|
27 | if (!gb_main){ |
---|
28 | fprintf(stderr, "%s: %s\n", progname, the_message); |
---|
29 | } |
---|
30 | else { |
---|
31 | GBT_message(gb_main, the_message); |
---|
32 | GB_close(gb_main); |
---|
33 | } |
---|
34 | free(the_message); |
---|
35 | return 0; |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.