Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / tt / lib / mp / mp_context.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 //%%  (c) Copyright 1993, 1994 Hewlett-Packard Company                  
24 //%%  (c) Copyright 1993, 1994 International Business Machines Corp.    
25 //%%  (c) Copyright 1993, 1994 Sun Microsystems, Inc.                   
26 //%%  (c) Copyright 1993, 1994 Novell, Inc.                             
27 //%%  $XConsortium: mp_context.C /main/3 1995/10/23 10:22:37 rswiston $                                                         
28 /*
29  *
30  * @(#)mp_context.C     1.5 30 Jul 1993
31  *
32  * Tool Talk Message Passer (MP) - mp_context.cc
33  *
34  * Copyright (c) 1992 by Sun Microsystems, Inc.
35  *
36  * Implementation of the _Tt_context: a context slotname.
37  */
38
39 #include <ctype.h>
40 #include <mp/mp_context.h>
41
42 _Tt_context::
43 _Tt_context()
44 {
45 }
46
47 _Tt_context::
48 _Tt_context(const _Tt_context &c)
49 {
50         _slotName = c._slotName;
51 }
52
53 _Tt_context::
54 ~_Tt_context()
55 {
56 }
57
58 Tt_status _Tt_context::
59 setName(
60         const char *slotname
61 )
62 {
63         if (slotname == 0) {
64                 return TT_ERR_SLOTNAME;
65         }
66         const char *pc = slotname;
67         if (*pc == '$') {
68                 pc++;
69         }
70         while (*pc != 0) {
71                 if ((! isalnum(*pc)) && (*pc != '_')) {
72                         return TT_ERR_SLOTNAME;
73                 }
74                 pc++;
75         }
76         _slotName = slotname;
77         return TT_OK;
78 }
79
80 void _Tt_context::
81 print(
82         const _Tt_ostream &os
83 ) const
84 {
85         _slotName.print( os );
86 }
87
88 bool_t _Tt_context::
89 xdr(
90         XDR *xdrs
91 )
92 {
93         return _slotName.xdr( xdrs );
94 }