blob: 7fac6cd728db0a89b02f44b6c598a7174db6750d [file] [log] [blame]
Benny Prijono812fdee2007-12-01 09:07:42 +00001/* $Id$ */
2/*
Benny Prijono844653c2008-12-23 17:27:53 +00003 * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
Benny Prijono32177c02008-06-20 22:44:47 +00004 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
Benny Prijono812fdee2007-12-01 09:07:42 +00005 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/**
22 * \page page_strerror_c Samples: Print out error message
23 *
24 * This file is pjsip-apps/src/samples/strerror.c
25 *
26 * \includelineno strerror.c
27 */
28
29
30#include <pjlib.h>
31#include <pjlib-util.h>
32#include <pjsip.h>
33#include <pjmedia.h>
34#include <pjnath.h>
35#include <pjsip_simple.h>
36
37/*
38 * main()
39 */
40int main(int argc, char *argv[])
41{
42 pj_caching_pool cp;
43 pjmedia_endpt *med_ept;
44 pjsip_endpoint *sip_ept;
45 char errmsg[PJ_ERR_MSG_SIZE];
46 pj_status_t code;
47
48 if (argc != 2) {
49 puts("Usage: strerror ERRNUM");
50 return 1;
51 }
52
53 pj_log_set_level(3);
54
55 pj_init();
56 pj_caching_pool_init(&cp, NULL, 0);
57 pjlib_util_init();
58 pjnath_init();
59 pjmedia_endpt_create(&cp.factory, NULL, 0, &med_ept);
60 pjsip_endpt_create(&cp.factory, "localhost", &sip_ept);
61 pjsip_evsub_init_module(sip_ept);
62
63 code = atoi(argv[1]);
64 pj_strerror(code, errmsg, sizeof(errmsg));
65
66 printf("Status %d: %s\n", code, errmsg);
67
68 pj_shutdown();
69 return 0;
70}
71