[Midnightbsd-cvs] src [11012] trunk/contrib/amd: add missing files

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Jun 15 18:31:44 EDT 2018


Revision: 11012
          http://svnweb.midnightbsd.org/src/?rev=11012
Author:   laffer1
Date:     2018-06-15 18:31:43 -0400 (Fri, 15 Jun 2018)
Log Message:
-----------
add missing files

Added Paths:
-----------
    trunk/contrib/amd/amd/info_sun.c
    trunk/contrib/amd/amd/ops_ext.c
    trunk/contrib/amd/amd/ops_lustre.c
    trunk/contrib/amd/amd/ops_nfs4.c
    trunk/contrib/amd/amd/ops_udf.c
    trunk/contrib/amd/amd/sun2amd.8
    trunk/contrib/amd/amd/sun2amd.c
    trunk/contrib/amd/amd/sun_map.c
    trunk/contrib/amd/amd/sun_map.h
    trunk/contrib/amd/amd/sun_map_parse.y
    trunk/contrib/amd/amd/sun_map_tok.l
    trunk/contrib/amd/amd/test1.sh
    trunk/contrib/amd/fsinfo/null_gram.c
    trunk/contrib/amd/fsinfo/null_gram.h
    trunk/contrib/amd/fsinfo/null_gram.y
    trunk/contrib/amd/fsinfo/null_lex.c
    trunk/contrib/amd/fsinfo/null_lex.l
    trunk/contrib/amd/include/nfs_common.h

Added: trunk/contrib/amd/amd/info_sun.c
===================================================================
--- trunk/contrib/amd/amd/info_sun.c	                        (rev 0)
+++ trunk/contrib/amd/amd/info_sun.c	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1997-2014 Erez Zadok
+ * Copyright (c) 1990 Jan-Simon Pendry
+ * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ * File: am-utils/amd/info_sun.c
+ *
+ */
+
+/*
+ * Get info from Sun automount-style /etc/auto_master, possibly following
+ * into multiple info services (via /etc/nsswitch.conf).
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <am_defs.h>
+#include <amd.h>
+#include <sun_map.h>
+
+
+/* XXX: just a placeholder.  fill in */


Property changes on: trunk/contrib/amd/amd/info_sun.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/amd/ops_ext.c
===================================================================
--- trunk/contrib/amd/amd/ops_ext.c	                        (rev 0)
+++ trunk/contrib/amd/amd/ops_ext.c	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,223 @@
+/*
+ * Copyright (c) 1997-2014 Erez Zadok
+ * Copyright (c) 1990 Jan-Simon Pendry
+ * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ * File: am-utils/amd/ops_ext.c
+ *
+ */
+
+/*
+ * Irix UN*X file system: EXT (Extended File System)
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <am_defs.h>
+#include <amd.h>
+
+/* forward declarations */
+static char *ext_match(am_opts *fo);
+static int ext2_mount(am_node *am, mntfs *mf);
+static int ext3_mount(am_node *am, mntfs *mf);
+static int ext4_mount(am_node *am, mntfs *mf);
+static int ext_umount(am_node *am, mntfs *mf);
+
+/*
+ * Ops structure
+ */
+am_ops ext2_ops =
+{
+  "ext2",
+  ext_match,
+  0,				/* ext_init */
+  ext2_mount,
+  ext_umount,
+  amfs_error_lookup_child,
+  amfs_error_mount_child,
+  amfs_error_readdir,
+  0,				/* ext_readlink */
+  0,				/* ext_mounted */
+  0,				/* ext_umounted */
+  amfs_generic_find_srvr,
+  0,				/* ext_get_wchan */
+  FS_MKMNT | FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */
+#ifdef HAVE_FS_AUTOFS
+  AUTOFS_EXT_FS_FLAGS,
+#endif /* HAVE_FS_AUTOFS */
+};
+
+am_ops ext3_ops =
+{
+  "ext3",
+  ext_match,
+  0,				/* ext_init */
+  ext3_mount,
+  ext_umount,
+  amfs_error_lookup_child,
+  amfs_error_mount_child,
+  amfs_error_readdir,
+  0,				/* ext_readlink */
+  0,				/* ext_mounted */
+  0,				/* ext_umounted */
+  amfs_generic_find_srvr,
+  0,				/* ext_get_wchan */
+  FS_MKMNT | FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */
+#ifdef HAVE_FS_AUTOFS
+  AUTOFS_EXT_FS_FLAGS,
+#endif /* HAVE_FS_AUTOFS */
+};
+
+am_ops ext4_ops =
+{
+  "ext4",
+  ext_match,
+  0,				/* ext_init */
+  ext4_mount,
+  ext_umount,
+  amfs_error_lookup_child,
+  amfs_error_mount_child,
+  amfs_error_readdir,
+  0,				/* ext_readlink */
+  0,				/* ext_mounted */
+  0,				/* ext_umounted */
+  amfs_generic_find_srvr,
+  0,				/* ext_get_wchan */
+  FS_MKMNT | FS_NOTIMEOUT | FS_UBACKGROUND | FS_AMQINFO, /* nfs_fs_flags */
+#ifdef HAVE_FS_AUTOFS
+  AUTOFS_EXT_FS_FLAGS,
+#endif /* HAVE_FS_AUTOFS */
+};
+
+/*
+ * EXT needs local filesystem and device.
+ */
+static char *
+ext_match(am_opts *fo)
+{
+
+  if (!fo->opt_dev) {
+    plog(XLOG_USER, "ext: no device specified");
+    return 0;
+  }
+
+  dlog("EXT: mounting device \"%s\" on \"%s\"", fo->opt_dev, fo->opt_fs);
+
+  /*
+   * Determine magic cookie to put in mtab
+   */
+  return xstrdup(fo->opt_dev);
+}
+
+
+static int
+mount_ext(char *mntdir, char *fs_name, char *opts, int on_autofs, char *
+    mount_type, const char *mnttab_type)
+{
+  ext_args_t ext_args;
+  mntent_t mnt;
+  int flags;
+
+  /*
+   * Figure out the name of the file system type.
+   */
+  MTYPE_TYPE type = mount_type;
+
+  memset((voidp) &ext_args, 0, sizeof(ext_args)); /* Paranoid */
+
+  /*
+   * Fill in the mount structure
+   */
+  memset((voidp) &mnt, 0, sizeof(mnt));
+  mnt.mnt_dir = mntdir;
+  mnt.mnt_fsname = fs_name;
+  mnt.mnt_type = mnttab_type;
+  mnt.mnt_opts = opts;
+
+  flags = compute_mount_flags(&mnt);
+#ifdef HAVE_FS_AUTOFS
+  if (on_autofs)
+    flags |= autofs_compute_mount_flags(&mnt);
+#endif /* HAVE_FS_AUTOFS */
+
+  /*
+   * Call generic mount routine
+   */
+  return mount_fs(&mnt, flags, (caddr_t) &ext_args, 0, type, 0, NULL, mnttab_file_name, on_autofs);
+}
+
+
+static int
+ext_mount(am_node *am, mntfs *mf, char *mount_type,
+  const char *mnttab_type)
+{
+  int on_autofs = mf->mf_flags & MFF_ON_AUTOFS;
+  int error;
+
+  error = mount_ext(mf->mf_mount, mf->mf_info, mf->mf_mopts, on_autofs,
+      mount_type, mnttab_type);
+  if (error) {
+    errno = error;
+    plog(XLOG_ERROR, "mount_ext: %m");
+    return error;
+  }
+
+  return 0;
+}
+
+static int
+ext2_mount(am_node *am, mntfs *mf)
+{
+  return ext_mount(am, mf, MOUNT_TYPE_EXT2, MNTTAB_TYPE_EXT2);
+}
+
+static int
+ext3_mount(am_node *am, mntfs *mf)
+{
+  return ext_mount(am, mf, MOUNT_TYPE_EXT3, MNTTAB_TYPE_EXT3);
+}
+
+static int
+ext4_mount(am_node *am, mntfs *mf)
+{
+  return ext_mount(am, mf, MOUNT_TYPE_EXT4, MNTTAB_TYPE_EXT4);
+}
+
+static int
+ext_umount(am_node *am, mntfs *mf)
+{
+  int unmount_flags = (mf->mf_flags & MFF_ON_AUTOFS) ? AMU_UMOUNT_AUTOFS : 0;
+
+  return UMOUNT_FS(mf->mf_mount, mnttab_file_name, unmount_flags);
+}


Property changes on: trunk/contrib/amd/amd/ops_ext.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/amd/ops_lustre.c
===================================================================
--- trunk/contrib/amd/amd/ops_lustre.c	                        (rev 0)
+++ trunk/contrib/amd/amd/ops_lustre.c	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2011 Christos Zoulas
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ * File: am-utils/amd/ops_lustre.c
+ *
+ */
+
+/*
+ * Lustre file system
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+#ifdef HAVE_FS_LUSTRE
+#include <am_defs.h>
+#include <amd.h>
+
+/* forward declarations */
+static char *lustre_match(am_opts *fo);
+static int lustre_mount(am_node *am, mntfs *mf);
+static int lustre_umount(am_node *am, mntfs *mf);
+
+/*
+ * Ops structure
+ */
+am_ops lustre_ops =
+{
+  "lustre",
+  lustre_match,
+  0,				/* lustre_init */
+  lustre_mount,
+  lustre_umount,
+  amfs_error_lookup_child,
+  amfs_error_mount_child,
+  amfs_error_readdir,
+  0,				/* lustre_readlink */
+  0,				/* lustre_mounted */
+  0,				/* lustre_umounted */
+  amfs_generic_find_srvr,
+  0,				/* lustre_get_wchan */
+  FS_MKMNT | FS_UBACKGROUND | FS_AMQINFO,	/* nfs_fs_flags */
+#ifdef HAVE_FS_AUTOFS
+  AUTOFS_LUSTRE_FS_FLAGS,
+#endif /* HAVE_FS_AUTOFS */
+};
+
+
+/*
+ * Lustre needs remote filesystem and host.
+ */
+static char *
+lustre_match(am_opts *fo)
+{
+  char *xmtab, *cp;
+  size_t l;
+  char *rhost, *ptr, *remhost;
+  struct in_addr addr;
+
+  if (fo->opt_fs && !fo->opt_rfs)
+    fo->opt_rfs = fo->opt_fs;
+  if (!fo->opt_rfs) {
+    plog(XLOG_USER, "lustre: no remote filesystem specified");
+    return NULL;
+  }
+  if (!fo->opt_rhost) {
+    plog(XLOG_USER, "lustre: no remote host specified");
+    return NULL;
+  }
+
+  /*
+   * Determine magic cookie to put in mtab
+   */
+  rhost = xstrdup(fo->opt_rhost);
+  remhost = NULL;
+  for (ptr = strtok(rhost, ":"); ptr; ptr = strtok(NULL, ":")) {
+    char *at = strchr(ptr, '@');
+    if (at == NULL) {
+      plog(XLOG_USER, "lustre: missing protocol in host `%s'", ptr);
+      XFREE(rhost);
+      return NULL;
+    }
+    *at = '\0';
+    /*
+     * Convert symbolic addresses to numbers that the kernel likes
+     */
+    if (inet_aton(ptr, &addr) == 0) {
+      struct hostent *hp;
+      if ((hp = gethostbyname(ptr)) == NULL) {
+	plog(XLOG_USER, "lustre: unknown host `%s'", ptr);
+	XFREE(rhost);
+	return NULL;
+      }
+      if (hp->h_length != sizeof(addr.s_addr)) {
+	plog(XLOG_USER, "lustre: bad address length %zu != %d for %s",
+	  sizeof(addr), hp->h_length, ptr);
+	XFREE(rhost);
+	return NULL;
+      }
+      memcpy(&addr.s_addr, hp->h_addr, sizeof(addr));
+    }
+    *at = '@';
+
+    cp = remhost;
+    if (remhost)
+      remhost = strvcat(cp, ":", inet_ntoa(addr), at, NULL);
+    else
+      remhost = strvcat(inet_ntoa(addr), at, NULL);
+    XFREE(cp);
+  }
+  if (remhost == NULL) {
+    plog(XLOG_USER, "lustre: empty host");
+    XFREE(rhost);
+    return NULL;
+  }
+
+  XFREE(rhost);
+  XFREE(fo->opt_rhost);
+  fo->opt_rhost = remhost;
+
+  l = strlen(fo->opt_rhost) + strlen(fo->opt_rfs) + 2;
+  xmtab = xmalloc(l);
+  xsnprintf(xmtab, l, "%s:%s", fo->opt_rhost, fo->opt_rfs);
+  dlog("lustre: mounting remote server \"%s\", remote fs \"%s\" on \"%s\"",
+       fo->opt_rhost, fo->opt_rfs, fo->opt_fs);
+
+
+  return xmtab;
+}
+
+static int
+lustre_mount(am_node *am, mntfs *mf)
+{
+  mntent_t mnt;
+  int genflags, error;
+  int on_autofs = mf->mf_flags & MFF_ON_AUTOFS;
+
+  /*
+   * Figure out the name of the file system type.
+   */
+  MTYPE_TYPE type = MOUNT_TYPE_LUSTRE;
+
+  /*
+   * Fill in the mount structure
+   */
+  memset(&mnt, 0, sizeof(mnt));
+  mnt.mnt_dir = mf->mf_mount;
+  mnt.mnt_fsname = mf->mf_info;
+  mnt.mnt_type = MNTTAB_TYPE_LUSTRE;
+  mnt.mnt_opts = mf->mf_mopts;
+
+  genflags = compute_mount_flags(&mnt);
+#ifdef HAVE_FS_AUTOFS
+  if (on_autofs)
+    genflags |= autofs_compute_mount_flags(&mnt);
+#endif /* HAVE_FS_AUTOFS */
+
+  /*
+   * Call generic mount routine
+   */
+  error = mount_fs(&mnt, genflags, NULL, 0, type, 0,
+      NULL, mnttab_file_name, on_autofs);
+  if (error) {
+    errno = error;
+    plog(XLOG_ERROR, "mount_lustre: %m");
+    return error;
+  }
+
+  return 0;
+}
+
+
+static int
+lustre_umount(am_node *am, mntfs *mf)
+{
+  int unmount_flags = (mf->mf_flags & MFF_ON_AUTOFS) ? AMU_UMOUNT_AUTOFS : 0;
+
+  return UMOUNT_FS(mf->mf_mount, mnttab_file_name, unmount_flags);
+}
+#endif


Property changes on: trunk/contrib/amd/amd/ops_lustre.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/amd/ops_nfs4.c
===================================================================
--- trunk/contrib/amd/amd/ops_nfs4.c	                        (rev 0)
+++ trunk/contrib/amd/amd/ops_nfs4.c	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1997-2014 Erez Zadok
+ * Copyright (c) 1990 Jan-Simon Pendry
+ * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ * File: am-utils/amd/ops_nfs4.c
+ *
+ */
+
+/*
+ * Network file system version 4.0
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <am_defs.h>
+#include <amd.h>
+
+/* FEEL FREE TO IMPLEMENT THIS... :-) */


