(*********************************************************************

Copyright 1989 by Roman E. Maeder

Adapted from
Roman E. Maeder: Programming in Mathematica, Addison-Wesley, 1989.

Permission is hereby granted to make copies of this file for
any purpose other than direct profit, or as part of a
commercial product, provided this copyright notice is left
intact. Sale, other than for the cost of media, is prohibited.

Permission is hereby granted to reproduce part or all of
this file, provided that the source is acknowledged.

*********************************************************************)

BeginPackage["Utilities`FilterOptions`"]

FilterOptions::usage = "FilterOptions[symbol, options...] returns a sequence
of those options that are valid options for symbol."

Begin["`Private`"]

FilterOptions[ command_Symbol, opts___ ] :=
Block[{keywords = First /@ Options[command]},
Sequence @@ Select[ {opts}, MemberQ[keywords, First[#]]& ]
]

End[]
EndPackage[]