\f
/* User and group names. */
-struct group *getgrnam ();
-struct passwd *getpwnam ();
-#if ! HAVE_DECL_GETPWUID
-struct passwd *getpwuid ();
-#endif
-#if ! HAVE_DECL_GETGRGID
-struct group *getgrgid ();
-#endif
-
/* Make sure you link with the proper libraries if you are running the
Yellow Peril (thanks for the good laugh, Ian J.!), or, euh... NIS.
This code should also be modified for non-UNIX systems to do something
}
\f
-struct name *
+static struct name *
make_name (const char *file_name)
{
struct name *p = xzalloc (sizeof (*p));
return p;
}
-void
+static void
free_name (struct name *p)
{
if (p)
static struct name *namelist; /* first name in list, if any */
static struct name *nametail; /* end of name list */
-/* File name arguments are processed in two stages: first a
+/* File name arguments are processed in two stages: first a
name_array (see below) is filled, then the names from it
are moved into the namelist.
which is meant to help process large archives on machines with
limited memory. With this option on, namelist contains at most one
entry, which diminishes the memory consumption.
-
+
However, I very much doubt if we still need this -- Sergey */
/* A name_array element contains entries of three types: */
union
{
const char *name; /* File or directory name */
- int matching_flags;/* fnmatch options if type == NELT_FMASK */
+ int matching_flags;/* fnmatch options if type == NELT_FMASK */
} v;
};
/* Check the size of name_array, reallocating it as necessary. */
static void
-check_name_alloc ()
+check_name_alloc (void)
{
if (names == allocated_names)
{
ep = &name_array[names++];
ep->type = NELT_CHDIR;
ep->v.name = name;
-}
+}
\f
/* Names from external name file. */
If CHANGE_DIRS is true, treat any entries of type NELT_CHDIR as
the request to change to the given directory.
-
+
Entries of type NELT_FMASK cause updates of the matching_flags
value. */
-struct name_elt *
+static struct name_elt *
name_next_elt (int change_dirs)
{
static struct name_elt entry;
{
struct name_elt *ep;
size_t source_len;
-
+
ep = &name_array[name_index++];
if (ep->type == NELT_FMASK)
{
matching_flags = ep->v.matching_flags;
continue;
}
-
+
source = ep->v.name;
source_len = strlen (source);
if (name_buffer_length < source_len)
buffer->directory = NULL;
buffer->parent = NULL;
buffer->cmdline = true;
-
+
namelist = nametail = buffer;
}
else if (change_dir)
if (!cursor)
return true;
-
+
if (cursor->name[0] == 0)
{
chdir_do (cursor->change_dir);
if (!WASFOUND (cursor) && cursor->name[0])
{
regex_usage_warning (cursor->name);
- ERROR ((0, 0,
+ ERROR ((0, 0,
(cursor->found_count == 0) ?
_("%s: Not found in archive") :
_("%s: Required occurrence not found in archive"),
if (!namelist)
return;
-
+
for (cursor = namelist; cursor; cursor = cursor->next)
if (WASFOUND (cursor))
return;
/* Sort *singly* linked LIST of names, of given LENGTH, using COMPARE
to order names. Return the sorted list. Note that after calling
this function, the `prev' links in list elements are messed up.
-
+
Apart from the type `struct name' and the definition of SUCCESSOR,
this is a generic list-sorting function, but it's too painful to
make it both generic and portable
add_hierarchy_to_namelist (struct name *name, dev_t device, bool cmdline)
{
const char *buffer;
-
+
name_fill_directory (name, device, cmdline);
buffer = directory_contents (name->directory);
if (buffer)
size_t old_prefix_len = child->parent->length;
size_t new_prefix_len = parent->length;
char *new_prefix = parent->name;
-
+
for (; child; child = child->sibling)
{
size_t size = child->length - old_prefix_len + new_prefix_len;
child->length = size;
rebase_directory (child->directory,
- child->parent->name, old_prefix_len,
+ child->parent->name, old_prefix_len,
new_prefix, new_prefix_len);
}
}
int num_names;
struct stat statbuf;
Hash_table *nametab;
-
+
name_gather ();
if (!namelist)
read_directory_file ();
}
-
+
num_names = 0;
for (name = namelist; name; name = name->next, num_names++)
{
register_individual_file (char const *name)
{
struct stat st;
-
+
if (deref_stat (dereference_option, name, &st) != 0)
return; /* Will be complained about later */
if (S_ISDIR (st.st_mode))
return;
-
+
hash_string_insert (&individual_file_table, name);
}