Property changes on: trunk/contrib/amd/amd/ops_nfs4.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/amd/ops_udf.c
===================================================================
--- trunk/contrib/amd/amd/ops_udf.c	                        (rev 0)
+++ trunk/contrib/amd/amd/ops_udf.c	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 1997-2014 Erez Zadok
+ * Copyright (c) 1990 Jan-Simon Pendry
+ * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ * File: am-utils/amd/ops_udf.c
+ *
+ */
+
+/*
+ * UDF file system
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <am_defs.h>
+#include <amd.h>
+
+/* forward definitions */
+static char *udf_match(am_opts *fo);
+static int udf_mount(am_node *am, mntfs *mf);
+static int udf_umount(am_node *am, mntfs *mf);
+
+/*
+ * Ops structure
+ */
+am_ops udf_ops =
+{
+	"udf",
+	udf_match,
+	0,				/* udf_init */
+	udf_mount,
+	udf_umount,
+	amfs_error_lookup_child,
+	amfs_error_mount_child,
+	amfs_error_readdir,
+	0,				/* udf_readlink */
+	0,				/* udf_mounted */
+	0,				/* udf_umounted */
+	amfs_generic_find_srvr,
+	0,				/* udf_get_wchan */
+	FS_MKMNT | FS_UBACKGROUND | FS_AMQINFO,	/* nfs_fs_flags */
+#ifdef HAVE_FS_AUTOFS
+	AUTOFS_UDF_FS_FLAGS,
+#endif /* HAVE_FS_AUTOFS */
+};
+
+#if defined(HAVE_UDF_ARGS_T_NOBODY_GID) || defined(HAVE_UDF_ARGS_T_NOBODY_UID)
+static int
+a_num(const char *s, const char *id_type)
+{
+	int id;
+	char *ep;
+
+	id = strtol(s, &ep, 0);
+	if (*ep || s == ep || id < 0) {
+		plog(XLOG_ERROR, "mount_udf: unknown %s: %s", id_type, s);
+		return 0;
+	}
+	return id;
+}
+#endif /* defined(HAVE_UDF_ARGS_T_NOBODY_GID) || defined(HAVE_UDF_ARGS_T_NOBODY_UID) */
+
+#if defined(HAVE_UDF_ARGS_T_NOBODY_GID)
+static gid_t
+a_gid(const char *s, const char *id_type)
+{
+	struct group *gr;
+
+	if ((gr = getgrnam(s)) != NULL)
+		return gr->gr_gid;
+	return a_num(s, id_type);
+}
+#endif /* defined(HAVE_UDF_ARGS_T_NOBODY_GID) */
+
+#if defined(HAVE_UDF_ARGS_T_NOBODY_UID)
+static uid_t
+a_uid(const char *s, const char *id_type)
+{
+	struct passwd *pw;
+
+	if ((pw = getpwnam(s)) != NULL)
+		return pw->pw_uid;
+	return a_num(s, id_type);
+}
+#endif /* defined(HAVE_UDF_ARGS_T_NOBODY_UID) */
+
+/*
+ * UDF needs remote filesystem.
+ */
+static char *
+udf_match(am_opts *fo)
+{
+
+	if (!fo->opt_dev) {
+		plog(XLOG_USER, "udf: no source device specified");
+		return 0;
+	}
+	dlog("UDF: mounting device \"%s\" on \"%s\"", fo->opt_dev, fo->opt_fs);
+
+	/*
+	 * Determine magic cookie to put in mtab
+	 */
+	return xstrdup(fo->opt_dev);
+}
+
+static int
+mount_udf(char *mntdir, char *fs_name, char *opts, int on_autofs)
+{
+	udf_args_t udf_args;
+	mntent_t mnt;
+	int flags;
+	char *str;
+#if defined(HAVE_UDF_ARGS_T_NOBODY_UID) || defined(HAVE_UDF_ARGS_T_ANON_UID)
+	uid_t uid_nobody;
+	gid_t gid_nobody;
+#endif /* defined(HAVE_UDF_ARGS_T_NOBODY_UID) || defined(HAVE_UDF_ARGS_T_ANON_UID) */
+	/*
+	 * Figure out the name of the file system type.
+	 */
+	MTYPE_TYPE type = MOUNT_TYPE_UDF;
+
+#if defined(HAVE_UDF_ARGS_T_NOBODY_UID) || defined(HAVE_UDF_ARGS_T_ANON_UID)
+	uid_nobody = a_uid("nobody", "user");
+	if (uid_nobody == 0) {
+		plog(XLOG_ERROR, "mount_udf: invalid uid for nobody");
+		return EPERM;
+	}
+#endif /* defined(HAVE_UDF_ARGS_T_NOBODY_UID) || defined(HAVE_UDF_ARGS_T_ANON_UID) */
+
+#if defined(HAVE_UDF_ARGS_T_NOBODY_GID) || defined(HAVE_UDF_ARGS_T_ANON_GID)
+	gid_nobody = a_gid("nobody", "group");
+	if (gid_nobody == 0) {
+		plog(XLOG_ERROR, "mount_udf: invalid gid for nobody");
+		return EPERM;
+	}
+#endif /* defined(HAVE_UDF_ARGS_T_NOBODY_GID) || defined(HAVE_UDF_ARGS_T_ANON_GID) */
+
+	str = NULL;
+	memset((voidp) &udf_args, 0, sizeof(udf_args)); /* Paranoid */
+
+	/*
+	 * Fill in the mount structure
+	 */
+	memset((voidp)&mnt, 0, sizeof(mnt));
+	mnt.mnt_dir = mntdir;
+	mnt.mnt_fsname = fs_name;
+	mnt.mnt_type = MNTTAB_TYPE_UDF;
+	mnt.mnt_opts = opts;
+
+	flags = compute_mount_flags(&mnt);
+
+#ifdef HAVE_UDF_ARGS_T_UDFMFLAGS
+# if defined(MNT2_UDF_OPT_CLOSESESSION) && defined(MNTTAB_OPT_CLOSESESSION)
+	if (amu_hasmntopt(&mnt, MNTTAB_OPT_CLOSESESSION))
+		udf_args.udfmflags |= MNT2_UDF_OPT_CLOSESESSION;
+# endif /* defined(MNT2_UDF_OPT_CLOSESESSION) && defined(MNTTAB_OPT_CLOSESESSION) */
+#endif /* HAVE_UDF_ARGS_T_UDFMFLAGS */
+
+#ifdef HAVE_UDF_ARGS_T_NOBODY_UID
+	udf_args.nobody_uid = uid_nobody;
+#endif /* HAVE_UDF_ARGS_T_NOBODY_UID */
+
+#ifdef HAVE_UDF_ARGS_T_NOBODY_GID
+	udf_args.nobody_gid = gid_nobody;
+#endif /* HAVE_UDF_ARGS_T_NOBODY_GID */
+
+#ifdef HAVE_UDF_ARGS_T_ANON_UID
+	udf_args.anon_uid = uid_nobody;	/* default to nobody */
+	if ((str = hasmntstr(&mnt, MNTTAB_OPT_USER)) != NULL) {
+		udf_args.anon_uid = a_uid(str, MNTTAB_OPT_USER);
+		XFREE(str);
+	}
+#endif /* HAVE_UDF_ARGS_T_ANON_UID */
+
+#ifdef HAVE_UDF_ARGS_T_ANON_GID
+	udf_args.anon_gid = gid_nobody;	/* default to nobody */
+	if ((str = hasmntstr(&mnt, MNTTAB_OPT_GROUP)) != NULL) {
+		udf_args.anon_gid = a_gid(str, MNTTAB_OPT_GROUP);
+		XFREE(str);
+	}
+#endif /* HAVE_UDF_ARGS_T_ANON_GID */
+
+#ifdef HAVE_UDF_ARGS_T_GMTOFF
+	udf_args.gmtoff = 0;
+	if ((str = hasmntstr(&mnt, MNTTAB_OPT_GMTOFF)) != NULL) {
+		udf_args.gmtoff = a_num(str, MNTTAB_OPT_GMTOFF);
+		XFREE(str);
+	}
+#endif /* HAVE_UDF_ARGS_T_GMTOFF */
+
+#ifdef HAVE_UDF_ARGS_T_SESSIONNR
+	udf_args.sessionnr = 0;
+	if ((str = hasmntstr(&mnt, MNTTAB_OPT_SESSIONNR)) != NULL) {
+		udf_args.sessionnr = a_num(str, MNTTAB_OPT_SESSIONNR);
+		XFREE(str);
+	}
+#endif /* HAVE_UDF_ARGS_T_SESSIONNR */
+
+#ifdef HAVE_UDF_ARGS_T_VERSION
+# ifdef UDFMNT_VERSION
+	udf_args.version = UDFMNT_VERSION;
+# endif /* UDFMNT_VERSION */
+#endif /* HAVE_UDF_ARGS_T_VERSION */
+
+#ifdef HAVE_UDF_ARGS_T_FSPEC
+	udf_args.fspec = fs_name;
+#endif /* HAVE_UFS_ARGS_T_FSPEC */
+
+	/*
+	 * Call generic mount routine
+	 */
+	return mount_fs(&mnt, flags, (caddr_t)&udf_args, 0, type, 0, NULL,
+	    mnttab_file_name, on_autofs);
+}
+
+static int
+udf_mount(am_node *am, mntfs *mf)
+{
+	int on_autofs;
+	int error;
+
+	on_autofs = mf->mf_flags & MFF_ON_AUTOFS;
+	error = mount_udf(mf->mf_mount, mf->mf_info, mf->mf_mopts, on_autofs);
+	if (error) {
+		errno = error;
+		plog(XLOG_ERROR, "mount_udf: %m");
+		return error;
+	}
+	return 0;
+}
+
+
+static int
+udf_umount(am_node *am, mntfs *mf)
+{
+	int unmount_flags;
+
+	unmount_flags = (mf->mf_flags & MFF_ON_AUTOFS) ? AMU_UMOUNT_AUTOFS : 0;
+	return UMOUNT_FS(mf->mf_mount, mnttab_file_name, unmount_flags);
+}


Property changes on: trunk/contrib/amd/amd/ops_udf.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/amd/sun2amd.8
===================================================================
--- trunk/contrib/amd/amd/sun2amd.8	                        (rev 0)
+++ trunk/contrib/amd/amd/sun2amd.8	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,92 @@
+.\"
+.\" Copyright (c) 1997-2014 Erez Zadok
+.\" Copyright (c) 2005 Daniel P. Ottavio
+.\" Copyright (c) 1990 Jan-Simon Pendry
+.\" Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+.\" Copyright (c) 1990 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Jan-Simon Pendry at Imperial College, London.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"
+.\" File: am-utils/amd/sun2amd.8
+.\"
+.TH SUN2AMD 8L "14 August 2005"
+
+.SH NAME
+sun2amd \- converts Sun automount maps to Amd maps
+
+.SH SYNOPSIS
+.B sun2amd
+[-hH] [-i infile] [-o outfile]
+
+.SH DESCRIPTION
+.B sun2amd
+is used to convert Sun style automount maps to Amd style automount
+maps.  By default
+.B sun2amd
+reads from stdin and writes to stdout.
+
+.SH OPTIONS
+.TP
+.B -h
+Help
+.TP
+.B -i
+Read Sun map information from specified file.
+.TP
+.B -o
+Write Amd map information to specified file.
+
+.SH EXAMPLE
+To convert a Sun automount file called auto_foo to an Amd file called
+auto.amd type:
+
+.B sun2amd
+-i auto_foo -o auto.amd
+
+.SH BUGS
+* Can not convert master maps yet.
+
+* NFS is the only automount type currently supported.
+
+total_bug_count = number_found + 1;
+
+.SH "SEE ALSO"
+.BR automount(8),
+.BR amd(8)
+
+.I "Linux NFS and Automounter Administration"
+by Erez Zadok, ISBN 0-7821-2739-8, (Sybex, 2001).
+.LP
+.I http://www.am-utils.org
+.LP
+
+.SH AUTHOR
+Daniel P. Ottavio
+.I <dottavio at ic.sunysb.edu>


Property changes on: trunk/contrib/amd/amd/sun2amd.8
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/amd/sun2amd.c
===================================================================
--- trunk/contrib/amd/amd/sun2amd.c	                        (rev 0)
+++ trunk/contrib/amd/amd/sun2amd.c	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 1997-2014 Erez Zadok
+ * Copyright (c) 2005 Daniel P. Ottavio
+ * Copyright (c) 1989 Jan-Simon Pendry
+ * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ * File: am-utils/amd/sun2amd.c
+ *
+ */
+
+/*
+ * Translate Sun-syntax maps to Amd maps
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <am_defs.h>
+#include <amd.h>
+#include <sun_map.h>
+
+
+/* dummies to make the program compile and link */
+struct amu_global_options gopt;
+#if defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP)
+# ifdef NEED_LIBWRAP_SEVERITY_VARIABLES
+/*
+ * Some systems that define libwrap already define these two variables
+ * in libwrap, while others don't: so I need to know precisely iff
+ * to define these two severity variables.
+ */
+int allow_severity=0, deny_severity=0, rfc931_timeout=0;
+# endif /* NEED_LIBWRAP_SEVERITY_VARIABLES */
+#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */
+
+
+/*
+ * Parse the stream sun_in, convert the map information to amd, write
+ * the results to amd_out.
+ */
+static int
+sun2amd_convert(FILE *sun_in, FILE *amd_out)
+{
+  char line_buff[INFO_MAX_LINE_LEN], *tmp, *key, *entry;
+  int pos, line = 0, retval = 1;
+
+  /* just to be safe */
+  memset(line_buff, 0, sizeof(line_buff));
+
+  /* Read the input line by line and do the conversion. */
+  while ((pos = file_read_line(line_buff, sizeof(line_buff), sun_in))) {
+    line++;
+    line_buff[pos - 1] = '\0';
+
+    /* remove comments */
+    if ((tmp = strchr(line_buff, '#')) != NULL) {
+      *tmp = '\0';
+    }
+
+    /* find start of key */
+    key = line_buff;
+    while (*key != '\0' && isspace((unsigned char)*key)) {
+      key++;
+    }
+
+    /* ignore blank lines */
+    if (*key == '\0') {
+      continue;
+    }
+
+    /* find the end of the key and NULL terminate */
+    tmp = key;
+    while (*tmp != '\0' && isspace((unsigned char)*tmp) == 0) {
+      tmp++;
+    }
+    if (*tmp == '\0') {
+      plog(XLOG_ERROR, "map line %d has no entry", line);
+      goto err;
+    }
+    *tmp++ = '\0';
+    if (*tmp == '\0') {
+      plog(XLOG_ERROR, "map line %d has no entry", line);
+      goto err;
+    }
+    entry = tmp;
+
+    /* convert the sun entry to an amd entry */
+    if ((tmp = sun_entry2amd(key, entry)) == NULL) {
+      plog(XLOG_ERROR, "parse error on line %d", line);
+      goto err;
+    }
+
+    if (fprintf(amd_out, "%s %s\n", key, tmp) < 0) {
+      plog(XLOG_ERROR, "can't write to output stream: %s", strerror(errno));
+      goto err;
+    }
+
+    /* just to be safe */
+    memset(line_buff, 0, sizeof(line_buff));
+  }
+
+  /* success */
+  retval = 0;
+
+ err:
+  return retval;
+}
+
+
+/*
+ * wrapper open function
+ */
+static FILE *
+sun2amd_open(const char *path, const char *mode)
+{
+  FILE *retval = NULL;
+
+  if ((retval = fopen(path,mode)) == NULL) {
+    plog(XLOG_ERROR,"could not open file %s",path);
+  }
+
+  return retval;
+}
+
+
+/*
+ * echo the usage and exit
+ */
+static void
+sun2amd_usage(void)
+{
+  fprintf(stderr,
+	  "usage : sun2amd [-hH] [-i infile] [-o outfile]\n"
+	  "-h\thelp\n"
+	  "-i\tspecify an infile (defaults to stdin)\n"
+	  "-o\tspecify an outfile (defaults to stdout)\n");
+}
+
+
+int
+main(int argc, char **argv)
+{
+  /* default in/out to stdin/stdout */
+  FILE *sun_in = stdin, *amd_out = stdout;
+  int opt, retval = 1;
+
+  while ((opt = getopt(argc, argv , "i:o:hH")) != -1) {
+    switch (opt) {
+
+    case 'i':
+      if ((sun_in = sun2amd_open(optarg,"r")) == NULL) {
+	goto err;
+      }
+      break;
+
+    case 'o':
+      if ((amd_out = sun2amd_open(optarg,"w")) == NULL) {
+	goto err;
+      }
+      break;
+
+    case 'h':
+    case 'H':
+      sun2amd_usage();
+      goto err;
+    }
+  }
+
+  retval = sun2amd_convert(sun_in,amd_out);
+
+ err:
+  exit(retval);
+}


