diff options
-rw-r--r-- | tools/perf/perf.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 05c861c045d5..109b89b30ced 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -48,7 +48,8 @@ int check_pager_config(const char *cmd) | |||
48 | return c.val; | 48 | return c.val; |
49 | } | 49 | } |
50 | 50 | ||
51 | static void commit_pager_choice(void) { | 51 | static void commit_pager_choice(void) |
52 | { | ||
52 | switch (use_pager) { | 53 | switch (use_pager) { |
53 | case 0: | 54 | case 0: |
54 | setenv("PERF_PAGER", "cat", 1); | 55 | setenv("PERF_PAGER", "cat", 1); |
@@ -70,7 +71,7 @@ static void set_debugfs_path(void) | |||
70 | "tracing/events"); | 71 | "tracing/events"); |
71 | } | 72 | } |
72 | 73 | ||
73 | static int handle_options(const char*** argv, int* argc, int* envchanged) | 74 | static int handle_options(const char ***argv, int *argc, int *envchanged) |
74 | { | 75 | { |
75 | int handled = 0; | 76 | int handled = 0; |
76 | 77 | ||
@@ -109,7 +110,7 @@ static int handle_options(const char*** argv, int* argc, int* envchanged) | |||
109 | *envchanged = 1; | 110 | *envchanged = 1; |
110 | } else if (!strcmp(cmd, "--perf-dir")) { | 111 | } else if (!strcmp(cmd, "--perf-dir")) { |
111 | if (*argc < 2) { | 112 | if (*argc < 2) { |
112 | fprintf(stderr, "No directory given for --perf-dir.\n" ); | 113 | fprintf(stderr, "No directory given for --perf-dir.\n"); |
113 | usage(perf_usage_string); | 114 | usage(perf_usage_string); |
114 | } | 115 | } |
115 | setenv(PERF_DIR_ENVIRONMENT, (*argv)[1], 1); | 116 | setenv(PERF_DIR_ENVIRONMENT, (*argv)[1], 1); |
@@ -124,7 +125,7 @@ static int handle_options(const char*** argv, int* argc, int* envchanged) | |||
124 | *envchanged = 1; | 125 | *envchanged = 1; |
125 | } else if (!strcmp(cmd, "--work-tree")) { | 126 | } else if (!strcmp(cmd, "--work-tree")) { |
126 | if (*argc < 2) { | 127 | if (*argc < 2) { |
127 | fprintf(stderr, "No directory given for --work-tree.\n" ); | 128 | fprintf(stderr, "No directory given for --work-tree.\n"); |
128 | usage(perf_usage_string); | 129 | usage(perf_usage_string); |
129 | } | 130 | } |
130 | setenv(PERF_WORK_TREE_ENVIRONMENT, (*argv)[1], 1); | 131 | setenv(PERF_WORK_TREE_ENVIRONMENT, (*argv)[1], 1); |
@@ -168,7 +169,7 @@ static int handle_alias(int *argcp, const char ***argv) | |||
168 | { | 169 | { |
169 | int envchanged = 0, ret = 0, saved_errno = errno; | 170 | int envchanged = 0, ret = 0, saved_errno = errno; |
170 | int count, option_count; | 171 | int count, option_count; |
171 | const char** new_argv; | 172 | const char **new_argv; |
172 | const char *alias_command; | 173 | const char *alias_command; |
173 | char *alias_string; | 174 | char *alias_string; |
174 | 175 | ||
@@ -210,11 +211,11 @@ static int handle_alias(int *argcp, const char ***argv) | |||
210 | if (!strcmp(alias_command, new_argv[0])) | 211 | if (!strcmp(alias_command, new_argv[0])) |
211 | die("recursive alias: %s", alias_command); | 212 | die("recursive alias: %s", alias_command); |
212 | 213 | ||
213 | new_argv = realloc(new_argv, sizeof(char*) * | 214 | new_argv = realloc(new_argv, sizeof(char *) * |
214 | (count + *argcp + 1)); | 215 | (count + *argcp + 1)); |
215 | /* insert after command name */ | 216 | /* insert after command name */ |
216 | memcpy(new_argv + count, *argv + 1, sizeof(char*) * *argcp); | 217 | memcpy(new_argv + count, *argv + 1, sizeof(char *) * *argcp); |
217 | new_argv[count+*argcp] = NULL; | 218 | new_argv[count + *argcp] = NULL; |
218 | 219 | ||
219 | *argv = new_argv; | 220 | *argv = new_argv; |
220 | *argcp += count - 1; | 221 | *argcp += count - 1; |
@@ -450,8 +451,8 @@ int main(int argc, const char **argv) | |||
450 | setup_path(); | 451 | setup_path(); |
451 | 452 | ||
452 | while (1) { | 453 | while (1) { |
453 | static int done_help = 0; | 454 | static int done_help; |
454 | static int was_alias = 0; | 455 | static int was_alias; |
455 | 456 | ||
456 | was_alias = run_argv(&argc, &argv); | 457 | was_alias = run_argv(&argc, &argv); |
457 | if (errno != ENOENT) | 458 | if (errno != ENOENT) |