View | Details | Raw Unified | Return to bug 15091
Collapse All | Expand All

(-)groff.cc (-1 / +5 lines)
Lines 113-119 Link Here
113
    command_prefix = PROG_PREFIX;
113
    command_prefix = PROG_PREFIX;
114
  commands[TROFF_INDEX].set_name(command_prefix, "troff");
114
  commands[TROFF_INDEX].set_name(command_prefix, "troff");
115
  while ((opt = getopt(argc, argv,
115
  while ((opt = getopt(argc, argv,
116
		       "itpeRsSzavVhblCENXZF:m:T:f:w:W:M:d:r:n:o:P:L:"))
116
		       "abCd:eEf:F:hiI:lL:m:M:n:No:pP:r:RsStT:vVw:W:XzZ"))
117
	 != EOF) {
117
	 != EOF) {
118
    char buf[3];
118
    char buf[3];
119
    buf[0] = '-';
119
    buf[0] = '-';
Lines 122-127 Link Here
122
    switch (opt) {
122
    switch (opt) {
123
    case 'i':
123
    case 'i':
124
      iflag = 1;
124
      iflag = 1;
125
      break;
126
    case 'I':
127
      commands[SOELIM_INDEX].set_name(command_prefix, "soelim");
128
      commands[SOELIM_INDEX].append_arg(buf, optarg);
125
      break;
129
      break;
126
    case 't':
130
    case 't':
127
      commands[TBL_INDEX].set_name(command_prefix, "tbl");
131
      commands[TBL_INDEX].set_name(command_prefix, "tbl");
(-)groff.man (+10 lines)
Lines 48-53 Link Here
48
.BI \-F dir
48
.BI \-F dir
49
]
49
]
50
[
50
[
51
.BI \-I dir
52
]
53
[
51
.BI \-T dev
54
.BI \-T dev
52
]
55
]
53
[
56
[
Lines 150-155 Link Here
150
.TP
153
.TP
151
.B \-s
154
.B \-s
152
Preprocess with @g@soelim.
155
Preprocess with @g@soelim.
156
.TP
157
.BI \-I dir
158
This option is as described in
159
.BR @g@soelim (@MAN1EXT@) .
160
This option implies the
161
.B \-s
162
option.
153
.TP
163
.TP
154
.B \-R
164
.B \-R
155
Preprocess with @g@refer.
165
Preprocess with @g@refer.
(-)soelim.cc (-5 / +55 lines)
Lines 29-51 Link Here
29
#include "error.h"
29
#include "error.h"
30
#include "stringclass.h"
30
#include "stringclass.h"
31
31
32
static int include_list_length;
33
static char **include_list;
34
32
int compatible_flag = 0;
35
int compatible_flag = 0;
33
36
34
extern int interpret_lf_args(const char *);
37
extern int interpret_lf_args(const char *);
35
38
36
int do_file(const char *filename);
39
int do_file(const char *filename);
37
40
41
42
static void
43
include_path_append(char *path)
44
{
45
	++include_list_length;
46
	size_t nbytes = include_list_length * sizeof(include_list[0]);
47
	include_list = (char **)realloc((void *)include_list, nbytes);
48
	include_list[include_list_length - 1] = path;
49
}
50
51
38
void usage()
52
void usage()
39
{
53
{
40
  fprintf(stderr, "usage: %s [ -vC ] [ files ]\n", program_name);
54
  fprintf(stderr, "usage: %s [ -vCI: ] [ files ]\n", program_name);
41
  exit(1);
55
  exit(1);
42
}
56
}
43
57
44
int main(int argc, char **argv)
58
int main(int argc, char **argv)
45
{
59
{
46
  program_name = argv[0];
60
  program_name = argv[0];
61
  include_path_append(".");
47
  int opt;
62
  int opt;
48
  while ((opt = getopt(argc, argv, "vC")) != EOF)
63
  while ((opt = getopt(argc, argv, "CI:v")) != EOF)
49
    switch (opt) {
64
    switch (opt) {
50
    case 'v':
65
    case 'v':
51
      {
66
      {
Lines 57-62 Link Here
57
    case 'C':
72
    case 'C':
58
      compatible_flag = 1;
73
      compatible_flag = 1;
59
      break;
74
      break;
75
    case 'I':
76
      include_path_append(optarg);
77
      break;
60
    case '?':
78
    case '?':
61
      usage();
79
      usage();
62
      break;
80
      break;
Lines 125-141 Link Here
125
int do_file(const char *filename)
143
int do_file(const char *filename)
126
{
144
{
127
  FILE *fp;
145
  FILE *fp;
128
  if (strcmp(filename, "-") == 0)
146
  string whole_filename;
147
  if (strcmp(filename, "-") == 0) {
129
    fp = stdin;
148
    fp = stdin;
130
  else {
149
    whole_filename = filename;
150
    whole_filename += '\0';
151
  }
152
  else if (filename[0] == '/') {
153
    whole_filename = filename;
154
    whole_filename += '\0';
131
    errno = 0;
155
    errno = 0;
132
    fp = fopen(filename, "r");
156
    fp = fopen(filename, "r");
133
    if (fp == 0) {
157
    if (fp == 0) {
134
      error("can't open `%1': %2", filename, strerror(errno));
158
      error("can't open `%1': %2", filename, strerror(errno));
135
      return 0;
159
      return 0;
136
    }
160
    }
161
  }
162
  else {
163
    size_t j;
164
    for (j = 0; j < include_list_length; ++j)
165
    {
166
      char *path = include_list[j];
167
      if (0 == strcmp(path, "."))
168
      	whole_filename = filename;
169
      else
170
        whole_filename = string(path) + "/" + filename;
171
      whole_filename += '\0';
172
      errno = 0;
173
      fp = fopen(whole_filename.contents(), "r");
174
      if (fp != 0)
175
      	break;
176
      if (errno != ENOENT) {
177
        error("can't open `%1': %2", whole_filename.contents(), strerror(errno));
178
        return 0;
179
      }
180
    }
181
    if (j >= include_list_length)
182
    {
183
      errno = ENOENT;
184
      error("can't open `%1': %2", filename, strerror(errno));
185
      return 0;
186
    }
137
  }
187
  }
138
  current_filename = filename;
188
  current_filename = whole_filename.contents();
139
  current_lineno = 1;
189
  current_lineno = 1;
140
  set_location();
190
  set_location();
141
  enum { START, MIDDLE, HAD_DOT, HAD_s, HAD_so, HAD_l, HAD_lf } state = START;
191
  enum { START, MIDDLE, HAD_DOT, HAD_s, HAD_so, HAD_l, HAD_lf } state = START;
(-)soelim.man (+13 lines)
Lines 25-30 Link Here
25
.B \-Cv
25
.B \-Cv
26
]
26
]
27
[
27
[
28
.BI \-I dir
29
]
30
[
28
.IR files \|.\|.\|.\|
31
.IR files \|.\|.\|.\|
29
]
32
]
30
.SH DESCRIPTION
33
.SH DESCRIPTION
Lines 52-57 Link Here
52
Recognize
55
Recognize
53
.B .so
56
.B .so
54
even when followed by a character other than space or newline.
57
even when followed by a character other than space or newline.
58
.TP
59
.BI \-I dir
60
This option may be used to specify a directory to search for
61
files (both those on the command line and those named in
62
.B \&.so
63
lines).
64
The current directory is always searched first.
65
This option may be specified more than once,
66
the directories will be searched in the order specified.
67
No directory search is performed for files specified using an absolute path.
55
.TP
68
.TP
56
.B \-v
69
.B \-v
57
Print the version number.
70
Print the version number.

Return to bug 15091