Справочник по консольным командам Toybox для Android 12


  Ver.0.8.4     Ver.0.8.9     Pending  

Путь: Toys/Other, команды версии: Ver.4     Ver.9


pwdx

Комментарии в файле pwdx.c :

usage: pwdx PID...

Распечатать рабочий каталог процессов, перечисленных в командной строке.


usage: pwdx PID...

Print working directory of processes listed on command line.


Исходный текст в файле pwdx.c

#include "toys.h"

void pwdx_main(void)
{
  char **optargs;

  for (optargs = toys.optargs; *optargs; optargs++) {
    char *path = toybuf;

    sprintf(toybuf, "/proc/%d/cwd", atoi(*optargs));
    if (!readlink0(path, toybuf, sizeof(toybuf))) {
      path = strerror(errno);
      toys.exitval = 1;
    }

    xprintf("%s: %s\n", *optargs, path);
  }
}