function pkgrequire (varargin)
  try pkglist = pkg("list");
  catch error("This is not Octave 3");
  end_try_catch

  for i = 1:nargin
    pkgname = varargin{i};
    found = false;
    for p = [pkglist]
      if (strcmp (pkgname, p{1}.name))
	found = true;
	if (!p{1}.loaded)
	  pkg ("load", pkgname)
	endif
	break;
      endif
    endfor
    if (!found)
      warning ("pkg_not_found", "Package %s not found", pkgname)
    endif
  endfor
endfunction
