1 /* -------------------------------------------------------------------- */
2 /* common.h								*/
3 /*									*/
4 /*  Copyright (C) 1999 Angelo Masci					*/
5 /*									*/
6 /*  This library is free software; you can redistribute it and/or	*/
7 /*  modify it under the terms of the GNU Library General Public		*/
8 /*  License as published by the Free Software Foundation; either	*/
9 /*  version 2 of the License, or (at your option) any later version.	*/
10 /*									*/
11 /*  This library 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 GNU	*/
14 /*  Library General Public License for more details.			*/
15 /*									*/
16 /*  You should have received a copy of the GNU Library General Public	*/
17 /*  License along with this library; if not, write to the Free		*/
18 /*  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.	*/
19 /*									*/
20 /*  You can contact the author at this e-mail address:			*/
21 /*									*/
22 /*  angelo@styx.demon.co.uk						*/
23 /*									*/
24 /* -------------------------------------------------------------------- */
25 /* $Id$
26    -------------------------------------------------------------------- */
27 
28 #if !defined(_COMMON_H)
29 #define _COMMON_H 1
30 
31 #include <stdarg.h>
32 #include <stdio.h>
33 
34 /* -------------------------------------------------------------------- */
35 
36 #if !defined(FALSE)
37 #define FALSE 		0
38 #endif
39 #if !defined(TRUE)
40 #define TRUE 		(!FALSE)
41 #endif
42 
43 #if defined(NEXT)
44 typedef int     	ssize_t;
45 typedef int     	pid_t;
46 typedef unsigned short  mode_t;
47 typedef short   	nlink_t;
48 #endif
49 
50 /* -------------------------------------------------------------------- */
51 
52 #define MAXLINELEN 	256		/* Commonly used for buffers 	*/
53 
54 /* -------------------------------------------------------------------- */
55 
56 #define sms_snprintf libcommon_snprintf
57 
58 /* -------------------------------------------------------------------- */
59 
60 void libcommon_usleep(long microseconds);
61 char *libcommon_strfcat(char *path, char *element);
62 char *libcommon_getword(char *ptr, char **endptr);
63 
64 int libcommon_vsnprintf(char *buf, int len, char *fmt, va_list args);
65 int libcommon_snprintf(char *buf, int len, char *fmt, ...);
66 int libcommon_vsprintf(char *buf, char *fmt, va_list args);
67 int libcommon_sprintf(char *buf, char *fmt, ...);
68 
69 int libcommon_vfprintf(FILE *fp, char *fmt, va_list args);
70 int libcommon_fprintf(FILE *fp, char *fmt, ...);
71 int libcommon_vprintf(char *fmt, va_list args);
72 int libcommon_printf(char *fmt, ...);
73 
74 int libcommon_vasprintf(char **buf, char *fmt, va_list args);
75 int libcommon_asprintf(char **buf, char *fmt, ...);
76 
77 /* -------------------------------------------------------------------- */
78 
79 #endif
80 /* -------------------------------------------------------------------- */
81 /* -------------------------------------------------------------------- */
82