Deleted Added
full compact
toe.c (174993) toe.c (176187)
1/****************************************************************************
1/****************************************************************************
2 * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
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
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.46 2007/10/13 22:26:38 tom Exp $")
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;
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;
319 int i;
320 int code;
321 int this_opt, last_opt = '?';
322 int v_opt = 0;
323
324 _nc_progname = _nc_rootname(argv[0]);
325
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
326 while ((this_opt = getopt(argc, argv, "0123456789ahuvUV")) != -1) {
327 while ((this_opt = getopt(argc, argv, "0123456789ahu:vU:V")) != -1) {
327 /* handle optional parameter */
328 if (isdigit(this_opt)) {
329 switch (last_opt) {
330 case 'v':
331 v_opt = (this_opt - '0');
332 break;
333 default:
334 if (isdigit(last_opt))

--- 9 unchanged lines hidden (view full) ---

344 case 'a':
345 all_dirs = TRUE;
346 break;
347 case 'h':
348 header = TRUE;
349 break;
350 case 'u':
351 direct_dependencies = TRUE;
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;
352 break;
353 case 'v':
354 v_opt = 1;
355 break;
356 case 'U':
357 invert_dependencies = TRUE;
354 break;
355 case 'v':
356 v_opt = 1;
357 break;
358 case 'U':
359 invert_dependencies = TRUE;
360 report_file = optarg;
358 break;
359 case 'V':
360 puts(curses_version());
361 ExitProgram(EXIT_SUCCESS);
362 default:
363 usage();
364 }
365 }
366 set_trace_level(v_opt);
367
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
368 if (direct_dependencies || invert_dependencies) {
369 if (freopen(argv[optind], "r", stdin) == 0) {
371 if (report_file != 0) {
372 if (freopen(report_file, "r", stdin) == 0) {
370 (void) fflush(stdout);
373 (void) fflush(stdout);
371 fprintf(stderr, "%s: can't open %s\n", _nc_progname, argv[optind]);
374 fprintf(stderr, "%s: can't open %s\n", _nc_progname, report_file);
372 ExitProgram(EXIT_FAILURE);
373 }
374
375 /* parse entries out of the source file */
375 ExitProgram(EXIT_FAILURE);
376 }
377
378 /* parse entries out of the source file */
376 _nc_set_source(argv[optind]);
379 _nc_set_source(report_file);
377 _nc_read_entry_source(stdin, 0, FALSE, FALSE, NULLHOOK);
378 }
379
380 /* maybe we want a direct-dependency listing? */
381 if (direct_dependencies) {
382 ENTRY *qp;
383
384 for_entry_list(qp) {

--- 114 unchanged lines hidden ---
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 ---