Property changes on: trunk/contrib/amd/amd/sun2amd.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/amd/sun_map.c
===================================================================
--- trunk/contrib/amd/amd/sun_map.c	                        (rev 0)
+++ trunk/contrib/amd/amd/sun_map.c	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,595 @@
+/*
+ * Copyright (c) 1997-2014 Erez Zadok
+ * Copyright (c) 2005 Daniel P. Ottavio
+ * Copyright (c) 1990 Jan-Simon Pendry
+ * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ * File: am-utils/amd/sun_map.c
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <am_defs.h>
+#include <amd.h>
+#include <sun_map.h>
+
+
+
+/*
+ * Add a data pointer to the end of the list.
+ */
+void
+sun_list_add(struct sun_list *list, qelem *item)
+{
+  if (list->last == NULL) {
+    list->last = item;
+    list->first = item;
+    item->q_back = NULL;
+  }
+  else {
+    list->last->q_forw = item;
+    item->q_back = list->last;
+    list->last = item;
+  }
+
+  item->q_forw = NULL;
+}
+
+
+/*
+ * Sun2Amd conversion routines
+ */
+
+/*
+ * AMD entry keywords
+ */
+#define AMD_OPTS_KW      "addopts:="     /* add entry options */
+#define AMD_RHOST_KW     "rhost:="       /* remote host */
+#define AMD_RFS_KW       "rfs:="         /* remote file system */
+#define AMD_FS_KW        "fs:="          /* local file system */
+#define AMD_DEV_KW       "dev:="         /* device */
+#define AMD_TYPE_NFS_KW  "type:=nfs;"    /* fs type nfs */
+#define AMD_TYPE_AUTO_KW "type:=auto;"   /* fs type auto */
+#define AMD_TYPE_CDFS_KW "type:=cdfs;"   /* fs type cd */
+#define AMD_MAP_FS_KW    "fs:=${map};"   /* set the mount map as current map */
+#define AMD_MAP_PREF_KW  "pref:=${key}/" /* set the mount map as current map */
+
+/*
+ * A set of string Sun fstypes.
+ */
+#define SUN_NFS_TYPE     "nfs"
+#define SUN_HSFS_TYPE    "hsfs" /* CD fs */
+#define SUN_AUTOFS_TYPE  "autofs"
+#define SUN_CACHEFS_TYPE "cachefs"
+
+#define SUN_KEY_SUB      "&"         /* Sun key substitution */
+
+/* a set a Sun variable substitutions for map entries */
+#define SUN_ARCH         "$ARCH"     /* host architecture */
+#define SUN_CPU          "$CPU"      /* processor type */
+#define SUN_HOST         "$HOST"     /* host name */
+#define SUN_OSNAME       "$OSNAME"   /* OS name */
+#define SUN_OSREL        "$OSREL"    /* OS release */
+#define SUN_OSVERS       "$OSVERS"   /* OS version */
+#define SUN_NATISA       "$NATISA"   /* native instruction set */
+
+/* a set of Amd variable substitutions */
+#define AMD_ARCH         "${arch}"   /* host architecture */
+#define AMD_HOST         "${host}"   /* host name */
+#define AMD_OSNAME       "${os}"     /* OS name */
+#define AMD_OSVER        "${osver}"  /* OS version */
+
+
+/*
+ * Return a copy of src that has all occurrences of 'str' replaced
+ * with sub.
+ *
+ * param src - the original string
+ * param str - string that is the replaced with str
+ * param sub - string that replaces an occurrences of 'delim'
+ *
+ * return - new string with str substitutions, NULL on error
+ */
+static char *
+sun_strsub(const char *src, const char *str, const char *sub)
+{
+
+  char *retval = NULL, *str_start, *str_end, *src_end;
+  size_t total_size, first_half, second_half, sub_size;
+
+  /* assign pointers to the start and end of str */
+  if ((str_start = strstr(src, str)) == NULL) {
+    return retval;
+  }
+  str_end = (strlen(str) - 1) + str_start;
+
+  /* assign to the end of the src. */
+  src_end = (strlen(src) - 1) + (char*)src;
+
+  /* size from the beginning of src to the start of str */
+  first_half = (size_t)(str_start - src);
+
+  /* size from the end of str to the end of src */
+  second_half = (size_t)(src_end - str_end);
+
+  sub_size = strlen(sub);
+
+  total_size = (first_half + sub_size + second_half + 1);
+
+  retval = (char*)xmalloc(total_size);
+  memset(retval, 0, total_size);
+
+  /*
+   * Put together the string such that the first half is copied
+   * followed the sub and second half.
+   *
+   * We use strncpy instead of xstrlcpy because we are intentionally
+   * causing truncation and we don't want this to cause errors in the
+   * log.
+   */
+  (void)strncpy(retval, src, first_half);
+  (void)strncat(retval, sub, sub_size);
+  (void)strncat(retval, str_end + 1, second_half);
+
+  if (strstr(retval, str) != NULL) {
+    /*
+     * If there is another occurrences of str call this function
+     * recursively.
+     */
+    char* tmp;
+    if ((tmp = sun_strsub(retval, str, sub)) != NULL) {
+      XFREE(retval);
+      retval = tmp;
+    }
+  }
+  return retval;
+}
+
+
+/*
+ * Return a new string that is a copy of str, all occurrences of a Sun
+ * variable substitutions are replaced by there equivalent Amd
+ * substitutions.
+ *
+ * param str - source string
+ *
+ * return - A new string with the expansions, NULL if str does not
+ * exist in src or error.
+ */
+static char *
+sun_expand2amd(const char *str)
+{
+
+  char *retval = NULL, *tmp = NULL, *tmp2 = NULL;
+  const char *pos;
+
+  /*
+   * Iterator through the string looking for '$' chars.  For each '$'
+   * found try to replace it with Sun variable substitutions.  If we
+   * find a '$' that is not a substation each of the i.e $blah than
+   * each of the replace attempt will fail and we'll move on to the
+   * next char.
+   */
+  tmp = xstrdup(str);
+  for (pos = str; *pos != '\0'; pos++) {
+    if (*pos != '$') {
+      continue;
+    }
+    if (tmp2 != NULL) {
+      XFREE(tmp);
+      tmp = tmp2;
+    }
+
+    /*
+     * If a 'replace' does not return NULL than a variable was
+     * successfully substituted.
+     */
+
+    /* architecture */
+    if ((tmp2 = sun_strsub(tmp, SUN_ARCH, AMD_ARCH)) != NULL) {
+      continue;
+    }
+    /* cpu - there is not POSIX uname for cpu so just use machine */
+    if ((tmp2 = sun_strsub(tmp, SUN_CPU, AMD_ARCH)) != NULL) {
+      continue;
+    }
+    /* hostname */
+    if ((tmp2 = sun_strsub(tmp, SUN_HOST, AMD_HOST)) != NULL) {
+      continue;
+    }
+    /* os name */
+    if ((tmp2 = sun_strsub(tmp, SUN_OSNAME, AMD_OSNAME)) != NULL) {
+      continue;
+    }
+    /*
+     * os release - Amd doesn't hava a OS release var just usr os
+     * version or now.
+     */
+    if ((tmp2 = sun_strsub(tmp, SUN_OSREL, AMD_OSVER)) != NULL) {
+      continue;
+    }
+    /* os version */
+    if ((tmp2 = sun_strsub(tmp, SUN_OSVERS, AMD_OSVER)) != NULL) {
+      continue;
+    }
+    /* native instruction set - there is no POSIX natisa so just use system */
+    if ((tmp2 = sun_strsub(tmp, SUN_NATISA, AMD_ARCH)) != NULL) {
+      continue;
+    }
+  }
+  if (tmp2 == NULL) {
+    retval = tmp;
+  }
+  else {
+    retval = tmp2;
+    XFREE(tmp);
+  }
+
+  return retval;
+}
+
+
+/*
+ * This is a wrapper function for appending Amd entry information to a
+ * buffer.  Any Sun variable substitutions will be converted into Amd
+ * equivalents.
+ *
+ * param dest   - destination buffer
+ * param deslen - destination buffer length
+ * param key    - entry key, this might be needed for key substitutions
+ * param str    - string to append
+ */
+static void
+sun_append_str(char *dest,
+	       size_t destlen,
+	       const char *key,
+	       const char *str)
+{
+  char *sub = NULL, *sub2 = NULL, *out = NULL;
+
+  /* By default we are going to just write the original string. */
+  out = (char*)str;
+
+  /*
+   * Resolve variable substitutions in two steps; 1) replace any key
+   * map substitutions with the entry key 2) expand any variable
+   * substitutions i.e $HOST.
+   *
+   * Try to replace the key substitution '&'. If this function returns
+   * with a new string, one or more key subs. where replaced with the
+   * entry key.
+   */
+  if ((sub = sun_strsub(str, SUN_KEY_SUB, "${key}")) != NULL) {
+    out = sub;
+    /*
+     * Try to convert any variable substitutions. If this function
+     * returns a new string one or more var subs where expanded.
+     */
+    if ((sub2 = sun_expand2amd(sub)) != NULL) {
+      out = sub2;
+    }
+  }
+  /*
+   * Try to convert any variable substitutions. If this function
+   * returns a new string one or more var subs where expanded.
+   */
+  else if (out != NULL && (sub = sun_expand2amd(out)) != NULL) {
+    out = sub;
+  }
+
+  if (out != NULL) {
+    xstrlcat(dest, out, destlen);
+  }
+  XFREE(sub);
+  XFREE(sub2);
+}
+
+
+/*
+ * Convert the list of Sun mount options to Amd mount options.  The
+ * result is concatenated to dest.
+ *
+ * param dest     - destination buffer
+ * param destlen  - destination buffer length
+ * param key      - automount key
+ * param opt_list - list of Sun mount options
+ */
+static void
+sun_opts2amd(char *dest,
+	     size_t destlen,
+	     const char *key,
+	     const struct sun_opt *opt_list)
+{
+  const struct sun_opt *opt;
+
+  xstrlcat(dest, AMD_OPTS_KW, destlen);
+
+  /* Iterate through each option and append it to the buffer. */
+  for(opt = opt_list; opt != NULL; opt = NEXT(struct sun_opt, opt)) {
+    sun_append_str(dest, destlen, key, opt->str);
+    /* If there are more options add some commas. */
+    if (NEXT(struct sun_opt, opt) != NULL) {
+      xstrlcat(dest, ",", destlen);
+    }
+  }
+  xstrlcat(dest, ";", destlen);
+}
+
+
+/*
+ * Convert the list of Sun mount locations to a list of Amd mount
+ * locations.  The result is concatenated to dest.
+ *
+ * param dest       - destination buffer
+ * param destlen    - destination buffer length
+ * param key        - automount key
+ * param local_list - list of Sun mount locations
+ */
+static void
+sun_locations2amd(char *dest,
+		  size_t destlen,
+		  const char *key,
+		  const struct sun_location *local_list)
+{
+  const struct sun_location *local;
+  const struct sun_host *host;
+
+  for (local = local_list;
+       local != NULL;
+       local = NEXT(struct sun_location,local)) {
+    /*
+     * Check to see if the list of hosts is empty.  Some mount types
+     * i.e cd-rom may have mount location with no host.
+     */
+    if (local->host_list != NULL) {
+      /* Write each host that belongs to this location. */
+      for (host = local->host_list;
+	   host != NULL;
+	   host = NEXT(struct sun_host, host)) {
+	/* set fstype NFS */
+	xstrlcat(dest, AMD_TYPE_NFS_KW, destlen);
+	/* add rhost key word */
+	xstrlcat(dest, AMD_RHOST_KW, destlen);
+	/* add host name */
+	sun_append_str(dest, destlen, key, host->name);
+	xstrlcat(dest, ";", destlen);
+	/* add remote fs key word */
+	xstrlcat(dest, AMD_RFS_KW, destlen);
+	/* add local path */
+	sun_append_str(dest, destlen, key, local->path);
+	if (NEXT(struct sun_host, host) != NULL) {
+	  xstrlcat(dest, ";", destlen);
+	  xstrlcat(dest, " ", destlen);
+	}
+      }
+    }
+    else {
+      /* no host location */
+      xstrlcat(dest, AMD_FS_KW, destlen);
+      sun_append_str(dest, destlen, key, local->path);
+    }
+    if (NEXT(struct sun_location, local) != NULL) {
+      /* add a space to separate each location */
+      xstrlcat(dest, " ", destlen);
+    }
+  }
+}
+
+
+/*
+ * Convert a Sun HSFS mount point to an Amd.  The result is
+ * concatenated intp dest.
+ *
+ * param dest    - destination buffer
+ * param destlen - destination buffer length
+ * param key     - automount key
+ * param s_entry - Sun entry
+ */
+static void
+sun_hsfs2amd(char *dest,
+	     size_t destlen,
+	     const char *key,
+	     const struct sun_entry *s_entry)
+{
+  /* set fstype CDFS */
+  xstrlcat(dest, AMD_TYPE_CDFS_KW, destlen);
+  /* set the cdrom device */
+  xstrlcat(dest, AMD_DEV_KW, destlen);
+  /* XXX: For now just assume that there is only one device. */
+  xstrlcat(dest, s_entry->location_list->path, destlen);
+}
+
+
+/*
+ * Convert a Sun NFS automount entry to an Amd.  The result is concatenated
+ * into dest.
+ *
+ * param dest    - destination buffer
+ * param destlen - destination buffer length
+ * param key     - automount key
+ * param s_entry - Sun entry
+ */
+static void
+sun_nfs2amd(char *dest,
+	    size_t destlen,
+	    const char *key,
+	    const struct sun_entry *s_entry)
+{
+  if (s_entry->location_list != NULL) {
+    /* write out the list of mountpoint locations */
+    sun_locations2amd(dest, destlen, key, s_entry->location_list);
+  }
+}
+
+
+/*
+ * Convert a Sun multi-mount point entry to an Amd.  This is done
+ * using the Amd type auto.  Each auto entry is separated with a \n.
+ *
+ * param dest    - destination buffer
+ * param destlen - destination buffer length
+ * param key     - automount key
+ * param s_entry - Sun entry
+ */
+static void
+sun_multi2amd(char *dest,
+	      size_t destlen,
+	      const char *key,
+	      const struct sun_entry *s_entry)
+{
+  const struct sun_mountpt *mountpt;
+
+  /* We need to setup a auto fs Amd automount point. */
+  xstrlcat(dest, AMD_TYPE_AUTO_KW, destlen);
+  xstrlcat(dest, AMD_MAP_FS_KW, destlen);
+  xstrlcat(dest, AMD_MAP_PREF_KW, destlen);
+
+  /* write the mountpts to dest */
+  for (mountpt = s_entry->mountpt_list;
+       mountpt != NULL;
+       mountpt = NEXT(struct sun_mountpt, mountpt)) {
+    xstrlcat(dest, "\n", destlen);
+    /* write the key */
+    xstrlcat(dest, key, destlen);
+    /* write the mount path */
+    sun_append_str(dest, destlen, key, mountpt->path);
+    /* space */
+    xstrlcat(dest, " ", destlen);
+    /* Write all the host locations for this mount point. */
+    sun_locations2amd(dest, destlen, key, mountpt->location_list);
+  }
+}
+
+
+/*
+ * Convert the sun_entry into an Amd equivalent string.
+ *
+ * param key     - automount key
+ * param s_entry - Sun style automap entry
+ *
+ * return - Amd entry on succes, NULL on error
+ */
+char *
+sun_entry2amd(const char *key, const char *s_entry_str)
+{
+  char *retval = NULL;
+  char line_buff[INFO_MAX_LINE_LEN];
+  int ws;
+  struct sun_entry *s_entry = NULL;
+
+  /* The key should not be NULL. */
+  if (key == NULL) {
+    plog(XLOG_ERROR,"Sun key value was null");
+    goto err;
+  }
+  /* The Sun entry string should never be NULL. */
+  if (s_entry_str == NULL) {
+    plog(XLOG_ERROR,"Sun entry value was null");
+    goto err;
+  }
+
+  /* Make sure there are no trailing white spaces or '\n'. */
+  xstrlcpy(line_buff, s_entry_str, sizeof(line_buff));
+  ws = strlen(line_buff) - 1;
+  while (ws >= 0 && (isspace((unsigned char)line_buff[ws]) || line_buff[ws] == '\n')) {
+    line_buff[ws--] = '\0';
+  }
+
+  /* Parse the sun entry line. */
+  s_entry = sun_map_parse_read(line_buff);
+  if (s_entry == NULL) {
+    plog(XLOG_ERROR,"could not parse Sun style map");
+    goto err;
+  }
+
+  memset(line_buff, 0, sizeof(line_buff));
+
+  if (s_entry->opt_list != NULL) {
+    /* write the mount options to the buffer  */
+    sun_opts2amd(line_buff, sizeof(line_buff), key, s_entry->opt_list);
+  }
+
+  /* Check if this is a multi-mount entry. */
+  if (s_entry->mountpt_list != NULL) {
+    /* multi-mount point */
+    sun_multi2amd(line_buff, sizeof(line_buff), key, s_entry);
+    retval = xstrdup(line_buff);
+  }
+  else {
+    /* single mount point */
+    if (s_entry->fstype != NULL) {
+      if (NSTREQ(s_entry->fstype, SUN_NFS_TYPE, strlen(SUN_NFS_TYPE))) {
+	/* NFS Type */
+	sun_nfs2amd(line_buff, sizeof(line_buff), key, s_entry);
+	retval = xstrdup(line_buff);
+      }
+      else if (NSTREQ(s_entry->fstype, SUN_HSFS_TYPE, strlen(SUN_HSFS_TYPE))) {
+	/* HSFS Type (CD fs) */
+	sun_hsfs2amd(line_buff, sizeof(line_buff), key, s_entry);
+	retval = xstrdup(line_buff);
+      }
+      /*
+       * XXX: The following fstypes are not yet supported.
+       */
+      else if (NSTREQ(s_entry->fstype, SUN_AUTOFS_TYPE, strlen(SUN_AUTOFS_TYPE))) {
+	/* AutoFS Type */
+	plog(XLOG_ERROR, "Sun fstype %s is currently not supported by Amd.",
+	     s_entry->fstype);
+	goto err;
+
+      }
+      else if (NSTREQ(s_entry->fstype, SUN_CACHEFS_TYPE, strlen(SUN_CACHEFS_TYPE))) {
+	/* CacheFS Type */
+	plog(XLOG_ERROR, "Sun fstype %s is currently not supported by Amd.",
+	     s_entry->fstype);
+	goto err;
+      }
+      else {
+	plog(XLOG_ERROR, "Sun fstype %s is currently not supported by Amd.",
+	     s_entry->fstype);
+	goto err;
+      }
+    }
+    else {
+      plog(XLOG_INFO, "No SUN fstype specified defaulting to NFS.");
+      sun_nfs2amd(line_buff, sizeof(line_buff), key, s_entry);
+      retval = xstrdup(line_buff);
+    }
+  }
+
+ err:
+  XFREE(s_entry);
+  return retval;
+}


