2
* Copyright (c) 2003-2004 Silicon Graphics, Inc. All Rights Reserved.
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of version 2 of the GNU General Public License as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it would be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* Further, this software is distributed without any warranty that it is
13
* free of the rightful claim of any third person regarding infringement
14
* or the like. Any license provided herein, whether implied or
15
* otherwise, applies only to this software file. Patent licenses, if
16
* any, provided herein do not apply to combinations of this program with
17
* other software, or any other product whatsoever.
19
* You should have received a copy of the GNU General Public License along
20
* with this program; if not, write the Free Software Foundation, Inc., 59
21
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
23
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24
* Mountain View, CA 94043, or:
28
* For further information regarding this notice, see:
30
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
33
#include <xfs/libxfs.h>
44
static char **cmdline;
50
_("Usage: %s [-adFfmrRstx] [-p prog] [-c cmd]... file\n"),
63
xfs_fsop_geom_t geometry = { 0 };
65
progname = basename(argv[0]);
66
pagesize = getpagesize();
67
setlocale(LC_ALL, "");
68
bindtextdomain(PACKAGE, LOCALEDIR);
71
while ((c = getopt(argc, argv, "ac:dFfmp:rRstVx")) != EOF) {
73
case 'a': /* append */
76
case 'c': /* commands */
78
cmdline = realloc(cmdline, sizeof(char*) * (ncmdline));
83
cmdline[ncmdline-1] = optarg;
95
mode = strtoul(optarg, &sp, 0);
96
if (!sp || sp == optarg) {
97
fprintf(stderr, _("non-numeric mode -- %s\n"),
106
flags |= IO_READONLY;
115
flags |= IO_REALTIME;
121
printf(_("%s version %s\n"), progname, VERSION);
128
while (optind < argc) {
129
if ((c = openfile(argv[optind], flags & IO_FOREIGN ?
130
NULL : &geometry, flags, mode)) < 0)
132
if (addfile(argv[optind], c, &geometry, flags) < 0)
151
for (i = 0; !done && i < ncmdline; i++) {
152
v = breakline(cmdline[i], &c);
154
done = command(c, v);
162
if ((input = fetchline()) == NULL)
164
v = breakline(input, &c);
166
done = command(c, v);