📄 xtar.c
字号:
/* * Copyright (C) 1998, 1999, Jonathan S. Shapiro. * * This file is part of the EROS Operating System. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2, * or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* * Xtar -- domain that untars an archive and creates appropriate * directories and files. * * Key Registers: * * KR12: arg0 Target directory * KR13: arg1 User's spacebank * KR14: arg2 * KR15: arg3 */#include "system.h"#include "tar.h"/* Global variables */void *head; /* points to current archive header */int blocking; /* Size of each block, in records. */int blocksize; /* Size of each block, in bytes. */void *ar_last; /* Last+1 record of archive block. */void *ar_block; /* Start of block of archive. */void *ar_record; /* Current record of archive. */struct header block; /* A block */int archive; /* file descriptor for archive file */int exit_status; /* status for exit when tar finishes */void *input; /* Input mmaped */int hit_eof; /* Hit the end-of-file */char current_file_name[NAMSIZ];char current_link_name[NAMSIZ];struct stat hstat; /* File statistics */intProcessRequest(Message *msg){ msg->snd_len = msg->rcv_len; msg->snd_data = msg->rcv_data; msg->snd_key0 = msg->rcv_key0; msg->snd_key1 = msg->rcv_key1; msg->snd_key2 = msg->rcv_key2; msg->snd_key3 = msg->rcv_key3; blocking = BLOCKINGSIZE; blocksize = blocking * RECORDSIZE; exit_status = TAREXIT_SUCCESS; head = ar_block = NULL; ar_last = ar_record = NULL; hit_eof = 0; read_and (extract_archive); /* leave receive info unchanged, but reset the length limit: */ msg->snd_code = RC_OK; return exit_status;}intmain(){ Message msg; node_copy(KR_CONSTIT, KC_OSTREAM, KR_OSTREAM); node_copy(KR_CONSTIT, KC_SLEEP, KR_SCRATCH); kdprintf(KR_OSTREAM, "Hit xtar main\n"); msg.snd_invKey = KR_VOID; msg.snd_key0 = KR_VOID; msg.snd_key1 = KR_VOID; msg.snd_key2 = KR_VOID; msg.snd_key3 = KR_VOID; msg.snd_data = 0; msg.snd_len = 0; msg.snd_code = 0; msg.snd_w1 = 0; msg.snd_w2 = 0; msg.snd_w3 = 0; msg.rcv_key0 = KR_RETURNER; msg.rcv_key1 = KR_CWD; msg.rcv_key2 = KR_FSROOT; msg.rcv_key3 = KR_RESUME; msg.rcv_len = 0; msg.rcv_code = 0; msg.rcv_w1 = 0; msg.rcv_w2 = 0; msg.rcv_w3 = 0; do { RETURN(&msg); msg.snd_invKey = msg.rcv_key3; } while ( ProcessRequest(&msg) ); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -