archiver.c File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
#include <arch.h>

Include dependency graph for archiver.c:

Go to the source code of this file.

Defines

#define S_IREAD   S_IRUSR
#define S_IWRITE   S_IWUSR
#define S_IEXEC   S_IXUSR
#define MAGIC_NUMBER   ARMAG
#define odd(nr)   (nr & 01)
#define even(nr)   (odd(nr) ? nr + 1 : nr)
#define FALSE   0
#define TRUE   1
#define READ   0
#define APPEND   2
#define CREATE   1
#define MEMBER   struct ar_hdr
#define NIL_PTR   ((char *) 0)
#define NIL_MEM   ((MEMBER *) 0)
#define NIL_LONG   ((long *) 0)
#define IO_SIZE   (10 * 1024)
#define equal(str1, str2)   (!strncmp((str1), (str2), 14))
#define S_ISDIR(m)   (m & S_IFDIR)

Typedefs

typedef char BOOL

Functions

long lseek ()
char * mktemp ()
char * ctime ()
 usage ()
 error (BOOL quit, char *str1, char *str2, char *str3, char *str4)
char * basename (char *path)
unsigned int rd_unsigned2 ()
 open_archive (char *name, int mode)
 catch ()
 main (int argc, argv)
MEMBER * get_member ()
char * get_mode ()
 get (int argc, argv)
 add (char *name, int fd, char *mess)
 extract (MEMBER *member)
 copy_member (MEMBER *member, int from, int to, extracting)
char * get_mode (int mode)
 wr_fatal ()
 rd_fatal ()
 mwrite (int fd, char *address, int bytes)
 show (char *s, char *name)

Variables

static char RcsId [] = "$Header: /opt/proj/minix/cvsroot/src/commands/aal/archiver.c,v 1.1.1.1 2005/04/21 14:53:57 beng Exp $"
BOOL verbose
BOOL app_fl
BOOL ex_fl
BOOL show_fl
BOOL pr_fl
BOOL rep_fl
BOOL del_fl
BOOL nocr_fl
BOOL local_fl
BOOL update_fl
int ar_fd
char io_buffer [IO_SIZE]
char * progname
char temp_buf [32]
char * temp_arch = &temp_buf[0]


Define Documentation

#define APPEND   2
 

Definition at line 66 of file archiver.c.

Referenced by buf_read(), buf_write(), get(), isInBuffer(), and open_archive().

#define CREATE   1
 

Definition at line 67 of file archiver.c.

Referenced by get(), and open_archive().

#define equal str1,
str2   )     (!strncmp((str1), (str2), 14))
 

Definition at line 77 of file archiver.c.

Referenced by __diff(), cmdlookup(), command(), doevent(), doinclude(), exec_one(), expr_operator(), find_builtin(), first(), get(), get_member(), lookup_op(), main(), parsefield(), parsenode(), printit(), readtoken(), readtoken1(), second(), uniq(), and updatepwd().

#define even nr   )     (odd(nr) ? nr + 1 : nr)
 

Definition at line 59 of file archiver.c.

Referenced by add(), copy_member(), and crc32_combine().

#define FALSE   0
 

Definition at line 62 of file archiver.c.

