/[monit]/monit/util.c
ViewVC logotype

Diff of /monit/util.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.164 by martinp, Sun Sep 25 21:02:54 2005 UTC revision 1.165 by hauk, Sat Oct 29 15:36:59 2005 UTC
# Line 382  int Util_startsWith(const char *a, const Line 382  int Util_startsWith(const char *a, const
382   * @param buf A string   * @param buf A string
383   */   */
384  void Util_handleEscapes(char *buf) {  void Util_handleEscapes(char *buf) {
385      
386    int editpos;    int editpos;
387    int insertpos;    int insertpos;
388      
389    ASSERT(buf);    ASSERT(buf);
390        
391    for(editpos=insertpos=0; *(buf+editpos)!='\0'; editpos++, insertpos++) {    for(editpos=insertpos=0; *(buf+editpos)!='\0'; editpos++, insertpos++) {
# Line 393  void Util_handleEscapes(char *buf) { Line 393  void Util_handleEscapes(char *buf) {
393      if(*(buf+editpos) == '\\' ) {      if(*(buf+editpos) == '\\' ) {
394                
395        switch(*(buf+editpos+1)) {        switch(*(buf+editpos+1)) {
396                    
397        case 'n':          case 'n':
398          *(buf+insertpos)='\n';            *(buf+insertpos)='\n';
399          editpos++;            editpos++;
400          break;            break;
401              
402        case 't':          case 't':
403          *(buf+insertpos)='\t';            *(buf+insertpos)='\t';
404          editpos++;            editpos++;
405          break;            break;
406              
407        case 'r':          case 'r':
408          *(buf+insertpos)='\r';            *(buf+insertpos)='\r';
409          editpos++;            editpos++;
410          break;            break;
411              
412        case ' ':          case ' ':
413          *(buf+insertpos)=' ';            *(buf+insertpos)=' ';
414          editpos++;            editpos++;
415          break;            break;
416              
417        case '\\':          case 'x':
418          *(buf+insertpos)='\\';            *(buf+insertpos)=x2c(&buf[editpos+2]);
419          editpos++;            editpos+=3;
420          break;            break;
421              
422        default:          case '\\':
423          *(buf+insertpos)=*(buf+editpos);            *(buf+insertpos)='\\';
424              editpos++;
425              break;
426              
427            default:
428              *(buf+insertpos)=*(buf+editpos);
429              
430        }          }  
431          
432      } else {      } else {
433          
434        *(buf+insertpos)=*(buf+editpos);        *(buf+insertpos)=*(buf+editpos);
435          
436      }        }  
437        
438    }    }
439    *(buf+insertpos)='\0';    *(buf+insertpos)='\0';
440      
441  }  }
442    
443    

Legend:
Removed from v.1.164  
changed lines
  Added in v.1.165

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26