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 * Copyright (c) 1988 by Sun Microsystems, Inc.
36 * Functions to translate ISAM file name to .rec, .ind, and .var file
37 * names. Also, several auxiliary functions that deal with path names.
41 #include "isam_impl.h"
47 * _makedat_isfname(isfname)
49 * Return path to .rec file corresponding to the ISAM file isfname.
50 * Conversion is done in place.
54 _makedat_isfname(char *isfname)
57 (void) strcat(isfname, DAT_SUFFIX);
61 * _makeind_isfname(isfname)
63 * Return path to .ind file corresponding to the ISAM file isfname.
64 * Conversion is done in place.
68 _makeind_isfname(char *isfname)
71 (void) strcat(isfname, IND_SUFFIX);
75 * _makevar_isfname(isfname)
77 * Return path to .var file corresponding to the ISAM file isfname.
78 * Conversion is done in place.
82 _makevar_isfname(char *isfname)
85 (void) strcat(isfname, VAR_SUFFIX);
92 * Remove last element of path. E.g. /usr/db/part yields /usr/db.
96 _removelast(char *path)
100 for (p = path + strlen(path); *--p != '/' && p >= path; )
107 * Return pointer to the last element in the path.
108 * E.g.: _lastelement("/usr/temp") returns "temp".
112 _lastelement(char *path)
116 p = path + strlen(path);
118 while (*--p != '/' && p > path)
121 return ((*p == '/') ? (p + 1) : p);