diff --git a/pub/src/edif.cpp b/pub/src/edif.cpp
index 5644f6bb85dbf1e66f79c7a80c9418c93b9d5705..d2b2d50477c83e90ef582361cabb5a0e6bb58516 100644
--- a/pub/src/edif.cpp
+++ b/pub/src/edif.cpp
@@ -9,6 +9,7 @@
 #include <math.h>
 #include <iostream>
 #include <algorithm>
+#include <boost/format.hpp>
 
 #include "mystd.h"
 #include "olm.h"
@@ -19,6 +20,7 @@
 #include "index.h"
 
 using namespace std;
+using boost::format;
 
 namespace NEdif {
     CParam* RFind(CEle* e, CCoord OneR);
@@ -38,53 +40,50 @@ void NEdif::Dir(void)
         c = e->C();
         d = e->D();
         // prepare ztext
-        char ztext[17];
+        string ztext;
         if( e->P()->nZ() ){
             if     ( e->P()->ZCo.size()==1 )
-                sprintf( ztext, "%16s",
-                         e->P()->ZCo[0].str().substr(0,16).c_str() );
+                ztext = str( format( "%-s16" ) % e->P()->ZCo[0].str() );
             else if( e->P()->ZCo.size()==2 )
-                sprintf( ztext, "%16s",
-                         ( e->P()->ZCo[0].str().substr(0,10) + ", " +
-                                  e->P()->ZCo[1].str().substr(0,4) ).c_str() );
+                ztext = str( format( "%-10s, %-4s" ) %
+                             e->P()->ZCo[0].str() %
+                             e->P()->ZCo[1].str() );
             else if( e->P()->ZCo.size()==3 )
-                sprintf( ztext, "%16s",
-                         ( e->P()->ZCo[0].str().substr(0,5) + ", " +
-                           e->P()->ZCo[1].str().substr(0,4) + ", " +
-                           e->P()->ZCo[2].str().substr(0,3) ).c_str() );
+                ztext = str( format( "%-5s, %-4s, %-3s" ) %
+                             e->P()->ZCo[0].str() %
+                             e->P()->ZCo[1].str() %
+                             e->P()->ZCo[2].str() );
             else
-                sprintf( ztext, "%16s",
-                         ( e->P()->ZCo[0].str().substr(0,4) + ", " +
-                           e->P()->ZCo[1].str().substr(0,3) + ", " +
-                           e->P()->ZCo[2].str().substr(0,2) + " &c" 
-                             ).c_str() );
+                ztext =  str( format( "%-3s, %-2s, %-1s &c" ) %
+                              e->P()->ZCo[0].str() %
+                              e->P()->ZCo[1].str() %
+                              e->P()->ZCo[2].str() );
         } else {
-            sprintf( ztext, "" );
+            ztext = str( format("%-16s") % "" );
         }
         // prepare xytext
-        char xytext[33];
+        string xytext;
         if( d ) {
             uint npts = e->nPts();
             string txtpts;
             if (npts) 
-                txtpts = strg(npts);
+                txtpts = str( format( "%-6d" ) % npts );
             else
-                txtpts = "?";
-            sprintf( xytext, "%6s %-12s %-12s",
-                     txtpts.c_str(),
-                     e->P()->xco.str().substr(0,12).c_str(),
-                     e->P()->yco.str().substr(0,12).c_str() );
+                txtpts = "     ?";
+            xytext = txtpts + str( format( "%-12s %-12s" ) %
+                                   e->P()->xco.str() %
+                                   e->P()->yco.str() );
         } else if ( c ) {
-            snprintf( xytext, 33, "%-32s", c->expr.c_str() );
+            xytext = c->expr;
         }
         // print everything
-        printf( "%3d%1s%-16s %5d %-16s %-32s\n",
-                iter.SelNo(),
-                e->P()->as_on_disk ? "=" : " ",
-                e->P()->name.substr(0,16).c_str(),
-                e->nScan(), 
-                ztext,
-                xytext );
+        cout << format( "%3d%1s%-16s %5d %-16s %-32s\n" ) %
+            iter.SelNo() %
+            ( e->P()->as_on_disk ? "=" : " " ) %
+            e->P()->name %
+            e->nScan() %
+            ztext %
+            xytext;
     }
 }