1/*
2 * Copyright (c) 2001-2007 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 *  usage.c
25 *  bless
26 *
27 *  Created by Shantonu Sen <ssen@apple.com> on Wed Nov 14 2001.
28 *  Copyright (c) 2001-2007 Apple Inc. All Rights Reserved.
29 *
30 *  $Id: usage.c,v 1.31 2005/12/05 12:59:30 ssen Exp $
31 *
32 */
33
34#include <stdlib.h>
35#include <stdio.h>
36
37#include "bless.h"
38
39#include "enums.h"
40#include "structs.h"
41#include "protos.h"
42
43void usage(void) {
44    fprintf(stderr, "Usage: %s [options]\n", getprogname());
45    fputs(
46"\t--help\t\tThis usage statement\n"
47"\n"
48"Info Mode:\n"
49"\t--info [dir]\tPrint blessing information for a specific volume, or the\n"
50"\t\t\tcurrently active boot volume if <dir> is not specified\n"
51"\t--getBoot\tSuppress normal output and print the active boot volume\n"
52"\t--version\tPrint bless version number\n"
53"\t--plist\t\tFor any output type, use a plist representation\n"
54"\t--verbose\tVerbose output\n"
55"\n"
56"File/Folder Mode:\n"
57"\t--file file\tSet <file> as the blessed boot file\n"
58"\t--folder dir\tSet <dir> as the blessed directory\n"
59"\t--bootinfo [file]\tUse <file> to create a \"BootX\" file in the\n"
60"\t\t\tblessed dir\n"
61"\t--bootefi [file]\tUse <file> to create a \"boot.efi\" file in the\n"
62"\t\t\tblessed dir\n"
63"\t--setBoot\tSet firmware to boot from this volume\n"
64"\t--openfolder dir\tSet <dir> to be the visible Finder directory\n"
65"\t--verbose\tVerbose output\n"
66"\n"
67"Mount Mode:\n"
68"\t--mount dir\tUse this mountpoint in conjunction with --setBoot\n"
69"\t--file file\tSet firmware to boot from <file>\n"
70"\t--setBoot\tSet firmware to boot from this volume\n"
71"\t--verbose\tVerbose output\n"
72"\n"
73"Device Mode:\n"
74"\t--device dev\tUse this block device in conjunction with --setBoot\n"
75"\t--setBoot\tSet firmware to boot from this volume\n"
76"\t--verbose\tVerbose output\n"
77"\n"
78"NetBoot Mode:\n"
79"\t--netboot\tSet firmware to boot from the network\n"
80"\t--server url\tUse BDSP to fetch boot parameters from <url>\n"
81"\t--verbose\tVerbose output\n"
82
83          ,
84          stderr);
85
86    exit(1);
87}
88
89/* Basically lifted from the man page */
90void usage_short(void) {
91    fprintf(stderr, "Usage: %s [options]\n", getprogname());
92    fputs(
93"bless --help\n"
94"\n"
95"bless --folder directory [--file file]\n"
96"\t[--bootinfo [file]] [--bootefi [file]]\n"
97"\t[--setBoot] [--openfolder directory] [--verbose]\n"
98"\n"
99"bless --mount directory [--file file] [--setBoot] [--verbose]\n"
100"\n"
101"bless --device device [--setBoot] [--verbose]\n"
102"\n"
103"bless --netboot --server url [--verbose]\n"
104"\n"
105"bless --info [directory] [--getBoot] [--plist] [--verbose] [--version]\n"
106,
107	  stderr);
108    exit(1);
109}
110