#include <sys/types.h>#include <sys/stat.h>#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <string.h>#include <dirent.h>#include <unistd.h>#include <fcntl.h>#include <errno.h>#include <limits.h>#include <time.h>#include <utime.h>Include dependency graph for remsync.c:

Go to the source code of this file.
Data Structures | |
| struct | pathname |
| struct | namelist |
| struct | entry |
Defines | |
| #define | nil 0 |
| #define | arraysize(a) (sizeof(a) / sizeof((a)[0])) |
| #define | arraylimit(a) ((a) + arraysize(a)) |
| #define | major(dev) ((int) ((dev) >> 8)) |
| #define | minor(dev) ((int) ((dev) & 0xFF)) |
| #define | S_ISLNK(mode) (0) |
| #define | lstat stat |
| #define | symlink(path1, path2) (errno= ENOSYS, -1) |
| #define | readlink(path, buf, len) (errno= ENOSYS, -1) |
| #define | NO_DEVICE (-1) |
| #define | BASE_INDENT 2 |
| #define | KEEP_STATE 0 |
| #define | KEEP_TRAVERSE 1 |
| #define | path_name(pp) ((const char *) (pp)->path) |
| #define | path_length(pp) ((pp)->idx) |
| #define | path_drop(pp) free((void *) (pp)->path) |
| #define | A_MODE1 0x01 |
| #define | A_MODE 0x02 |
| #define | A_OWNER 0x04 |
| #define | A_SIZETIME 0x08 |
| #define | A_DEV 0x10 |
| #define | A_LINK 0x20 |
Typedefs | |
| typedef pathname | pathname_t |
| typedef namelist | namelist_t |
| typedef enum filetype | filetype_t |
| typedef entry | entry_t |
Enumerations | |
| enum | filetype { F_DIR, F_FILE, F_BLK, F_CHR, F_PIPE, F_LINK } |
| enum | { DELETE, REPLACE, COPY, SIMILAR, EQUAL, ADD } |
Functions | |
| void | report (const char *label) |
| void | fatal (const char *label) |
| void * | allocate (void *mem, size_t size) |
| void | deallocate (void *mem) |
| void | forget (void *mem) |
| char * | copystr (const char *s) |
| void | path_init (pathname_t *pp) |
| void | path_add (pathname_t *pp, const char *name) |
| void | path_trunc (pathname_t *pp, size_t didx) |
| char * | rdlink (const char *link, off_t size) |
| void | sort (namelist_t **anl) |
| namelist_t * | collect (const char *dir) |
| char * | pop_name (namelist_t **names) |
| void | linked (entry_t *entry, struct stat *stp) |
| entry_t * | traverse (void) |
| void | checkstate (void) |
| void | indent (int depth) |
| int | print_name (FILE *fp, const char *name) |
| void | mkstatefile (void) |
| char * | read1line (FILE *fp) |
| void | getword (char **pline, char **parg, size_t *plen) |
| void | splitline (char *line, char ***pargv, size_t *pargc) |
| int | getattributes (entry_t *entry, int argc, char **argv) |
| void | state_syntax (off_t line) |
| entry_t * | readstate (void) |
| void | checkdiff (void) |
| if (local==nil) | |
| if (remote->type!=local->type) | |
| switch (remote->type) | |
| void | delete (entry_t *old) |
| void | change_modes (entry_t *old, entry_t *new) |
| int | cat (int f, off_t size) |
| void | add (entry_t *old, entry_t *new) |
| void | mkdifferences (void) |
| void | apply_remove (pathname_t *pp) |
| void | apply_mkold (const char *file, const char *err) |
| void | apply_chmod (const char *file, mode_t mode, uid_t uid, gid_t gid, int talk) |
| void | apply_add (pathname_t *pp, entry_t *entry) |
| void | apply_link (const char *file, pathname_t *pp) |
| void | diff_syntax (const char *line) |
| void | apply_differences (void) |
| void | usage (void) |
| int | main (int argc, char **argv) |
Variables | |
| int | sflag |
| int | dflag |
| int | uflag |
| int | xflag |
| int | Dflag |
| int | vflag |
| dev_t | xdev = NO_DEVICE |
| int | excode = 0 |
| int | keep |
| char * | tree |
| FILE * | statefp |
| char * | state_file |
| FILE * | difffp |
| char * | diff_file |
| struct { | |
| char * f_name | |
| FILE * f_fp | |
| int f_type | |
| char * word | |
| int type | |
| int val | |
| char * name | |
| CMD code | |
| void(* fn )() | |
| ARGT argt | |
| char * name | |
| char * nm | |
| char type | |
| char flags | |
| char * value | |
| const char * name | |
| signed char fat_bits | |
| int tracks | |
| unsigned short heads | |
| unsigned short sectors | |
| device_t * dev | |
| int nr_partitions | |
| int free_regions | |
| int used_regions | |
| int sectors | |
| int nr_regions | |
| int biosdrive | |
| region_t regions [NR_REGIONS] | |
| int this_month | |
| int feb | |
| int sept | |
| int days_in_month | |
| int dow_first | |
| int o_file | |
| int o_field | |
| WINDOW * win | |
| char erase | |
| char kill | |
| char werase | |
| unsigned baudr | |
| int speedcode | |
| u16_t vendor | |
| u16_t device | |
| } | remote |
| struct { | |
| char * f_name | |
| FILE * f_fp | |
| int f_type | |
| char * word | |
| int type | |
| int val | |
| char * name | |
| CMD code | |
| void(* fn )() | |
| ARGT argt | |
| char * name | |
| char * nm | |
| char type | |
| char flags | |
| char * value | |
| const char * name | |
| signed char fat_bits | |
| int tracks | |
| unsigned short heads | |
| unsigned short sectors | |
| device_t * dev | |
| int nr_partitions | |
| int free_regions | |
| int used_regions | |
| int sectors | |
| int nr_regions | |
| int biosdrive | |
| region_t regions [NR_REGIONS] | |
| int this_month | |
| int feb | |
| int sept | |
| int days_in_month | |
| int dow_first | |
| int o_file | |
| int o_field | |
| WINDOW * win | |
| char erase | |
| char kill | |
| char werase | |
| unsigned baudr | |
| int speedcode | |
| u16_t vendor | |
| u16_t device | |
| } | cmp |
| return | EQUAL |
|
|
Referenced by getattributes(). |
|
|
Referenced by getattributes(). |
|
|
Referenced by getattributes(). |
|
|
Referenced by getattributes(). |
|
|
Referenced by getattributes(). |
|
|
Referenced by getattributes(). |
|
|
|
|
|
|
|
|
Definition at line 47 of file remsync.c. Referenced by indent(). |
|
|
Definition at line 80 of file remsync.c. Referenced by readstate(). |
|
|
Definition at line 81 of file remsync.c. Referenced by traverse(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 42 of file remsync.c. Referenced by traverse(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Definition at line 1008 of file remsync.c. References cat(), checkdiff(), close, difffp, EINVAL, EOF, err, errno, F_BLK, F_CHR, F_DIR, F_FILE, F_LINK, F_PIPE, file, fprintf(), fputc(), entry::gid, entry::ignore, entry::link, entry::linked, entry::mode, entry::mtime, nil, O_RDONLY, open, entry::path, path_add(), path_drop, path_init(), path_name, print_name(), entry::rdev, report(), entry::size, stderr, strerror(), tree, entry::type, entry::uid, and vflag. |
|
||||||||||||
|
Definition at line 61 of file remsync.c. References assert, errno, exit(), fatal(), fprintf(), heap_chunks, malloc(), nil, realloc(), stderr, and strerror(). |
|
||||||||||||
|
Definition at line 1246 of file remsync.c. References utimbuf::actime, apply_chmod(), apply_mkold(), apply_remove(), arraylimit, c, chmod, close, diff_file, difffp, dirty, entry, EOF, exit(), F_BLK, F_CHR, F_DIR, F_FILE, F_LINK, F_PIPE, feof, ferror, fprintf(), getc, entry::gid, entry::ignore, int(), entry::link, lstat, major, minor, mkdir, mknod, entry::mode, utimbuf::modtime, entry::mtime, nil, O_CREAT, O_TRUNC, O_WRONLY, open, p, path_name, entry::rdev, report(), S_IFBLK, S_IFCHR, S_IFIFO, S_ISREG, entry::size, size, st, stat::st_mode, stat::st_mtime, stderr, symlink, time, entry::type, entry::uid, unlink, utime, vflag, and write. Referenced by apply_differences(). |
|
||||||||||||||||||||||||
|
Definition at line 1215 of file remsync.c. References chmod, chown, EPERM, errno, file, fprintf(), lstat, report(), st, stat::st_gid, stat::st_mode, stat::st_uid, stderr, and vflag. Referenced by apply_add(), and apply_differences(). |
|
|
Definition at line 1402 of file remsync.c. References apply_add(), apply_chmod(), apply_link(), apply_mkold(), apply_remove(), argc, argv, checkdiff(), diff_syntax(), difffp, entry, feof, getattributes(), entry::ignore, link, nil, path, path_add(), path_init(), path_length, path_name, path_trunc(), read1line(), splitline(), strcmp, strtoul(), and tree. |
|
||||||||||||
|
Definition at line 1371 of file remsync.c. References apply_remove(), errno, excode, fprintf(), link, lstat, path_name, report(), stat::st_dev, stat::st_ino, stderr, strerror(), and vflag. Referenced by apply_differences(). |
|
||||||||||||
|
Definition at line 1200 of file remsync.c. References utimbuf::actime, fprintf(), utimbuf::modtime, nil, report(), stderr, and utime. Referenced by apply_add(), and apply_differences(). |
|
|
Definition at line 1159 of file remsync.c. References collect(), ENOENT, entries, errno, fprintf(), lstat, nil, path_add(), path_length, path_name, path_trunc(), pop_name(), report(), rmdir, S_ISDIR, st, stat::st_mode, stderr, unlink, and vflag. Referenced by apply_add(), apply_differences(), and apply_link(). |
|
||||||||||||
|
Definition at line 972 of file remsync.c. References c, checkdiff(), Dflag, difffp, EINVAL, EOF, err, errno, int(), n, p, putc, and read. Referenced by add(), and categorize(). |
|
||||||||||||
|
Definition at line 952 of file remsync.c. References checkdiff(), fprintf(), print_name(), and vflag. Referenced by mkdifferences(). |
|
|
Definition at line 872 of file remsync.c. References diff_file, difffp, fatal(), and ferror. Referenced by add(), apply_differences(), cat(), change_modes(), and mkdifferences(). |
|
|
Definition at line 496 of file remsync.c. References fatal(), ferror, state_file, and statefp. Referenced by indent(), mkstatefile(), and readstate(). |
|
|
Definition at line 233 of file remsync.c. References allocate(), closedir, copystr(), entry, errno, names, name::next, nil, opendir, readdir, and sort(). |
|
|
Definition at line 94 of file remsync.c. References allocate(), c, nil, strcpy(), and strlen(). |
|
|
Definition at line 71 of file remsync.c. References alloc_count, free, and nil. |
|
|
|
|
|
Definition at line 1395 of file remsync.c. References diff_file, exit(), fprintf(), and stderr. Referenced by apply_differences(). |
|
|
|
|
|
Definition at line 83 of file remsync.c. References arraylimit, deallocate, and keep. Referenced by getattributes(), linked(), and pop_name(). |
|
||||||||||||||||
|
Definition at line 681 of file remsync.c. References A_DEV, A_LINK, A_MODE, A_MODE1, A_OWNER, A_SIZETIME, allocate(), arraysize, copystr(), deallocate, entry, F_BLK, F_CHR, F_DIR, F_FILE, F_LINK, F_PIPE, forget(), entry::gid, i, entry::lastlink, entry::link, entry::linked, lp, entry::mode, entry::mtime, next, nil, entry::path, path, entry::rdev, entry::size, strcmp, strtoul(), entry::type, and entry::uid. Referenced by apply_differences(), and readstate(). |
|
||||||||||||||||
|
Definition at line 623 of file remsync.c. References allocate(), arg, c, and i. Referenced by servxcheck(). |
|
|
|
|
|
|
|
|
Definition at line 501 of file remsync.c. References BASE_INDENT, checkstate(), EOF, n, putc, and statefp. |
|
||||||||||||
|
Definition at line 303 of file remsync.c. References allocate(), arraysize, copystr(), deallocate, dev, entry, entry::fake_ino, forget(), entry::lastlink, entry::link, entry::linked, lp, next, nil, entry::path, path, S_ISDIR, stat::st_dev, stat::st_ino, stat::st_mode, and stat::st_nlink. Referenced by copy1(), traverse(), and trylink(). |
|
||||||||||||
|
|
|
|
Definition at line 1108 of file remsync.c. References ADD, add(), change_modes(), checkdiff(), compare, COPY, DELETE, difffp, EQUAL, F_FILE, fflush(), fprintf(), local, nil, readstate(), remote, SIMILAR, and traverse(). |
|
|
Definition at line 533 of file remsync.c. References checkstate(), entry::depth, entry, EOF, F_BLK, F_CHR, F_DIR, F_FILE, F_LINK, F_PIPE, entry::fake_ino, fflush(), fprintf(), fputc(), entry::gid, entry::ignore, indent, entry::lastlink, entry::link, entry::mode, entry::mtime, entry::name, nil, print_name(), entry::rdev, entry::size, statefp, strerror(), traverse(), entry::type, and entry::uid. |
|
||||||||||||
|
Definition at line 114 of file remsync.c. References allocate(), pathname::idx, pathname::lim, p, pathname::path, slash(), and strlen(). |
|
|
Definition at line 107 of file remsync.c. References allocate(), pathname::idx, pathname::lim, nil, and pathname::path. |
|
||||||||||||
|
Definition at line 146 of file remsync.c. References pathname::idx, and pathname::path. |
|
|
Definition at line 262 of file remsync.c. References deallocate, forget(), namelist::name, names, and namelist::next. Referenced by apply_remove(), and traverse(). |
|
||||||||||||
|
Definition at line 516 of file remsync.c. References c, EOF, ferror, fp, fprintf(), p, and putc. Referenced by add(), change_modes(), and mkstatefile(). |
|
||||||||||||
|
Definition at line 182 of file remsync.c. References allocate(), n, nil, path, and readlink. Referenced by traverse(). |
|
|
Definition at line 592 of file remsync.c. References allocate(), c, EOF, exit(), ferror, fp, fprintf(), getc, nil, and stderr. Referenced by apply_differences(), and readstate(). |
|
|
Definition at line 797 of file remsync.c. References allocate(), argc, argv, checkstate(), entry::depth, entry, feof, getattributes(), entry::ignore, indent, keep, KEEP_STATE, lineno, entry::link, entry::name, nil, entry::path, path, path_add(), path_init(), path_length, path_name, path_trunc(), read1line(), splitline(), state_syntax(), statefp, and strcmp. Referenced by mkdifferences(). |
|
|
Definition at line 49 of file remsync.c. References errno, excode, fprintf(), stderr, and strerror(). |
|
|
Definition at line 197 of file remsync.c. References if(), namelist::name, namelist::next, nil, sort(), and strcmp. |
|
||||||||||||||||
|
Definition at line 653 of file remsync.c. References allocate(), argv, and nil. Referenced by apply_differences(), and readstate(). |
|
|
Definition at line 790 of file remsync.c. References exit(), fprintf(), state_file, and stderr. Referenced by readstate(). |
|
|
Definition at line 911 of file remsync.c. References COPY, F_BLK, F_CHR, F_DIR, F_FILE, F_LINK, F_PIPE, local, remote, SIMILAR, strcmp, and uflag. Referenced by Do(), do_sigprocmask(), lexi(), m_move(), reduce(), and step(). |
|
|
Definition at line 359 of file remsync.c. References allocate(), collect(), copystr(), entry::depth, EINVAL, ENOENT, entries, entry, errno, EXDEV, F_BLK, F_CHR, F_DIR, F_FILE, F_LINK, F_PIPE, entry::gid, entry::ignore, keep, KEEP_TRAVERSE, entry::link, linked(), lstat, entry::mode, entry::mtime, entry::name, nil, NO_DEVICE, entry::path, path, path_add(), path_init(), path_length, path_name, path_trunc(), pop_name(), entry::rdev, rdlink(), report(), S_ISBLK, S_ISCHR, S_ISDIR, S_ISFIFO, S_ISLNK, S_ISREG, entry::size, st, stat::st_dev, stat::st_gid, stat::st_mode, stat::st_mtime, stat::st_rdev, stat::st_size, stat::st_uid, tree, entry::type, entry::uid, xdev, and xflag. |
|
|
|
|
|
Referenced by bsearch(), cmd_tag(), cmp_fields(), compare(), Findchar(), Findmacro(), Findnum(), Findstr(), inflate_fast(), main(), nm_sort(), Nreq(), qsort1(), search(), search_mnem(), and selected(). |
|
|
Definition at line 39 of file remsync.c. Referenced by cat(), copy(), extract(), and pax_options(). |
|
|
|
|
|
Definition at line 357 of file remsync.c. Referenced by apply_add(), checkdiff(), and diff_syntax(). |
|
|
Definition at line 356 of file remsync.c. Referenced by add(), apply_add(), apply_differences(), cat(), checkdiff(), and mkdifferences(). |
|
|
|
|
|
|
|
|
Definition at line 79 of file remsync.c. Referenced by forget(), mkdirp(), readstate(), and traverse(). |
|
|
Referenced by if(), mkdifferences(), and switch(). |
|
|
|
|
|
Definition at line 355 of file remsync.c. Referenced by checkstate(), and state_syntax(). |
|
|
Definition at line 354 of file remsync.c. Referenced by checkstate(), indent(), mkstatefile(), and readstate(). |
|
|
Definition at line 353 of file remsync.c. Referenced by add(), apply_differences(), build_tree(), gen_bitlen(), io(), newtp(), pqdownheap(), scan_tree(), send_tree(), and traverse(). |
|
|
|
|
|
|
|
|
|
|
|
|
1.4.6