Diff
Not logged in

Differences From:

File src/printf.c part of check-in [dbda8d6ce9] - Initial check-in of m1 sources. by drh on 2007-07-21 14:10:57. [view]

To:

File src/printf.c part of check-in [c7278fd013] - Win32 port now functional except network operations. This commit was done on windows :-). See win32.txt for status of all commands. No networking commands are functional yet. All path operations are now functioning. by jnc on 2007-09-22 06:47:11. Also file src/printf.c part of check-in [3c5482959c] - Merge in the w32 changes. by drh on 2007-09-22 19:43:55. [view]

@@ -50,8 +50,9 @@
 #define etHTMLIZE    16 /* Make text safe for HTML */
 #define etHTTPIZE    17 /* Make text safe for HTTP.  "/" encoded as %2f */
 #define etURLIZE     18 /* Make text safe for HTTP.  "/" not encoded */
 #define etFOSSILIZE  19 /* The fossil header encoding format. */
+#define etPATH       20 /* Path type */
 
 
 /*
 ** An "etByte" is an 8-bit unsigned value.
@@ -110,8 +111,9 @@
   {  'i', 10, 1, etRADIX,      0,  0 },
   {  'n',  0, 0, etSIZE,       0,  0 },
   {  '%',  0, 0, etPERCENT,    0,  0 },
   {  'p', 16, 0, etPOINTER,    0,  1 },
+  {  '/',  0, 0, etPATH,       0,  0 },
 };
 #define etNINFO  (sizeof(fmtinfo)/sizeof(fmtinfo[0]))
 
 /*
@@ -542,8 +544,24 @@
           length =1;
         }
         bufpt = buf;
         break;
+      case etPATH: {
+        int i;
+        char *e = va_arg(ap,char*);
+        if( e==0 ){e="";}
+        length = strlen(e);
+        zExtra = bufpt = malloc(length+1);
+        for( i=0; i<length; i++ ){
+          if( e[i]=='\\' ){
+            bufpt[i]='/';
+          }else{
+            bufpt[i]=e[i];
+          }
+        }
+        bufpt[length]='\0';
+        break;
+      }
       case etSTRING:
       case etDYNSTRING:
         bufpt = va_arg(ap,char*);
         if( bufpt==0 ){