Lines Matching +full:stdout +full:- +full:path

6  * This is the main hub from which the sub-commands (perf stat,
12 #include "util/build-id.h"
16 #include <subcmd/exec-cmd.h>
18 #include <subcmd/run-command.h>
19 #include "util/parse-events.h"
20 #include <subcmd/parse-options.h>
21 #include "util/bpf-loader.h"
26 #include "perf-sys.h"
43 "perf [--version] [--help] [OPTIONS] COMMAND [ARGS]";
48 static int use_pager = -1;
58 { "buildid-cache", cmd_buildid_cache, 0 },
59 { "buildid-list", cmd_buildid_list, 0 },
102 if (strstarts(var, "pager.") && !strcmp(var + 6, c->cmd)) in pager_command_config()
103 c->val = perf_config_bool(var, value); in pager_command_config()
107 /* returns 0 for "no pager", 1 for "use pager", and -1 for "not specified" */
113 c.val = -1; in check_pager_config()
121 if (strstarts(var, "tui.") && !strcmp(var + 4, c->cmd)) in browser_command_config()
122 c->val = perf_config_bool(var, value); in browser_command_config()
123 if (strstarts(var, "gtk.") && !strcmp(var + 4, c->cmd)) in browser_command_config()
124 c->val = perf_config_bool(var, value) ? 2 : 0; in browser_command_config()
130 * and -1 for "not specified"
137 c.val = -1; in check_browser_config()
159 OPT_ARGUMENT("exec-path", "exec-path"),
160 OPT_ARGUMENT("html-path", "html-path"),
162 OPT_ARGUMENT("no-pager", "no-pager"),
163 OPT_ARGUMENT("debugfs-dir", "debugfs-dir"),
164 OPT_ARGUMENT("buildid-dir", "buildid-dir"),
165 OPT_ARGUMENT("list-cmds", "list-cmds"),
166 OPT_ARGUMENT("list-opts", "list-opts"),
177 if (cmd[0] != '-') in handle_options()
182 * commands can be written with "--" prepended in handle_options()
185 if (!strcmp(cmd, "--help") || !strcmp(cmd, "--version")) in handle_options()
189 * Shortcut for '-h' and '-v' options to invoke help in handle_options()
192 if (!strcmp(cmd, "-h")) { in handle_options()
193 (*argv)[0] = "--help"; in handle_options()
197 if (!strcmp(cmd, "-v")) { in handle_options()
198 (*argv)[0] = "--version"; in handle_options()
202 if (!strcmp(cmd, "-vv")) { in handle_options()
219 } else if (!strcmp(cmd, "--html-path")) { in handle_options()
222 } else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) { in handle_options()
224 } else if (!strcmp(cmd, "--no-pager")) { in handle_options()
228 } else if (!strcmp(cmd, "--debugfs-dir")) { in handle_options()
230 fprintf(stderr, "No directory given for --debugfs-dir.\n"); in handle_options()
237 (*argc)--; in handle_options()
238 } else if (!strcmp(cmd, "--buildid-dir")) { in handle_options()
240 fprintf(stderr, "No directory given for --buildid-dir.\n"); in handle_options()
247 (*argc)--; in handle_options()
253 } else if (!strcmp(cmd, "--list-cmds")) { in handle_options()
258 printf("%s ", p->cmd); in handle_options()
262 } else if (!strcmp(cmd, "--list-opts")) { in handle_options()
265 for (i = 0; i < ARRAY_SIZE(options)-1; i++) { in handle_options()
267 printf("--%s ", p->long_name); in handle_options()
271 } else if (!strcmp(cmd, "--debug")) { in handle_options()
273 fprintf(stderr, "No variable specified for --debug.\n"); in handle_options()
280 (*argc)--; in handle_options()
287 (*argc)--; in handle_options()
302 if (use_browser == -1) in run_builtin()
303 use_browser = check_browser_config(p->cmd); in run_builtin()
305 if (use_pager == -1 && p->option & RUN_SETUP) in run_builtin()
306 use_pager = check_pager_config(p->cmd); in run_builtin()
307 if (use_pager == -1 && p->option & USE_PAGER) in run_builtin()
313 status = p->fn(argc, argv); in run_builtin()
322 /* Somebody closed stdout? */ in run_builtin()
323 if (fstat(fileno(stdout), &st)) in run_builtin()
331 if (fflush(stdout)) { in run_builtin()
336 if (ferror(stdout)) { in run_builtin()
340 if (fclose(stdout)) { in run_builtin()
355 /* Turn "perf cmd --help" into "perf help cmd" */ in handle_internal_command()
356 if (argc > 1 && !strcmp(argv[1], "--help")) { in handle_internal_command()
363 if (strcmp(p->cmd, cmd)) in handle_internal_command()
375 if (asprintf(&cmd, "perf-%s", argv[0]) < 0) in execv_dashed_external()
392 if (status != -ERR_RUN_COMMAND_EXEC) { in execv_dashed_external()
396 status = -128; in execv_dashed_external()
398 exit(-status); in execv_dashed_external()
456 cmd = "perf-help"; in main()
469 * "perf-xxxx" is the same as "perf xxxx", but we obviously: in main()
471 * - cannot take flags in between the "perf" and the "xxxx". in main()
472 * - cannot execute it externally (since it would just do in main()
480 if (strstarts(cmd, "perf-")) { in main()
488 cmd -= 5; in main()
498 "trace command not available: missing audit-libs devel package at build time.\n"); in main()
504 argc--; in main()
509 if (strstarts(argv[0], "--")) in main()
523 * We use PATH to find perf commands, but we prepend some higher in main()
524 * precedence paths: the "--exec-path" option, the PERF_EXEC_PATH in main()