MRMOPENHIERARCHY(3)

πŸ“¦
version 2.5.2 Β· 2 versions
, in alpine 3.24, arch rolling, centos-stream 9, epel 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

🌸 MrmOpenHierarchy β€” the girlies' guide to opening a whole UID hierarchy πŸ’…

okay bestie, this is MrmOpenHierarchy, a library call straight out of the Motif resource manager, and we're gonna get you fluent in it. no cap.


✨ NAME ✨

MrmOpenHierarchy β€” allocates a hierarchy ID and opens all the UID files in the hierarchy 🫢


✨ SYNOPSIS ✨

#include <Mrm/MrmPublic.h>
Cardinal MrmOpenHierarchy(
MrmCount num_files,
String file_names_list[],
MrmOsOpenParamPtr *ancillary_structures_list,
MrmHierarchy *hierarchy_id);

✨ DESCRIPTION ✨

so real talk first: this routine is obsolete πŸ’€ and it only exists for compatibility with previous releases. it got replaced by MrmOpenHierarchyPerDisplay. MrmOpenHierarchy is identical to MrmOpenHierarchyPerDisplay except that it doesn't take a display argument. that's the whole difference, periodt.

  • num_files β€” the number of files in the name list. count 'em, bestie.
  • file_names_list β€” an array of character strings that identify the UID files. this is your lineup πŸ‘‘
  • ancillary_structures_list β€” a list of operating-system-dependent ancillary structures matching things like filenames, clobber flags, and so forth. this argument should be NULL for most operations. if you actually need to reference this structure, go read the definition of MrmOsOpenParamPtr in the MrmPublic.h header file for more info. iykyk.
  • hierarchy_id β€” returns the search hierarchy ID. this ID is the thing that identifies the list of UID files that MRM searches (in order!) when it's doing subsequent fetch calls. it's giving ✨receipts✨

πŸ¦‹ the pathname situation

every UID file string in file_names_list can be either a full pathname or just a filename. here's the vibe check:

  • if a UID file string has a leading slash (/), it's a full pathname, and MRM opens the file exactly as specified. no searching, no games.
  • otherwise, the string is a filename, and MRM goes looking for it along a search path. that path comes from the UIDPATH environment variable, or from a default search path β€” and that default varies depending on whether or not the XAPPLRESDIR environment variable is set.

the UIDPATH environment variable specifies a search path and naming conventions associated with UID files. it can contain the substitution field %U, where the UID file string from the file_names_list argument to MrmOpenHierarchyPerDisplay gets substituted for %U. it can also contain the substitution fields accepted by XtResolvePathname. the substitution field %T is always mapped to uid. the entire path is first searched with %S mapped to .uid. if no file is found, it gets searched again with %S mapped to NULL.

⚠️ if no display is set prior to calling this function, the result of this function's call to XtResolvePathname is undefined. no display, no promises, bestie 😭

🌈 the iconic example

for example, the following UIDPATH value and MrmOpenHierarchy call cause MRM to open two separate UID files:

UIDPATH=/uidlib/%L/%U.uid:/uidlib/%U/%L
  static char *uid_files[] = {"/usr/users/me/test.uid", "test2"};
  MrmHierarchy  *Hierarchy_id;
  MrmOpenHierarchy((MrmCount)2,uid_files, NULL, Hierarchy_id)

MRM opens the first file, /usr/users/me/test.uid, as specified in the file_names_list argument to MrmOpenHierarchy, because that UID file string specifies a full pathname. then MRM looks for the second file, test2, first as /uidlib/%L/test2.uid and second as /uidlib/test2/%L, where the display's language string is substituted for %L. slay ✨

πŸ’– after MrmOpenHierarchy opens the UID hierarchy, you should not delete or modify the UID files until you close the UID hierarchy by calling MrmCloseHierarchy. hands off, okay??

πŸŽ€ default search paths: XAPPLRESDIR is set, UIDPATH is not

if UIDPATH is not set but the environment variable XAPPLRESDIR is set, MRM searches the following pathnames:

  • %U%S
  • $XAPPLRESDIR/%L/uid/%N/%U%S
  • $XAPPLRESDIR/%l/uid/%N/%U%S
  • $XAPPLRESDIR/uid/%N/%U%S
  • $XAPPLRESDIR/%L/uid/%U%S
  • $XAPPLRESDIR/%l/uid/%U%S
  • $XAPPLRESDIR/uid/%U%S
  • $HOME/uid/%U%S
  • $HOME/%U%S
  • /usr/lib/X11/%L/uid/%N/%U%S
  • /usr/lib/X11/%l/uid/%N/%U%S
  • /usr/lib/X11/uid/%N/%U%S
  • /usr/lib/X11/%L/uid/%U%S
  • /usr/lib/X11/%l/uid/%U%S
  • /usr/lib/X11/uid/%U%S
  • /usr/include/X11/uid/%U%S

πŸŽ€ default search paths: neither is set

if neither UIDPATH nor XAPPLRESDIR is set, MRM searches the following pathnames:

  • %U%S
  • HOME/%L/uid/%N/%U%S
  • HOME/%l/uid/%N/%U%S
  • $HOME/uid/%N/%U%S
  • $HOME/%L/uid/%U%S
  • $HOME/%l/uid/%U%S
  • $HOME/uid/%U%S
  • $HOME/%U%S
  • /usr/lib/X11/%L/uid/%N/%U%S
  • /usr/lib/X11/%l/uid/%N/%U%S
  • /usr/lib/X11/uid/%N/%U%S
  • /usr/lib/X11/%L/uid/%U%S
  • /usr/lib/X11/%l/uid/%U%S
  • /usr/lib/X11/uid/%U%S
  • /usr/include/X11/uid/%U%S

these paths are defaults that vendors may change. for example, a vendor may use different directories for /usr/lib/X11 and /usr/include/X11. so like, your mileage may vary, girly πŸ’…


🧚 the substitution fields, explained

  • %U β€” the UID file string, from the file_names_list argument.
  • %N β€” the class name of the application.
  • %L β€” the display's language string. this string is influenced by XtSetLanguageProc. the default string is determined by calling setlocale(LC_ALL, NULL).
  • %l β€” the language component of the display's language string. (lowercase l, bestie, don't mix them up πŸ™ˆ)
  • %S β€” the suffix to the filename. the entire path is first searched with a suffix of .uid. if no file is found, it's searched again with a NULL suffix.

✨ RETURN ✨

this function returns one of the following status return constants:

  • MrmSUCCESS β€” the function executed successfully. we ate and left no crumbs πŸ‘‘
  • MrmNOT_FOUND β€” file not found. 😭 it's giving missing.
  • MrmFAILURE β€” the function failed. πŸ’€

MrmOpenHierarchyPerDisplay(3) and MrmCloseHierarchy(3). go read those too, they're the main characters of this friend group 🌈


mwah πŸ’– that was the whole MrmOpenHierarchy(library call) page, literally all of it, no crumbs left behind β€” and yeah, the version/footer line down at the bottom was just the same MrmOpenHierarchy(library call) marker, so consider this your official sign-off, bestie. πŸŽ€