Changeset 448421b in tol
- Timestamp:
- Jan 3, 2012, 5:33:17 PM (15 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 0d27864
- Parents:
- c495c08
- File:
-
- 1 edited
-
tol/btol/set_type/setgra.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/set_type/setgra.cpp
rc495c08 r448421b 2788 2788 2789 2789 //-------------------------------------------------------------------- 2790 DeclareContensClass(BSet, BSetTemporary, BSetP Open);2791 DefExtOpr(1, BSetP Open, "POpen", 1, 1,2790 DeclareContensClass(BSet, BSetTemporary, BSetPExec); 2791 DefExtOpr(1, BSetPExec, "PExec", 1, 1, 2792 2792 "Set", 2793 2793 "(Set Args)", … … 2796 2796 BOperClassify::System_); 2797 2797 2798 #define POPEN 2799 #ifdef POPEN 2800 //-------------------------------------------------------------------- 2801 void BSetPOpen::CalcContens() 2798 #ifdef WIN32 2799 void escapeCmdArg( const char *input, BText &output ) 2800 { 2801 const char *pCh = input; 2802 int bs = 0; 2803 int need = 0; 2804 2805 while ( *pCh ) { 2806 if ( !bs && *pCh == ' ' ) { 2807 need = 1; 2808 break; 2809 } 2810 bs = ((*pCh == '\\') && !bs); 2811 ++pCh; 2812 } 2813 if ( need ) { 2814 output = "\""; 2815 output += input; 2816 output += "\""; 2817 } else { 2818 output = input; 2819 } 2820 } 2821 #else 2822 void escapeCmdArg( const char *input, BText &output ) 2823 { 2824 const char *pCh = input; 2825 output = ""; 2826 int bs = 0; 2827 2828 while ( *pCh ) { 2829 if ( !bs && *pCh == ' ' ) { 2830 output += "\\ "; 2831 } else { 2832 output += *pCh; 2833 } 2834 bs = ((*pCh == '\\') && !bs); 2835 ++pCh; 2836 } 2837 } 2838 #endif 2839 2840 //-------------------------------------------------------------------- 2841 void BSetPExec::CalcContens() 2802 2842 //-------------------------------------------------------------------- 2803 2843 { … … 2816 2856 badArg = 1; 2817 2857 } 2818 const BText &txt = Text( arg ); 2819 /* 2820 char *start = txt.Buffer(); 2821 char *end ; 2822 char *tmp = new char[ txt.Length() ]; 2823 do { 2824 end = start; 2825 int bs = 0; 2826 while ( *end ) { 2827 if ( !bs && isspace( *end ) ) break; 2828 bs = *end == '\\'; 2829 ++end 2830 } 2831 } 2832 while ( *end ) { 2833 cmd += strncpy( tmp, start, end - start ); 2834 cmd += "\\ "; 2835 start = end + 1; 2836 } 2837 delete []tmp; 2838 */ 2839 cmd += txt; 2840 cmd += " "; 2858 BText &_arg = Text( arg ), escapedArg; 2859 escapeCmdArg( _arg, escapedArg ); 2860 if ( i > 1 ) { 2861 cmd += " "; 2862 } 2863 cmd += escapedArg; 2841 2864 } 2842 2865 if ( !badArg ) { … … 2875 2898 contens_.RobElement(result); 2876 2899 } 2877 #endif
Note: See TracChangeset
for help on using the changeset viewer.
