mount_procfs.c revision 1.2
11.2Spk/*
21.2Spk * Copyright (c) 1993 Paul Kranenburg
31.2Spk * All rights reserved.
41.2Spk *
51.2Spk * Redistribution and use in source and binary forms, with or without
61.2Spk * modification, are permitted provided that the following conditions
71.2Spk * are met:
81.2Spk * 1. Redistributions of source code must retain the above copyright
91.2Spk *    notice, this list of conditions and the following disclaimer.
101.2Spk * 2. Redistributions in binary form must reproduce the above copyright
111.2Spk *    notice, this list of conditions and the following disclaimer in the
121.2Spk *    documentation and/or other materials provided with the distribution.
131.2Spk * 3. All advertising materials mentioning features or use of this software
141.2Spk *    must display the following acknowledgement:
151.2Spk *      This product includes software developed by Paul Kranenburg.
161.2Spk * 4. The name of the author may not be used to endorse or promote products
171.2Spk *    derived from this software withough specific prior written permission
181.2Spk *
191.2Spk * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
201.2Spk * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
211.2Spk * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
221.2Spk * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
231.2Spk * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
241.2Spk * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
251.2Spk * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
261.2Spk * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
271.2Spk * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
281.2Spk * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
291.2Spk *
301.2Spk *	$Id: mount_procfs.c,v 1.2 1993/08/24 17:16:56 pk Exp $
311.2Spk */
321.2Spk
331.1Spk#include <stdio.h>
341.1Spk#include <sys/types.h>
351.1Spk#include <sys/mount.h>
361.1Spk
371.1Spkvoid
381.1Spkusage ()
391.1Spk{
401.1Spk	fprintf (stderr, "usage: mount_pfs dir\n");
411.1Spk	exit (1);
421.1Spk}
431.1Spk
441.1Spkint
451.1Spkmain (argc, argv)
461.1Spkint argc;
471.1Spkchar **argv;
481.1Spk{
491.1Spk	char *dev;
501.1Spk	char *dir;
511.1Spk	int c;
521.1Spk	extern char *optarg;
531.1Spk	extern int optind;
541.1Spk	int opts;
551.1Spk
561.1Spk	opts = MNT_RDONLY;
571.1Spk
581.1Spk	while ((c = getopt (argc, argv, "F:")) != EOF) {
591.1Spk		switch (c) {
601.1Spk		case 'F':
611.1Spk			opts |= atoi (optarg);
621.1Spk			break;
631.1Spk		default:
641.1Spk			usage ();
651.1Spk		}
661.1Spk	}
671.1Spk
681.1Spk	if (optind + 2 != argc)
691.1Spk		usage ();
701.1Spk
711.1Spk	dev = argv[optind];
721.1Spk	dir = argv[optind + 1];
731.1Spk
741.1Spk	if (mount (MOUNT_PROCFS, dir, opts, (caddr_t)0) < 0) {
751.1Spk		perror ("mount");
761.1Spk		exit (1);
771.1Spk	}
781.1Spk
791.1Spk	exit (0);
801.1Spk}
811.1Spk
82