blob: bdf565beec7816d8a4ff1740b4a7afd3011a9bb5 [file] [log] [blame]
Juan Cespedesac3db291998-04-25 14:31:58 +02001#if HAVE_CONFIG_H
2#include "config.h"
3#endif
4
Juan Cespedes5e01f651998-03-08 22:31:44 +01005#include <string.h>
6#include <stdlib.h>
7#include <unistd.h>
Juan Cespedes1b9cfd61999-08-30 19:34:50 +02008#include <fcntl.h>
Juan Cespedes5e01f651998-03-08 22:31:44 +01009#include <errno.h>
10#include <limits.h>
11
Juan Cespedesac3db291998-04-25 14:31:58 +020012#if HAVE_GETOPT_H
13#include <getopt.h>
14#endif
15
Juan Cespedes5e01f651998-03-08 22:31:44 +010016#include "ltrace.h"
17#include "options.h"
18#include "defs.h"
19
Steve Fink58c73a72006-07-17 23:18:35 +020020#ifndef SYSCONFDIR
21#define SYSCONFDIR "/etc"
22#endif
23
24#define SYSTEM_CONFIG_FILE SYSCONFDIR "/trace.conf"
25#define USER_CONFIG_FILE "~/.ltrace.conf"
26
Juan Cespedes1cd999a2001-07-03 00:46:04 +020027#define MAX_LIBRARY 30
28char *library[MAX_LIBRARY];
29int library_num = 0;
Juan Cespedesac3db291998-04-25 14:31:58 +020030static char *progname; /* Program name (`ltrace') */
Ian Wienand2d45b1a2006-02-20 22:48:07 +010031FILE *output;
Juan Cespedes5e01f651998-03-08 22:31:44 +010032int opt_a = DEFAULT_ACOLUMN; /* default alignment column for results */
Juan Cespedesd65efa32003-02-03 00:22:30 +010033int opt_c = 0; /* Count time, calls, and report a summary on program exit */
Juan Cespedes5e01f651998-03-08 22:31:44 +010034int opt_d = 0; /* debug */
35int opt_i = 0; /* instruction pointer */
36int opt_s = DEFAULT_STRLEN; /* default maximum # of bytes printed in strings */
37int opt_S = 0; /* display syscalls */
38int opt_L = 1; /* display library calls */
39int opt_f = 0; /* trace child processes as they are created */
Ian Wienand2d45b1a2006-02-20 22:48:07 +010040char *opt_u = NULL; /* username to run command as */
Juan Cespedesf666d191998-09-20 23:04:34 +020041int opt_r = 0; /* print relative timestamp */
Juan Cespedes5e0acdb1998-04-04 08:34:07 +020042int opt_t = 0; /* print absolute timestamp */
Juan Cespedesd914a202004-11-10 00:15:33 +010043#ifdef USE_DEMANGLE
Juan Cespedesac3db291998-04-25 14:31:58 +020044int opt_C = 0; /* Demangle low-level symbol names into user-level names */
45#endif
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +020046int opt_n = 0; /* indent trace output according to program flow */
Juan Cespedesd65efa32003-02-03 00:22:30 +010047int opt_T = 0; /* show the time spent inside each call */
Juan Cespedes5e01f651998-03-08 22:31:44 +010048
49/* List of pids given to option -p: */
Ian Wienand2d45b1a2006-02-20 22:48:07 +010050struct opt_p_t *opt_p = NULL; /* attach to process with a given pid */
Juan Cespedes5e01f651998-03-08 22:31:44 +010051
Juan Cespedesac3db291998-04-25 14:31:58 +020052/* List of function names given to option -e: */
Ian Wienand2d45b1a2006-02-20 22:48:07 +010053struct opt_e_t *opt_e = NULL;
54int opt_e_enable = 1;
Juan Cespedesac3db291998-04-25 14:31:58 +020055
Ian Wienand9a2ad352006-02-20 22:44:45 +010056/* List of global function names given to -x: */
Paul Gilliam24e643a2006-03-13 18:43:13 +010057struct opt_x_t *opt_x = NULL;
Ian Wienand9a2ad352006-02-20 22:44:45 +010058
Steve Fink58c73a72006-07-17 23:18:35 +020059/* List of filenames give to option -F: */
60struct opt_F_t *opt_F = NULL; /* alternate configuration file(s) */
61
Paul Gilliambe320772006-04-24 22:06:23 +020062#ifdef PLT_REINITALISATION_BP
Ian Wienand9a2ad352006-02-20 22:44:45 +010063/* Set a break on the routine named here in order to re-initialize breakpoints
64 after all the PLTs have been initialzed */
Paul Gilliambe320772006-04-24 22:06:23 +020065char *PLTs_initialized_by_here = PLT_REINITALISATION_BP;
66#endif
Ian Wienand9a2ad352006-02-20 22:44:45 +010067
Ian Wienand2d45b1a2006-02-20 22:48:07 +010068static void usage(void)
69{
Juan Cespedesac3db291998-04-25 14:31:58 +020070#if !(HAVE_GETOPT || HAVE_GETOPT_LONG)
71 fprintf(stdout, "Usage: %s [command [arg ...]]\n"
Ian Wienand2d45b1a2006-02-20 22:48:07 +010072 "Trace library calls of a given program.\n\n", progname);
Juan Cespedesac3db291998-04-25 14:31:58 +020073#else
74 fprintf(stdout, "Usage: %s [option ...] [command [arg ...]]\n"
Ian Wienand2d45b1a2006-02-20 22:48:07 +010075 "Trace library calls of a given program.\n\n"
Juan Cespedesac3db291998-04-25 14:31:58 +020076# if HAVE_GETOPT_LONG
Ian Wienand2d45b1a2006-02-20 22:48:07 +010077 " -a, --align=COLUMN align return values in a secific column.\n"
Juan Cespedesac3db291998-04-25 14:31:58 +020078# else
Ian Wienand2d45b1a2006-02-20 22:48:07 +010079 " -a COLUMN align return values in a secific column.\n"
Juan Cespedesac3db291998-04-25 14:31:58 +020080# endif
Ian Wienand2d45b1a2006-02-20 22:48:07 +010081 " -c count time and calls, and report a summary on exit.\n"
Juan Cespedesd914a202004-11-10 00:15:33 +010082# ifdef USE_DEMANGLE
Juan Cespedesac3db291998-04-25 14:31:58 +020083# if HAVE_GETOPT_LONG
Ian Wienand2d45b1a2006-02-20 22:48:07 +010084 " -C, --demangle decode low-level symbol names into user-level names.\n"
Juan Cespedesac3db291998-04-25 14:31:58 +020085# else
Ian Wienand2d45b1a2006-02-20 22:48:07 +010086 " -C decode low-level symbol names into user-level names.\n"
Juan Cespedesac3db291998-04-25 14:31:58 +020087# endif
88# endif
89# if HAVE_GETOPT_LONG
Ian Wienand2d45b1a2006-02-20 22:48:07 +010090 " -d, --debug print debugging info.\n"
Juan Cespedesac3db291998-04-25 14:31:58 +020091# else
Ian Wienand2d45b1a2006-02-20 22:48:07 +010092 " -d print debugging info.\n"
Juan Cespedesac3db291998-04-25 14:31:58 +020093# endif
Ian Wienand2d45b1a2006-02-20 22:48:07 +010094 " -e expr modify which events to trace.\n"
95 " -f follow forks.\n"
Juan Cespedesd65efa32003-02-03 00:22:30 +010096# if HAVE_GETOPT_LONG
Steve Fink58c73a72006-07-17 23:18:35 +020097 " -F, --config=FILE load alternate configuration file\n"
98# else
99 " -F FILE load alternate configuration file\n"
100# endif
101 " (can be repeated).\n"
102# if HAVE_GETOPT_LONG
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100103 " -h, --help display this help and exit.\n"
Juan Cespedesd65efa32003-02-03 00:22:30 +0100104# else
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100105 " -h display this help and exit.\n"
Juan Cespedesd65efa32003-02-03 00:22:30 +0100106# endif
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100107 " -i print instruction pointer at time of library call.\n"
Juan Cespedesd65efa32003-02-03 00:22:30 +0100108# if HAVE_GETOPT_LONG
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100109 " -l, --library=FILE print library calls from this library only.\n"
Juan Cespedesd65efa32003-02-03 00:22:30 +0100110# else
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100111 " -l FILE print library calls from this library only.\n"
Juan Cespedesd65efa32003-02-03 00:22:30 +0100112# endif
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100113 " -L do NOT display library calls.\n"
Juan Cespedesac3db291998-04-25 14:31:58 +0200114# if HAVE_GETOPT_LONG
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100115 " -n, --indent=NR indent output by NR spaces for each call level nesting.\n"
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +0200116# else
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100117 " -n NR indent output by NR spaces for each call level nesting.\n"
Juan Cespedes5b3ffdf2001-07-02 00:52:45 +0200118# endif
119# if HAVE_GETOPT_LONG
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100120 " -o, --output=FILE write the trace output to that file.\n"
Juan Cespedesac3db291998-04-25 14:31:58 +0200121# else
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100122 " -o FILE write the trace output to that file.\n"
Juan Cespedesac3db291998-04-25 14:31:58 +0200123# endif
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100124 " -p PID attach to the process with the process ID pid.\n"
125 " -r print relative timestamps.\n"
126 " -s STRLEN specify the maximum string size to print.\n"
127 " -S display system calls.\n"
128 " -t, -tt, -ttt print absolute timestamps.\n"
129 " -T show the time spent inside each call.\n"
130 " -u USERNAME run command with the userid, groupid of username.\n"
Juan Cespedesac3db291998-04-25 14:31:58 +0200131# if HAVE_GETOPT_LONG
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100132 " -V, --version output version information and exit.\n"
Juan Cespedesac3db291998-04-25 14:31:58 +0200133# else
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100134 " -V output version information and exit.\n"
Juan Cespedesac3db291998-04-25 14:31:58 +0200135# endif
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100136 " -x NAME treat the global NAME like a library subroutine.\n"
Paul Gilliambe320772006-04-24 22:06:23 +0200137#ifdef PLT_REINITALISATION_BP
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100138 " -X NAME same as -x; and PLT's will be initialized by here.\n"
Paul Gilliambe320772006-04-24 22:06:23 +0200139#endif
140 "\nReport bugs to ltrace-devel@lists.alioth.debian.org\n",
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100141 progname);
Juan Cespedesac3db291998-04-25 14:31:58 +0200142#endif
Juan Cespedes5e01f651998-03-08 22:31:44 +0100143}
144
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100145static char *search_for_command(char *filename)
146{
Juan Cespedesf1bfe202002-03-27 00:22:23 +0100147 static char pathname[PATH_MAX];
Juan Cespedes5e01f651998-03-08 22:31:44 +0100148 char *path;
149 int m, n;
150
151 if (strchr(filename, '/')) {
152 return filename;
153 }
154 for (path = getenv("PATH"); path && *path; path += m) {
155 if (strchr(path, ':')) {
156 n = strchr(path, ':') - path;
157 m = n + 1;
158 } else {
159 m = n = strlen(path);
160 }
Juan Cespedesf1bfe202002-03-27 00:22:23 +0100161 if (n + strlen(filename) + 1 >= PATH_MAX) {
162 fprintf(stderr, "Error: filename too long\n");
163 exit(1);
164 }
165 strncpy(pathname, path, n);
Juan Cespedes5e01f651998-03-08 22:31:44 +0100166 if (n && pathname[n - 1] != '/') {
167 pathname[n++] = '/';
168 }
169 strcpy(pathname + n, filename);
170 if (!access(pathname, X_OK)) {
171 return pathname;
172 }
173 }
174 return filename;
175}
176
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100177char **process_options(int argc, char **argv)
178{
Juan Cespedesac3db291998-04-25 14:31:58 +0200179 progname = argv[0];
Juan Cespedes5e01f651998-03-08 22:31:44 +0100180 output = stderr;
181
Juan Cespedesac3db291998-04-25 14:31:58 +0200182#if HAVE_GETOPT || HAVE_GETOPT_LONG
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100183 while (1) {
Juan Cespedesac3db291998-04-25 14:31:58 +0200184 int c;
185#if HAVE_GETOPT_LONG
186 int option_index = 0;
187 static struct option long_options[] = {
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100188 {"align", 1, 0, 'a'},
Steve Fink58c73a72006-07-17 23:18:35 +0200189 {"config", 1, 0, 'F'},
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100190 {"debug", 0, 0, 'd'},
Juan Cespedesd914a202004-11-10 00:15:33 +0100191# ifdef USE_DEMANGLE
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100192 {"demangle", 0, 0, 'C'},
Juan Cespedes8e3e0821998-09-24 13:49:55 +0200193#endif
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100194 {"indent", 1, 0, 'n'},
195 {"help", 0, 0, 'h'},
196 {"library", 1, 0, 'l'},
197 {"output", 1, 0, 'o'},
198 {"version", 0, 0, 'V'},
199 {0, 0, 0, 0}
Juan Cespedesac3db291998-04-25 14:31:58 +0200200 };
Juan Cespedesd65efa32003-02-03 00:22:30 +0100201 c = getopt_long(argc, argv, "+cdfhiLrStTV"
Juan Cespedesd914a202004-11-10 00:15:33 +0100202# ifdef USE_DEMANGLE
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100203 "C"
Juan Cespedesac3db291998-04-25 14:31:58 +0200204# endif
Steve Fink58c73a72006-07-17 23:18:35 +0200205 "a:e:F:l:n:o:p:s:u:x:X:", long_options,
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100206 &option_index);
Juan Cespedesac3db291998-04-25 14:31:58 +0200207#else
Juan Cespedesd65efa32003-02-03 00:22:30 +0100208 c = getopt(argc, argv, "+cdfhiLrStTV"
Juan Cespedesd914a202004-11-10 00:15:33 +0100209# ifdef USE_DEMANGLE
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100210 "C"
Juan Cespedesac3db291998-04-25 14:31:58 +0200211# endif
Steve Fink58c73a72006-07-17 23:18:35 +0200212 "a:e:F:l:n:o:p:s:u:x:X:");
Juan Cespedesac3db291998-04-25 14:31:58 +0200213#endif
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100214 if (c == -1) {
Juan Cespedesac3db291998-04-25 14:31:58 +0200215 break;
Juan Cespedes5e01f651998-03-08 22:31:44 +0100216 }
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100217 switch (c) {
218 case 'a':
219 opt_a = atoi(optarg);
220 break;
221 case 'c':
222 opt_c++;
223 break;
Juan Cespedesd914a202004-11-10 00:15:33 +0100224#ifdef USE_DEMANGLE
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100225 case 'C':
226 opt_C++;
227 break;
Juan Cespedesac3db291998-04-25 14:31:58 +0200228#endif
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100229 case 'd':
230 opt_d++;
231 break;
232 case 'e':
233 {
234 char *str_e = strdup(optarg);
235 if (!str_e) {
236 perror("ltrace: strdup");
237 exit(1);
Ian Wienand9a2ad352006-02-20 22:44:45 +0100238 }
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100239 if (str_e[0] == '!') {
240 opt_e_enable = 0;
241 str_e++;
242 }
243 while (*str_e) {
244 struct opt_e_t *tmp;
245 char *str2 = strchr(str_e, ',');
246 if (str2) {
247 *str2 = '\0';
248 }
249 tmp = malloc(sizeof(struct opt_e_t));
Juan Cespedesd65efa32003-02-03 00:22:30 +0100250 if (!tmp) {
251 perror("ltrace: malloc");
252 exit(1);
253 }
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100254 tmp->name = str_e;
255 tmp->next = opt_e;
256 opt_e = tmp;
257 if (str2) {
258 str_e = str2 + 1;
259 } else {
260 break;
261 }
Ian Wienand9a2ad352006-02-20 22:44:45 +0100262 }
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100263 break;
264 }
265 case 'f':
266 opt_f = 1;
267 break;
Steve Fink58c73a72006-07-17 23:18:35 +0200268 case 'F':
269 {
270 struct opt_F_t *tmp = malloc(sizeof(struct opt_F_t));
271 if (!tmp) {
272 perror("ltrace: malloc");
273 exit(1);
274 }
275 tmp->filename = strdup(optarg);
276 tmp->next = opt_F;
277 opt_F = tmp;
278 break;
279 }
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100280 case 'h':
281 usage();
282 exit(0);
283 case 'i':
284 opt_i++;
285 break;
286 case 'l':
287 if (library_num == MAX_LIBRARY) {
288 fprintf(stderr,
289 "Too many libraries. Maximum is %i.\n",
290 MAX_LIBRARY);
291 exit(1);
292 }
293 library[library_num++] = optarg;
294 break;
295 case 'L':
296 opt_L = 0;
297 break;
298 case 'n':
299 opt_n = atoi(optarg);
300 break;
301 case 'o':
302 output = fopen(optarg, "w");
303 if (!output) {
304 fprintf(stderr,
305 "Can't open %s for output: %s\n",
306 optarg, strerror(errno));
307 exit(1);
308 }
309 setvbuf(output, (char *)NULL, _IOLBF, 0);
310 fcntl(fileno(output), F_SETFD, FD_CLOEXEC);
311 break;
312 case 'p':
313 {
314 struct opt_p_t *tmp =
315 malloc(sizeof(struct opt_p_t));
316 if (!tmp) {
317 perror("ltrace: malloc");
318 exit(1);
319 }
320 tmp->pid = atoi(optarg);
321 tmp->next = opt_p;
322 opt_p = tmp;
323 break;
324 }
325 case 'r':
326 opt_r++;
327 break;
328 case 's':
329 opt_s = atoi(optarg);
330 break;
331 case 'S':
332 opt_S = 1;
333 break;
334 case 't':
335 opt_t++;
336 break;
337 case 'T':
338 opt_T++;
339 break;
340 case 'u':
341 opt_u = optarg;
342 break;
343 case 'V':
344 printf("ltrace version " PACKAGE_VERSION ".\n"
345 "Copyright (C) 1997-2006 Juan Cespedes <cespedes@debian.org>.\n"
346 "This is free software; see the GNU General Public Licence\n"
347 "version 2 or later for copying conditions. There is NO warranty.\n");
348 exit(0);
349 case 'X':
Paul Gilliambe320772006-04-24 22:06:23 +0200350#ifdef PLT_REINITALISATION_BP
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100351 PLTs_initialized_by_here = optarg;
Paul Gilliambe320772006-04-24 22:06:23 +0200352#else
353 fprintf(stderr, "WANRING: \"-X\" not used for this "
354 "architecture: assuming you meant \"-x\"\n");
355#endif
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100356 /* Fall Thru */
Juan Cespedesac3db291998-04-25 14:31:58 +0200357
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100358 case 'x':
359 {
Paul Gilliam24e643a2006-03-13 18:43:13 +0100360 struct opt_x_t *p = opt_x;
Ian Wienand9a2ad352006-02-20 22:44:45 +0100361
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100362 /* First, check for duplicate. */
363 while (p && strcmp(p->name, optarg)) {
364 p = p->next;
365 }
366 if (p) {
Ian Wienand9a2ad352006-02-20 22:44:45 +0100367 break;
368 }
369
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100370 /* If not duplicate, add to list. */
Paul Gilliam24e643a2006-03-13 18:43:13 +0100371 p = malloc(sizeof(struct opt_x_t));
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100372 if (!p) {
373 perror("ltrace: malloc");
374 exit(1);
375 }
376 p->name = optarg;
Paul Gilliam24e643a2006-03-13 18:43:13 +0100377 p->found = 0;
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100378 p->next = opt_x;
379 opt_x = p;
380 break;
381 }
Ian Wienand9a2ad352006-02-20 22:44:45 +0100382
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100383 default:
Juan Cespedesac3db291998-04-25 14:31:58 +0200384#if HAVE_GETOPT_LONG
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100385 fprintf(stderr,
386 "Try `%s --help' for more information\n",
387 progname);
Juan Cespedesac3db291998-04-25 14:31:58 +0200388#else
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100389 fprintf(stderr, "Try `%s -h' for more information\n",
390 progname);
Juan Cespedesac3db291998-04-25 14:31:58 +0200391#endif
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100392 exit(1);
Juan Cespedes5e01f651998-03-08 22:31:44 +0100393 }
394 }
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100395 argc -= optind;
396 argv += optind;
Juan Cespedesac3db291998-04-25 14:31:58 +0200397#endif
Juan Cespedes5e01f651998-03-08 22:31:44 +0100398
Steve Fink58c73a72006-07-17 23:18:35 +0200399 if (!opt_F) {
400 opt_F = malloc(sizeof(struct opt_F_t));
401 opt_F->next = malloc(sizeof(struct opt_F_t));
402 opt_F->next->next = NULL;
403 opt_F->filename = USER_CONFIG_FILE;
404 opt_F->next->filename = SYSTEM_CONFIG_FILE;
405 }
406 /* Reverse the config file list since it was built by
407 * prepending, and it would make more sense to process the
408 * files in the order they were given. Probably it would make
409 * more sense to keep a tail pointer instead? */
410 {
411 struct opt_F_t *egg = NULL;
412 struct opt_F_t *chicken;
413 while (opt_F) {
414 chicken = opt_F->next;
415 opt_F->next = egg;
416 egg = opt_F;
417 opt_F = chicken;
418 }
419 opt_F = egg;
420 }
421
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100422 if (!opt_p && argc < 1) {
Juan Cespedesac3db291998-04-25 14:31:58 +0200423 fprintf(stderr, "%s: too few arguments\n", progname);
Juan Cespedes5c3fe062004-06-14 18:08:37 +0200424 usage();
Juan Cespedes5e01f651998-03-08 22:31:44 +0100425 exit(1);
426 }
Juan Cespedesf666d191998-09-20 23:04:34 +0200427 if (opt_r && opt_t) {
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100428 fprintf(stderr, "%s: Incompatible options -r and -t\n",
429 progname);
Juan Cespedesf666d191998-09-20 23:04:34 +0200430 exit(1);
431 }
Ian Wienand2d45b1a2006-02-20 22:48:07 +0100432 if (argc > 0) {
Juan Cespedesac3db291998-04-25 14:31:58 +0200433 command = search_for_command(argv[0]);
Juan Cespedes1fe93d51998-03-13 00:29:21 +0100434 }
Juan Cespedesac3db291998-04-25 14:31:58 +0200435 return &argv[0];
Juan Cespedes5e01f651998-03-08 22:31:44 +0100436}