Referenced by abort_mined(), abortdo(), add(), adjmove(), advance(), another_hunk(), ask(), at(), auto_var(), bc_add(), bc_compare(), bc_divide(), bc_raise(), bc_sqrt(), bc_sub(), blkflush(), blkinit(), bottom_line(), catch(), change(), check_exec(), check_file(), check_stack(), check_string(), checkmark(), clear_func(), cmd_append(), cmd_args(), cmd_at(), cmd_map(), cmd_mkexrc(), cmd_move(), cmd_put(), cmd_read(), cmd_set(), cmd_substitute(), cmd_tag(), cmd_write(), cmd_xit(), command(), common_open(), conv4(), conv_inode(), copy_member(), cpp_echo(), cpp_getc(), ctags(), cut(), dasm(), death(), digits(), display(), do_battle(), do_cancel(), do_digraph(), do_ed_script(), do_escape(), do_exec(), do_first_init(), do_getstat(), do_initialize(), do_mount(), do_read(), do_rename(), do_status(), do_vdevio(), do_vread(), do_vwrite(), docmd(), docmds1(), dopirate(), dp_recv(), dp_send(), drawtext(), dyndep(), ec_recv(), ec_send(), el1_send(), el2_init(), el2_probe(), enclosed(), english(), error_reply(), eth_cancel(), eth_read(), eth_write(), ex(), exebpnt(), execute(), expandabbr(), expr(), extract(), f_reset(), file_getc(), file_init(), file_open(), fill(), filter(), finds_data(), finds_pc(), fmt(), free_range(), Func2(), Func3(), func_key(), fxp_check_ints(), fxp_getstat(), fxp_pci_conf(), fxp_probe(), fxp_readv(), fxp_report_link(), fxp_restart_ru(), fxp_writev(), get_array_num(), get_expression(), get_file(), get_header(), getabkey(), getchar(), getfn(), getnak(), gnu_finds_data(), gnu_finds_pc(), gnu_text_symbol(), hasattr(), holding(), icmp_pack_oneCsum(), implmacros(), in_process(), init_digraphs(), init_gen(), init_load(), init_storage(), initialize(), initopts(), input(), insert_arg(), insert_id_rec(), InterpretCommand(), intuit_diff_type(), inventory(), ip_cancel(), ip_chk_hdropt(), ip_frag_chk(), ip_packet2user(), ip_read(), ip_write(), ipr_destunrch(), ipr_gateway_down(), ipr_mtu(), ipr_redirect(), ipr_ttl_exc(), is(), is_unused_port(), is_zero(), IsAnyLower(), isperiod(), itverb(), ivbrief(), ivdrink(), iveat(), ivkill(), ivlook(), ivread(), lance_probe(), lex_gettoken(), load_code(), load_file(), long_val(), lookin(), lookup(), m_bsrch(), m_fsrch(), m_Nsrch(), m_nsrch(), m_scroll(), main(), make(), MakeMove(), makenew(), match(), Memcmp(), merge(), mode(), mounted(), ne_probe(), ne_reset(), new_field(), new_yy_file(), newline(), nl(), nocbreak(), noecho(), noraw(), normend(), ns_interrupt(), ns_recv(), ns_reset(), open_archive(), open_new_file(), outustr(), pack_oneCsum(), packet2user(), pagef(), panic(), patch_match(), patch_stack(), pch_swap(), plan_a(), plan_b(), print(), Print_Record(), Proc5(), process_params(), ProgramMove(), promisc_restart_read(), psip_cancel(), psip_read(), psip_write(), pspeak(), PT(), push_constant(), Read_Super_Block(), ReadCommand(), redraw(), reinitialize_almost_everything(), reply(), reprint(), ResetGame(), restart_write_fd(), resume_curses(), rl_check_ints(), rl_clear_rx(), rl_do_reset(), rl_getstat(), rl_handler(), rl_pci_conf(), rl_probe(), rl_readv(), rl_report_link(), rl_reset_hw(), rl_writev(), rtl_probe(), run_code(), rw_inode(), rzfile(), S(), search_dir(), selected(), setattr(), setoption(), setviz(), showmsg(), sig_proc(), similar(), sr_rec(), start_syscall(), stimer(), stop_beep(), store_var(), substitute(), suspend_curses(), tail(), tcp_cancel(), tcp_check_conn(), tcp_fd_read(), tcp_fd_write(), tcp_frag2conn(), tcp_main(), tcp_read(), tcp_reply_read(), tcp_reply_write(), tcp_su4connect(), tcp_write(), text_symbol(), there_is_another_patch(), tmpabort(), tmpend(), tmpsave(), tmpstart(), trapint(), trverb(), tty_echo(), udp_cancel(), udp_get_data(), udp_packet2user(), udp_read(), udp_write(), undo(), v_1ex(), v_at(), v_change(), v_errlist(), v_filter(), v_insert(), v_keyword(), v_lshift(), v_overtype(), v_redraw(), v_reformat(), v_rshift(), v_subst(), v_undo(), v_xit(), vbreak(), vi(), vinsert(), w_do_open(), WB(), wcrx(), wcrxpn(), wcsend(), wdeth_probe(), wgetch(), write_map(), WT(), yes(), zgethdr(), and zsendfdata().

