groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] (no subject)


From: Gaius Mulley
Subject: [Groff] (no subject)
Date: Sat, 15 Jan 2000 04:06:09 +0000 (GMT)

Hi Werner,

I've only just spotted this paragraph, I'll reply to this
soonish. I wonder whether we should remove it for the time
being?

>> A similar problem occurs in tmac/tmac.arkup's .CDFTP macro.  Here
>> safe mode is essential.  If I ran groff in unsafe mode as root, that
>> macro would change my Solaris 7 box's hostname to "--unsafe"!  This
>> bug should get fixed as well, e.g. by adding a new builtin string
>> giving the hostname.

Werner writes:

> Gaius, can you comment this, please?


Here is the patch which gives troff the troffrc-end.
This macro is automatically invoked (providing that no_rc
is not set) at the end of all user specified macros.

The actual tmac/troffrc_end file was emailed before
in the newfiles.tar.gz

cheers Gaius



diff -r -c groff-cvs/troff/input.cc    groff-html/troff/input.cc
*** groff-cvs/troff/input.cc    Wed Jan 12 14:16:55 2000
--- groff-html/troff/input.cc   Sat Jan 15 03:47:20 2000
***************
*** 50,56 ****
  
  #define USAGE_EXIT_CODE 1
  #define MACRO_PREFIX "tmac."
! #define STARTUP_FILE "troffrc"
  #define DEFAULT_INPUT_STACK_LIMIT 1000
  
  #ifndef DEFAULT_WARNING_MASK
--- 50,57 ----
  
  #define USAGE_EXIT_CODE 1
  #define MACRO_PREFIX "tmac."
! #define INITIAL_STARTUP_FILE "troffrc"
! #define FINAL_STARTUP_FILE   "troffrc-end"
  #define DEFAULT_INPUT_STACK_LIMIT 1000
  
  #ifndef DEFAULT_WARNING_MASK
***************
*** 5213,5222 ****
    process_input_stack();
  }
  
! static void process_startup_file()
  {
    char *path;
!   FILE *fp = macro_path.open_file(STARTUP_FILE, &path);
    if (fp) {
      input_stack::push(new file_iterator(fp, symbol(path).contents()));
      a_delete path;
--- 5214,5223 ----
    process_input_stack();
  }
  
! static void process_startup_file(char *filename)
  {
    char *path;
!   FILE *fp = macro_path.open_file(filename, &path);
    if (fp) {
      input_stack::push(new file_iterator(fp, symbol(path).contents()));
      a_delete path;
***************
*** 5511,5517 ****
      delete tem;
    }
    if (!no_rc)
!     process_startup_file();
    if (safer_flag)
      prepend_string("safer", &macros);
    while (macros) {
--- 5512,5518 ----
      delete tem;
    }
    if (!no_rc)
!     process_startup_file(INITIAL_STARTUP_FILE);
    if (safer_flag)
      prepend_string("safer", &macros);
    while (macros) {
***************
*** 5520,5525 ****
--- 5521,5528 ----
      macros = macros->next;
      delete tem;
    }
+   if (!no_rc)
+     process_startup_file(FINAL_STARTUP_FILE);
    for (i = optind; i < argc; i++)
      process_input_file(argv[i]);
    if (optind >= argc || iflag)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]