Property changes on: trunk/contrib/amd/amd/sun_map.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/amd/sun_map.h
===================================================================
--- trunk/contrib/amd/amd/sun_map.h	                        (rev 0)
+++ trunk/contrib/amd/amd/sun_map.h	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 1997-2014 Erez Zadok
+ * Copyright (c) 2005 Daniel P. Ottavio
+ * Copyright (c) 1990 Jan-Simon Pendry
+ * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ * File: am-utils/amd/sun_map.h
+ *
+ */
+
+#ifndef _SUN_MAP_H
+#define _SUN_MAP_H
+
+/* host */
+struct sun_host {
+  qelem head;     /* link-list header */
+  char *name;     /* hostname */
+  int weight;     /* weight given to the host */
+};
+
+/* location */
+struct sun_location {
+  qelem head;                 /* link-list header */
+  char *path;                 /* server path */
+  struct sun_host *host_list; /* list of hosts */
+};
+
+/* sun mount option */
+struct sun_opt {
+  qelem head;    /* link-list header */
+  char *str;     /* option string */
+};
+
+/* mount point */
+struct sun_mountpt {
+  qelem head;                         /* link-list header */
+  char *path;                         /* optional mount point path */
+  char *fstype;                       /* filesystem type */
+  struct sun_opt      *opt_list;      /* list of option strings */
+  struct sun_location *location_list; /* list of 'struct s2a_location' */
+};
+
+/* automount entry */
+struct sun_entry {
+  qelem head;                         /* link-list header */
+  char *key;                          /* auto map key */
+  char *fstype;                       /* filesystem type */
+  struct sun_opt      *opt_list;      /* list of mount options */
+  struct sun_location *location_list; /* list of mount locations */
+  struct sun_mountpt  *mountpt_list;  /* list of mount points */
+};
+
+/*
+ * automount map file
+ *
+ * XXX: Only a place holder structure, not implemented yet.
+ */
+struct sun_map {
+  qelem head;                     /* link-list header */
+  char *path;                     /* directory path of the map file */
+  char *mount_dir;                /* top level mount point for this map */
+  int  lookup;                    /* lookup type i.e file, yp, program, etc. */
+  int  direct_bool;               /* set true if this map is a direct map */
+  struct sun_opt   *opt_list;     /* list of global map options */
+  struct sun_opt   *include_list; /* list of included map files  */
+  struct sun_entry *entry_list;   /* list of 'struct s2a_entry' */
+};
+
+/*
+ * master map file
+ *
+ * XXX: Only a place holder structure, not implemented yet.
+ */
+struct sun_mmap {
+  qelem head;                   /* link-list header */
+  struct sun_opt *include_list; /* list of included master maps */
+  struct sun_map *amap_list;    /* list of 'struct s2a_amap' */
+};
+
+struct sun_list {
+  qelem *first;
+  qelem *last;
+};
+
+
+/*
+ * EXTERNS
+ */
+extern char *sun_entry2amd(const char *, const char *);
+extern struct sun_entry *sun_map_parse_read(const char *);
+extern void sun_list_add(struct sun_list *, qelem *);
+
+#endif /* not _SUN_MAP_H */


Property changes on: trunk/contrib/amd/amd/sun_map.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/amd/sun_map_parse.y
===================================================================
--- trunk/contrib/amd/amd/sun_map_parse.y	                        (rev 0)
+++ trunk/contrib/amd/amd/sun_map_parse.y	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,492 @@
+%{
+/*
+ * Copyright (c) 1997-2014 Erez Zadok
+ * Copyright (c) 2005 Daniel P. Ottavio
+ * Copyright (c) 1990 Jan-Simon Pendry
+ * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ * File: am-utils/amd/sun_map_parse.y
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+#include <am_defs.h>
+#include <amd.h>
+#include <sun_map.h>
+
+
+#define SUN_FSTYPE_STR  "fstype="
+
+
+extern int sun_map_lex(void);
+extern int sun_map_error(const char *);
+extern void sun_map_tok_setbuff(const char *);
+extern int sun_map_parse(void);
+
+struct sun_entry *sun_map_parse_read(const char *);
+
+static struct sun_list *sun_entry_list = NULL;
+static struct sun_list *sun_opt_list = NULL;
+static struct sun_list *sun_host_list = NULL;
+static struct sun_list *sun_location_list = NULL;
+static struct sun_list *mountpt_list = NULL;
+static char *tmpFsType = NULL;
+
+
+/*
+ * Each get* function returns a pointer to the corresponding global
+ * list structure.  If the structure is NULL than a new instance is
+ * returned.
+ */
+static struct sun_list *get_sun_opt_list(void);
+static struct sun_list *get_sun_host_list(void);
+static struct sun_list *get_sun_location_list(void);
+static struct sun_list *get_mountpt_list(void);
+static struct sun_list *get_sun_entry_list(void);
+
+%}
+
+%union {
+  char strval[2048];
+}
+
+%token NEWLINE COMMENT WSPACE
+%token <strval> WORD
+
+%%
+
+amap : file
+     ;
+
+file : new_lines entries
+     | entries
+     ;
+
+entries : entry
+        | entry new_lines
+        | entry new_lines entries
+        ;
+
+new_lines : NEWLINE
+          | NEWLINE new_lines
+          ;
+
+entry : locations {
+
+  struct sun_list *list;
+  struct sun_entry *entry;
+
+  /* allocate an entry */
+  entry = CALLOC(struct sun_entry);
+
+  /*
+   * Assign the global location list to this entry and reset the
+   * global pointer.  Reseting the global pointer will create a new
+   * list instance next time get_sun_location_list() is called.
+   */
+  list = get_sun_location_list();
+  entry->location_list = (struct sun_location *)list->first;
+  sun_location_list = NULL;
+
+   /* Add this entry to the entry list. */
+  sun_list_add(get_sun_entry_list(), (qelem *)entry);
+}
+
+| '-' options WSPACE locations {
+
+  struct sun_list *list;
+  struct sun_entry *entry;
+
+  entry = CALLOC(struct sun_entry);
+
+  /* An fstype may have been defined in the 'options'. */
+  if (tmpFsType != NULL) {
+    entry->fstype = tmpFsType;
+    tmpFsType = NULL;
+  }
+
+  /*
+   * Assign the global location list to this entry and reset the
+   * global pointer.  Reseting the global pointer will create a new
+   * list instance next time get_sun_location_list() is called.
+   */
+  list = get_sun_location_list();
+  entry->location_list = (struct sun_location *)list->first;
+  sun_location_list = NULL;
+
+  /*
+   * Assign the global opt list to this entry and reset the global
+   * pointer.  Reseting the global pointer will create a new list
+   * instance next time get_sun_opt_list() is called.
+   */
+  list = get_sun_opt_list();
+  entry->opt_list = (struct sun_opt *)list->first;
+  sun_opt_list = NULL;
+
+  /* Add this entry to the entry list. */
+  sun_list_add(get_sun_entry_list(), (qelem *)entry);
+}
+
+| mountpoints {
+
+  struct sun_list *list;
+  struct sun_entry *entry;
+
+  /* allocate an entry */
+  entry = CALLOC(struct sun_entry);
+
+  /*
+   * Assign the global mountpt list to this entry and reset the global
+   * pointer.  Reseting the global pointer will create a new list
+   * instance next time get_mountpt_list() is called.
+   */
+  list = get_mountpt_list();
+  entry->mountpt_list = (struct sun_mountpt *)list->first;
+  mountpt_list = NULL;
+
+  /* Add this entry to the entry list. */
+  sun_list_add(get_sun_entry_list(), (qelem *)entry);
+}
+
+| '-' options WSPACE mountpoints {
+
+  struct sun_list *list;
+  struct sun_entry *entry;
+
+  /* allocate an entry */
+  entry = CALLOC(struct sun_entry);
+
+  /* An fstype may have been defined in the 'options'. */
+  if (tmpFsType != NULL) {
+    entry->fstype = tmpFsType;
+    tmpFsType = NULL;
+  }
+
+  /*
+   * Assign the global mountpt list to this entry and reset the global
+   * pointer.  Reseting the global pointer will create a new list
+   * instance next time get_mountpt_list() is called.
+   */
+  list = get_mountpt_list();
+  entry->mountpt_list = (struct sun_mountpt *)list->first;
+  mountpt_list = NULL;
+
+  /*
+   * Assign the global opt list to this entry and reset the global
+   * pointer.  Reseting the global pointer will create a new list
+   * instance next time get_sun_opt_list() is called.
+   */
+  list = get_sun_opt_list();
+  entry->opt_list = (struct sun_opt *)list->first;
+  sun_opt_list = NULL;
+
+  /* Add this entry to the entry list. */
+  sun_list_add(get_sun_entry_list(), (qelem *)entry);
+}
+;
+
+mountpoints : mountpoint
+            | mountpoint WSPACE mountpoints
+            ;
+
+mountpoint : WORD WSPACE location {
+
+  struct sun_list *list;
+  struct sun_mountpt *mountpt;
+
+  /* allocate a mountpt */
+  mountpt = CALLOC(struct sun_mountpt);
+
+  /*
+   * Assign the global loaction list to this entry and reset the
+   * global pointer.  Reseting the global pointer will create a new
+   * list instance next time get_sun_location_list() is called.
+   */
+  list = get_sun_location_list();
+  mountpt->location_list = (struct sun_location *)list->first;
+  sun_location_list = NULL;
+
+  mountpt->path = xstrdup($1);
+
+  /* Add this mountpt to the mountpt list. */
+  sun_list_add(get_mountpt_list(), (qelem *)mountpt);
+}
+
+| WORD WSPACE '-' options WSPACE location {
+
+  struct sun_list *list;
+  struct sun_mountpt *mountpt;
+
+  /* allocate a mountpt */
+  mountpt = CALLOC(struct sun_mountpt);
+
+  /* An fstype may have been defined in the 'options'. */
+  if (tmpFsType != NULL) {
+    mountpt->fstype = tmpFsType;
+    tmpFsType = NULL;
+  }
+
+  /*
+   * Assign the global location list to this entry and reset the
+   * global pointer.  Reseting the global pointer will create a new
+   * list instance next time get_sun_location_list() is called.
+   */
+  list = get_sun_location_list();
+  mountpt->location_list = (struct sun_location *)list->first;
+  sun_location_list = NULL;
+
+  /*
+   * Assign the global opt list to this entry and reset the global
+   * pointer.  Reseting the global pointer will create a new list
+   * instance next time get_sun_opt_list() is called.
+   */
+  list = get_sun_opt_list();
+  mountpt->opt_list = (struct sun_opt *)list->first;
+  sun_opt_list = NULL;
+
+  mountpt->path = xstrdup($1);
+
+  /* Add this mountpt to the mountpt list. */
+  sun_list_add(get_mountpt_list(), (qelem *)mountpt);
+}
+;
+
+locations : location
+          | location WSPACE locations
+          ;
+
+location : hosts ':' WORD {
+
+  struct sun_list *list;
+  struct sun_location *location;
+
+  /* allocate a new location */
+  location = CALLOC(struct sun_location);
+
+  /*
+   * Assign the global opt list to this entry and reset the global
+   * pointer.  Reseting the global pointer will create a new list
+   * instance next time get_sun_opt_list() is called.
+   */
+  list = get_sun_host_list();
+  location->host_list = (struct sun_host *)list->first;
+  sun_host_list = NULL;
+
+  location->path = xstrdup($3);
+
+  /* Add this location to the location list. */
+  sun_list_add(get_sun_location_list(), (qelem *)location);
+}
+
+| ':' WORD {
+
+  struct sun_location *location;
+
+  /* allocate a new location */
+  location = CALLOC(struct sun_location);
+
+  location->path = xstrdup($2);
+
+  /* Add this location to the location list. */
+  sun_list_add(get_sun_location_list(), (qelem *)location);
+}
+;
+
+hosts : host
+      | host ',' hosts
+      ;
+
+host : WORD {
+
+  /* allocate a new host */
+  struct sun_host *host = CALLOC(struct sun_host);
+
+  host->name = xstrdup($1);
+
+  /* Add this host to the host list. */
+  sun_list_add(get_sun_host_list(),(qelem *)host);
+}
+
+| WORD weight {
+
+  /*
+   * It is assumed that the host for this rule was allocated by the
+   * 'weight' rule and assigned to be the last host item on the host
+   * list.
+   */
+  struct sun_host *host = (struct sun_host *)sun_host_list->last;
+
+  host->name = xstrdup($1);
+}
+;
+
+weight : '(' WORD ')' {
+
+  int val;
+  /* allocate a new host */
+  struct sun_host *host = CALLOC(struct sun_host);
+
+  val = atoi($2);
+
+  host->weight = val;
+
+  /* Add this host to the host list. */
+  sun_list_add(get_sun_host_list(), (qelem *)host);
+}
+;
+
+options : option
+        | option ',' options
+        ;
+
+option : WORD {
+
+  char *type;
+
+  /* check if this is an fstype option */
+  if ((type = strstr($1,SUN_FSTYPE_STR)) != NULL) {
+    /* parse out the fs type from the Sun fstype keyword  */
+    if ((type = type + strlen(SUN_FSTYPE_STR)) != NULL) {
+      /*
+       * This global fstype str will be assigned to the current being
+       * parsed later in the parsing.
+       */
+      tmpFsType = xstrdup(type);
+    }
+  }
+  else {
+    /*
+     * If it is not an fstype option allocate an opt struct and assign
+     * the value.
+     */
+    struct sun_opt *opt = CALLOC(struct sun_opt);
+    opt->str = xstrdup($1);
+    /* Add this opt to the opt list. */
+    sun_list_add(get_sun_opt_list(), (qelem *)opt);
+  }
+}
+
+;
+
+%%
+
+/*
+ * Parse 'map_data' which is assumed to be a Sun-syle map.  If
+ * successful a sun_entry is returned.
+ *
+ * The parser is designed to parse map entries with out the keys.  For
+ * example the entry:
+ *
+ * usr -ro pluto:/usr/local
+ *
+ * should be passed to the parser as:
+ *
+ * -ro pluto:/usr/local
+ *
+ * The reason for this is that the Amd info services already strip off
+ * the key when they read map info.
+ */
+struct sun_entry *
+sun_map_parse_read(const char *map_data)
+{
+  struct sun_entry *retval = NULL;
+
+  /* pass map_data to lex */
+  sun_map_tok_setbuff(map_data);
+
+  /* call yacc */
+  sun_map_parse();
+
+  if (sun_entry_list != NULL) {
+    /* return the first Sun entry in the list */
+    retval = (struct sun_entry*)sun_entry_list->first;
+    sun_entry_list = NULL;
+  }
+  else {
+    plog(XLOG_ERROR, "Sun map parser did not produce data structs.");
+  }
+
+  return retval;
+}
+
+
+static struct sun_list *
+get_sun_entry_list(void)
+{
+  if (sun_entry_list == NULL) {
+    sun_entry_list = CALLOC(struct sun_list);
+  }
+  return sun_entry_list;
+}
+
+
+static struct sun_list *
+get_mountpt_list(void)
+{
+  if (mountpt_list == NULL) {
+    mountpt_list = CALLOC(struct sun_list);
+  }
+  return mountpt_list;
+}
+
+
+static struct sun_list *
+get_sun_location_list(void)
+{
+  if (sun_location_list == NULL) {
+    sun_location_list = CALLOC(struct sun_list);
+  }
+  return sun_location_list;
+}
+
+
+static struct sun_list *
+get_sun_host_list(void)
+{
+  if (sun_host_list == NULL) {
+    sun_host_list = CALLOC(struct sun_list);
+  }
+  return sun_host_list;
+}
+
+
+static struct sun_list *
+get_sun_opt_list(void)
+{
+  if (sun_opt_list == NULL) {
+    sun_opt_list = CALLOC(struct sun_list);
+  }
+  return sun_opt_list;
+}

