mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
Patch from Matt Kraai <kraai@alumni.carnegiemellon.edu> to
simplify ar.c and make it more readable. -Erik
This commit is contained in:
parent
2086e3d679
commit
57ebebfb01
30
ar.c
30
ar.c
@ -35,11 +35,11 @@
|
|||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
#define AR_BLOCK_SIZE 60
|
#define AR_BLOCK_SIZE 60
|
||||||
#define AR_PRESERVE_DATE 1
|
#define AR_PRESERVE_DATE 1 /* preserve original dates */
|
||||||
#define AR_VERBOSE 2
|
#define AR_VERBOSE 2 /* be verbose */
|
||||||
#define AR_DISPLAY 4
|
#define AR_DISPLAY 4 /* display contents */
|
||||||
#define AR_EXT_TO_FILE 8
|
#define AR_EXT_TO_FILE 8 /* extract contents of archive */
|
||||||
#define AR_EXT_TO_STDOUT 16
|
#define AR_EXT_TO_STDOUT 16 /* extract to stdout */
|
||||||
|
|
||||||
#define BB_DECLARE_EXTERN
|
#define BB_DECLARE_EXTERN
|
||||||
#define bb_need_io_error
|
#define bb_need_io_error
|
||||||
@ -302,20 +302,20 @@ extern int ar_main(int argc, char **argv)
|
|||||||
++opt_ptr;
|
++opt_ptr;
|
||||||
while ((c = *opt_ptr++) != '\0') {
|
while ((c = *opt_ptr++) != '\0') {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'o': /* preserver original dates */
|
case 'o':
|
||||||
funct = funct | 1;
|
funct = funct | AR_PRESERVE_DATE;
|
||||||
break;
|
break;
|
||||||
case 'p': /* extract to stdout */
|
case 'v':
|
||||||
funct = funct | 16;
|
funct = funct | AR_VERBOSE;
|
||||||
break;
|
break;
|
||||||
case 't': /* display contents */
|
case 't':
|
||||||
funct = funct | 4;
|
funct = funct | AR_DISPLAY;
|
||||||
break;
|
break;
|
||||||
case 'x': /* extract contents of archive */
|
case 'x':
|
||||||
funct = funct | 8;
|
funct = funct | AR_EXT_TO_FILE;
|
||||||
break;
|
break;
|
||||||
case 'v': /* be verbose */
|
case 'p':
|
||||||
funct = funct | 2;
|
funct = funct | AR_EXT_TO_STDOUT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage(ar_usage);
|
usage(ar_usage);
|
||||||
|
@ -35,11 +35,11 @@
|
|||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
#define AR_BLOCK_SIZE 60
|
#define AR_BLOCK_SIZE 60
|
||||||
#define AR_PRESERVE_DATE 1
|
#define AR_PRESERVE_DATE 1 /* preserve original dates */
|
||||||
#define AR_VERBOSE 2
|
#define AR_VERBOSE 2 /* be verbose */
|
||||||
#define AR_DISPLAY 4
|
#define AR_DISPLAY 4 /* display contents */
|
||||||
#define AR_EXT_TO_FILE 8
|
#define AR_EXT_TO_FILE 8 /* extract contents of archive */
|
||||||
#define AR_EXT_TO_STDOUT 16
|
#define AR_EXT_TO_STDOUT 16 /* extract to stdout */
|
||||||
|
|
||||||
#define BB_DECLARE_EXTERN
|
#define BB_DECLARE_EXTERN
|
||||||
#define bb_need_io_error
|
#define bb_need_io_error
|
||||||
@ -302,20 +302,20 @@ extern int ar_main(int argc, char **argv)
|
|||||||
++opt_ptr;
|
++opt_ptr;
|
||||||
while ((c = *opt_ptr++) != '\0') {
|
while ((c = *opt_ptr++) != '\0') {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'o': /* preserver original dates */
|
case 'o':
|
||||||
funct = funct | 1;
|
funct = funct | AR_PRESERVE_DATE;
|
||||||
break;
|
break;
|
||||||
case 'p': /* extract to stdout */
|
case 'v':
|
||||||
funct = funct | 16;
|
funct = funct | AR_VERBOSE;
|
||||||
break;
|
break;
|
||||||
case 't': /* display contents */
|
case 't':
|
||||||
funct = funct | 4;
|
funct = funct | AR_DISPLAY;
|
||||||
break;
|
break;
|
||||||
case 'x': /* extract contents of archive */
|
case 'x':
|
||||||
funct = funct | 8;
|
funct = funct | AR_EXT_TO_FILE;
|
||||||
break;
|
break;
|
||||||
case 'v': /* be verbose */
|
case 'p':
|
||||||
funct = funct | 2;
|
funct = funct | AR_EXT_TO_STDOUT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage(ar_usage);
|
usage(ar_usage);
|
||||||
|
Loading…
Reference in New Issue
Block a user