2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
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: isfname.c /main/3 1995/10/23 11:40:04 rswiston $ */
29 static char sccsid[] = "@(#)isfname.c 1.3 89/07/17 Copyr 1988 Sun Micro";
32 * Copyright (c) 1988 by Sun Microsystems, Inc.
39 * Functions to translate ISAM file name to .rec, .ind, and .var file
40 * names. Also, several auxiliary functions that deal with path names.
44 #include "isam_impl.h"
50 * _makedat_isfname(isfname)
52 * Return path to .rec file corresponding to the ISAM file isfname.
53 * Conversion is done in place.
57 _makedat_isfname(char *isfname)
60 (void) strcat(isfname, DAT_SUFFIX);
64 * _makeind_isfname(isfname)
66 * Return path to .ind file corresponding to the ISAM file isfname.
67 * Conversion is done in place.
71 _makeind_isfname(char *isfname)
74 (void) strcat(isfname, IND_SUFFIX);
78 * _makevar_isfname(isfname)
80 * Return path to .var file corresponding to the ISAM file isfname.
81 * Conversion is done in place.
85 _makevar_isfname(char *isfname)
88 (void) strcat(isfname, VAR_SUFFIX);
95 * Remove last element of path. E.g. /usr/db/part yields /usr/db.
99 _removelast(char *path)
103 for (p = path + strlen(path); *--p != '/' && p >= path; )
110 * Return pointer to the last element in the path.
111 * E.g.: _lastelement("/usr/temp") returns "temp".
115 _lastelement(char *path)
119 p = path + strlen(path);
121 while (*--p != '/' && p > path)
124 return ((*p == '/') ? (p + 1) : p);