Added: trunk/contrib/amd/amd/sun_map_tok.l
===================================================================
--- trunk/contrib/amd/amd/sun_map_tok.l	                        (rev 0)
+++ trunk/contrib/amd/amd/sun_map_tok.l	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,233 @@
+%{
+/*
+ * Copyright (c) 1997-2014 Erez Zadok
+ * Copyright (c) 2005 Daniel P. Ottavio
+ * Copyright (c) 1990 Jan-Simon Pendry
+ * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry at Imperial College, London.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ * File: am-utils/amd/sun_map_tok.l
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+/*
+ * Some systems include a definition for the macro ECHO in <sys/ioctl.h>,
+ * and their (bad) version of lex defines it too at the very beginning of
+ * the generated lex.yy.c file (before it can be easily undefined),
+ * resulting in a conflict.  So undefine it here before needed.
+ * Luckily, it does not appear that this macro is actually used in the rest
+ * of the generated lex.yy.c file.
+ */
+#ifdef ECHO
+# undef ECHO
+#endif /* ECHO */
+#include <am_defs.h>
+#include <amd.h>
+#include <sun_map_parse.h>
+/* and once again undefine this, just in case */
+#ifdef ECHO
+# undef ECHO
+#endif /* ECHO */
+
+/*
+ * There are some things that need to be defined only if using GNU flex.
+ * These must not be defined if using standard lex
+ */
+#ifdef FLEX_SCANNER
+# ifndef ECHO
+#  define ECHO __IGNORE(fwrite( yytext, yyleng, 1, yyout ))
+# endif /* not ECHO */
+#endif /* FLEX_SCANNER */
+
+int yylex(void);
+int sun_map_error(const char *);
+
+/*
+ * We need to configure lex to parse from a string
+ * instead of a file. Each version of lex has it's
+ * own way of doing this (sigh).
+ */
+
+/* assign the buffer to parse */
+void sun_map_tok_setbuff(const char* buff);
+
+/* buffer that contains the string to parse */
+const char *sun_map_tok_buff = NULL;
+
+#ifdef FLEX_SCANNER
+/*
+ * The flex scanner uses the YY_INPUT to parse the input.
+ * We need to redefine it so that it can parse strings.
+ * In addition to the above string buffer we need to have
+ * a position pointer and a end pointer.
+ */
+
+/* current position of the buffer */
+const char *sun_map_tok_pos = NULL;
+
+/* size of the buffer */
+const char *sun_map_tok_end = NULL;
+
+/* copies the current position + maxsize into buff */
+int sun_map_input(char *buff, int maxsize);
+
+# undef YY_INPUT
+# define YY_INPUT(buff,result,maxsize) (result = sun_map_input(buff,maxsize))
+
+#else
+/*
+ * If this is not Flex than fall back to an AT&T style lex.
+ * We can parse strings by redefining input and unput.
+ */
+#undef input
+#undef unput
+#define input()  (*(char *)sun_map_tok_buff++)
+#define unput(c) (*(char *)--sun_map_tok_buff = c)
+
+#endif /* FLEX_SCANNER */
+
+/*
+ * some systems such as DU-4.x have a different GNU flex in /usr/bin
+ * which automatically generates yywrap macros and symbols.  So I must
+ * distinguish between them and when yywrap is actually needed.
+ */
+#if !defined(yywrap) || defined(yylex)
+int yywrap(void);
+#endif /* not yywrap or yylex */
+
+/* no need to use yywrap() */
+#define YY_SKIP_YYWRAP
+
+int sun_map_line = 1;
+int sun_map_tokpos = 1;
+
+%}
+
+/* This option causes Solaris lex to fail.  Use flex.  See BUGS file */
+/* no need to use yyunput() */
+%option nounput
+%option noinput
+
+/* allocate more output slots so lex scanners don't run out of mem */
+%o 1024
+
+WORD_REX       [A-Za-z0-9_/&\.$=]+[A-Za-z0-9_/&\.$=-]*
+COMMENT_REX    ^#.*\n
+WSPACE_REX     [ \t]*
+NEWLINE_REX    [ \t]*\n
+CONTINUE_REX   "\\"\n
+
+%%
+
+{WORD_REX}      {
+                  sun_map_tokpos += yyleng;
+                  xstrlcpy((char *)sun_map_lval.strval,(const char *)yytext,sizeof(sun_map_lval.strval));
+                  return WORD;
+                }
+
+{WSPACE_REX}    {
+                  sun_map_tokpos += yyleng;
+                  return WSPACE;
+                }
+
+{NEWLINE_REX}   {
+                  sun_map_tokpos = 0;
+                  sun_map_line++;
+                  return NEWLINE;
+                }
+
+{CONTINUE_REX}  {
+                  sun_map_tokpos = 0;
+                  sun_map_line++;
+                }
+
+{COMMENT_REX}   {
+                  sun_map_line++;
+                }
+
+.               {
+                  return yytext[0];
+                }
+
+%%
+
+
+int
+sun_map_error(const char* s)
+{
+  return 1;
+}
+
+#ifdef FLEX_SCANNER
+void
+sun_map_tok_setbuff(const char* buff)
+{
+  sun_map_tok_end = buff + strlen(buff);
+  sun_map_tok_pos = buff;
+  sun_map_tok_buff = buff;
+}
+
+
+int
+sun_map_input(char *buff, int maxsize)
+{
+  int size = MIN(maxsize, (sun_map_tok_end - sun_map_tok_pos));
+  if (size > 0) {
+    memcpy(buff,sun_map_tok_pos,size);
+    sun_map_tok_pos += size;
+  }
+
+  return size;
+}
+#else
+void
+sun_map_tok_setbuff(const char* buff)
+{
+  sun_map_tok_buff = buff;
+}
+
+#endif /* FLEX_SCANNER */
+
+/*
+ * some systems such as DU-4.x have a different GNU flex in /usr/bin
+ * which automatically generates yywrap macros and symbols.  So I must
+ * distinguish between them and when yywrap is actually needed.
+ */
+#if !defined(yywrap) || defined(yylex)
+int yywrap(void)
+{
+  return 1;
+}
+#endif /* not yywrap or yylex */

Added: trunk/contrib/amd/amd/test1.sh
===================================================================
--- trunk/contrib/amd/amd/test1.sh	                        (rev 0)
+++ trunk/contrib/amd/amd/test1.sh	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,2 @@
+#!/bin/sh
+./amd -v 2> /dev/null


