NetBSD-5.0.2/sbin/mount_portal/examples/advanced.1

Using the file advanced.1.conf, we might obtain the following results:

% mkdir /p
% mount `pwd`/advanced.1.conf /p
% cat /p/tcp/localhost/daytime
Tue Jul  6 01:09:15 1999

% cat /p/fs//etc/rc	# Note the double /, as fs/ is stripped.
<contents of /etc/rc>

% cat /p/fs/etc/rc	# Since the daemon does a chdir to /, we
			# don't really need to specify the extra slash.
<contents of /etc/rc>

% cat /p/echo/echo/this/message
echo/this/message

% cat /p/echo/"This has spaces in it, but is protected by quotes"
This has spaces in it, but is protected by quotes

% cat /p/echo_nostrip/thisthat
echo_nostrip/thisthat

% cat /p/echo_noslashNoticeNoSlashHere
NoticeNoSlashHere

% cksum /etc/rc
1896381655 10514 /etc/rc

% cat /etc/rc | gzip > /tmp/rc.gz

% cksum /tmp/rc /p/gzcat//tmp/rc.gz
1896381655 10514 /tmp/rc
1896381655 10514 /p/gzcat//tmp/rc.gz

% cat /etc/rc > /p/gzip//tmp/rc.gz.2

% ls -l /tmp/rc.gz*
-rw-r--r--  1 root  wheel  3751 Jul  6 01:25 /tmp/rc.gz
-rw-r--r--  1 root  wheel  3751 Jul  6 01:26 /tmp/rc.gz.2

% cat /etc/rc > /p/gzip9//tmp/rc.gz9

% ls -l /tmp/rc.gz9
-rw-r--r--  1 root  wheel  3748 Jul  6 01:27 /tmp/rc.gz9

% cat /p/gzcat//tmp/rc.gz9 | cksum
1896381655 10514

% cat /p/ftp/ftp.NetBSD.org:pub/NetBSD/README
  <contents deleted>

% cat /p/http://www.NetBSD.org/index.html
  <contents deleted>

# And now for some more creative uses...
% cd /tmp
# Both formats of FTP commands work:
% cp /p/ftp/ftp.NetBSD.org:pub/NetBSD/NetBSD-current/tar_files/src/bin.tar.gz .

% cp /p/ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/src/sbin.tar.gz .

% tar xzf sbin.tar.gz

# Or, we can be fancier.  Tar tries to convert /p/ftp/a:b into a
# request for file b from host /p/ftp/a, so we need to
# circumvent that by using cat.
% cat /p/gzcat//p/ftp/ftp.NetBSD.org:pub/NetBSD/NetBSD-current/tar_files/src/sbin.tar.gz | tar xf -

# Or, we can bzip all of our man pages and still access them
# without changing the man program:
% cd /usr/share/man/man8

% cat mount_portal.8 | bzip2 -9 > mount_portal.8.bz2

% rm mount_portal.8

% ln -s /p/bzcat//usr/share/man/man8/mount_portal.8.bz2 mount_portal.8

% man mount_portal
  <it works!>

% cat /p/nroff//p/bzcat//usr/share/man/man8/mount_portal.bz2
  <also works.>

# Or, rather than putting //, we can use the last nroff
# configuration, nroff%, instead:
% cat /p/nroff%/p/bzcat%/usr/share/man/man8/mount_portal.bz2

# Also, we can provide read-only 'sysctlfs' functionality.  This
# is provided by the shell script sysctlfs.sh, which should be in
# /usr/share/examples/mount_portal.

% cat /p/sysctl/kern.mbuf
msize = 128
mclbytes = 2048
nmbclusters = 512
mblowat = 16
mcllowat = 8

% cat /p/sysctl/kern/mbuf
msize = 128
mclbytes = 2048
nmbclusters = 512
mblowat = 16
mcllowat = 8

% cat /p/sysctl/kern/mbuf/msize
128