home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / g / gtak212.zip / 1.10 / testpad.c < prev    next >
C/C++ Source or Header  |  1992-09-02  |  2KB  |  83 lines

  1. /*****************************************************************************
  2.  * $Id: testpad.c,v 1.2 1992/09/02 20:08:54 ak Exp $
  3.  *****************************************************************************
  4.  * $Log: testpad.c,v $
  5.  * Revision 1.2  1992/09/02  20:08:54  ak
  6.  * Version AK200
  7.  * - Tape access
  8.  * - Quick file access
  9.  * - OS/2 extended attributes
  10.  * - Some OS/2 fixes
  11.  * - Some fixes of Kai Uwe Rommel
  12.  *
  13.  * Revision 1.1.1.1  1992/09/02  19:23:01  ak
  14.  * Original GNU Tar 1.10 with some filenames changed for FAT compatibility.
  15.  *
  16.  * Revision 1.1  1992/09/02  19:22:59  ak
  17.  * Initial revision
  18.  *
  19.  *****************************************************************************/
  20.  
  21. static char *rcsid = "$Id: testpad.c,v 1.2 1992/09/02 20:08:54 ak Exp $";
  22.  
  23. /* Find out if we need the pad field in the header for this machine
  24.    Copyright (C) 1991 Free Software Foundation
  25.  
  26.    This program is free software; you can redistribute it and/or
  27.    modify it under the terms of the GNU General Public License as
  28.    published by the Free Software Foundation; either version 1, or (at
  29.    your option) any later version.
  30.  
  31.    This program is distributed in the hope that it will be useful, but
  32.    WITHOUT ANY WARRANTY; without even the implied warranty of
  33.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  34.    General Public License for more details.
  35.  
  36.    You should have received a copy of the GNU General Public License
  37.    along with this program; if not, write to the Free Software
  38.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  39. */
  40.  
  41. #include <stdio.h>
  42.  
  43. struct inc
  44. {
  45.   char a[20];
  46.   char b[20];
  47. };
  48.  
  49. struct test1
  50. {
  51.   char a;
  52.   struct inc in[5];
  53. };
  54.  
  55. struct test2
  56. {
  57.   char a;
  58.   char b;
  59.   struct inc in[5];
  60. };
  61.  
  62. main ()
  63. {
  64.   struct test1 t1;
  65.   struct test2 t2;
  66.   int t1diff, t2diff;
  67.   
  68.   t1diff = (char *)&t1.in - (char *)&t1;
  69.   t2diff = (char *)&t2.in - (char *)&t2;
  70.   
  71.   if (t2diff == t1diff + 1)
  72.     printf ("#define NEEDPAD\n");
  73.   else if (t1diff != t2diff)
  74.     fprintf (stderr, "Cannot determine padding for tar struct, \n\
  75. will try with none.\n");
  76.  
  77.   exit (0);
  78. }
  79.  
  80.       
  81.     
  82.   
  83.