Property changes on: trunk/contrib/amd/amd/test1.sh
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/fsinfo/null_gram.c
===================================================================
--- trunk/contrib/amd/fsinfo/null_gram.c	                        (rev 0)
+++ trunk/contrib/amd/fsinfo/null_gram.c	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,1414 @@
+/* A Bison parser, made by GNU Bison 3.0.2.  */
+
+/* Bison implementation for Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+   simplifying the original so-called "semantic" parser.  */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+   infringing on user name space.  This should be done even for local
+   variables, as they might otherwise be expanded by user macros.
+   There are some unavoidable exceptions within include files to
+   define necessary library symbols; they are noted "INFRINGES ON
+   USER NAME SPACE" below.  */
+
+/* Identify Bison output.  */
+#define YYBISON 1
+
+/* Bison version.  */
+#define YYBISON_VERSION "3.0.2"
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers.  */
+#define YYPURE 0
+
+/* Push parsers.  */
+#define YYPUSH 0
+
+/* Pull parsers.  */
+#define YYPULL 1
+
+
+/* Substitute the variable and function names.  */
+#define yyparse         null_parse
+#define yylex           null_lex
+#define yyerror         null_error
+#define yydebug         null_debug
+#define yynerrs         null_nerrs
+
+#define yylval          null_lval
+#define yychar          null_char
+
+/* Copy the first part of user declarations.  */
+#line 1 "../../fsinfo/null_gram.y" /* yacc.c:339  */
+
+void yyerror(const char *fmt, ...);
+extern int yylex(void);
+
+#line 79 "null_gram.c" /* yacc.c:339  */
+
+# ifndef YY_NULLPTR
+#  if defined __cplusplus && 201103L <= __cplusplus
+#   define YY_NULLPTR nullptr
+#  else
+#   define YY_NULLPTR 0
+#  endif
+# endif
+
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* In a future release of Bison, this section will be replaced
+   by #include "y.tab.h".  */
+#ifndef YY_NULL_NULL_GRAM_H_INCLUDED
+# define YY_NULL_NULL_GRAM_H_INCLUDED
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int null_debug;
+#endif
+
+
+/* Value type.  */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+
+extern YYSTYPE null_lval;
+
+int null_parse (void);
+
+#endif /* !YY_NULL_NULL_GRAM_H_INCLUDED  */
+
+/* Copy the second part of user declarations.  */
+
+#line 126 "null_gram.c" /* yacc.c:358  */
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#else
+typedef signed char yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+#  define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+#  define YYSIZE_T size_t
+# elif ! defined YYSIZE_T
+#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYSIZE_T size_t
+# else
+#  define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+#  if ENABLE_NLS
+#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+#  endif
+# endif
+# ifndef YY_
+#  define YY_(Msgid) Msgid
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__                                               \
+      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
+     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
+#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+#  define YY_ATTRIBUTE(Spec) /* empty */
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
+# if defined _MSC_VER && 1200 <= _MSC_VER
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E.  */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(E) ((void) (E))
+#else
+# define YYUSE(E) /* empty */
+#endif
+
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+    _Pragma ("GCC diagnostic push") \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+    _Pragma ("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols.  */
+
+# ifdef YYSTACK_USE_ALLOCA
+#  if YYSTACK_USE_ALLOCA
+#   ifdef __GNUC__
+#    define YYSTACK_ALLOC __builtin_alloca
+#   elif defined __BUILTIN_VA_ARG_INCR
+#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+#   elif defined _AIX
+#    define YYSTACK_ALLOC __alloca
+#   elif defined _MSC_VER
+#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+#    define alloca _alloca
+#   else
+#    define YYSTACK_ALLOC alloca
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
+#     endif
+#    endif
+#   endif
+#  endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+   /* Pacify GCC's 'empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+    /* The OS might guarantee only one guard page at the bottom of the stack,
+       and a page size can be as small as 4096 bytes.  So we cannot safely
+       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
+       to allow for a few compiler-allocated temporary stack slots.  */
+#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+#  endif
+# else
+#  define YYSTACK_ALLOC YYMALLOC
+#  define YYSTACK_FREE YYFREE
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+#  endif
+#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
+       && ! ((defined YYMALLOC || defined malloc) \
+             && (defined YYFREE || defined free)))
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
+#   endif
+#  endif
+#  ifndef YYMALLOC
+#   define YYMALLOC malloc
+#   if ! defined malloc && ! defined EXIT_SUCCESS
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifndef YYFREE
+#   define YYFREE free
+#   if ! defined free && ! defined EXIT_SUCCESS
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+     && (! defined __cplusplus \
+         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member.  */
+union yyalloc
+{
+  yytype_int16 yyss_alloc;
+  YYSTYPE yyvs_alloc;
+};
+
+/* The size of the maximum gap between one aligned stack and the next.  */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+   N elements.  */
+# define YYSTACK_BYTES(N) \
+     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+      + YYSTACK_GAP_MAXIMUM)
+
+# define YYCOPY_NEEDED 1
+
+/* Relocate STACK from its old location to the new one.  The
+   local variables YYSIZE and YYSTACKSIZE give the old and new number of
+   elements in the stack, and YYPTR gives the new location of the
+   stack.  Advance YYPTR to a properly aligned location for the next
+   stack.  */
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
+    do                                                                  \
+      {                                                                 \
+        YYSIZE_T yynewbytes;                                            \
+        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+        Stack = &yyptr->Stack_alloc;                                    \
+        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / sizeof (*yyptr);                          \
+      }                                                                 \
+    while (0)
+
+#endif
+
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(Dst, Src, Count) \
+      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+#  else
+#   define YYCOPY(Dst, Src, Count)              \
+      do                                        \
+        {                                       \
+          YYSIZE_T yyi;                         \
+          for (yyi = 0; yyi < (Count); yyi++)   \
+            (Dst)[yyi] = (Src)[yyi];            \
+        }                                       \
+      while (0)
+#  endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state.  */
+#define YYFINAL  2
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   0
+
+/* YYNTOKENS -- Number of terminals.  */
+#define YYNTOKENS  3
+/* YYNNTS -- Number of nonterminals.  */
+#define YYNNTS  2
+/* YYNRULES -- Number of rules.  */
+#define YYNRULES  2
+/* YYNSTATES -- Number of states.  */
+#define YYNSTATES  3
+
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+   by yylex, with out-of-bounds checking.  */
+#define YYUNDEFTOK  2
+#define YYMAXUTOK   257
+
+#define YYTRANSLATE(YYX)                                                \
+  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, without out-of-bounds checking.  */
+static const yytype_uint8 yytranslate[] =
+{
+       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     1,     2
+};
+
+#if YYDEBUG
+  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
+static const yytype_uint8 yyrline[] =
+{
+       0,     8,     8
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || 0
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
+static const char *const yytname[] =
+{
+  "$end", "error", "$undefined", "$accept", "token", YY_NULLPTR
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+   (internal) symbol number NUM (which must be that of a token).  */
+static const yytype_uint16 yytoknum[] =
+{
+       0,   256,   257
+};
+# endif
+
+#define YYPACT_NINF -1
+
+#define yypact_value_is_default(Yystate) \
+  (!!((Yystate) == (-1)))
+
+#define YYTABLE_NINF -1
+
+#define yytable_value_is_error(Yytable_value) \
+  0
+
+  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+     STATE-NUM.  */
+static const yytype_int8 yypact[] =
+{
+      -1,     0,    -1
+};
+
+  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+     Performed when YYTABLE does not specify something else to do.  Zero
+     means the default is an error.  */
+static const yytype_uint8 yydefact[] =
+{
+       2,     0,     1
+};
+
+  /* YYPGOTO[NTERM-NUM].  */
+static const yytype_int8 yypgoto[] =
+{
+      -1,    -1
+};
+
+  /* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int8 yydefgoto[] =
+{
+      -1,     1
+};
+
+  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+     positive, shift that token.  If negative, reduce the rule whose
+     number is the opposite.  If YYTABLE_NINF, syntax error.  */
+static const yytype_uint8 yytable[] =
+{
+       2
+};
+
+static const yytype_uint8 yycheck[] =
+{
+       0
+};
+
+  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+     symbol of state STATE-NUM.  */
+static const yytype_uint8 yystos[] =
+{
+       0,     4,     0
+};
+
+  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,     3,     4
+};
+
+  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+static const yytype_uint8 yyr2[] =
+{
+       0,     2,     0
+};
+
+
+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (yychar = YYEMPTY)
+#define YYEMPTY         (-2)
+#define YYEOF           0
+
+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
+
+
+#define YYRECOVERING()  (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value)                                  \
+do                                                              \
+  if (yychar == YYEMPTY)                                        \
+    {                                                           \
+      yychar = (Token);                                         \
+      yylval = (Value);                                         \
+      YYPOPSTACK (yylen);                                       \
+      yystate = *yyssp;                                         \
+      goto yybackup;                                            \
+    }                                                           \
+  else                                                          \
+    {                                                           \
+      yyerror (YY_("syntax error: cannot back up")); \
+      YYERROR;                                                  \
+    }                                                           \
+while (0)
+
+/* Error token number */
+#define YYTERROR        1
+#define YYERRCODE       256
+
+
+
+/* Enable debugging if requested.  */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args)                        \
+do {                                            \
+  if (yydebug)                                  \
+    YYFPRINTF Args;                             \
+} while (0)
+
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
+
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
+do {                                                                      \
+  if (yydebug)                                                            \
+    {                                                                     \
+      YYFPRINTF (stderr, "%s ", Title);                                   \
+      yy_symbol_print (stderr,                                            \
+                  Type, Value); \
+      YYFPRINTF (stderr, "\n");                                           \
+    }                                                                     \
+} while (0)
+
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT.  |
+`----------------------------------------*/
+
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+{
+  FILE *yyo = yyoutput;
+  YYUSE (yyo);
+  if (!yyvaluep)
+    return;
+# ifdef YYPRINT
+  if (yytype < YYNTOKENS)
+    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# endif
+  YYUSE (yytype);
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+{
+  YYFPRINTF (yyoutput, "%s %s (",
+             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+
+  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
+  YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included).                                                   |
+`------------------------------------------------------------------*/
+
+static void
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
+  YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top)                            \
+do {                                                            \
+  if (yydebug)                                                  \
+    yy_stack_print ((Bottom), (Top));                           \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
+
+static void
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
+{
+  unsigned long int yylno = yyrline[yyrule];
+  int yynrhs = yyr2[yyrule];
+  int yyi;
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+             yyrule - 1, yylno);
+  /* The symbols being reduced.  */
+  for (yyi = 0; yyi < yynrhs; yyi++)
+    {
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+      yy_symbol_print (stderr,
+                       yystos[yyssp[yyi + 1 - yynrhs]],
+                       &(yyvsp[(yyi + 1) - (yynrhs)])
+                                              );
+      YYFPRINTF (stderr, "\n");
+    }
+}
+
+# define YY_REDUCE_PRINT(Rule)          \
+do {                                    \
+  if (yydebug)                          \
+    yy_reduce_print (yyssp, yyvsp, Rule); \
+} while (0)
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks.  */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+   if the built-in stack extension method is used).
+
+   Do not make this value too large; the results are undefined if
+   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+   evaluated with infinite-precision integer arithmetic.  */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+#  if defined __GLIBC__ && defined _STRING_H
+#   define yystrlen strlen
+#  else
+/* Return the length of YYSTR.  */
+static YYSIZE_T
+yystrlen (const char *yystr)
+{
+  YYSIZE_T yylen;
+  for (yylen = 0; yystr[yylen]; yylen++)
+    continue;
+  return yylen;
+}
+#  endif
+# endif
+
+# ifndef yystpcpy
+#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+#   define yystpcpy stpcpy
+#  else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+   YYDEST.  */
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+{
+  char *yyd = yydest;
+  const char *yys = yysrc;
+
+  while ((*yyd++ = *yys++) != '\0')
+    continue;
+
+  return yyd - 1;
+}
+#  endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+   quotes and backslashes, so that it's suitable for yyerror.  The
+   heuristic is that double-quoting is unnecessary unless the string
+   contains an apostrophe, a comma, or backslash (other than
+   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
+   null, do not copy; instead, return the length of what the result
+   would have been.  */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+  if (*yystr == '"')
+    {
+      YYSIZE_T yyn = 0;
+      char const *yyp = yystr;
+
+      for (;;)
+        switch (*++yyp)
+          {
+          case '\'':
+          case ',':
+            goto do_not_strip_quotes;
+
+          case '\\':
+            if (*++yyp != '\\')
+              goto do_not_strip_quotes;
+            /* Fall through.  */
+          default:
+            if (yyres)
+              yyres[yyn] = *yyp;
+            yyn++;
+            break;
+
+          case '"':
+            if (yyres)
+              yyres[yyn] = '\0';
+            return yyn;
+          }
+    do_not_strip_quotes: ;
+    }
+
+  if (! yyres)
+    return yystrlen (yystr);
+
+  return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+   about the unexpected token YYTOKEN for the state stack whose top is
+   YYSSP.
+
+   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
+   not large enough to hold the message.  In that case, also set
+   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
+   required number of bytes is too large to store.  */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+                yytype_int16 *yyssp, int yytoken)
+{
+  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+  YYSIZE_T yysize = yysize0;
+  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+  /* Internationalized format string. */
+  const char *yyformat = YY_NULLPTR;
+  /* Arguments of yyformat. */
+  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+  /* Number of reported tokens (one for the "unexpected", one per
+     "expected"). */
+  int yycount = 0;
+
+  /* There are many possibilities here to consider:
+     - If this state is a consistent state with a default action, then
+       the only way this function was invoked is if the default action
+       is an error action.  In that case, don't check for expected
+       tokens because there are none.
+     - The only way there can be no lookahead present (in yychar) is if
+       this state is a consistent state with a default action.  Thus,
+       detecting the absence of a lookahead is sufficient to determine
+       that there is no unexpected or expected token to report.  In that
+       case, just report a simple "syntax error".
+     - Don't assume there isn't a lookahead just because this state is a
+       consistent state with a default action.  There might have been a
+       previous inconsistent state, consistent state with a non-default
+       action, or user semantic action that manipulated yychar.
+     - Of course, the expected token list depends on states to have
+       correct lookahead information, and it depends on the parser not
+       to perform extra reductions after fetching a lookahead from the
+       scanner and before detecting a syntax error.  Thus, state merging
+       (from LALR or IELR) and default reductions corrupt the expected
+       token list.  However, the list is correct for canonical LR with
+       one exception: it will still contain any token that will not be
+       accepted due to an error action in a later state.
+  */
+  if (yytoken != YYEMPTY)
+    {
+      int yyn = yypact[*yyssp];
+      yyarg[yycount++] = yytname[yytoken];
+      if (!yypact_value_is_default (yyn))
+        {
+          /* Start YYX at -YYN if negative to avoid negative indexes in
+             YYCHECK.  In other words, skip the first -YYN actions for
+             this state because they are default actions.  */
+          int yyxbegin = yyn < 0 ? -yyn : 0;
+          /* Stay within bounds of both yycheck and yytname.  */
+          int yychecklim = YYLAST - yyn + 1;
+          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+          int yyx;
+
+          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+                && !yytable_value_is_error (yytable[yyx + yyn]))
+              {
+                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+                  {
+                    yycount = 1;
+                    yysize = yysize0;
+                    break;
+                  }
+                yyarg[yycount++] = yytname[yyx];
+                {
+                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+                  if (! (yysize <= yysize1
+                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                    return 2;
+                  yysize = yysize1;
+                }
+              }
+        }
+    }
+
+  switch (yycount)
+    {
+# define YYCASE_(N, S)                      \
+      case N:                               \
+        yyformat = S;                       \
+      break
+      YYCASE_(0, YY_("syntax error"));
+      YYCASE_(1, YY_("syntax error, unexpected %s"));
+      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+    }
+
+  {
+    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+      return 2;
+    yysize = yysize1;
+  }
+
+  if (*yymsg_alloc < yysize)
+    {
+      *yymsg_alloc = 2 * yysize;
+      if (! (yysize <= *yymsg_alloc
+             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+      return 1;
+    }
+
+  /* Avoid sprintf, as that infringes on the user's name space.
+     Don't have undefined behavior even if the translation
+     produced a string with the wrong number of "%s"s.  */
+  {
+    char *yyp = *yymsg;
+    int yyi = 0;
+    while ((*yyp = *yyformat) != '\0')
+      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+        {
+          yyp += yytnamerr (yyp, yyarg[yyi++]);
+          yyformat += 2;
+        }
+      else
+        {
+          yyp++;
+          yyformat++;
+        }
+  }
+  return 0;
+}
+#endif /* YYERROR_VERBOSE */
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+{
+  YYUSE (yyvaluep);
+  if (!yymsg)
+    yymsg = "Deleting";
+  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YYUSE (yytype);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
+
+
+
+
+/* The lookahead symbol.  */
+int yychar;
+
+/* The semantic value of the lookahead symbol.  */
+YYSTYPE yylval;
+/* Number of syntax errors so far.  */
+int yynerrs;
+
+
+/*----------.
+| yyparse.  |
+`----------*/
+
+int
+yyparse (void)
+{
+    int yystate;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus;
+
+    /* The stacks and their tools:
+       'yyss': related to states.
+       'yyvs': related to semantic values.
+
+       Refer to the stacks through separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
+
+    /* The state stack.  */
+    yytype_int16 yyssa[YYINITDEPTH];
+    yytype_int16 *yyss;
+    yytype_int16 *yyssp;
+
+    /* The semantic value stack.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs;
+    YYSTYPE *yyvsp;
+
+    YYSIZE_T yystacksize;
+
+  int yyn;
+  int yyresult;
+  /* Lookahead token as an internal (translated) token number.  */
+  int yytoken = 0;
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+
+#if YYERROR_VERBOSE
+  /* Buffer for error messages, and its allocated size.  */
+  char yymsgbuf[128];
+  char *yymsg = yymsgbuf;
+  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
+
+  /* The number of symbols on the RHS of the reduced rule.
+     Keep to zero when no symbol should be popped.  */
+  int yylen = 0;
+
+  yyssp = yyss = yyssa;
+  yyvsp = yyvs = yyvsa;
+  yystacksize = YYINITDEPTH;
+
+  YYDPRINTF ((stderr, "Starting parse\n"));
+
+  yystate = 0;
+  yyerrstatus = 0;
+  yynerrs = 0;
+  yychar = YYEMPTY; /* Cause a token to be read.  */
+  goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate.  |
+`------------------------------------------------------------*/
+ yynewstate:
+  /* In all cases, when you get here, the value and location stacks
+     have just been pushed.  So pushing a state here evens the stacks.  */
+  yyssp++;
+
+ yysetstate:
+  *yyssp = yystate;
+
+  if (yyss + yystacksize - 1 <= yyssp)
+    {
+      /* Get the current used size of the three stacks, in elements.  */
+      YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+      {
+        /* Give user a chance to reallocate the stack.  Use copies of
+           these so that the &'s don't force the real ones into
+           memory.  */
+        YYSTYPE *yyvs1 = yyvs;
+        yytype_int16 *yyss1 = yyss;
+
+        /* Each stack pointer address is followed by the size of the
+           data in use in that stack, in bytes.  This used to be a
+           conditional around just the two extra args, but that might
+           be undefined if yyoverflow is a macro.  */
+        yyoverflow (YY_("memory exhausted"),
+                    &yyss1, yysize * sizeof (*yyssp),
+                    &yyvs1, yysize * sizeof (*yyvsp),
+                    &yystacksize);
+
+        yyss = yyss1;
+        yyvs = yyvs1;
+      }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+      goto yyexhaustedlab;
+# else
+      /* Extend the stack our own way.  */
+      if (YYMAXDEPTH <= yystacksize)
+        goto yyexhaustedlab;
+      yystacksize *= 2;
+      if (YYMAXDEPTH < yystacksize)
+        yystacksize = YYMAXDEPTH;
+
+      {
+        yytype_int16 *yyss1 = yyss;
+        union yyalloc *yyptr =
+          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+        if (! yyptr)
+          goto yyexhaustedlab;
+        YYSTACK_RELOCATE (yyss_alloc, yyss);
+        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+#  undef YYSTACK_RELOCATE
+        if (yyss1 != yyssa)
+          YYSTACK_FREE (yyss1);
+      }
+# endif
+#endif /* no yyoverflow */
+
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;
+
+      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+                  (unsigned long int) yystacksize));
+
+      if (yyss + yystacksize - 1 <= yyssp)
+        YYABORT;
+    }
+
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+  if (yystate == YYFINAL)
+    YYACCEPT;
+
+  goto yybackup;
+
+/*-----------.
+| yybackup.  |
+`-----------*/
+yybackup:
+
+  /* Do appropriate processing given the current state.  Read a
+     lookahead token if we need one and don't already have one.  */
+
+  /* First try to decide what to do without reference to lookahead token.  */
+  yyn = yypact[yystate];
+  if (yypact_value_is_default (yyn))
+    goto yydefault;
+
+  /* Not known => get a lookahead token if don't already have one.  */
+
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
+  if (yychar == YYEMPTY)
+    {
+      YYDPRINTF ((stderr, "Reading a token: "));
+      yychar = yylex ();
+    }
+
+  if (yychar <= YYEOF)
+    {
+      yychar = yytoken = YYEOF;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else
+    {
+      yytoken = YYTRANSLATE (yychar);
+      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+    }
+
+  /* If the proper action on seeing token YYTOKEN is to reduce or to
+     detect an error, take that action.  */
+  yyn += yytoken;
+  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+    goto yydefault;
+  yyn = yytable[yyn];
+  if (yyn <= 0)
+    {
+      if (yytable_value_is_error (yyn))
+        goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
+
+  /* Shift the lookahead token.  */
+  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
+
+  yystate = yyn;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+  goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state.  |
+`-----------------------------------------------------------*/
+yydefault:
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    goto yyerrlab;
+  goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction.  |
+`-----------------------------*/
+yyreduce:
+  /* yyn is the number of a rule to reduce with.  */
+  yylen = yyr2[yyn];
+
+  /* If YYLEN is nonzero, implement the default value of the action:
+     '$$ = $1'.
+
+     Otherwise, the following line sets YYVAL to garbage.
+     This behavior is undocumented and Bison
+     users should not rely upon it.  Assigning to YYVAL
+     unconditionally makes the parser a bit smaller, and it avoids a
+     GCC warning that YYVAL may be used uninitialized.  */
+  yyval = yyvsp[1-yylen];
+
+
+  YY_REDUCE_PRINT (yyn);
+  switch (yyn)
+    {
+      
+#line 1188 "null_gram.c" /* yacc.c:1646  */
+      default: break;
+    }
+  /* User semantic actions sometimes alter yychar, and that requires
+     that yytoken be updated with the new translation.  We take the
+     approach of translating immediately before every use of yytoken.
+     One alternative is translating here after every semantic action,
+     but that translation would be missed if the semantic action invokes
+     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+     incorrect destructor might then be invoked immediately.  In the
+     case of YYERROR or YYBACKUP, subsequent parser actions might lead
+     to an incorrect destructor call or verbose syntax error message
+     before the lookahead is translated.  */
+  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+
+  *++yyvsp = yyval;
+
+  /* Now 'shift' the result of the reduction.  Determine what state
+     that goes to, based on the state we popped back to and the rule
+     number reduced by.  */
+
+  yyn = yyr1[yyn];
+
+  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+    yystate = yytable[yystate];
+  else
+    yystate = yydefgoto[yyn - YYNTOKENS];
+
+  goto yynewstate;
+
+
+/*--------------------------------------.
+| yyerrlab -- here on detecting error.  |
+`--------------------------------------*/
+yyerrlab:
+  /* Make sure we have latest lookahead translation.  See comments at
+     user semantic actions for why this is necessary.  */
+  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
+    {
+      ++yynerrs;
+#if ! YYERROR_VERBOSE
+      yyerror (YY_("syntax error"));
+#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+                                        yyssp, yytoken)
+      {
+        char const *yymsgp = YY_("syntax error");
+        int yysyntax_error_status;
+        yysyntax_error_status = YYSYNTAX_ERROR;
+        if (yysyntax_error_status == 0)
+          yymsgp = yymsg;
+        else if (yysyntax_error_status == 1)
+          {
+            if (yymsg != yymsgbuf)
+              YYSTACK_FREE (yymsg);
+            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+            if (!yymsg)
+              {
+                yymsg = yymsgbuf;
+                yymsg_alloc = sizeof yymsgbuf;
+                yysyntax_error_status = 2;
+              }
+            else
+              {
+                yysyntax_error_status = YYSYNTAX_ERROR;
+                yymsgp = yymsg;
+              }
+          }
+        yyerror (yymsgp);
+        if (yysyntax_error_status == 2)
+          goto yyexhaustedlab;
+      }
+# undef YYSYNTAX_ERROR
+#endif
+    }
+
+
+
+  if (yyerrstatus == 3)
+    {
+      /* If just tried and failed to reuse lookahead token after an
+         error, discard it.  */
+
+      if (yychar <= YYEOF)
+        {
+          /* Return failure if at end of input.  */
+          if (yychar == YYEOF)
+            YYABORT;
+        }
+      else
+        {
+          yydestruct ("Error: discarding",
+                      yytoken, &yylval);
+          yychar = YYEMPTY;
+        }
+    }
+
+  /* Else will try to reuse lookahead token after shifting the error
+     token.  */
+  goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
+yyerrorlab:
+
+  /* Pacify compilers like GCC when the user code never invokes
+     YYERROR and the label yyerrorlab therefore never appears in user
+     code.  */
+  if (/*CONSTCOND*/ 0)
+     goto yyerrorlab;
+
+  /* Do not reclaim the symbols of the rule whose action triggered
+     this YYERROR.  */
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+  yystate = *yyssp;
+  goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR.  |
+`-------------------------------------------------------------*/
+yyerrlab1:
+  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
+
+  for (;;)
+    {
+      yyn = yypact[yystate];
+      if (!yypact_value_is_default (yyn))
+        {
+          yyn += YYTERROR;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+            {
+              yyn = yytable[yyn];
+              if (0 < yyn)
+                break;
+            }
+        }
+
+      /* Pop the current state because it cannot handle the error token.  */
+      if (yyssp == yyss)
+        YYABORT;
+
+
+      yydestruct ("Error: popping",
+                  yystos[yystate], yyvsp);
+      YYPOPSTACK (1);
+      yystate = *yyssp;
+      YY_STACK_PRINT (yyss, yyssp);
+    }
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+
+  /* Shift the error token.  */
+  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+  yystate = yyn;
+  goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here.  |
+`-------------------------------------*/
+yyacceptlab:
+  yyresult = 0;
+  goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here.  |
+`-----------------------------------*/
+yyabortlab:
+  yyresult = 1;
+  goto yyreturn;
+
+#if !defined yyoverflow || YYERROR_VERBOSE
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here.  |
+`-------------------------------------------------*/
+yyexhaustedlab:
+  yyerror (YY_("memory exhausted"));
+  yyresult = 2;
+  /* Fall through.  */
+#endif
+
+yyreturn:
+  if (yychar != YYEMPTY)
+    {
+      /* Make sure we have latest lookahead translation.  See comments at
+         user semantic actions for why this is necessary.  */
+      yytoken = YYTRANSLATE (yychar);
+      yydestruct ("Cleanup: discarding lookahead",
+                  yytoken, &yylval);
+    }
+  /* Do not reclaim the symbols of the rule whose action triggered
+     this YYABORT or YYACCEPT.  */
+  YYPOPSTACK (yylen);
+  YY_STACK_PRINT (yyss, yyssp);
+  while (yyssp != yyss)
+    {
+      yydestruct ("Cleanup: popping",
+                  yystos[*yyssp], yyvsp);
+      YYPOPSTACK (1);
+    }
+#ifndef yyoverflow
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+  if (yymsg != yymsgbuf)
+    YYSTACK_FREE (yymsg);
+#endif
+  return yyresult;
+}


Property changes on: trunk/contrib/amd/fsinfo/null_gram.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/fsinfo/null_gram.h
===================================================================
--- trunk/contrib/amd/fsinfo/null_gram.h	                        (rev 0)
+++ trunk/contrib/amd/fsinfo/null_gram.h	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,56 @@
+/* A Bison parser, made by GNU Bison 3.0.2.  */
+
+/* Bison interface for Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+#ifndef YY_NULL_NULL_GRAM_H_INCLUDED
+# define YY_NULL_NULL_GRAM_H_INCLUDED
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int null_debug;
+#endif
+
+
+/* Value type.  */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+
+extern YYSTYPE null_lval;
+
+int null_parse (void);
+
+#endif /* !YY_NULL_NULL_GRAM_H_INCLUDED  */


Property changes on: trunk/contrib/amd/fsinfo/null_gram.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/fsinfo/null_gram.y
===================================================================
--- trunk/contrib/amd/fsinfo/null_gram.y	                        (rev 0)
+++ trunk/contrib/amd/fsinfo/null_gram.y	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,8 @@
+%{
+void yyerror(const char *fmt, ...);
+extern int yylex(void);
+%}
+
+%%
+
+token:

Added: trunk/contrib/amd/fsinfo/null_lex.c
===================================================================
--- trunk/contrib/amd/fsinfo/null_lex.c	                        (rev 0)
+++ trunk/contrib/amd/fsinfo/null_lex.c	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,1716 @@
+
+#line 3 "lex.null_.c"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define yy_create_buffer null__create_buffer
+#define yy_delete_buffer null__delete_buffer
+#define yy_flex_debug null__flex_debug
+#define yy_init_buffer null__init_buffer
+#define yy_flush_buffer null__flush_buffer
+#define yy_load_buffer_state null__load_buffer_state
+#define yy_switch_to_buffer null__switch_to_buffer
+#define yyin null_in
+#define yyleng null_leng
+#define yylex null_lex
+#define yylineno null_lineno
+#define yyout null_out
+#define yyrestart null_restart
+#define yytext null_text
+#define yywrap null_wrap
+#define yyalloc null_alloc
+#define yyrealloc null_realloc
+#define yyfree null_free
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types. 
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif	/* defined (__STDC__) */
+#endif	/* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE null_restart(null_in  )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
+#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+extern int null_leng;
+
+extern FILE *null_in, *null_out;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+    #define YY_LESS_LINENO(n)
+    
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up null_text. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		*yy_cp = (yy_hold_char); \
+		YY_RESTORE_YY_MORE_OFFSET \
+		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+		YY_DO_BEFORE_ACTION; /* set up null_text again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr)  )
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+	{
+	FILE *yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+	/* When an EOF's been seen but there's still some text to process
+	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+	 * shouldn't try reading from the input source any more.  We might
+	 * still have a bunch of tokens to match, though, because of
+	 * possible backing-up.
+	 *
+	 * When we actually see the EOF, we change the status to "new"
+	 * (via null_restart()), so that the user can continue scanning by
+	 * just pointing null_in at a new input file.
+	 */
+#define YY_BUFFER_EOF_PENDING 2
+
+	};
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* Stack of input buffers. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+                          : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+/* yy_hold_char holds the character lost when null_text is formed. */
+static char yy_hold_char;
+static int yy_n_chars;		/* number of characters read into yy_ch_buf */
+int null_leng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 0;		/* whether we need to initialize */
+static int yy_start = 0;	/* start state number */
+
+/* Flag which is used to allow null_wrap()'s to do buffer switches
+ * instead of setting up a fresh null_in.  A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void null_restart (FILE *input_file  );
+void null__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
+YY_BUFFER_STATE null__create_buffer (FILE *file,int size  );
+void null__delete_buffer (YY_BUFFER_STATE b  );
+void null__flush_buffer (YY_BUFFER_STATE b  );
+void null_push_buffer_state (YY_BUFFER_STATE new_buffer  );
+void null_pop_buffer_state (void );
+
+static void null_ensure_buffer_stack (void );
+static void null__load_buffer_state (void );
+static void null__init_buffer (YY_BUFFER_STATE b,FILE *file  );
+
+#define YY_FLUSH_BUFFER null__flush_buffer(YY_CURRENT_BUFFER )
+
+YY_BUFFER_STATE null__scan_buffer (char *base,yy_size_t size  );
+YY_BUFFER_STATE null__scan_string (yyconst char *yy_str  );
+YY_BUFFER_STATE null__scan_bytes (yyconst char *bytes,int len  );
+
+void *null_alloc (yy_size_t  );
+void *null_realloc (void *,yy_size_t  );
+void null_free (void *  );
+
+#define yy_new_buffer null__create_buffer
+
+#define yy_set_interactive(is_interactive) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){ \
+        null_ensure_buffer_stack (); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            null__create_buffer(null_in,YY_BUF_SIZE ); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+	}
+
+#define yy_set_bol(at_bol) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){\
+        null_ensure_buffer_stack (); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            null__create_buffer(null_in,YY_BUF_SIZE ); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+	}
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+typedef unsigned char YY_CHAR;
+
+FILE *null_in = (FILE *) 0, *null_out = (FILE *) 0;
+
+typedef int yy_state_type;
+
+extern int null_lineno;
+
+int null_lineno = 1;
+
+extern char *null_text;
+#define yytext_ptr null_text
+
+static yy_state_type yy_get_previous_state (void );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
+static int yy_get_next_buffer (void );
+static void yy_fatal_error (yyconst char msg[]  );
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up null_text.
+ */
+#define YY_DO_BEFORE_ACTION \
+	(yytext_ptr) = yy_bp; \
+	null_leng = (size_t) (yy_cp - yy_bp); \
+	(yy_hold_char) = *yy_cp; \
+	*yy_cp = '\0'; \
+	(yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 1
+#define YY_END_OF_BUFFER 2
+/* This struct is not used in this scanner,
+   but its presence is necessary. */
+struct yy_trans_info
+	{
+	flex_int32_t yy_verify;
+	flex_int32_t yy_nxt;
+	};
+static yyconst flex_int16_t yy_accept[6] =
+    {   0,
+        0,    0,    2,    1,    0
+    } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int32_t yy_meta[2] =
+    {   0,
+        1
+    } ;
+
+static yyconst flex_int16_t yy_base[7] =
+    {   0,
+        0,    0,    2,    3,    3,    0
+    } ;
+
+static yyconst flex_int16_t yy_def[7] =
+    {   0,
+        6,    6,    5,    5,    0,    5
+    } ;
+
+static yyconst flex_int16_t yy_nxt[5] =
+    {   0,
+        4,    5,    3,    5
+    } ;
+
+static yyconst flex_int16_t yy_chk[5] =
+    {   0,
+        6,    3,    5,    5
+    } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+extern int null__flex_debug;
+int null__flex_debug = 0;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *null_text;
+#line 1 "../../fsinfo/null_lex.l"
+#line 2 "../../fsinfo/null_lex.l"
+#include "null_gram.h"
+
+void null_error(const char *fmt, ...) {}
+int null_wrap(void) { return 0; }
+#define YY_NO_INPUT 1
+#line 481 "lex.null_.c"
+
+#define INITIAL 0
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+static int yy_init_globals (void );
+
+/* Accessor methods to globals.
+   These are made visible to non-reentrant scanners for convenience. */
+
+int null_lex_destroy (void );
+
+int null_get_debug (void );
+
+void null_set_debug (int debug_flag  );
+
+YY_EXTRA_TYPE null_get_extra (void );
+
+void null_set_extra (YY_EXTRA_TYPE user_defined  );
+
+FILE *null_get_in (void );
+
+void null_set_in  (FILE * in_str  );
+
+FILE *null_get_out (void );
+
+void null_set_out  (FILE * out_str  );
+
+int null_get_leng (void );
+
+char *null_get_text (void );
+
+int null_get_lineno (void );
+
+void null_set_lineno (int line_number  );
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int null_wrap (void );
+#else
+extern int null_wrap (void );
+#endif
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (void );
+#else
+static int input (void );
+#endif
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
+#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO do { if (fwrite( null_text, null_leng, 1, null_out )) {} } while (0)
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+		{ \
+		int c = '*'; \
+		size_t n; \
+		for ( n = 0; n < max_size && \
+			     (c = getc( null_in )) != EOF && c != '\n'; ++n ) \
+			buf[n] = (char) c; \
+		if ( c == '\n' ) \
+			buf[n++] = (char) c; \
+		if ( c == EOF && ferror( null_in ) ) \
+			YY_FATAL_ERROR( "input in flex scanner failed" ); \
+		result = n; \
+		} \
+	else \
+		{ \
+		errno=0; \
+		while ( (result = fread(buf, 1, max_size, null_in))==0 && ferror(null_in)) \
+			{ \
+			if( errno != EINTR) \
+				{ \
+				YY_FATAL_ERROR( "input in flex scanner failed" ); \
+				break; \
+				} \
+			errno=0; \
+			clearerr(null_in); \
+			} \
+		}\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int null_lex (void);
+
+#define YY_DECL int null_lex (void)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after null_text and null_leng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+	YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp, *yy_bp;
+	register int yy_act;
+    
+#line 9 "../../fsinfo/null_lex.l"
+
+#line 668 "lex.null_.c"
+
+	if ( !(yy_init) )
+		{
+		(yy_init) = 1;
+
+#ifdef YY_USER_INIT
+		YY_USER_INIT;
+#endif
+
+		if ( ! (yy_start) )
+			(yy_start) = 1;	/* first start state */
+
+		if ( ! null_in )
+			null_in = stdin;
+
+		if ( ! null_out )
+			null_out = stdout;
+
+		if ( ! YY_CURRENT_BUFFER ) {
+			null_ensure_buffer_stack ();
+			YY_CURRENT_BUFFER_LVALUE =
+				null__create_buffer(null_in,YY_BUF_SIZE );
+		}
+
+		null__load_buffer_state( );
+		}
+
+	while ( 1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = (yy_c_buf_p);
+
+		/* Support of null_text. */
+		*yy_cp = (yy_hold_char);
+
+		/* yy_bp points to the position in yy_ch_buf of the start of
+		 * the current run.
+		 */
+		yy_bp = yy_cp;
+
+		yy_current_state = (yy_start);
+yy_match:
+		do
+			{
+			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			if ( yy_accept[yy_current_state] )
+				{
+				(yy_last_accepting_state) = yy_current_state;
+				(yy_last_accepting_cpos) = yy_cp;
+				}
+			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+				{
+				yy_current_state = (int) yy_def[yy_current_state];
+				if ( yy_current_state >= 6 )
+					yy_c = yy_meta[(unsigned int) yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+			++yy_cp;
+			}
+		while ( yy_base[yy_current_state] != 3 );
+
+yy_find_action:
+		yy_act = yy_accept[yy_current_state];
+		if ( yy_act == 0 )
+			{ /* have to back up */
+			yy_cp = (yy_last_accepting_cpos);
+			yy_current_state = (yy_last_accepting_state);
+			yy_act = yy_accept[yy_current_state];
+			}
+
+		YY_DO_BEFORE_ACTION;
+
+do_action:	/* This label is used only to access EOF actions. */
+
+		switch ( yy_act )
+	{ /* beginning of action switch */
+			case 0: /* must back up */
+			/* undo the effects of YY_DO_BEFORE_ACTION */
+			*yy_cp = (yy_hold_char);
+			yy_cp = (yy_last_accepting_cpos);
+			yy_current_state = (yy_last_accepting_state);
+			goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 10 "../../fsinfo/null_lex.l"
+ECHO;
+	YY_BREAK
+#line 756 "lex.null_.c"
+case YY_STATE_EOF(INITIAL):
+	yyterminate();
+
+	case YY_END_OF_BUFFER:
+		{
+		/* Amount of text matched not including the EOB char. */
+		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+		/* Undo the effects of YY_DO_BEFORE_ACTION. */
+		*yy_cp = (yy_hold_char);
+		YY_RESTORE_YY_MORE_OFFSET
+
+		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+			{
+			/* We're scanning a new file or input source.  It's
+			 * possible that this happened because the user
+			 * just pointed null_in at a new source and called
+			 * null_lex().  If so, then we have to assure
+			 * consistency between YY_CURRENT_BUFFER and our
+			 * globals.  Here is the right place to do so, because
+			 * this is the first action (other than possibly a
+			 * back-up) that will match for the new input source.
+			 */
+			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+			YY_CURRENT_BUFFER_LVALUE->yy_input_file = null_in;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+			}
+
+		/* Note that here we test for yy_c_buf_p "<=" to the position
+		 * of the first EOB in the buffer, since yy_c_buf_p will
+		 * already have been incremented past the NUL character
+		 * (since all states make transitions on EOB to the
+		 * end-of-buffer state).  Contrast this with the test
+		 * in input().
+		 */
+		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+			{ /* This was really a NUL. */
+			yy_state_type yy_next_state;
+
+			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state(  );
+
+			/* Okay, we're now positioned to make the NUL
+			 * transition.  We couldn't have
+			 * yy_get_previous_state() go ahead and do it
+			 * for us because it doesn't know how to deal
+			 * with the possibility of jamming (and we don't
+			 * want to build jamming into it because then it
+			 * will run more slowly).
+			 */
+
+			yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+			yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+			if ( yy_next_state )
+				{
+				/* Consume the NUL. */
+				yy_cp = ++(yy_c_buf_p);
+				yy_current_state = yy_next_state;
+				goto yy_match;
+				}
+
+			else
+				{
+				yy_cp = (yy_c_buf_p);
+				goto yy_find_action;
+				}
+			}
+
+		else switch ( yy_get_next_buffer(  ) )
+			{
+			case EOB_ACT_END_OF_FILE:
+				{
+				(yy_did_buffer_switch_on_eof) = 0;
+
+				if ( null_wrap( ) )
+					{
+					/* Note: because we've taken care in
+					 * yy_get_next_buffer() to have set up
+					 * null_text, we can now set up
+					 * yy_c_buf_p so that if some total
+					 * hoser (like flex itself) wants to
+					 * call the scanner after we return the
+					 * YY_NULL, it'll still work - another
+					 * YY_NULL will get returned.
+					 */
+					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+					yy_act = YY_STATE_EOF(YY_START);
+					goto do_action;
+					}
+
+				else
+					{
+					if ( ! (yy_did_buffer_switch_on_eof) )
+						YY_NEW_FILE;
+					}
+				break;
+				}
+
+			case EOB_ACT_CONTINUE_SCAN:
+				(yy_c_buf_p) =
+					(yytext_ptr) + yy_amount_of_matched_text;
+
+				yy_current_state = yy_get_previous_state(  );
+
+				yy_cp = (yy_c_buf_p);
+				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+				goto yy_match;
+
+			case EOB_ACT_LAST_MATCH:
+				(yy_c_buf_p) =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+				yy_current_state = yy_get_previous_state(  );
+
+				yy_cp = (yy_c_buf_p);
+				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+				goto yy_find_action;
+			}
+		break;
+		}
+
+	default:
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	} /* end of action switch */
+		} /* end of scanning one token */
+} /* end of null_lex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *	EOB_ACT_LAST_MATCH -
+ *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *	EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (void)
+{
+    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	register char *source = (yytext_ptr);
+	register int number_to_move, i;
+	int ret_val;
+
+	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+		YY_FATAL_ERROR(
+		"fatal flex scanner internal error--end of buffer missed" );
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+		{ /* Don't try to fill the buffer, so this is an EOF. */
+		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+			{
+			/* We matched a single character, the EOB, so
+			 * treat this as a final EOF.
+			 */
+			return EOB_ACT_END_OF_FILE;
+			}
+
+		else
+			{
+			/* We matched some text prior to the EOB, first
+			 * process it.
+			 */
+			return EOB_ACT_LAST_MATCH;
+			}
+		}
+
+	/* Try to read more data. */
+
+	/* First move last chars to start of buffer. */
+	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+	for ( i = 0; i < number_to_move; ++i )
+		*(dest++) = *(source++);
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+		/* don't do the read, it's not guaranteed to return an EOF,
+		 * just force an EOF
+		 */
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+	else
+		{
+			int num_to_read =
+			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+		while ( num_to_read <= 0 )
+			{ /* Not enough room in the buffer - grow it. */
+
+			/* just a shorter name for the current buffer */
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+			int yy_c_buf_p_offset =
+				(int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int new_size = b->yy_buf_size * 2;
+
+				if ( new_size <= 0 )
+					b->yy_buf_size += b->yy_buf_size / 8;
+				else
+					b->yy_buf_size *= 2;
+
+				b->yy_ch_buf = (char *)
+					/* Include room in for 2 EOB chars. */
+					null_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = 0;
+
+			if ( ! b->yy_ch_buf )
+				YY_FATAL_ERROR(
+				"fatal error - scanner input buffer overflow" );
+
+			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+						number_to_move - 1;
+
+			}
+
+		if ( num_to_read > YY_READ_BUF_SIZE )
+			num_to_read = YY_READ_BUF_SIZE;
+
+		/* Read in more data. */
+		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+			(yy_n_chars), (size_t) num_to_read );
+
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	if ( (yy_n_chars) == 0 )
+		{
+		if ( number_to_move == YY_MORE_ADJ )
+			{
+			ret_val = EOB_ACT_END_OF_FILE;
+			null_restart(null_in  );
+			}
+
+		else
+			{
+			ret_val = EOB_ACT_LAST_MATCH;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+				YY_BUFFER_EOF_PENDING;
+			}
+		}
+
+	else
+		ret_val = EOB_ACT_CONTINUE_SCAN;
+
+	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) null_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
+		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+	}
+
+	(yy_n_chars) += number_to_move;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+	return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+    static yy_state_type yy_get_previous_state (void)
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp;
+    
+	yy_current_state = (yy_start);
+
+	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+		{
+		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+		if ( yy_accept[yy_current_state] )
+			{
+			(yy_last_accepting_state) = yy_current_state;
+			(yy_last_accepting_cpos) = yy_cp;
+			}
+		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+			{
+			yy_current_state = (int) yy_def[yy_current_state];
+			if ( yy_current_state >= 6 )
+				yy_c = yy_meta[(unsigned int) yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+		}
+
+	return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *	next_state = yy_try_NUL_trans( current_state );
+ */
+    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
+{
+	register int yy_is_jam;
+    	register char *yy_cp = (yy_c_buf_p);
+
+	register YY_CHAR yy_c = 1;
+	if ( yy_accept[yy_current_state] )
+		{
+		(yy_last_accepting_state) = yy_current_state;
+		(yy_last_accepting_cpos) = yy_cp;
+		}
+	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+		{
+		yy_current_state = (int) yy_def[yy_current_state];
+		if ( yy_current_state >= 6 )
+			yy_c = yy_meta[(unsigned int) yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+	yy_is_jam = (yy_current_state == 5);
+
+	return yy_is_jam ? 0 : yy_current_state;
+}
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+    static int yyinput (void)
+#else
+    static int input  (void)
+#endif
+
+{
+	int c;
+    
+	*(yy_c_buf_p) = (yy_hold_char);
+
+	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+		{
+		/* yy_c_buf_p now points to the character we want to return.
+		 * If this occurs *before* the EOB characters, then it's a
+		 * valid NUL; if not, then we've hit the end of the buffer.
+		 */
+		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+			/* This was really a NUL. */
+			*(yy_c_buf_p) = '\0';
+
+		else
+			{ /* need more input */
+			int offset = (yy_c_buf_p) - (yytext_ptr);
+			++(yy_c_buf_p);
+
+			switch ( yy_get_next_buffer(  ) )
+				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					null_restart(null_in );
+
+					/*FALLTHROUGH*/
+
+				case EOB_ACT_END_OF_FILE:
+					{
+					if ( null_wrap( ) )
+						return EOF;
+
+					if ( ! (yy_did_buffer_switch_on_eof) )
+						YY_NEW_FILE;
+#ifdef __cplusplus
+					return yyinput();
+#else
+					return input();
+#endif
+					}
+
+				case EOB_ACT_CONTINUE_SCAN:
+					(yy_c_buf_p) = (yytext_ptr) + offset;
+					break;
+				}
+			}
+		}
+
+	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
+	*(yy_c_buf_p) = '\0';	/* preserve null_text */
+	(yy_hold_char) = *++(yy_c_buf_p);
+
+	return c;
+}
+#endif	/* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * 
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+    void null_restart  (FILE * input_file )
+{
+    
+	if ( ! YY_CURRENT_BUFFER ){
+        null_ensure_buffer_stack ();
+		YY_CURRENT_BUFFER_LVALUE =
+            null__create_buffer(null_in,YY_BUF_SIZE );
+	}
+
+	null__init_buffer(YY_CURRENT_BUFFER,input_file );
+	null__load_buffer_state( );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * 
+ */
+    void null__switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
+{
+    
+	/* TODO. We should be able to replace this entire function body
+	 * with
+	 *		null_pop_buffer_state();
+	 *		null_push_buffer_state(new_buffer);
+     */
+	null_ensure_buffer_stack ();
+	if ( YY_CURRENT_BUFFER == new_buffer )
+		return;
+
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*(yy_c_buf_p) = (yy_hold_char);
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+	null__load_buffer_state( );
+
+	/* We don't actually know whether we did this switch during
+	 * EOF (null_wrap()) processing, but the only time this flag
+	 * is looked at is after null_wrap() is called, so it's safe
+	 * to go ahead and always set it.
+	 */
+	(yy_did_buffer_switch_on_eof) = 1;
+}
+
+static void null__load_buffer_state  (void)
+{
+    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+	null_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+	(yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * 
+ * @return the allocated buffer state.
+ */
+    YY_BUFFER_STATE null__create_buffer  (FILE * file, int  size )
+{
+	YY_BUFFER_STATE b;
+    
+	b = (YY_BUFFER_STATE) null_alloc(sizeof( struct yy_buffer_state )  );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in null__create_buffer()" );
+
+	b->yy_buf_size = size;
+
+	/* yy_ch_buf has to be 2 characters longer than the size given because
+	 * we need to put in 2 end-of-buffer characters.
+	 */
+	b->yy_ch_buf = (char *) null_alloc(b->yy_buf_size + 2  );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in null__create_buffer()" );
+
+	b->yy_is_our_buffer = 1;
+
+	null__init_buffer(b,file );
+
+	return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with null__create_buffer()
+ * 
+ */
+    void null__delete_buffer (YY_BUFFER_STATE  b )
+{
+    
+	if ( ! b )
+		return;
+
+	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+	if ( b->yy_is_our_buffer )
+		null_free((void *) b->yy_ch_buf  );
+
+	null_free((void *) b  );
+}
+
+#ifndef __cplusplus
+extern int isatty (int );
+#endif /* __cplusplus */
+    
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a null_restart() or at EOF.
+ */
+    static void null__init_buffer  (YY_BUFFER_STATE  b, FILE * file )
+
+{
+	int oerrno = errno;
+    
+	null__flush_buffer(b );
+
+	b->yy_input_file = file;
+	b->yy_fill_buffer = 1;
+
+    /* If b is the current buffer, then null__init_buffer was _probably_
+     * called from null_restart() or through yy_get_next_buffer.
+     * In that case, we don't want to reset the lineno or column.
+     */
+    if (b != YY_CURRENT_BUFFER){
+        b->yy_bs_lineno = 1;
+        b->yy_bs_column = 0;
+    }
+
+        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+    
+	errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * 
+ */
+    void null__flush_buffer (YY_BUFFER_STATE  b )
+{
+    	if ( ! b )
+		return;
+
+	b->yy_n_chars = 0;
+
+	/* We always need two end-of-buffer characters.  The first causes
+	 * a transition to the end-of-buffer state.  The second causes
+	 * a jam in that state.
+	 */
+	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+	b->yy_buf_pos = &b->yy_ch_buf[0];
+
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	if ( b == YY_CURRENT_BUFFER )
+		null__load_buffer_state( );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ *  the current state. This function will allocate the stack
+ *  if necessary.
+ *  @param new_buffer The new state.
+ *  
+ */
+void null_push_buffer_state (YY_BUFFER_STATE new_buffer )
+{
+    	if (new_buffer == NULL)
+		return;
+
+	null_ensure_buffer_stack();
+
+	/* This block is copied from null__switch_to_buffer. */
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*(yy_c_buf_p) = (yy_hold_char);
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	/* Only push if top exists. Otherwise, replace top. */
+	if (YY_CURRENT_BUFFER)
+		(yy_buffer_stack_top)++;
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+	/* copied from null__switch_to_buffer. */
+	null__load_buffer_state( );
+	(yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ *  The next element becomes the new top.
+ *  
+ */
+void null_pop_buffer_state (void)
+{
+    	if (!YY_CURRENT_BUFFER)
+		return;
+
+	null__delete_buffer(YY_CURRENT_BUFFER );
+	YY_CURRENT_BUFFER_LVALUE = NULL;
+	if ((yy_buffer_stack_top) > 0)
+		--(yy_buffer_stack_top);
+
+	if (YY_CURRENT_BUFFER) {
+		null__load_buffer_state( );
+		(yy_did_buffer_switch_on_eof) = 1;
+	}
+}
+
+/* Allocates the stack if it does not exist.
+ *  Guarantees space for at least one push.
+ */
+static void null_ensure_buffer_stack (void)
+{
+	int num_to_alloc;
+    
+	if (!(yy_buffer_stack)) {
+
+		/* First allocation is just for 2 elements, since we don't know if this
+		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
+		 * immediate realloc on the next call.
+         */
+		num_to_alloc = 1;
+		(yy_buffer_stack) = (struct yy_buffer_state**)null_alloc
+								(num_to_alloc * sizeof(struct yy_buffer_state*)
+								);
+		if ( ! (yy_buffer_stack) )
+			YY_FATAL_ERROR( "out of dynamic memory in null_ensure_buffer_stack()" );
+								  
+		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+				
+		(yy_buffer_stack_max) = num_to_alloc;
+		(yy_buffer_stack_top) = 0;
+		return;
+	}
+
+	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+		/* Increase the buffer to prepare for a possible push. */
+		int grow_size = 8 /* arbitrary grow size */;
+
+		num_to_alloc = (yy_buffer_stack_max) + grow_size;
+		(yy_buffer_stack) = (struct yy_buffer_state**)null_realloc
+								((yy_buffer_stack),
+								num_to_alloc * sizeof(struct yy_buffer_state*)
+								);
+		if ( ! (yy_buffer_stack) )
+			YY_FATAL_ERROR( "out of dynamic memory in null_ensure_buffer_stack()" );
+
+		/* zero only the new slots.*/
+		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+		(yy_buffer_stack_max) = num_to_alloc;
+	}
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ * 
+ * @return the newly allocated buffer state object. 
+ */
+YY_BUFFER_STATE null__scan_buffer  (char * base, yy_size_t  size )
+{
+	YY_BUFFER_STATE b;
+    
+	if ( size < 2 ||
+	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
+	     base[size-1] != YY_END_OF_BUFFER_CHAR )
+		/* They forgot to leave room for the EOB's. */
+		return 0;
+
+	b = (YY_BUFFER_STATE) null_alloc(sizeof( struct yy_buffer_state )  );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in null__scan_buffer()" );
+
+	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
+	b->yy_buf_pos = b->yy_ch_buf = base;
+	b->yy_is_our_buffer = 0;
+	b->yy_input_file = 0;
+	b->yy_n_chars = b->yy_buf_size;
+	b->yy_is_interactive = 0;
+	b->yy_at_bol = 1;
+	b->yy_fill_buffer = 0;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	null__switch_to_buffer(b  );
+
+	return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to null_lex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ * 
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ *       null__scan_bytes() instead.
+ */
+YY_BUFFER_STATE null__scan_string (yyconst char * yystr )
+{
+    
+	return null__scan_bytes(yystr,strlen(yystr) );
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to null_lex() will
+ * scan from a @e copy of @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * 
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE null__scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
+{
+	YY_BUFFER_STATE b;
+	char *buf;
+	yy_size_t n;
+	int i;
+    
+	/* Get memory for full buffer, including space for trailing EOB's. */
+	n = _yybytes_len + 2;
+	buf = (char *) null_alloc(n  );
+	if ( ! buf )
+		YY_FATAL_ERROR( "out of dynamic memory in null__scan_bytes()" );
+
+	for ( i = 0; i < _yybytes_len; ++i )
+		buf[i] = yybytes[i];
+
+	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+	b = null__scan_buffer(buf,n );
+	if ( ! b )
+		YY_FATAL_ERROR( "bad buffer in null__scan_bytes()" );
+
+	/* It's okay to grow etc. this buffer, and we should throw it
+	 * away when we're done.
+	 */
+	b->yy_is_our_buffer = 1;
+
+	return b;
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg )
+{
+    	(void) fprintf( stderr, "%s\n", msg );
+	exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up null_text. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		null_text[null_leng] = (yy_hold_char); \
+		(yy_c_buf_p) = null_text + yyless_macro_arg; \
+		(yy_hold_char) = *(yy_c_buf_p); \
+		*(yy_c_buf_p) = '\0'; \
+		null_leng = yyless_macro_arg; \
+		} \
+	while ( 0 )
+
+/* Accessor  methods (get/set functions) to struct members. */
+
+/** Get the current line number.
+ * 
+ */
+int null_get_lineno  (void)
+{
+        
+    return null_lineno;
+}
+
+/** Get the input stream.
+ * 
+ */
+FILE *null_get_in  (void)
+{
+        return null_in;
+}
+
+/** Get the output stream.
+ * 
+ */
+FILE *null_get_out  (void)
+{
+        return null_out;
+}
+
+/** Get the length of the current token.
+ * 
+ */
+int null_get_leng  (void)
+{
+        return null_leng;
+}
+
+/** Get the current token.
+ * 
+ */
+
+char *null_get_text  (void)
+{
+        return null_text;
+}
+
+/** Set the current line number.
+ * @param line_number
+ * 
+ */
+void null_set_lineno (int  line_number )
+{
+    
+    null_lineno = line_number;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ * 
+ * @see null__switch_to_buffer
+ */
+void null_set_in (FILE *  in_str )
+{
+        null_in = in_str ;
+}
+
+void null_set_out (FILE *  out_str )
+{
+        null_out = out_str ;
+}
+
+int null_get_debug  (void)
+{
+        return null__flex_debug;
+}
+
+void null_set_debug (int  bdebug )
+{
+        null__flex_debug = bdebug ;
+}
+
+static int yy_init_globals (void)
+{
+        /* Initialization is the same as for the non-reentrant scanner.
+     * This function is called from null_lex_destroy(), so don't allocate here.
+     */
+
+    (yy_buffer_stack) = 0;
+    (yy_buffer_stack_top) = 0;
+    (yy_buffer_stack_max) = 0;
+    (yy_c_buf_p) = (char *) 0;
+    (yy_init) = 0;
+    (yy_start) = 0;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+    null_in = stdin;
+    null_out = stdout;
+#else
+    null_in = (FILE *) 0;
+    null_out = (FILE *) 0;
+#endif
+
+    /* For future reference: Set errno on error, since we are called by
+     * null_lex_init()
+     */
+    return 0;
+}
+
+/* null_lex_destroy is for both reentrant and non-reentrant scanners. */
+int null_lex_destroy  (void)
+{
+    
+    /* Pop the buffer stack, destroying each element. */
+	while(YY_CURRENT_BUFFER){
+		null__delete_buffer(YY_CURRENT_BUFFER  );
+		YY_CURRENT_BUFFER_LVALUE = NULL;
+		null_pop_buffer_state();
+	}
+
+	/* Destroy the stack itself. */
+	null_free((yy_buffer_stack) );
+	(yy_buffer_stack) = NULL;
+
+    /* Reset the globals. This is important in a non-reentrant scanner so the next time
+     * null_lex() is called, initialization will occur. */
+    yy_init_globals( );
+
+    return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+	register int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+	register int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+}
+#endif
+
+void *null_alloc (yy_size_t  size )
+{
+	return (void *) malloc( size );
+}
+
+void *null_realloc  (void * ptr, yy_size_t  size )
+{
+	/* The cast to (char *) in the following accommodates both
+	 * implementations that use char* generic pointers, and those
+	 * that use void* generic pointers.  It works with the latter
+	 * because both ANSI C and C++ allow castless assignment from
+	 * any pointer type to void*, and deal with argument conversions
+	 * as though doing an assignment.
+	 */
+	return (void *) realloc( (char *) ptr, size );
+}
+
+void null_free (void * ptr )
+{
+	free( (char *) ptr );	/* see null_realloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 10 "../../fsinfo/null_lex.l"


Property changes on: trunk/contrib/amd/fsinfo/null_lex.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/contrib/amd/fsinfo/null_lex.l
===================================================================
--- trunk/contrib/amd/fsinfo/null_lex.l	                        (rev 0)
+++ trunk/contrib/amd/fsinfo/null_lex.l	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,9 @@
+%{
+#include "null_gram.h"
+
+void null_error(const char *fmt, ...) {}
+int yywrap(void) { return 0; }
+%}
+%option nounput
+%option noinput
+%%

Added: trunk/contrib/amd/include/nfs_common.h
===================================================================
--- trunk/contrib/amd/include/nfs_common.h	                        (rev 0)
+++ trunk/contrib/amd/include/nfs_common.h	2018-06-15 22:31:43 UTC (rev 11012)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2011 Christos Zoulas
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *
+ * File: am-utils/include/nfs_common.c
+ *
+ */
+struct nfs_common_args {
+  u_long flags;
+  u_long acdirmin;
+  u_long acdirmax;
+  u_long acregmin;
+  u_long acregmax;
+  u_long timeo;
+  u_long retrans;
+  u_long rsize;
+  u_long wsize;
+};
+
+#ifdef HAVE_NFS_ARGS_T_ACREGMIN
+#define GET_ACREGMIN(nap, a) nap->acregmin = a.acregmin;
+#define PUT_ACREGMIN(nap, a) a.acregmin = nap->acregmin;
+#else
+#define GET_ACREGMIN(nap, a)
+#define PUT_ACREGMIN(nap, a)
+#endif
+#ifdef HAVE_NFS_ARGS_T_ACREGMAX
+#define GET_ACREGMAX(nap, a) nap->acregmax = a.acregmax;
+#define PUT_ACREGMAX(nap, a) a.acregmax = nap->acregmax;
+#else
+#define GET_ACREGMAX(nap, a)
+#define PUT_ACREGMAX(nap, a)
+#endif
+
+#ifdef HAVE_NFS_ARGS_T_ACDIRMIN
+#define GET_ACDIRMIN(nap, a) nap->acdirmin = a.acdirmin;
+#define PUT_ACDIRMIN(nap, a) a.acdirmin = nap->acdirmin;
+#else
+#define GET_ACDIRMIN(nap, a)
+#define PUT_ACDIRMIN(nap, a)
+#endif
+#ifdef HAVE_NFS_ARGS_T_ACDIRMAX
+#define GET_ACDIRMAX(nap, a) nap->acdirmax = a.acdirmax;
+#define PUT_ACDIRMAX(nap, a) a.acdirmax = nap->acdirmax;
+#else
+#define GET_ACDIRMAX(nap, a)
+#define PUT_ACDIRMAX(nap, a)
+#endif
+
+#define get_nfs_common_args(nap, a) \
+  do { \
+    nap->flags = a.flags; \
+    GET_ACREGMIN(nap, a) \
+    GET_ACREGMAX(nap, a) \
+    GET_ACDIRMIN(nap, a) \
+    GET_ACDIRMAX(nap, a) \
+    nap->timeo = a.timeo; \
+    nap->retrans = a.retrans; \
+    nap->rsize = a.rsize; \
+    nap->wsize = a.wsize; \
+  } while (/*CONSTCOND*/0)
+
+#define put_nfs_common_args(nap, a) \
+  do { \
+    a.flags = nap->flags; \
+    PUT_ACREGMIN(nap, a) \
+    PUT_ACREGMAX(nap, a) \
+    PUT_ACDIRMIN(nap, a) \
+    PUT_ACDIRMAX(nap, a) \
+    a.timeo = nap->timeo; \
+    a.retrans = nap->retrans; \
+    a.rsize = nap->rsize; \
+    a.wsize = nap->wsize; \
+  } while (/*CONSTCOND*/0)


Property changes on: trunk/contrib/amd/include/nfs_common.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list