source code open - cert-svc-ui
[framework/security/cert-svc-ui.git] / common / src / mgr-app-common-util.c
1 /*
2  * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved 
3  * 
4  * This file is part of the Manage Applications
5  * Written by Eunmi Son <eunmi.son@samsung.com>
6  *
7  * PROPRIETARY/CONFIDENTIAL
8  *
9  * This software is the confidential and proprietary information of 
10  * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not 
11  * disclose such Confidential Information and shall use it only in 
12  * accordance with the terms of the license agreement you entered 
13  * into with SAMSUNG ELECTRONICS. 
14  *
15  * SAMSUNG make no representations or warranties about the suitability 
16  * of the software, either express or implied, including but not limited 
17  * to the implied warranties of merchantability, fitness for a particular 
18  * purpose, or non-infringement. SAMSUNG shall not be liable for any 
19  * damages suffered by licensee as a result of using, modifying or 
20  * distributing this software or its derivatives.
21  *
22  */
23
24
25 #include "mgr-app-common-util.h"
26 #include "mgr-app-common-debug.h"
27 #include <string.h>
28
29 char *_strncpy(char *dest, const char *src, int len, char *file, int line)
30 {
31         if (dest == NULL || src == NULL || len <= 0) {
32                 MGR_APP_DEBUG_ERR("STRNCPY ERROR at %s(%d)", file, line);
33                 return dest;
34         }
35
36         strncpy(dest, src, len);
37         dest[len] = '\0';
38
39         return dest;
40 }
41
42 char *_strncat(char *dest, const char *src, int dest_size, char *file, int line)
43 {
44         if (dest == NULL || src == NULL || dest_size <= 0) {
45                 MGR_APP_DEBUG_ERR("STRNCAT ERROR at %s(%d)", file, line);
46                 return dest;
47         }
48
49         return strncat(dest, src, dest_size);
50 }
51
52 int _strncmp(const char *src1, const char *src2, int len, char *file, int line)
53 {
54         if (src1 == NULL || src2 == NULL || len <= 0) {
55                 MGR_APP_DEBUG_ERR("STRNCMP ERROR at %s(%d)", file, line);
56                 return -1;
57         }
58
59         return strncmp(src1, src2, len);
60 }
61
62