#define IO_SIZE   (10 * 1024)
 

Definition at line 75 of file archiver.c.

Referenced by add(), copy_member(), and put_line().

#define MAGIC_NUMBER   ARMAG
 

Definition at line 54 of file archiver.c.

Referenced by open_archive().

#define MEMBER   struct ar_hdr
 

Definition at line 69 of file archiver.c.

Referenced by add(), get(), get_member(), and show().

#define NIL_LONG   ((long *) 0)
 

Definition at line 73 of file archiver.c.

#define NIL_MEM   ((MEMBER *) 0)
 

Definition at line 72 of file archiver.c.

Referenced by get(), and get_member().

#define NIL_PTR   ((char *) 0)
 

Definition at line 71 of file archiver.c.

Referenced by abort_mined(), add_file(), add_path(), alloc(), bad_write(), basename(), bottom_line(), change(), copy(), cstart(), CTL(), delete(), error(), exception(), extract(), fcntl(), get_expression(), get_header(), get_line(), get_opts(), insert(), length_of(), load_file(), MA(), main(), match(), mbrk(), move(), mread(), msbrk(), mwrite(), new_field(), open_outfile(), print(), print_table(), PT(), put_line(), scratch_file(), search(), set_up(), SH(), sort(), string_print(), substitute(), tarfile(), verb_print(), VI(), WB(), WT(), and yank().

#define odd nr   )     (nr & 01)
 

Definition at line 58 of file archiver.c.

Referenced by copy_member(), and crc32_combine().

#define READ   0
 

Definition at line 65 of file archiver.c.

Referenced by _read_pm(), determine(), disk_io(), do_close(), do_unpause(), extract(), get(), get_inode(), get_super(), interact(), itverb(), main(), pipe_check(), PT(), read(), read_cluster(), read_fat(), read_more(), read_standards(), release(), rw_inode(), rw_super(), scratch_file(), set(), test04(), test06(), test10(), test11(), test7d(), test7i(), test7j(), trverb(), and WB().

#define S_IEXEC   S_IXUSR
 

Definition at line 37 of file archiver.c.

Referenced by get_mode(), and rwx().

#define S_IREAD   S_IRUSR
 

Definition at line 31 of file archiver.c.

Referenced by get_mode(), getfp(), and rwx().

#define S_ISDIR m   )     (m & S_IFDIR)
 

Definition at line 79 of file archiver.c.

Referenced by add(), apply_remove(), ar_open(), cleandir(), compare(), copy(), copy1(), delete(), do1(), do_change(), do_chown(), file(), file_data(), fpathconf(), fts_stat(), link1(), linked(), lnk_creat(), main(), makedir(), makepath(), makeUnixDir(), mark(), mk_link(), mkpath(), mpBuildUnixFilename(), new_node(), opendir(), r_readdir(), rl_add_slash(), select_image(), test21b(), test27a(), test39f(), traverse(), and unlnk_exist().

#define S_IWRITE   S_IWUSR
 

Definition at line 34 of file archiver.c.

Referenced by get_mode(), getfp(), rwx(), tmpstart(), and touch().

#define TRUE   1
 

Definition at line 63 of file archiver.c.

