xref: /titanic_52/usr/src/cmd/perl/contrib/Sun/Solaris/Utils/Utils.xs (revision ee70a468fe7e19ca2e6a88027e9a71e4b2c13d7f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1999 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  * Utils.xs contains XS wrappers for utility functions needed initially by
31  * Sun::Solaris::Kstat, but that should prove generally useful as well.
32  */
33 
34 /* Solaris includes */
35 #include <libgen.h>
36 #include <libintl.h>
37 
38 /* Perl XS includes */
39 #include "EXTERN.h"
40 #if __GNUC__ >= 5
41 #include "perl.h"
42 #else
43 #define _Thread_local
44 #include "perl.h"
45 #undef _Thread_local
46 #undef PERL_GET_CONTEXT
47 #undef PERL_SET_CONTEXT
48 #define PERL_GET_CONTEXT	PTHREAD_GETSPECIFIC(PL_thr_key)
49 #define PERL_SET_CONTEXT(t)	Perl_set_context((void*)t)
50 #endif
51 #include "XSUB.h"
52 
53 /*
54  * The XS code exported to perl is below here.  Note that the XS preprocessor
55  * has its own commenting syntax, so all comments from this point on are in
56  * that form.
57  */
58 
59 MODULE = Sun::Solaris::Utils PACKAGE = Sun::Solaris::Utils
60 PROTOTYPES: ENABLE
61 
62  #
63  # See gmatch(3GEN)
64  #
65 
66 int
67 gmatch(str, pattern)
68 	char *str;
69 	char *pattern;
70 
71  #
72  # See gettext(3C)
73  #
74 
75 char *
76 gettext(msgid)
77 	char *msgid
78 
79  #
80  # See dcgettext(3C)
81  #
82 
83 char *
84 dcgettext(domainname, msgid, category)
85 	char *domainname
86 	char *msgid
87 	int  category
88 
89  #
90  # See dgettext(3C)
91  #
92 
93 char *
94 dgettext(domainname, msgid)
95 	char *domainname
96 	char *msgid
97 
98  #
99  # See textdomain(3C)
100  #
101 
102 char *
103 textdomain(domain)
104 	char *domain
105 
106  #
107  # See bindtextdomain(3C)
108  #
109 
110 char *
111 bindtextdomain(domain, dirname)
112 	char *domain
113 	char *dirname
114