main.c revision d6555420322a42c16b93414c29a62f8e841abc7b
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "inc.h"
#include "extern.h"
static char *arnam;
/*
* Function prototypes
*/
static void usage(void);
static void check_swap();
#define OPTSTR ":a:b:i:vucsrdxtplmqVCTzM"
int
{
int i;
int fd;
int ret;
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
#endif
(void) textdomain(TEXT_DOMAIN);
for (i = 0; signum[i]; i++)
/*
* Initialize cmd_info
*/
exit(1);
}
if (argc < 2)
usage();
/*
* Option handling.
*/
exit(1);
}
}
/*
* Check SWAP
*/
check_swap();
exit(1);
}
}
if ((fd == -1) &&
PLAIN_ERROR, (char *)0, arnam);
exit(1);
}
#ifdef BROWSER
#endif
} else
#ifdef BROWSER
#endif
/*
* Check SWAP
*/
check_swap();
return (ret);
}
/*
* Option hadning function.
* Using getopt(), following xcu4 convention.
*/
static void
{
int Vflag = 0;
int c;
int usage_err = 0;
switch (c) {
case 'a': /* position after named archive member file */
break;
case 'b': /* position before named archive member file */
case 'i': /* position before named archive member: same as b */
break;
case 'c': /* supress messages */
break;
case 'd':
/*
* key operation:
* delete files from the archive
*/
break;
case 'l': /* temporary directory */
break;
case 'm':
/*
* key operation:
* move files to end of the archive
* or as indicated by position flag
*/
break;
case 'p':
/*
* key operation:
* print files in the archive
*/
break;
case 'q':
/*
* key operation:
* quickly append files to end of the archive
*/
break;
case 'r':
/*
* key operation:
* replace or add files to the archive
*/
break;
case 's': /* force symbol table regeneration */
break;
case 't':
/*
* key operation:
* print table of contents
*/
break;
case 'u': /* update: change archive dependent on file dates */
break;
case 'v': /* verbose */
break;
case 'x':
/*
* key operation:
* extract files from the archive
*/
break;
case 'z':
break;
case 'V':
/*
* print version information.
* adjust command line access accounting
*/
if (Vflag == 0) {
(const char *)SGU_PKG,
(const char *)SGU_REL);
Vflag++;
}
break;
case 'C':
break;
case 'M':
break;
case 'T':
break;
case ':':
PLAIN_ERROR, (char *)0, optopt);
usage_err++;
break;
case '?':
PLAIN_ERROR, (char *)0, optopt);
usage_err++;
break;
}
}
usage();
}
/*
* Set the function to be called to do the key operation.
* Check that only one key is indicated.
*/
static void
{
exit(1);
}
}
static void
usage(void)
{
"usage: ar -d[-vV] archive file ...\n"
" ar -m[-abivV] [posname] archive file ...\n"
" ar -p[-vV][-s] archive [file ...]\n"
" ar -q[-cuvV] [-abi] [posname] [file ...]\n"
" ar -r[-cuvV] [-abi] [posname] [file ...]\n"
" ar -t[-vV][-s] archive [file ...]\n"
" ar -x[-vV][-sCT] archive [file ...]\n"));
exit(1);
}
/*ARGSUSED0*/
static void
{
exit(100);
}
/* tells the user which of the listed files were not found in the archive */
static int
{
int i, n;
n = 0;
n++;
}
return (n);
}
/*
* Debugging info
*/
static void
check_swap(void)
{
}