|
Lines 48-53
Link Here
|
| 48 |
short int mode = 0, imode; |
48 |
short int mode = 0, imode; |
| 49 |
const char *hmark = NULL, *lmark, *nmark, *nlmark; |
49 |
const char *hmark = NULL, *lmark, *nmark, *nlmark; |
| 50 |
char ch; |
50 |
char ch; |
|
|
51 |
const char* srcstart = src; |
| 51 |
|
52 |
|
| 52 |
if (src == NULL) |
53 |
if (src == NULL) |
| 53 |
return NULL; |
54 |
return NULL; |
|
Lines 69-75
Link Here
|
| 69 |
if (*src == 0 || iseng(*src)) |
70 |
if (*src == 0 || iseng(*src)) |
| 70 |
{ |
71 |
{ |
| 71 |
lmark = src-1; |
72 |
lmark = src-1; |
| 72 |
while ((!isheb(*lmark)) && (!ispunct(*lmark))) lmark--; |
73 |
while (lmark > srcstart && !isheb(*lmark) && !ispunct(*lmark)) lmark--; |
| 73 |
src = lmark; |
74 |
src = lmark; |
| 74 |
imode = 0; |
75 |
imode = 0; |
| 75 |
nmark = NULL; |
76 |
nmark = NULL; |
|
Lines 114-119
Link Here
|
| 114 |
hmark = NULL; |
115 |
hmark = NULL; |
| 115 |
mode = 0; |
116 |
mode = 0; |
| 116 |
} |
117 |
} |
|
|
118 |
if (*src == '\0') *dest = '\0'; |
| 117 |
} |
119 |
} |
| 118 |
if (!*src++) |
120 |
if (!*src++) |
| 119 |
break; |
121 |
break; |
|
Lines 141-155
Link Here
|
| 141 |
char *temp=NULL, *tmp=NULL; |
143 |
char *temp=NULL, *tmp=NULL; |
| 142 |
char *arg=NULL, *arg2=NULL; |
144 |
char *arg=NULL, *arg2=NULL; |
| 143 |
int i=0; |
145 |
int i=0; |
|
|
146 |
char* saveptr = NULL; |
| 144 |
|
147 |
|
| 145 |
temp = (char*) malloc(strlen(input)+1); |
148 |
temp = (char*) malloc(strlen(input)+1); |
| 146 |
tmp = temp; |
149 |
tmp = temp; |
| 147 |
|
150 |
|
| 148 |
strcpy(temp, input); |
151 |
strcpy(temp, input); |
| 149 |
|
152 |
|
| 150 |
arg = strtok(temp, "\n"); |
153 |
arg = strtok_r(temp, "\n", &saveptr); |
| 151 |
for(i = 0; (i < index) && (arg!=NULL); i++) |
154 |
for(i = 0; (i < index) && (arg!=NULL); i++) |
| 152 |
arg = strtok(NULL, "\n"); |
155 |
arg = strtok_r(NULL, "\n", &saveptr); |
| 153 |
|
156 |
|
| 154 |
if(arg != NULL) |
157 |
if(arg != NULL) |
| 155 |
{ |
158 |
{ |
|
Lines 164-169
Link Here
|
| 164 |
{ |
167 |
{ |
| 165 |
char* temp_str = NULL; |
168 |
char* temp_str = NULL; |
| 166 |
char* temp = NULL; |
169 |
char* temp = NULL; |
|
|
170 |
char* arg = NULL; |
| 167 |
int i=0; |
171 |
int i=0; |
| 168 |
int size = 0; |
172 |
int size = 0; |
| 169 |
if(src == NULL) |
173 |
if(src == NULL) |
|
Lines 172-192
Link Here
|
| 172 |
if((temp_str = (char*)malloc(strlen(src)+1))== NULL) |
176 |
if((temp_str = (char*)malloc(strlen(src)+1))== NULL) |
| 173 |
return NULL; |
177 |
return NULL; |
| 174 |
|
178 |
|
| 175 |
temp = GetArg(src, i); |
179 |
arg = GetArg(src, i); |
| 176 |
while(temp != NULL) |
180 |
while(arg != NULL) |
| 177 |
{ |
181 |
{ |
| 178 |
i++; |
182 |
i++; |
| 179 |
temp = hebrew(temp); |
183 |
temp = hebrew(arg); |
|
|
184 |
free(arg); |
| 180 |
memcpy(temp_str + size , temp, strlen(temp)); |
185 |
memcpy(temp_str + size , temp, strlen(temp)); |
| 181 |
size += strlen(temp) ; |
186 |
size += strlen(temp) ; |
| 182 |
temp_str[size++] = '\n'; |
187 |
temp_str[size++] = '\n'; |
| 183 |
|
188 |
|
| 184 |
free(temp); |
189 |
free(temp); |
| 185 |
temp = NULL; |
190 |
temp = NULL; |
| 186 |
temp = GetArg(src, i); |
191 |
arg = GetArg(src, i); |
| 187 |
} |
192 |
} |
| 188 |
free(temp); |
193 |
// Above loop adds a line break after last line that wasn't there in src |
| 189 |
temp_str[size]= '\0'; |
194 |
// replace it with the null terminator |
|
|
195 |
temp_str[--size]= '\0'; |
| 190 |
return temp_str; |
196 |
return temp_str; |
| 191 |
} |
197 |
} |
| 192 |
|
198 |
|