1
1
/* info.c -- Display nodes of Info files in multiple windows.
2
$Id: info.c,v 1.53 2002/03/02 15:18:58 karl Exp $
2
$Id: info.c,v 1.11 2004/04/11 17:56:45 karl Exp $
4
Copyright (C) 1993, 96, 97, 98, 99, 2000, 01, 02
5
Free Software Foundation, Inc.
4
Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
5
2004 Free Software Foundation, Inc.
7
7
This program is free software; you can redistribute it and/or modify
8
8
it under the terms of the GNU General Public License as published by
99
102
static struct option long_options[] = {
100
103
{ "apropos", 1, 0, APROPOS_OPTION },
101
104
{ "directory", 1, 0, 'd' },
105
{ "dribble", 1, 0, DRIBBLE_OPTION },
106
{ "file", 1, 0, 'f' },
107
{ "help", 0, &print_help_p, 1 },
108
{ "index-search", 1, 0, IDXSRCH_OPTION },
109
{ "location", 0, &print_where_p, 1 },
102
110
{ "node", 1, 0, 'n' },
103
{ "file", 1, 0, 'f' },
104
{ "subnodes", 0, &dump_subnodes, 1 },
105
111
{ "output", 1, 0, 'o' },
106
112
{ "raw-escapes", 0, &raw_escapes_p, 1 },
113
{ "no-raw-escapes", 0, &raw_escapes_p, 0 },
114
{ "restore", 1, 0, RESTORE_OPTION },
107
115
{ "show-options", 0, 0, 'O' },
116
{ "subnodes", 0, &dump_subnodes, 1 },
108
117
{ "usage", 0, 0, 'O' },
118
{ "version", 0, &print_version_p, 1 },
109
119
{ "vi-keys", 0, &vi_keys_p, 1 },
110
{ "help", 0, &print_help_p, 1 },
111
{ "version", 0, &print_version_p, 1 },
112
{ "dribble", 1, 0, DRIBBLE_OPTION },
113
{ "restore", 1, 0, RESTORE_OPTION },
120
{ "where", 0, &print_where_p, 1 },
115
122
{ "speech-friendly", 0, &speech_friendly, 1 },
117
{ "index-search", 1, 0, IDXSRCH_OPTION },
118
124
{NULL, 0, NULL, 0}
121
127
/* String describing the shorthand versions of the long options found above. */
123
static char *short_options = "d:n:f:o:ORsb";
129
static char *short_options = "d:n:f:ho:ORswb";
125
static char *short_options = "d:n:f:o:ORs";
131
static char *short_options = "d:n:f:ho:ORws";
128
134
/* When non-zero, the Info window system has been initialized. */
129
135
int info_windows_initialized_p = 0;
131
137
/* Some "forward" declarations. */
132
static void info_short_help (), remember_info_program_name ();
133
static void init_messages ();
134
extern void add_file_directory_to_path ();
138
static void info_short_help (void);
139
static void init_messages (void);
137
142
/* **************************************************************** */
277
292
printf ("%s (GNU %s) %s\n", program_name, PACKAGE, VERSION);
279
printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\
280
There is NO warranty. You may redistribute this software\n\
294
puts ("Copyright (C) 2004 Free Software Foundation, Inc.");
295
printf (_("There is NO warranty. You may redistribute this software\n\
281
296
under the terms of the GNU General Public License.\n\
282
For more information about these matters, see the files named COPYING.\n"),
297
For more information about these matters, see the files named COPYING.\n"));
373
395
file name is either "dir", or the contents of user_filename if one
374
396
was specified. */
376
char *errstr, *errarg1, *errarg2;
399
char *errarg1, *errarg2;
377
401
NODE *new_initial_node = info_follow_menus (initial_node, argv + optind,
378
&errstr, &errarg1, &errarg2);
402
&errstr, &errarg1, &errarg2);
380
404
if (new_initial_node && new_initial_node != initial_node)
381
405
initial_node = new_initial_node;
409
if (initial_node->parent)
410
printf ("%s\n", initial_node->parent);
411
else if (initial_node->filename
412
&& !is_dir_name (filename_non_directory (initial_node->filename)))
413
printf ("%s\n", initial_node->filename);
383
419
/* If the user specified that this node should be output, then do that
384
420
now. Otherwise, start the Info session with this node. Or act
385
421
accordingly if the initial node was not found. */
389
425
dump_node_to_file (initial_node, user_output_filename,
392
info_error (errstr, errarg1, errarg2);
428
info_error ((char *) errstr, errarg1, errarg2);
398
begin_info_session_with_error (initial_node, errstr,
434
begin_info_session_with_error (initial_node, (char *) errstr,
400
436
/* If the user specified `--index-search=STRING' or
401
437
--show-options, start the info session in the node
402
438
corresponding to what they want. */
550
585
/* Produce a scaled down description of the available options to Info. */
587
info_short_help (void)
555
590
static const char speech_friendly_string[] = N_("\
556
--speech-friendly be friendly to speech synthesizers.\n");
591
-b, --speech-friendly be friendly to speech synthesizers.\n");
558
593
static const char speech_friendly_string[] = "";
563
598
Usage: %s [OPTION]... [MENU-ITEM...]\n\
565
600
Read documentation in Info format.\n\
568
--apropos=SUBJECT look up SUBJECT in all indices of all manuals.\n\
569
--directory=DIR add DIR to INFOPATH.\n\
570
--dribble=FILENAME remember user keystrokes in FILENAME.\n\
571
--file=FILENAME specify Info file to visit.\n\
572
--help display this help and exit.\n\
573
--index-search=STRING go to node pointed by index entry STRING.\n\
574
--node=NODENAME specify nodes in first visited Info file.\n\
575
--output=FILENAME output selected nodes to FILENAME.\n\
576
--raw-escapes don't remove ANSI escapes from man pages.\n\
577
--restore=FILENAME read initial keystrokes from FILENAME.\n\
578
--show-options, --usage go to command-line options node.\n%s\
579
--subnodes recursively output menu items.\n\
580
--vi-keys use vi-like and less-like key bindings.\n\
581
--version display version information and exit.\n\
603
--apropos=STRING look up STRING in all indices of all manuals.\n\
604
-d, --directory=DIR add DIR to INFOPATH.\n\
605
--dribble=FILENAME remember user keystrokes in FILENAME.\n\
606
-f, --file=FILENAME specify Info file to visit.\n\
607
-h, --help display this help and exit.\n\
608
--index-search=STRING go to node pointed by index entry STRING.\n\
609
-n, --node=NODENAME specify nodes in first visited Info file.\n\
610
-o, --output=FILENAME output selected nodes to FILENAME.\n\
611
-R, --raw-escapes output \"raw\" ANSI escapes (default).\n\
612
--no-raw-escapes output escapes as literal text.\n\
613
--restore=FILENAME read initial keystrokes from FILENAME.\n\
614
-O, --show-options, --usage go to command-line options node.\n%s\
615
--subnodes recursively output menu items.\n\
616
-w, --where, --location print physical location of Info file.\n\
617
--vi-keys use vi-like and less-like key bindings.\n\
618
--version display version information and exit.\n\
583
620
The first non-option argument, if present, is the menu entry to start from;\n\
584
621
it is searched for in all `dir' files along INFOPATH.\n\
607
646
use them that way. This also has the advantage that there's only one
608
647
copy of the strings. */
610
char *msg_cant_find_node;
611
char *msg_cant_file_node;
612
char *msg_cant_find_window;
613
char *msg_cant_find_point;
614
char *msg_cant_kill_last;
615
char *msg_no_menu_node;
616
char *msg_no_foot_node;
617
char *msg_no_xref_node;
618
char *msg_no_pointer;
619
char *msg_unknown_command;
620
char *msg_term_too_dumb;
621
char *msg_at_node_bottom;
622
char *msg_at_node_top;
623
char *msg_one_window;
624
char *msg_win_too_small;
625
char *msg_cant_make_help;
649
const char *msg_cant_find_node;
650
const char *msg_cant_file_node;
651
const char *msg_cant_find_window;
652
const char *msg_cant_find_point;
653
const char *msg_cant_kill_last;
654
const char *msg_no_menu_node;
655
const char *msg_no_foot_node;
656
const char *msg_no_xref_node;
657
const char *msg_no_pointer;
658
const char *msg_unknown_command;
659
const char *msg_term_too_dumb;
660
const char *msg_at_node_bottom;
661
const char *msg_at_node_top;
662
const char *msg_one_window;
663
const char *msg_win_too_small;
664
const char *msg_cant_make_help;
630
669
msg_cant_find_node = _("Cannot find node `%s'.");
631
670
msg_cant_file_node = _("Cannot find node `(%s)%s'.");