Referenced by Add(), add(), addobj(), adjust_options(), advance(), alloc(), another_hunk(), arp_ioctl(), b64_add(), bc_compare(), bc_divide(), bc_raise(), bc_sqrt(), beep(), beep_x(), bottom_line(), bug(), catch(), cbreak(), change(), check_exec(), check_next(), check_stack(), checkmark(), chkinvok(), clock_task(), cmd_args(), cmd_at(), cmd_global(), cmd_map(), cmd_mkexrc(), cmd_put(), cmd_read(), cmd_set(), cmd_shell(), cmd_write(), cmp(), command(), common_open(), conv_inode(), copy_member(), cpp_echo(), cpp_getc(), cpp_open(), cstart(), ctags(), cut(), dasm(), delete(), digits(), do_battle(), do_digraph(), do_escape(), do_initialize(), do_int(), do_mkdir(), do_mknod(), do_mount(), do_option(), do_read(), do_rename(), do_segctl(), do_setsid(), do_shutdown(), do_slink(), do_vdevio(), do_vwrite(), do_write(), docmd(), docmds1(), doexp(), doiobj(), domove(), dopirate(), dp_recv(), dp_send(), driver_task(), dyndep(), ec_recv(), ec_send(), echo(), el1_interrupt(), el2_probe(), el3_interrupt(), el3_rx_complete(), english(), eth_cancel(), eth_ioctl(), exebpnt(), exrefresh(), f_intr_wait(), fdc_out(), fdc_results(), filbuf(), file_getc(), file_insert(), file_open(), fill(), fillkeybuf(), find_key(), finds_data(), finds_pc(), flush(), fmt(), free_range(), fs_init(), Func2(), Func3(), func_key(), fxp_check_ints(), fxp_do_conf(), fxp_handler(), fxp_init_hw(), fxp_probe(), fxp_rec_mode(), fxp_reset_hw(), fxp_watchdog_f(), fxp_writev(), generate(), get_header(), get_line(), get_member(), get_opts(), getfn(), getline(), getnak(), getpipe(), gnu_finds_data(), gnu_finds_pc(), gnu_text_symbol(), grow_hunkmax(), IF(), implmacros(), initopts(), initscr(), input(), insert(), insert_arg(), insert_id_rec(), InterpretCommand(), inventory(), ip_cancel(), ip_chk_hdropt(), ip_frag_chk(), ip_ioctl(), is(), is_authorized(), is_zero(), IsAnyLower(), isperiod(), itverb(), ivlook(), ksig_pending(), lance_probe(), lex_gettoken(), link_fat(), load_code(), load_file(), long_val(), lookin(), lookup(), m_bsrch(), m_fsrch(), m_Nsrch(), m_nsrch(), main(), make(), mark2phys(), matlin(), mbrk(), Memcmp(), mode(), mounted(), mread(), msbrk(), msg(), mwrite(), ne_reset(), new_field(), newline(), nonl(), normend(), ns_interrupt(), ns_recv(), ns_reset(), ns_send(), num(), open_archive(), open_new_file(), open_outfile(), output_done(), pagef(), panic(), parse_path(), patch_stack(), pch_swap(), pio_getblock(), plan_a(), plan_b(), print(), Print_Record(), print_table(), process_params(), procheader(), psip_ioctl(), push_constant(), put_line(), putsec(), raw(), rd_fatal(), re_input(), read_info(), Read_Super_Block(), read_symbol(), ReadCommand(), recalibrate(), redraw(), redrawrange(), resume_curses(), rev_in_string(), rl_check_ints(), rl_do_reset(), rl_handler(), rl_probe(), rl_watchdog_f(), rl_writev(), rt_error(), rtl_probe(), savestr(), ScreenInit(), search(), search_dir(), selected(), set_owner(), setoption(), setviz(), show1instruction(), showmsg(), similar(), smartdrawtext(), stack_trace(), start_syscall(), stimer(), stop_execution(), store_var(), substitute(), sys_task(), tail(), tcp_cancel(), tcp_check_conn(), tcp_connect(), tcp_ioctl(), tcp_listen(), tcp_reply_ioctl(), tcp_setconf(), tcp_setopt(), tcp_su4listen(), text_symbol(), there_is_another_patch(), tmpabort(), tmpend(), tmpsave(), turn(), udp_cancel(), udp_ioctl(), udp_peek(), udp_rd_enqueue(), udp_setopt(), undo(), usage(), v_again(), v_filter(), v_insert(), v_paste(), v_reformat(), vbreak(), veat(), VI(), vkill(), vlook(), vpour(), vunlock(), vwake(), w_do_open(), warn(), WB(), wclear(), wcrx(), wcrxpn(), wcsend(), wctx(), wdeth_probe(), will_option(), wr_fatal(), wrefresh(), write_map(), WT(), XT(), yes(), and yyerror().


