1/**************************************************************************** |
2 * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * |
3 * * 4 * Permission is hereby granted, free of charge, to any person obtaining a * 5 * copy of this software and associated documentation files (the * 6 * "Software"), to deal in the Software without restriction, including * 7 * without limitation the rights to use, copy, modify, merge, publish, * 8 * distribute, distribute with modifications, sublicense, and/or sell * 9 * copies of the Software, and to permit persons to whom the Software is * 10 * furnished to do so, subject to the following conditions: * --- 28 unchanged lines hidden (view full) --- 39#include <progs.priv.h> 40 41#include <sys/stat.h> 42 43#if USE_HASHED_DB 44#include <hashed_db.h> 45#endif 46 |
47MODULE_ID("$Id: toe.c,v 1.48 2008/01/05 20:41:26 tom Exp $") |
48 49#define isDotname(name) (!strcmp(name, ".") || !strcmp(name, "..")) 50 51const char *_nc_progname; 52 53#if NO_LEAKS 54#undef ExitProgram 55static void ExitProgram(int code) GCC_NORETURN; --- 255 unchanged lines hidden (view full) --- 311 312int 313main(int argc, char *argv[]) 314{ 315 bool all_dirs = FALSE; 316 bool direct_dependencies = FALSE; 317 bool invert_dependencies = FALSE; 318 bool header = FALSE; |
319 char *report_file = 0; |
320 int i; 321 int code; 322 int this_opt, last_opt = '?'; 323 int v_opt = 0; 324 325 _nc_progname = _nc_rootname(argv[0]); 326 |
327 while ((this_opt = getopt(argc, argv, "0123456789ahu:vU:V")) != -1) { |
328 /* handle optional parameter */ 329 if (isdigit(this_opt)) { 330 switch (last_opt) { 331 case 'v': 332 v_opt = (this_opt - '0'); 333 break; 334 default: 335 if (isdigit(last_opt)) --- 9 unchanged lines hidden (view full) --- 345 case 'a': 346 all_dirs = TRUE; 347 break; 348 case 'h': 349 header = TRUE; 350 break; 351 case 'u': 352 direct_dependencies = TRUE; |
353 report_file = optarg; |
354 break; 355 case 'v': 356 v_opt = 1; 357 break; 358 case 'U': 359 invert_dependencies = TRUE; |
360 report_file = optarg; |
361 break; 362 case 'V': 363 puts(curses_version()); 364 ExitProgram(EXIT_SUCCESS); 365 default: 366 usage(); 367 } 368 } 369 set_trace_level(v_opt); 370 |
371 if (report_file != 0) { 372 if (freopen(report_file, "r", stdin) == 0) { |
373 (void) fflush(stdout); |
374 fprintf(stderr, "%s: can't open %s\n", _nc_progname, report_file); |
375 ExitProgram(EXIT_FAILURE); 376 } 377 378 /* parse entries out of the source file */ |
379 _nc_set_source(report_file); |
380 _nc_read_entry_source(stdin, 0, FALSE, FALSE, NULLHOOK); 381 } 382 383 /* maybe we want a direct-dependency listing? */ 384 if (direct_dependencies) { 385 ENTRY *qp; 386 387 for_entry_list(qp) { --- 114 unchanged lines hidden --- |