#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <pwd.h>#include <grp.h>#include <tar.h>#include <stdarg.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <utime.h>#include <sys/wait.h>#include <stdio.h>#include <errno.h>#include <dirent.h>Include dependency graph for tar.c:

Go to the source code of this file.
Data Structures | |
| struct | link |
Defines | |
| #define | POSIX_COMP |
| #define | DIRECT_3 |
| #define | direct dirent |
| #define | TRUE 1 |
| #define | FALSE 0 |
| #define | STRING_SIZE 256 |
| #define | HEADER_SIZE TBLOCK |
| #define | NAME_SIZE NAMSIZ |
| #define | m_name name |
| #define | m_mode mode |
| #define | m_uid uid |
| #define | m_gid gid |
| #define | m_size size |
| #define | m_time mtime |
| #define | m_checksum chksum |
| #define | m_linked typeflag |
| #define | m_link linkname |
| #define | hdr_block dummy |
| #define | m header |
| #define | member dbuf |
| #define | INT_TYPE (sizeof(header.member.m_uid)) |
| #define | LONG_TYPE (sizeof(header.member.m_size)) |
| #define | NIL_HEADER ((HEADER *) 0) |
| #define | NIL_PTR ((char *) 0) |
| #define | TBLOCK_SIZE TBLOCK |
| #define | flush() print(NIL_PTR) |
| #define | block_size() |
Typedefs | |
| typedef char | BOOL |
| typedef hblock | HEADER |
Functions | |
| _PROTOTYPE (int main,(int argc, char **argv)) | |
| _PROTOTYPE (void error,(char *s1, char *s2)) | |
| _PROTOTYPE (BOOL get_header,(void)) | |
| _PROTOTYPE (void tarfile,(void)) | |
| _PROTOTYPE (void extract,(char *file)) | |
| _PROTOTYPE (void copy,(char *file, int from, int to, long bytes)) | |
| _PROTOTYPE (long convert,(char str[], int type)) | |
| _PROTOTYPE (int checksum,(void)) | |
| _PROTOTYPE (int is_dir,(char *file)) | |
| _PROTOTYPE (char *path_name,(char *file)) | |
| _PROTOTYPE (void add_path,(char *name)) | |
| _PROTOTYPE (void add_close,(int fd)) | |
| _PROTOTYPE (int add_open,(char *file, struct stat *st)) | |
| _PROTOTYPE (void make_header,(char *file, struct stat *st)) | |
| _PROTOTYPE (void is_added,(struct stat *st, char *file)) | |
| _PROTOTYPE (void is_deleted,(struct stat *st)) | |
| _PROTOTYPE (char *is_linked,(struct stat *st)) | |
| _PROTOTYPE (void mread,(int fd, char *address, int bytes)) | |
| _PROTOTYPE (int bread,(int fd, char *address, int bytes)) | |
| _PROTOTYPE (void print,(char *str)) | |
| _PROTOTYPE (char *num_out,(long number)) | |
| _PROTOTYPE (void string_print,(char *buffer, char *fmt,...)) | |
| void | error (char *s1, char *s2) |
| int | main (int argc, argv) |
| BOOL | get_header () |
| void | tarfile () |
| void | skip_entry () |
| void | extract (char *file) |
| void | delete (char *file) |
| void | do_chown (char *file) |
| void | timestamp (char *file) |
| void | copy (char *file, int from, int to, long bytes) |
| long | convert (str, int type) |
| int | checksum () |
| int | is_dir (char *file) |
| char * | path_name (char *file) |
| void | add_path (char *name) |
| void | add_file (char *file) |
| void | verb_print (char *s1, char *s2) |
| void | add_close (int fd) |
| int | add_open (char *file, struct stat *st) |
| void | make_header (char *file, struct stat *st) |
| void | is_added (struct stat *st, char *file) |
| void | is_deleted (struct stat *st) |
| char * | is_linked (struct stat *st) |
| void | clear_header () |
| void | adjust_boundary () |
| void | mread (int fd, char *address, int bytes) |
| void | mwrite (int fd, char *address, int bytes) |
| int | bread (int fd, char *address, int bytes) |
| int | bwrite (int fd, char *address, int bytes) |
| void | print (char *str) |
| char * | num_out (long number) |
| void | string_print (char *buffer, char *fmt) |
Variables | |
| link * | link_top |
| HEADER | header |
| BOOL | show_fl |
| BOOL | creat_fl |
| BOOL | ext_fl |
| int | tar_fd |
| char | usage [] = "Usage: tar [cxt][vo][F][f] tarfile [files]." |
| char | io_buffer [TBLOCK_SIZE] |
| char | path [NAME_SIZE] |
| char | pathname [NAME_SIZE] |
| int | force_flag = 0 |
| int | chown_flag = 0 |
| int | verbose_flag = 0 |
| int | norec_flag = 0 |
| ino_t | ar_inode |
| dev_t | ar_dev |
| int | total_blocks |
| int | u_mask |
| char | output [TBLOCK_SIZE] |
|
|
Value: (int) ((convert(header.member.m_size, LONG_TYPE) \ + (long) TBLOCK_SIZE - 1) / (long) TBLOCK_SIZE) Definition at line 188 of file tar.c. Referenced by add_z_2(), alloc_block(), alloc_inode(), allocate_buffer(), allocbitmap(), bf_append(), bf_pack(), chkdev(), chkdirzone(), chksuper(), Data_Block(), devio(), devread(), devwrite(), df(), diskio(), dodir(), dumpbitmap(), eat_dir(), eat_file(), enter_dir(), file_vir2sec(), get_block(), getsuper(), incr_link(), incr_size(), loadbitmap(), main(), make_bootable(), print_fs(), printtotal(), put_block(), r_readdir(), r_stat(), r_super(), r_vir2abs(), rahead(), read_ahead(), read_write(), rw_block(), rw_scattered(), select_image(), sizeup(), skip_entry(), super(), tape_inquire(), tarfile(), and was_blk_special(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 154 of file tar.c. Referenced by checksum(), do_chown(), extract(), and get_header(). |
|
|
Definition at line 155 of file tar.c. Referenced by extract(), and timestamp(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 122 of file tar.c. Referenced by add(), get(), get_member(), and trymandir(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 103 of file tar.c. Referenced by string_print(). |
|
|
Definition at line 159 of file tar.c. Referenced by checksum(), clear_header(), copy(), print(), and skip_entry(). |
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
|
Definition at line 839 of file tar.c. References close. Referenced by add_file(). |
|
|
Definition at line 664 of file tar.c. References add_close(), add_open(), add_path(), ar_dev, ar_inode, bread(), chdir, closedir, copy, cwd, direct::d_name, dir, DIRSIZ, errno, getcwd, header, if(), is_added(), is_deleted(), is_linked(), lstat, make_header(), mread(), mwrite(), NAMSIZ, NIL_PTR, norec_flag, NULL, opendir, path_name, readdir, readlink, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFREG, st, stat::st_dev, stat::st_ino, stat::st_mode, stat::st_size, stat, strcmp, strcpy(), strerror(), string_print, strncpy(), tar_fd, TSIZLEN, verb_print(), and verbose_flag. |
|
||||||||||||
|
Definition at line 848 of file tar.c. References errno, fprintf(), O_RDONLY, open, S_IFDIR, S_IFMT, S_IFREG, st, stat::st_mode, stderr, and strerror(). Referenced by add_file(). |
|
|
|
|
|
Definition at line 963 of file tar.c. References clear_header(), close, header, mwrite(), tar_fd, and total_blocks. |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
Definition at line 608 of file tar.c. References header, INT_TYPE, ptr, and TBLOCK_SIZE. |
|
|
Definition at line 956 of file tar.c. References header, ptr, and TBLOCK_SIZE. Referenced by adjust_boundary(), and make_header(). |
|
||||||||||||
|
Definition at line 591 of file tar.c. Referenced by do_chown(), extract(), get_header(), main(), and timestamp(). |
|
||||||||||||||||||||
|
Definition at line 572 of file tar.c. References blocks, bread(), int(), io_buffer, long(), mwrite(), NIL_PTR, string_print, tar_fd, TBLOCK_SIZE, and verbose_flag. |
|
|
Definition at line 522 of file tar.c. References rmdir, S_ISDIR, stat::st_mode, stat, and unlink. |
|
|
Definition at line 534 of file tar.c. References chmod, chown, chown_flag, convert(), getgrnam(), getpwnam(), gid, group::gr_gid, header, int(), INT_TYPE, NULL, passwd::pw_uid, pwd, strncmp(), timestamp(), TMAGIC, TMAGLEN, u_mask, and uid. |
|
||||||||||||
|
Definition at line 224 of file tar.c. References exit(), flush, NIL_PTR, and string_print. |
|
|
Definition at line 412 of file tar.c. References access, close, convert(), copy, creat, do_chown(), errno, header, index(), int(), INT_TYPE, link, LONG_TYPE, mkdir, mkfifo, mknod, NIL_PTR, print, r, S_IFBLK, S_IFCHR, strerror(), string_print, symlink, tar_fd, verb_print(), and verbose_flag. |
|
|
Definition at line 332 of file tar.c. References check, checksum(), convert(), error, FALSE, force_flag, header, int(), INT_TYPE, mread(), NIL_PTR, tar_fd, and TRUE. Referenced by tarfile(). |
|
||||||||||||
|
Definition at line 901 of file tar.c. References link::dev, link_top, malloc(), NULL, path_name, print, strcpy(), and strlen(). Referenced by add_file(). |
|
|
Definition at line 923 of file tar.c. References free, link_top, link::next, and NULL. Referenced by add_file(). |
|
|
|
|
|
Definition at line 934 of file tar.c. References link::dev, link::ino, link_top, link::name, NAMSIZ, link::next, link::nlink, NULL, and strncpy(). Referenced by add_file(). |
|
||||||||||||
|
Definition at line 232 of file tar.c. References chown_flag, creat_fl, error, ext_fl, force_flag, i, NIL_PTR, norec_flag, ptr, show_fl, st, TRUE, umask, usage, and verbose_flag. |
|
||||||||||||
|
Definition at line 862 of file tar.c. References clear_header(), getgrgid(), getpwuid(), group::gr_name, header, NULL, ptr, passwd::pw_name, pwd, S_IFBLK, S_IFCHR, S_IFDIR, S_IFMT, S_IFREG, string_print, strncpy(), TGNMLEN, TMAGIC, TMAGLEN, TSIZLEN, and TUNMLEN. Referenced by add_file(). |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 983 of file tar.c. References bwrite(), error, NIL_PTR, and total_blocks. |
|
|
Definition at line 1045 of file tar.c. References i. Referenced by change(), file_insert(), GOTO(), scratch_file(), string_print(), and yank(). |
|
|
Definition at line 630 of file tar.c. References path, and string_print. |
|
|
Definition at line 1025 of file tar.c. References indx(), NIL_PTR, tar_fd, TBLOCK_SIZE, and write. |
|
|
Definition at line 405 of file tar.c. References block_size, blocks, bread(), io_buffer, tar_fd, and TBLOCK_SIZE. Referenced by tarfile(). |
|
||||||||||||
|
Definition at line 1063 of file tar.c. References args, BOOL, buf_ptr, i, NIL_PTR, num_out(), pr_fl, print, STRING_SIZE, va_arg, va_end, and va_start. |
|
|
Definition at line 352 of file tar.c. References block_size, flush, get_header(), header, is_dir, NIL_PTR, skip_entry(), string_print, strncpy(), TSIZLEN, verb_print(), and verbose_flag. |
|
|
|
|
||||||||||||
|
Definition at line 833 of file tar.c. References NIL_PTR, string_print, and verbose_flag. Referenced by add_file(), extract(), and tarfile(). |
|
|
Definition at line 183 of file tar.c. Referenced by add_file(). |
|
|
Definition at line 182 of file tar.c. Referenced by add_file(). |
|
|
Definition at line 176 of file tar.c. Referenced by do_chown(), and main(). |
|
|
Definition at line 163 of file tar.c. Referenced by main(). |
|
|
Definition at line 163 of file tar.c. Referenced by main(). |
|
|
Definition at line 171 of file tar.c. Referenced by get_header(), and main(). |
|
|
|
|
|
|
|
|
Referenced by is_added(), is_deleted(), and is_linked(). |
|
|
Definition at line 179 of file tar.c. Referenced by add_file(), and main(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 165 of file tar.c. Referenced by add_file(), adjust_boundary(), copy(), extract(), get_header(), print(), and skip_entry(). |
|
|
Definition at line 185 of file tar.c. Referenced by adjust_boundary(), and mwrite(). |
|
|
|
|
|
Definition at line 167 of file tar.c. Referenced by cache2file(), cache_reply(), domonth(), doyear(), getargs(), ifname2n(), letterToCode(), main(), make_time(), mattrib(), mcat(), mcopy(), mdel(), mdir(), mdoctorfat(), mdu(), mformat(), minfo(), mlabel(), mmd(), mmove(), mpartition(), mshowfat(), parse(), parse_args_init_io(), parse_time(), and setoption(). |
|
|
|
1.4.6