home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / fileutils-3.6 / src / cp-aux.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-14  |  1.8 KB  |  60 lines

  1. /* cp-aux.c  -- file copying (auxiliary routines)
  2.    Copyright (C) 1989, 1990, 1991 Free Software Foundation.
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 2, or (at your option)
  7.    any later version.
  8.  
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18.    Written by Torbjorn Granlund, Sweden (tege@sics.se). */
  19.  
  20. #include <stdio.h>
  21.  
  22. #include "cp.h"
  23.  
  24. extern char *program_name;
  25.  
  26. void
  27. usage (reason)
  28.      char *reason;
  29. {
  30.   if (reason != NULL)
  31.     fprintf (stderr, "%s: %s\n", program_name, reason);
  32.  
  33.   fprintf (stderr, "\
  34. Usage: %s [options] source dest\n\
  35.        %s [options] source... directory\n\
  36. Options:\n\
  37.        [-abdfilprsuvxPR] [-S backup-suffix] [-V {numbered,existing,simple}]\n\
  38.        [--backup] [--no-dereference] [--force] [--interactive]\n\
  39.        [--one-file-system] [--preserve] [--recursive] [--update] [--verbose]\n\
  40.        [--suffix=backup-suffix] [--version-control={numbered,existing,simple}]\n\
  41.        [--archive] [--path] [--link] [--symbolic-link] [--help] [--version]\n",
  42.        program_name, program_name);
  43.  
  44.   exit (2);
  45. }
  46.  
  47. int
  48. is_ancestor (sb, ancestors)
  49.      struct stat *sb;
  50.      struct dir_list *ancestors;
  51. {
  52.   while (ancestors != 0)
  53.     {
  54.       if (ancestors->ino == sb->st_ino && ancestors->dev == sb->st_dev)
  55.     return 1;
  56.       ancestors = ancestors->parent;
  57.     }
  58.   return 0;
  59. }
  60.