new (Fam::Connection)

    /*
     * Create a new connection to the FAM daemon.
     *
     * Raises an ArgumentError exception if the number of arguments is not 0
     * or 1, or a Fam::Error exception if a connection to FAM could not
     * be established.
     *
     * Examples:
     *   # connect and tell FAM the application is named 'foo'
     *   fam = Fam::Connection.new 'foo'
     *
     *   # just connect
     *   fam = Fam::Connection.new
     *
     */
    static VALUE fam_conn_init(int argc, VALUE *argv, VALUE self)
    {
      FAMConnection *conn;
      int err = 0;

      Data_Get_Struct(self, FAMConnection, conn);
      switch (argc) {
        case 0:
          err = FAMOpen(conn);
          break;
        case 1:
          err = FAMOpen2(conn, RSTRING(argv[0])->ptr);
          break;
        default:
          rb_raise(rb_eArgError, "invalid argument count (not 0 or 1)");
      }

      if (err == -1) {
        rb_raise(eError, "Couldn't open FAM connection: %s", fam_error());
      }

      return self;
    }