Typedef Documentation

typedef char BOOL
 

Definition at line 61 of file archiver.c.


Function Documentation

add char *  name,
int  fd,
char *  mess
 

Definition at line 464 of file archiver.c.

References AR_TOTAL, basename, close, error, even, FALSE, io_buffer, IO_SIZE, L, lseek, member, MEMBER, mwrite(), offset, open, read, S_ISDIR, show(), stat, status, strncpy(), verbose, wr_arhdr(), and x.

Referenced by cmd_append(), cmd_read(), compare(), filter(), inflate_fast(), input(), master(), mkdifferences(), paste(), and v_insert().

char* basename char *  path  ) 
 

Definition at line 135 of file archiver.c.

References basename, NIL_PTR, and ptr.

catch  ) 
 

Definition at line 191 of file archiver.c.

copy_member MEMBER *  member,
int  from,
int  to,
extracting 
 

Definition at line 555 of file archiver.c.

References AR_TOTAL, BOOL, error, even, FALSE, io_buffer, IO_SIZE, L, long(), lseek, mwrite(), odd, offset, pos, read, strncpy(), and TRUE.

Referenced by extract(), and get().

char* ctime  ) 
 

Referenced by AnyMail(), cdiff(), days2time(), dbgprint(), deliver(), logmsg(), main(), personprint(), Print_Record(), printit(), quickprint(), sayhello(), shortprint(), syslog(), tab_print(), and wall().

error BOOL  quit,
char *  str1,
char *  str2,
char *  str3,
char *  str4
 

Definition at line 121 of file archiver.c.

References _exit, sprint(), strlen(), temp_arch, unlink, and write.

extract MEMBER *  member  ) 
 

Definition at line 530 of file archiver.c.

References ar_fd, chmod, close, copy_member(), creat, error, FALSE, pr_fl, show(), strncpy(), and verbose.

Referenced by main(), move(), spcmove(), vbreak(), vdrink(), vdrop(), vextract(), vfill(), vinsert(), vlock(), vpour(), and vwear().

get int  argc,
argv 
 

Definition at line 320 of file archiver.c.

References app_fl, APPEND, ar_fd, basename, copy_member(), CREATE, del_fl, equal, ex_fl, get_member(), i, member, MEMBER, NIL_MEM, open_archive(), pr_fl, print, READ, rep_fl, show_fl, temp_arch, and wr_arhdr().

Referenced by getline(), and initget().

MEMBER* get_member  ) 
 

Definition at line 299 of file archiver.c.

References ar_fd, equal, error, lseek, member, MEMBER, NIL_MEM, rd_arhdr(), SYMDEF, and TRUE.

Referenced by get().

char* get_mode int  mode  ) 
 

Definition at line 593 of file archiver.c.

References S_IEXEC, S_IREAD, S_IWRITE, and tmp.

char* get_mode  ) 
 

Referenced by test02(), and test09().

long lseek  ) 
 

main int  argc,
argv 
 

Definition at line 198 of file archiver.c.

References app_fl, del_fl, ex_fl, local_fl, nocr_fl, pr_fl, progname, ptr, rep_fl, show_fl, TRUE, update_fl, usage, and verbose.

char* mktemp  ) 
 

Referenced by create_file_names(), filter(), main(), make_tmp(), opentemp(), sbx_tset(), and spool().

mwrite int  fd,
char *  address,
int  bytes
 

Definition at line 624 of file archiver.c.

