Xft support under OpenMotif 2.3.3 - I've been using this for quite a while on
[nedit.git] / util / clearcase.c
blob2deac8026a2bc78eb4cebd2a91707bd71d819bf2
1 static const char CVSID[] = "$Id: clearcase.c,v 1.6 2004/11/09 21:58:45 yooden Exp $";
2 /*******************************************************************************
3 * *
4 * clearcase.c -- Nirvana Editor ClearCase support utilities *
5 * *
6 * Copyright (C) 2001 Mark Edel *
7 * *
8 * This is free software; you can redistribute it and/or modify it under the *
9 * terms of the GNU General Public License as published by the Free Software *
10 * Foundation; either version 2 of the License, or (at your option) any later *
11 * version. In addition, you may distribute versions of this program linked to *
12 * Motif or Open Motif. See README for details. *
13 * *
14 * This software is distributed in the hope that it will be useful, but WITHOUT *
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
17 * more details. *
18 * *
19 * You should have received a copy of the GNU General Public License along with *
20 * software; if not, write to the Free Software Foundation, Inc., 59 Temple *
21 * Place, Suite 330, Boston, MA 02111-1307 USA *
22 * *
23 * Nirvana Text Editor *
24 * March, 2001 *
25 * *
26 * Written by Mark Edel *
27 * *
28 *******************************************************************************/
30 #ifdef HAVE_CONFIG_H
31 #include "../config.h"
32 #endif
34 #include "clearcase.h"
36 #include <string.h>
37 #include <stdlib.h>
39 #include <X11/Intrinsic.h>
41 #ifdef HAVE_DEBUG_H
42 #include "../debug.h"
43 #endif
45 static int ClearCaseViewTagFound = 0;
46 static char *ClearCaseViewRoot = NULL;
47 static const char *ClearCaseViewTag = NULL;
49 const char* GetClearCaseVersionExtendedPath(const char* fullname)
51 return(strstr(fullname, "@@/"));
56 ** Return a string showing the ClearCase view tag. If ClearCase is not in
57 ** use, or a view is not set, NULL is returned.
59 ** If user has ClearCase and is in a view, CLEARCASE_ROOT will be set and
60 ** the view tag can be extracted. This check is safe and efficient enough
61 ** that it doesn't impact non-clearcase users, so it is not conditionally
62 ** compiled. (Thanks to Max Vohlken)
64 const char *GetClearCaseViewTag(void)
66 if (!ClearCaseViewTagFound) {
67 /* Extract the view name from the CLEARCASE_ROOT environment variable */
68 const char *envPtr = getenv("CLEARCASE_ROOT");
69 if (envPtr != NULL) {
70 const char *tagPtr;
71 ClearCaseViewRoot = XtMalloc(strlen(envPtr) + 1);
72 strcpy(ClearCaseViewRoot, envPtr);
74 tagPtr = strrchr(ClearCaseViewRoot, '/');
75 if (tagPtr != NULL) {
76 ClearCaseViewTag = ++tagPtr;
80 /* If we don't find it first time, we will never find it, so may just as
81 * well say that we have found it.
83 ClearCaseViewTagFound = 1;
85 return(ClearCaseViewTag);