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