mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	more formatting cleanup, and avoid running off the end of the string
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@47641 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		
							
								
								
									
										32
									
								
								main/term.c
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								main/term.c
									
									
									
									
									
								
							| @@ -266,28 +266,26 @@ char *term_prompt(char *outbuf, const char *inbuf, int maxout) | ||||
|  | ||||
| /* filter escape sequences */ | ||||
| void term_filter_escapes(char *line) | ||||
|  { | ||||
| 	 int i; | ||||
|     | ||||
| 	 for (i = 0; i < strlen(line); i++) { | ||||
| { | ||||
| 	int i; | ||||
| 	int len = strlen(line); | ||||
|  | ||||
| 	for (i = 0; i < len; i++) { | ||||
| 		if (line[i] != ESC) | ||||
| 			continue; | ||||
| 		if (line[i + 1] == '\x5b') { | ||||
| 		if ((i < (len - 2)) && | ||||
| 		    (line[i + 1] == 0x5B)) { | ||||
| 			switch (line[i + 2]) { | ||||
| 		 	case '\x30': | ||||
| 			case '\x31': | ||||
| 			case '\x33': | ||||
| 				break; | ||||
| 			default: | ||||
| 				/* replace ESC with a space */ | ||||
| 				line[i] = ' '; | ||||
| 		 	case 0x30: | ||||
| 			case 0x31: | ||||
| 			case 0x33: | ||||
| 				continue; | ||||
| 			} | ||||
| 		} else { | ||||
| 			/* replace ESC with a space */ | ||||
| 			line[i] = ' '; | ||||
| 		} | ||||
| 	 } | ||||
|  } | ||||
| 		/* replace ESC with a space */ | ||||
| 		line[i] = ' '; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| char *term_prep(void) | ||||
| { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user