Index: info/info.c =================================================================== RCS file: /cvsroot/texinfo/texinfo/info/info.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -r1.2 -r1.3 --- info/info.c 9 Jan 2004 09:07:44 -0000 1.2 +++ info/info.c 17 Jan 2004 12:19:27 -0000 1.3 @@ -1,8 +1,8 @@ /* info.c -- Display nodes of Info files in multiple windows. - $Id: info.c,v 1.2 2004/01/09 09:07:44 dirt Exp $ + $Id: info.c,v 1.3 2004/01/17 12:19:27 dirt Exp $ - Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -80,6 +80,9 @@ int vi_keys_p = 0; /* Non-zero means don't remove ANSI escape sequences. */ int raw_escapes_p = 1; +/* Non-zero means print the absolute location of the file to be loaded. */ +static int print_where_p = 0; + #ifdef __MSDOS__ /* Non-zero indicates that screen output should be made 'speech-friendly'. Since on MSDOS the usual behavior is to write directly to the video @@ -103,6 +106,7 @@ static struct option long_options[] = { { "file", 1, 0, 'f' }, { "help", 0, &print_help_p, 1 }, { "index-search", 1, 0, IDXSRCH_OPTION }, + { "location", 0, &print_where_p, 1 }, { "node", 1, 0, 'n' }, { "output", 1, 0, 'o' }, { "raw-escapes", 0, &raw_escapes_p, 1 }, @@ -113,6 +117,7 @@ static struct option long_options[] = { { "usage", 0, 0, 'O' }, { "version", 0, &print_version_p, 1 }, { "vi-keys", 0, &vi_keys_p, 1 }, + { "where", 0, &print_where_p, 1 }, #ifdef __MSDOS__ { "speech-friendly", 0, &speech_friendly, 1 }, #endif @@ -121,9 +126,9 @@ static struct option long_options[] = { /* String describing the shorthand versions of the long options found above. */ #ifdef __MSDOS__ -static char *short_options = "d:n:f:ho:ORsb"; +static char *short_options = "d:n:f:ho:ORswb"; #else -static char *short_options = "d:n:f:ho:ORs"; +static char *short_options = "d:n:f:ho:ORws"; #endif /* When non-zero, the Info window system has been initialized. */ @@ -230,6 +235,11 @@ main (argc, argv) dump_subnodes = 1; break; + /* For compatibility with man, -w is --where. */ + case 'w': + print_where_p = 1; + break; + #ifdef __MSDOS__ /* User wants speech-friendly output. */ case 'b': @@ -286,7 +296,7 @@ main (argc, argv) There is NO warranty. You may redistribute this software\n\ under the terms of the GNU General Public License.\n\ For more information about these matters, see the files named COPYING.\n"), - "2003"); + "2004"); xexit (0); } @@ -371,7 +381,9 @@ For more information about these matters { free (initial_node); - if (user_output_filename) + if (print_where_p) + printf ("%s\n", user_filename); + else if (user_output_filename) dump_nodes_to_file (user_filename, user_nodenames, user_output_filename, dump_subnodes); else @@ -392,6 +404,17 @@ For more information about these matters if (new_initial_node && new_initial_node != initial_node) initial_node = new_initial_node; + if (print_where_p) + { + if (initial_node->parent) + printf ("%s\n", initial_node->parent); + else if (initial_node->filename) + printf ("%s\n", initial_node->filename); + else + xexit (1); + xexit (0); + } + /* If the user specified that this node should be output, then do that now. Otherwise, start the Info session with this node. Or act accordingly if the initial node was not found. */ @@ -592,6 +615,7 @@ Options:\n\ --restore=FILENAME read initial keystrokes from FILENAME.\n\ -O, --show-options, --usage go to command-line options node.\n%s\ --subnodes recursively output menu items.\n\ + -w, --where, --location print physical location of Info file.\n\ --vi-keys use vi-like and less-like key bindings.\n\ --version display version information and exit.\n\ \n\