Untitled

 avatar
unknown
plain_text
a year ago
1.6 kB
8
Indexable
  1 #include <stdlib.h>
  2 #include <sys/stat.h>
  3 #include <stdint.h>
  4 #include <string.h>
  5 #include <sys/stat.h>
  6 #include <stdio.h>
  7 #include <sys/types.h>
  8 #include <pwd.h>
  9 #include <grp.h>
 10
 11 #ifndef HH
 12 #define HH
 13
 14 /* Field size macros */
 15 #define NAME_SIZE 100
 16 #define MODE_SIZE 8
 17 #define UID_SIZE 8
 18 #define GID_SIZE 8
 19 #define FILESIZE_SIZE 12
 20 #define MTIME_SIZE 12
 21 #define CHKSUM_SIZE 8
 22 #define TYPEFLAG_SIZE 1
 23 #define LINKNAME_SIZE 100
 24 #define MAGIC_SIZE 48
 25 #define VERSION_SIZE 2
 26 #define UNAME_SIZE 32
 27 #define GNAME_SIZE 32
 28 #define DEVMAJOR_SIZE 8
 29 #define DEVMINOR_SIZE 8
 30 #define PREFIX_SIZE 155
 31
 32 /* Name length macros */
 33 #define MAX_NAME_LEN 256
 34
 35 typedef struct header{
 36     char *name; /* NUL-terminated is NUL fits; size: 100 */
 37     char *mode; /* Octal string; size: 8 */
 38     char *uid; /* Octal string; size: 8 */
 39     char *gid; /* Octal string; size: 8 */
 40     char *size; /* Octal string; size: 12 */
 41     char *mtime; /* Octal string; size: 12 */
 42     char *chksum; /* Octal string; size: 8 */
 43     char typeflag; /*One char, not malloced*/
 44     char *linkname; /* NUL-terminated if NUL fits; size: 100 */
 45     char *magic; /* Must be "ustar", NUL-terminated; size: 48, not malloced */
 46     char *version; /* Must be "00"; size: 2 , not malloced*/
 47     char *uname; /* NUL-terminated; size: 32 */
 48     char *gname; /* NUL-terminated; size: 32 */
 49     char *devmajor; /* Octal string; size: 8 */
 50     char *devminor; /* Octal string; size: 8 */
"header.h" 63L, 1782C
Editor is loading...
Leave a Comment