References error, TRUE, and write.

Referenced by add(), add_file(), adjust_boundary(), copy(), copy_member(), and put_line().

open_archive char *  name,
int  mode
 

Definition at line 157 of file archiver.c.

References AALMAG, APPEND, ARMAG, close, creat, CREATE, error, FALSE, L, lseek, magic, MAGIC_NUMBER, nocr_fl, open, progname, rd_unsigned2(), TRUE, and wr_int2().

Referenced by get().

rd_fatal  ) 
 

Definition at line 619 of file archiver.c.

References error, and TRUE.

Referenced by rd_arhdr(), and rd_bytes().

unsigned int rd_unsigned2  ) 
 

Referenced by open_archive(), and process().

show char *  s,
char *  name
 

Definition at line 633 of file archiver.c.

References MEMBER, print, and x.

Referenced by add(), extract(), mlabel(), set(), and uniq().

usage void   ) 
 

Definition at line 108 of file archiver.c.

References error, progname, and TRUE.

wr_fatal  ) 
 

Definition at line 614 of file archiver.c.

References error, and TRUE.

Referenced by wr_bytes().


Variable Documentation

BOOL app_fl
 

Definition at line 83 of file archiver.c.

Referenced by get(), and main().

int ar_fd
 

Definition at line 97 of file archiver.c.

Referenced by extract(), get(), and get_member().

BOOL del_fl
 

Definition at line 88 of file archiver.c.

Referenced by get(), and main().

BOOL ex_fl
 

Definition at line 84 of file archiver.c.

Referenced by get(), and main().

char io_buffer[IO_SIZE]
 

Definition at line 99 of file archiver.c.

Referenced by add(), copy(), copy_member(), and skip_entry().

BOOL local_fl
 

Definition at line 90 of file archiver.c.

Referenced by main().

BOOL nocr_fl
 

Definition at line 89 of file archiver.c.

Referenced by main(), and open_archive().

BOOL pr_fl
 

Definition at line 86 of file archiver.c.

Referenced by extract(), get(), main(), and string_print().

char* progname
 

Definition at line 101 of file archiver.c.

Referenced by _mwrite_one(), check_mtab(), del_entry(), do_getname(), eat_dir(), error(), fatal(), fatal_error(), fxp_getname(), init(), main(), main_loop(), open_archive(), pexit(), process_command_line(), rl_getname(), Usage(), usage(), warn(), word_alloc(), xmalloc(), and xrealloc().

char RcsId[] = "$Header: /opt/proj/minix/cvsroot/src/commands/aal/archiver.c,v 1.1.1.1 2005/04/21 14:53:57 beng Exp $" [static]
 

Definition at line 9 of file archiver.c.

BOOL rep_fl
 

Definition at line 87 of file archiver.c.

Referenced by get(), and main().

BOOL show_fl
 

Definition at line 85 of file archiver.c.

Referenced by get(), and main().

char* temp_arch = &temp_buf[0]
 

Definition at line 104 of file archiver.c.

Referenced by catch(), error(), and get().

char temp_buf[32]
 

Definition at line 103 of file archiver.c.

BOOL update_fl
 

Definition at line 91 of file archiver.c.

Referenced by main().

BOOL verbose
 

Definition at line 82 of file archiver.c.

Referenced by add(), another_hunk(), argmatch(), cl_block(), dec(), deliver(), deltemp(), do_ed_script(), dump_dir(), dump_file(), extract(), finduser(), format_device(), get_flags(), get_line(), hashcmd(), inittemp(), interrupt(), ListHosts(), main(), minfo(), mlabel(), mpartition(), output(), plan_a(), plan_b(), pr_class(), pr_rr(), pr_type(), predef(), prin1(), print_conn(), printinfo(), readfs(), scan_input(), scan_profile(), skip_to(), talk(), there_is_another_patch(), transform(), and unix_exec().


Generated on Fri Apr 14 22:57:42 2006 for minix by  doxygen 1.4.6