1

Zsh has amazing file globbing. I want to use it in another application. I dug around the zsh code a bit and found the function zglob: https://github.com/zsh-users/zsh/blob/c96606cc0617b85d3bf0784d0bf1ecd71e44cbd7/Src/glob.c#L1152-L1158

This looks like what I want to be using, but there are a few complications. The first two arguments that zglob takes are internal zsh types so it's not immediately clear how to construct a LinkList and a LinkNode given a char* which represents the string that I'd like to glob.

Ideally, I would be able to write a function with the following signature:

  char** do_the_glob(char* path)

So, given a char* (or std::string) which represents the path pattern, can I get a char** (or std::vector) with the paths which the pattern resolves to?

Also, if I build the zsh code, I get a ton of libraries:

  $ pwd
  ~/git/zsh
  $ find . -name "*.so"
  ./Src/Builtins/rlimits.so
  ./Src/Builtins/sched.so
  ./Src/Modules/attr.so
  ./Src/Modules/cap.so
  ./Src/Modules/clone.so
  ./Src/Modules/curses.so
  ./Src/Modules/datetime.so
  ./Src/Modules/db_gdbm.so
  ./Src/Modules/example.so
  ./Src/Modules/files.so
  ./Src/Modules/langinfo.so
  ./Src/Modules/mapfile.so
  ./Src/Modules/mathfunc.so
  ./Src/Modules/newuser.so
  ./Src/Modules/parameter.so
  ./Src/Modules/regex.so
  ./Src/Modules/socket.so
  ./Src/Modules/stat.so
  ./Src/Modules/system.so
  ./Src/Modules/tcp.so
  ./Src/Modules/termcap.so
  ./Src/Modules/terminfo.so
  ./Src/Modules/zftp.so
  ./Src/Modules/zprof.so
  ./Src/Modules/zpty.so
  ./Src/Modules/zselect.so
  ./Src/Modules/zutil.so
  ./Src/Zle/compctl.so
  ./Src/Zle/complete.so
  ./Src/Zle/complist.so
  ./Src/Zle/computil.so
  ./Src/Zle/deltochar.so
  ./Src/Zle/zle.so
  ./Src/Zle/zleparameter.so

It's not entirely clear which libraries include which symbols, if at all. Any help from someone who's familiar with this codebase would be super awesome.

marpaia
  • 39
  • 5

0 Answers0