home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / f / futi14as.zip / CP.H < prev    next >
C/C++ Source or Header  |  1992-02-22  |  5KB  |  178 lines

  1. /*  cp.h  -- file copying (data definitions)
  2.     Copyright (C) 1989, 1990 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 1, 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. /*  MS-DOS port (c) 1990 by Thorsten Ohl, ohl@gnu.ai.mit.edu
  21.     This port is also distributed under the terms of the
  22.     GNU General Public License as published by the
  23.     Free Software Foundation.
  24.  
  25.     Please note that this file is not identical to the
  26.     original GNU release, you should have received this
  27.     code as patch to the official release.
  28.  
  29.     $Header: e:/gnu/fileutil/RCS/cp.h 1.4.0.2 90/09/19 12:27:43 tho Exp $
  30.  */
  31.  
  32. #include <sys/types.h>
  33.  
  34. #include "system.h"
  35.  
  36. struct dir_list
  37. {
  38.   struct dir_list *parent;
  39.   ino_t ino;
  40.   dev_t dev;
  41. };
  42.  
  43. struct entry
  44. {
  45.   ino_t ino;
  46.   dev_t dev;
  47.   char *node;            /* Path name, or &new_file for new inodes.  */
  48.   struct entry *coll_link;    /* 0 = entry not occupied.  */
  49. };
  50.  
  51. struct htab
  52. {
  53.   unsigned modulus;        /* Size of the `hash' pointer vector.  */
  54.   struct entry *entry_tab;    /* Pointer to dynamically growing vector.  */
  55.   unsigned entry_tab_size;    /* Size of current `entry_tab' allocation.  */
  56.   unsigned first_free_entry;    /* Index in `entry_tab'.  */
  57.   struct entry *hash[1];    /* Vector of pointers in `entry_tab'.  */
  58. };
  59.  
  60. extern int exit_status;
  61. extern struct htab *htab;
  62.  
  63. #ifdef MSDOS
  64.  
  65. #include <gnulib.h>
  66.  
  67. extern void forget_all (void);
  68. extern int copy_reg (char *, char *);
  69. extern void hash_init (unsigned int, unsigned int);
  70. extern int remember_created (char *);
  71. extern char *remember_copied (char *, unsigned short, short);
  72.  
  73. #else /* not MSDOS */
  74.  
  75. extern char *xmalloc ();
  76. extern char *xrealloc ();
  77. extern void forget_copied ();
  78. extern void forget_all ();
  79. extern int copy_reg ();
  80. extern void hash_init ();
  81. extern char *remember_copied ();
  82. extern int remember_created ();
  83.  
  84. #endif /* not MSDOS */
  85.  
  86. /* For created inodes, a pointer in the search structure to this
  87.    character identifies that the inode as new.  */
  88. extern char new_file;
  89.  
  90. #ifdef MSDOS
  91. extern  void main (int, char **);
  92. extern  void usage (char *);
  93. extern  void error (int status, int errnum, char *message, ...);
  94. extern  int yesno (void);
  95. extern  char *stpcpy (char *, char *);
  96. extern  int user_confirm_overwriting (char *);
  97. extern  int member (int);
  98. extern  int do_copy (int, char **);
  99. extern  int copy (char *, char *, int, short, struct dir_list *);
  100. extern  int copy_dir(char *,char *,int,struct stat *,struct dir_list *);
  101. extern  void strip_trailing_slashes (char **path);
  102. #endif /* MSDOS */
  103.  
  104. extern void error ();
  105. extern void usage ();
  106. extern char *savedir ();
  107. extern char *stpcpy ();
  108. extern int yesno ();
  109. extern int do_copy ();
  110. extern int copy ();
  111. extern int copy_dir ();
  112. extern void strip_trailing_slashes ();
  113. extern int is_ancestor ();
  114.  
  115. /* System calls.  */
  116.  
  117. #ifdef MSDOS
  118.  
  119. #include <direct.h>
  120. #include <io.h>
  121. #include <malloc.h>
  122. #include <pwd.h>
  123.  
  124. /* Very "interesting" system calls ... */
  125. #define    link(a, b)            (-1)
  126. #define chown(path, uid, gid)        0
  127. #define mkdir(path, mode)        mkdir (path)
  128. #define ftruncate            chsize
  129.  
  130. extern  int eaccess_stat (struct stat *statp, int mode);
  131.  
  132. #else /* not MSDOS */
  133.  
  134. extern int mknod ();
  135.  
  136. #ifdef _POSIX_SOURCE
  137. #define S_IWRITE S_IWUSR
  138. #define S_IEXEC S_IXUSR
  139. #else
  140. extern int open ();
  141. extern int close ();
  142. extern int fstat ();
  143. extern int stat ();
  144. extern int lstat ();
  145. extern int read ();
  146. extern int write ();
  147. extern int symlink ();
  148. extern int readlink ();
  149. extern int mkdir ();
  150. extern unsigned short umask ();
  151. extern int unlink ();
  152. extern int link ();
  153. extern int chmod ();
  154. extern int chown ();
  155. extern int access ();
  156. extern int utime ();
  157. extern int ftruncate ();
  158. extern int isatty ();
  159. extern off_t lseek ();
  160. #endif
  161.  
  162. #endif /* not MSDOS */
  163.  
  164. /* Library calls.  */
  165. #include <errno.h>
  166. #ifdef STDC_HEADERS
  167. #include <stdlib.h>
  168. #else
  169. extern char *getenv ();
  170. extern char *malloc ();
  171. extern char *realloc ();
  172. extern void exit ();
  173. extern void free ();
  174. extern int fputs ();
  175.  
  176. extern int errno;
  177. #endif
  178.