1*7304104dSAndroid Build Coastguard Worker /* Functions to handle creation of Linux archives.
2*7304104dSAndroid Build Coastguard Worker Copyright (C) 2007 Red Hat, Inc.
3*7304104dSAndroid Build Coastguard Worker This file is part of elfutils.
4*7304104dSAndroid Build Coastguard Worker Written by Ulrich Drepper <[email protected]>, 2007.
5*7304104dSAndroid Build Coastguard Worker
6*7304104dSAndroid Build Coastguard Worker This file is free software; you can redistribute it and/or modify
7*7304104dSAndroid Build Coastguard Worker it under the terms of the GNU General Public License as published by
8*7304104dSAndroid Build Coastguard Worker the Free Software Foundation; either version 3 of the License, or
9*7304104dSAndroid Build Coastguard Worker (at your option) any later version.
10*7304104dSAndroid Build Coastguard Worker
11*7304104dSAndroid Build Coastguard Worker elfutils is distributed in the hope that it will be useful, but
12*7304104dSAndroid Build Coastguard Worker WITHOUT ANY WARRANTY; without even the implied warranty of
13*7304104dSAndroid Build Coastguard Worker MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14*7304104dSAndroid Build Coastguard Worker GNU General Public License for more details.
15*7304104dSAndroid Build Coastguard Worker
16*7304104dSAndroid Build Coastguard Worker You should have received a copy of the GNU General Public License
17*7304104dSAndroid Build Coastguard Worker along with this program. If not, see <http://www.gnu.org/licenses/>. */
18*7304104dSAndroid Build Coastguard Worker
19*7304104dSAndroid Build Coastguard Worker #ifdef HAVE_CONFIG_H
20*7304104dSAndroid Build Coastguard Worker # include <config.h>
21*7304104dSAndroid Build Coastguard Worker #endif
22*7304104dSAndroid Build Coastguard Worker
23*7304104dSAndroid Build Coastguard Worker #include <limits.h>
24*7304104dSAndroid Build Coastguard Worker #include <string.h>
25*7304104dSAndroid Build Coastguard Worker
26*7304104dSAndroid Build Coastguard Worker #include "arlib.h"
27*7304104dSAndroid Build Coastguard Worker
28*7304104dSAndroid Build Coastguard Worker
29*7304104dSAndroid Build Coastguard Worker /* Add long file name FILENAME of length FILENAMELEN to the symbol table
30*7304104dSAndroid Build Coastguard Worker SYMTAB. Return the offset into the long file name table. */
31*7304104dSAndroid Build Coastguard Worker long int
arlib_add_long_name(const char * filename,size_t filenamelen)32*7304104dSAndroid Build Coastguard Worker arlib_add_long_name (const char *filename, size_t filenamelen)
33*7304104dSAndroid Build Coastguard Worker {
34*7304104dSAndroid Build Coastguard Worker size_t size = obstack_object_size (&symtab.longnamesob);
35*7304104dSAndroid Build Coastguard Worker
36*7304104dSAndroid Build Coastguard Worker obstack_grow (&symtab.longnamesob, filename, filenamelen);
37*7304104dSAndroid Build Coastguard Worker obstack_grow (&symtab.longnamesob, "/\n", 2);
38*7304104dSAndroid Build Coastguard Worker
39*7304104dSAndroid Build Coastguard Worker return size - sizeof (struct ar_hdr);
40*7304104dSAndroid Build Coastguard Worker }
41