home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / linux / backup / star-1.3.1.tar.gz / star-1.3.1.tar / star-1.3.1 / star / props.c < prev    next >
C/C++ Source or Header  |  2000-05-07  |  4KB  |  137 lines

  1. /* @(#)props.c    1.14 00/05/07 Copyright 1994 J. Schilling */
  2. #ifndef lint
  3. static    char sccsid[] =
  4.     "@(#)props.c    1.14 00/05/07 Copyright 1994 J. Schilling";
  5. #endif
  6. /*
  7.  *    Set up properties for different archive types
  8.  *
  9.  *    Copyright (c) 1994 J. Schilling
  10.  */
  11. /*
  12.  * This program is free software; you can redistribute it and/or modify
  13.  * it under the terms of the GNU General Public License as published by
  14.  * the Free Software Foundation; either version 2, or (at your option)
  15.  * any later version.
  16.  *
  17.  * This program is distributed in the hope that it will be useful,
  18.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20.  * GNU General Public License for more details.
  21.  *
  22.  * You should have received a copy of the GNU General Public License
  23.  * along with this program; see the file COPYING.  If not, write to
  24.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  25.  */
  26.  
  27. #include <mconfig.h>
  28. #include <stdio.h>
  29. #include "star.h"
  30. #include "props.h"
  31. #include "diff.h"
  32. #include <standard.h>
  33. #include <schily.h>
  34. #include "starsubs.h"
  35.  
  36. extern    BOOL    debug;
  37.  
  38. struct properties props;
  39.  
  40. EXPORT    void    setprops    __PR((long htype));
  41. EXPORT    void    printprops    __PR((void));
  42.  
  43. EXPORT void
  44. setprops(htype)
  45.     long    htype;
  46. {
  47.     switch (H_TYPE(htype)) {
  48.  
  49.     case H_STAR:
  50.         props.pr_flags = PR_LOCAL_STAR|PR_SPARSE|PR_VOLHDR;
  51.         props.pr_fillc = ' ';
  52.         props.pr_diffmask = 0L;
  53.         props.pr_nflags =
  54.             PR_POSIX_SPLIT|PR_PREFIX_REUSED|PR_LONG_NAMES;
  55.         props.pr_maxnamelen =  PATH_MAX;
  56.         props.pr_maxlnamelen = PATH_MAX;
  57.         props.pr_maxsname =    NAMSIZ;
  58.         props.pr_maxslname =   NAMSIZ;
  59.         props.pr_maxprefix =   PFXSIZ;
  60.         props.pr_sparse_in_hdr = 0;
  61.         break;
  62.  
  63.     case H_XSTAR:
  64.     case H_XUSTAR:
  65.         props.pr_flags =
  66.             PR_POSIX_OCTAL|PR_LOCAL_STAR|PR_SPARSE|PR_VOLHDR;
  67.         props.pr_fillc = '0';
  68.         props.pr_diffmask = 0L;
  69.         props.pr_nflags =
  70.             PR_POSIX_SPLIT|PR_PREFIX_REUSED|PR_LONG_NAMES;
  71.         props.pr_maxnamelen =  PATH_MAX;
  72.         props.pr_maxlnamelen = PATH_MAX;
  73.         props.pr_maxsname =    NAMSIZ;
  74.         props.pr_maxslname =   NAMSIZ;
  75.         props.pr_maxprefix =   130;
  76.         props.pr_sparse_in_hdr = 0;
  77.         break;
  78.  
  79.     case H_USTAR:
  80.         props.pr_flags = PR_POSIX_OCTAL;
  81.         props.pr_fillc = '0';
  82.         props.pr_diffmask = (D_ATIME|D_CTIME);
  83.         props.pr_nflags = PR_POSIX_SPLIT;
  84.         props.pr_maxnamelen =  NAMSIZ;
  85.         props.pr_maxlnamelen = NAMSIZ;
  86.         props.pr_maxsname =    NAMSIZ;
  87.         props.pr_maxslname =   NAMSIZ;
  88.         props.pr_maxprefix =   PFXSIZ;
  89.         props.pr_sparse_in_hdr = 0;
  90.         break;
  91.  
  92.     case H_GNUTAR:
  93.         props.pr_flags =
  94.             PR_LOCAL_GNU|PR_SPARSE|PR_GNU_SPARSE_BUG|PR_VOLHDR;
  95.         props.pr_fillc = ' ';
  96.         props.pr_diffmask = 0L;
  97.         props.pr_nflags = PR_LONG_NAMES;
  98.         props.pr_maxnamelen =  PATH_MAX;
  99.         props.pr_maxlnamelen = PATH_MAX;
  100.         props.pr_maxsname =    NAMSIZ-1;
  101.         props.pr_maxslname =   NAMSIZ-1;
  102.         props.pr_maxprefix =   0;
  103.         props.pr_sparse_in_hdr = SPARSE_IN_HDR;
  104.         break;
  105.  
  106.     case H_TAR:
  107.     case H_OTAR:
  108.     default:
  109.         props.pr_flags = 0;
  110.         props.pr_fillc = ' ';
  111.         props.pr_diffmask = (D_ATIME|D_CTIME);
  112.         props.pr_nflags = PR_DUMB_EOF;
  113.         props.pr_maxnamelen =  NAMSIZ-1;
  114.         props.pr_maxlnamelen = NAMSIZ-1;
  115.         props.pr_maxsname =    NAMSIZ-1;
  116.         props.pr_maxslname =   NAMSIZ-1;
  117.         props.pr_maxprefix =   0;
  118.         props.pr_sparse_in_hdr = 0;
  119.     }
  120.     if (debug) printprops();
  121. }
  122.  
  123. EXPORT void
  124. printprops()
  125. {
  126.     error("pr_flags:         0x%X\n", props.pr_flags);
  127.     error("pr_fillc:         '%c'\n", props.pr_fillc);
  128.     prdiffopts(stderr, "pr_diffmask:      ", props.pr_diffmask);
  129.     error("pr_nflags:        0x%X\n", props.pr_nflags);
  130.     error("pr_maxnamelen:    %d\n", props.pr_maxnamelen);
  131.     error("pr_maxlnamelen:   %d\n", props.pr_maxlnamelen);
  132.     error("pr_maxsname:      %d\n", props.pr_maxsname);
  133.     error("pr_maxslname:     %d\n", props.pr_maxslname);
  134.     error("pr_maxprefix:     %d\n", props.pr_maxprefix);
  135.     error("pr_sparse_in_hdr: %d\n", props.pr_sparse_in_hdr);
  136. }
  137.