/*
- * Copyright (c) 2003-2010,2013 Apple Inc. All Rights Reserved.
+ * Copyright (c) 2003-2010,2013-2017 Apple Inc. All Rights Reserved.
*
* @APPLE_LICENSE_HEADER_START@
- *
+ *
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
- *
+ *
* @APPLE_LICENSE_HEADER_END@
*
* security.c
*/
#include "SecurityTool.h"
+#include "SecInternalReleasePriv.h"
#include <SecurityTool/readline.h>
#include "leaks.h"
#include <ctype.h>
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* The default prompt. */
const char *prompt_string = "security> ";
-/* The name of this program. */
-const char *prog_name;
-
-
/* Forward declarations of static functions. */
" -p Set the prompt to \"prompt\" (implies -i).\n"
" -q Be less verbose.\n"
" -v Be more verbose about what's going on.\n"
- "%s commands are:\n", prog_name, prog_name);
+ "%s commands are:\n", getprogname(), getprogname());
help(0, NULL);
return 2;
}
-/* Execute a single command. */
+/* Execute a single command. */
static int
execute_command(int argc, char * const *argv)
{
}
else
{
- fprintf(stderr, "unknown command \"%s\"", argv[0]);
+ warnx("unknown command: %s", argv[0]);
return 1;
}
}
int do_leaks = 0;
int ch;
- /* Remember my name. */
- prog_name = strrchr(argv[0], '/');
- prog_name = prog_name ? prog_name + 1 : argv[0];
+ if (!SecIsInternalRelease()) {
+ errx(1, "command unavailable");
+ }
/* Do getopt stuff for global options. */
optind = 1;