annotate kpathsea/extend-fname.c @ 2400:49dc322cd9fb

[project @ 1996-10-13 05:36:32 by jwe]
author jwe
date Sun, 13 Oct 1996 05:36:32 +0000
parents 611d403c7f3d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1268
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
1 /* extend-fname.c: give a filename a suffix, if necessary.
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
2
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
3 Copyright (C) 1992, 93 Free Software Foundation, Inc.
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
4
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
7 the Free Software Foundation; either version 2, or (at your option)
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
8 any later version.
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
9
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
13 GNU General Public License for more details.
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
14
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
16 along with this program; if not, write to the Free Software
1315
611d403c7f3d [project @ 1995-06-25 19:56:32 by jwe]
jwe
parents: 1268
diff changeset
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1268
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
18
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
19 #include <kpathsea/config.h>
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
20
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
21
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
22 /* We may or may not return NAME. It's up to the caller not to assume
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
23 the return value is modifiable. */
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
24
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
25 string
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
26 extend_filename P2C(const_string, name, const_string, default_suffix)
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
27 {
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
28 string new_s;
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
29 const_string suffix = find_suffix (name);
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
30
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
31 new_s = suffix == NULL ? concat3 (name, ".", default_suffix)
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
32 : (string) name;
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
33 return new_s;
76a0c05089d4 [project @ 1995-04-20 19:15:51 by jwe]
jwe
parents:
diff changeset
34 }