[OpenSER-Users] [OT] Annoying empty lines when using "M4 Macro Processor"

Iñaki Baz Castillo ibc at aliax.net
Sun Jan 20 23:29:12 CET 2008


El Domingo, 20 de Enero de 2008, Iñaki Baz Castillo escribió:

> ---- local.m4 ----
> define(`IP',`127.0.0.1')
> define(`PORT' ,`5061')
> -----------------------
>
>
> ---- file.txt.m4 ----
> My ip is IP and my port is PORT.
> --------------------------
>
>
> ~# m4 local.m4 file.txt.m4 > file.txt
>
> ---- file.txt ----
>   <-- Empty line
>   <-- Empty line
>   <-- Empty line
>   <-- Empty line
> My ip is 127.0.0.1 and my port is 5061.
> ---------------------


Ops, just now I've discovered the "dnl" option and an explanation:
  "Another problem with m4 is that it replaces its commands with empty lines."

So I could solve partially the problem with this:

---- local.m4 ----
define(`IP',`127.0.0.1')dnl
define(`PORT' ,`5061')dnl
-----------------------


But the problem still occurs if I want to include comments in the local.m4 
file as:

---- local.m4 ----
# Server data:  <-- This will add an empty line.
define(`IP',`127.0.0.1')dnl
define(`PORT' ,`5061')dnl
-----------------------




-- 
Iñaki Baz Castillo




More information about the sr-users mailing list