macro_rules! linklist {
($func:ident: adg$(, $rest:ident)*) => {
concat!(
"- [Application Developers' Guide on `", stringify!($func), "`][adg]\n",
$crate::_doc::linklist!($func: $($rest),*)
)
};
($func:ident: mwg$(, $rest:ident)*) => {
concat!(
"- [Module Writers' Guide on `", stringify!($func), "`][mwg]\n",
$crate::_doc::linklist!($func: $($rest),*)
)
};
($func:ident: _std$(, $rest:ident)*) => {
$crate::_doc::linklist!($func: man7, manbsd, mansun, xsso$(, $rest)*)
};
($func:ident: man7$(, $rest:ident)*) => {
concat!(
"- [Linux-PAM manpage for `", stringify!($func), "`][man7]\n",
$crate::_doc::linklist!($func: $($rest),*)
)
};
($func:ident: manbsd$(, $rest:ident)*) => {
concat!(
"- [OpenPAM manpage for `", stringify!($func), "`][manbsd]\n",
$crate::_doc::linklist!($func: $($rest),*)
)
};
($func:ident: mansun$(, $rest:ident)*) => {
concat!(
"- [Illumos manpage for `", stringify!($func), "`][mansun]\n",
$crate::_doc::linklist!($func: $($rest),*)
)
};
($func:ident: xsso$(, $rest:ident)*) => {
concat!(
"- [X/SSO spec for `", stringify!($func), "`][xsso]",
$crate::_doc::linklist!($func: $($rest),*)
)
};
($func:ident:$(,)?) => { "" };
}
macro_rules! guide {
($name:ident: $page_link:literal) => {
concat!(
"[",
stringify!($name),
"]: https://www.chiark.greenend.org.uk/doc/libpam-doc/html/",
$page_link
)
};
}
macro_rules! man7 {
($n:literal $fn:ident $($anchor:literal)?) => {
$crate::_doc::man7!(man7: $n $fn $($anchor)?)
};
($name:ident: $n:literal $fn:ident $($anchor:literal)?) => {
concat!(
"[", stringify!($name), "]: ",
"https://man7.org/linux/man-pages/man", $n, "/",
stringify!($fn), ".", $n, ".html", $("#", $anchor)?
)
};
}
macro_rules! manbsd {
($n:literal $func:ident $($anchor:literal)?) => {
$crate::_doc::manbsd!(manbsd: $n $func $($anchor)?)
};
($name:ident: $n:literal $func:ident $($anchor:literal)?) => {
concat!("[", stringify!($name), "]: ",
"https://man.netbsd.org/", stringify!($func), ".", $n,
$("#", $anchor)?
)
};
}
macro_rules! mansun {
($n:literal $func:ident $($anchor:literal)?) => {
$crate::_doc::mansun!(mansun: [$n ""] $func $($anchor)?)
};
($n:literal $func:literal $($anchor:literal)?) => {
$crate::_doc::mansun!(mansun: [$n ""] $func $($anchor)?)
};
([$n:literal $sect:literal] $func:ident $($anchor:literal)?) => {
$crate::_doc::mansun!(mansun: [$n $sect] $func $($anchor)?)
};
($name:ident: $n:literal $func:ident $($anchor:literal)?) => {
$crate::_doc::mansun!($name: [$n ""] $func $($anchor)?)
};
($name:ident: $n:literal $func:literal $($anchor:literal)?) => {
$crate::_doc::mansun!($name: [$n ""] ($func) $($anchor)?)
};
($name:ident: [$n:literal $sect:literal] $func:ident $($anchor:literal)?) => {
$crate::_doc::mansun!($name: [$n $sect] (stringify!($func)) $($anchor)?)
};
($name:ident: [$n:literal $sect:literal] ($func:expr) $($anchor:literal)?) => {
concat!("[", stringify!($name), "]: ",
"https: $("#", $anchor)?
)
};
}
macro_rules! xsso {
($func:ident) => { $crate::_doc::xsso!(xsso: concat!(stringify!($func), ".htm")) };
($page:literal) => { $crate::_doc::xsso!(xsso: $page) };
($name:ident: $page:expr) => {
concat!("[", stringify!($name), "]: https://pubs.opengroup.org/onlinepubs/8329799/", $page)
};
}
macro_rules! stdlinks {
($n:literal $func:ident) => {
concat!(
$crate::_doc::man7!($n $func), "\n",
$crate::_doc::manbsd!($n $func), "\n",
$crate::_doc::mansun!([$n "pam"] $func), "\n",
$crate::_doc::xsso!($func))
};
}
pub(crate) use {guide, linklist, man7, manbsd, mansun, stdlinks, xsso};