]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - io/init.c
2 * Copyright (c) 2003 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/
50 static char **cmdline
;
56 _("Usage: %s [-r] [-p prog] [-c cmd]... file\n"), progname
);
68 progname
= basename(argv
[0]);
69 setlocale(LC_ALL
, "");
70 bindtextdomain(PACKAGE
, LOCALEDIR
);
73 while ((c
= getopt(argc
, argv
, "ac:dfp:rstVx")) != EOF
) {
75 case 'a': /* append */
78 case 'c': /* commands */
80 cmdline
= realloc(cmdline
, sizeof(char*) * (ncmdline
));
85 cmdline
[ncmdline
-1] = optarg
;
87 case 'd': /* directIO */
90 case 'f': /* create */
93 case 'p': /* progname */
96 case 'r': /* readonly */
102 case 't': /* truncate */
105 case 'x': /* realtime */
109 printf(_("%s version %s\n"), progname
, VERSION
);
116 if (optind
!= argc
- 1)
119 fname
= strdup(argv
[optind
]);
120 if ((fdesc
= openfile(fname
, append
, fflag
, directio
,
121 readonly
, osync
, trunc
, realtime
)) < 0)
138 for (i
= 0; !done
&& i
< ncmdline
; i
++) {
139 v
= breakline(cmdline
[i
], &c
);
141 done
= command(c
, v
);
149 if ((input
= fetchline()) == NULL
)
151 v
= breakline(input
, &c
);
153 done
= command(c
, v
);