]>
git.wh0rd.org - sysvinit.git/blob - src/fstab-decode.c
3 Copyright (c) 2006 Red Hat, Inc. All rights reserved.
5 This copyrighted material is made available to anyone wishing to use, modify,
6 copy, or redistribute it subject to the terms and conditions of the GNU General
9 This program is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 PARTICULAR PURPOSE. See the GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15 Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 Author: Miloslav Trmac <mitr@redhat.com> */
25 /* Decode the fstab-encoded string in place. */
34 while (*src
!= '\0') {
38 static const struct repl
{
43 #define R(X, Y) { X, sizeof(X) - 1, Y }
54 for (i
= 0; i
< sizeof (repls
) / sizeof (repls
[0]);
56 if (memcmp(src
+ 1, repls
[i
].orig
,
59 src
+= 1 + repls
[i
].len
;
73 main (int argc
, char *argv
[])
78 fprintf(stderr
, "Usage: fstab-decode command [arguments]\n");
81 for (i
= 2; i
< (size_t)argc
; i
++)
83 execvp(argv
[1], argv
+ 1);
84 fprintf(stderr
, "fstab-decode: %s: %s\n", argv
[1], strerror(errno
));