안시 문자열로 인한 공백
2007.04.12 11:45
제 목:[무한] 안시 문자열로 인한 공백 생김 방지
올린이:쿨러453 (이기한 ) 99/02/11 02:27 읽음: 92 관련자료 없음
-----------------------------------------------------------------------------
안시로 인해서 잡담이나 소지품 리스트에 불필요한 공백이 생기는 문제를 고친
것입니다. misc.c 의 delimit() 함수.
/************************************************************************/
/* delimit */
/************************************************************************/
/* This function takes a given string, and if it is greater than a given*/
/* number of characters, then it is split up into several lines. This */
/* is done by replacing spaces with carriage returns before the end of */
/* the line. */
/* ANSI 문자열로 인하여 정렬이 제대로 되지 않던 문제 고침 -- by beagle */
#define MAXLINE 77
void delimit(str)
char *str;
{
int i, j, l, len, lastspace;
char str2[2048];
int sublen, isansistr; /* 변수 추가 */
str2[0] = 0;
j = (str) ? strlen(str) : 0;
if(j < MAXLINE)
return;
len = 0; lastspace = -1; l = 0;
sublen = 0; isansistr = 0; /* 변수 초기화 */
for(i=0; i if(str[i] == ' ') {
lastspace = i;
sublen = 0; /* 공백을 만나면 sublen 초기화 */
}
if(str[i] == '\n') {
len = 0;
lastspace = -1;
sublen = 0; /* 개행되면 sublen 초기화 */
}
/* ANSI 시작 부분인지 검사 */
if (str[i] == '\x1B' && str[i + 1] == '[')
isansistr = 1;
/* ANSI 부분이라면 문자열 길이에서 제외 */
if (!isansistr) {
len++;
sublen++;
}
/* ANSI 끝나는 부분 검사 */
if (isansistr && isalpha (str[i]))
isansistr = 0;
/* MAXLINE 보다 길이가 커지면 개행함 */
if(len > MAXLINE && lastspace > -1) {
str[lastspace] = 0;
strcat(str2, &str[l]);
strcat(str2, "\n ");
l = lastspace + 1;
len = sublen + 2; /* 다음 줄의 길이 초기화 */
lastspace = -1;
}
}
strcat(str2, &str[l]);
strcpy(str, str2);
}
홈지기 "그륨"
올린이:쿨러453 (이기한 ) 99/02/11 02:27 읽음: 92 관련자료 없음
-----------------------------------------------------------------------------
안시로 인해서 잡담이나 소지품 리스트에 불필요한 공백이 생기는 문제를 고친
것입니다. misc.c 의 delimit() 함수.
/************************************************************************/
/* delimit */
/************************************************************************/
/* This function takes a given string, and if it is greater than a given*/
/* number of characters, then it is split up into several lines. This */
/* is done by replacing spaces with carriage returns before the end of */
/* the line. */
/* ANSI 문자열로 인하여 정렬이 제대로 되지 않던 문제 고침 -- by beagle */
#define MAXLINE 77
void delimit(str)
char *str;
{
int i, j, l, len, lastspace;
char str2[2048];
int sublen, isansistr; /* 변수 추가 */
str2[0] = 0;
j = (str) ? strlen(str) : 0;
if(j < MAXLINE)
return;
len = 0; lastspace = -1; l = 0;
sublen = 0; isansistr = 0; /* 변수 초기화 */
for(i=0; i if(str[i] == ' ') {
lastspace = i;
sublen = 0; /* 공백을 만나면 sublen 초기화 */
}
if(str[i] == '\n') {
len = 0;
lastspace = -1;
sublen = 0; /* 개행되면 sublen 초기화 */
}
/* ANSI 시작 부분인지 검사 */
if (str[i] == '\x1B' && str[i + 1] == '[')
isansistr = 1;
/* ANSI 부분이라면 문자열 길이에서 제외 */
if (!isansistr) {
len++;
sublen++;
}
/* ANSI 끝나는 부분 검사 */
if (isansistr && isalpha (str[i]))
isansistr = 0;
/* MAXLINE 보다 길이가 커지면 개행함 */
if(len > MAXLINE && lastspace > -1) {
str[lastspace] = 0;
strcat(str2, &str[l]);
strcat(str2, "\n ");
l = lastspace + 1;
len = sublen + 2; /* 다음 줄의 길이 초기화 */
lastspace = -1;
}
}
strcat(str2, &str[l]);
strcpy(str, str2);
}
홈지기 "그륨"
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
37 | 레벨을 32767까지 가능하게 | 그리움 | 2007.04.12 | 200 |
36 | 직업 추가하기 #2 | 그리움 | 2007.04.12 | 199 |
35 | 이도류 | 그리움 | 2007.04.12 | 199 |
34 | 기술추가 | 그리움 | 2007.04.12 | 199 |
33 | 귀환장소 변경소스 #2 | 그리움 | 2007.04.12 | 198 |
32 | 베팅소스 | 그리움 | 2007.04.12 | 198 |
31 | 방 전체공격 소스 | 그리움 | 2007.04.12 | 197 |
30 | 자동으로 돈줍기 #2 | 그리움 | 2007.04.12 | 197 |
29 | 패거리 레벨 조정 소스 | 그리움 | 2007.04.12 | 195 |
28 | 자기 아파트 자기가 방설명 넣기 | 그리움 | 2007.04.12 | 195 |
27 | 지도 소스 #2 | 그리움 | 2007.04.12 | 195 |
26 | 패거리창고 소스 | 그리움 | 2007.04.12 | 194 |
» | 안시 문자열로 인한 공백 | 그리움 | 2007.04.12 | 193 |
24 | 배경색 바꾸기 | 그리움 | 2007.04.12 | 192 |
23 | 안시 문자열로 인한 공백 #2 | 그리움 | 2007.04.12 | 191 |
22 | 귀환장소 설정 | 그리움 | 2007.04.12 | 190 |
21 | 이동력 추가하기 | 그리움 | 2007.04.12 | 188 |
20 | 명성치 도입 | 그리움 | 2007.04.12 | 187 |
19 | 출구 정렬 | 그리움 | 2007.04.12 | 186 |
18 | 분신을 만드는 기술 | 그리움 | 2007.04.12 | 183 |