dos.c (530B)
1 /* 2 * Copy me if you can. 3 * by 20h 4 */ 5 6 #include <unistd.h> 7 #include <stdlib.h> 8 #include <string.h> 9 #include <strings.h> 10 11 #include "ind.h" 12 13 char * 14 dosenc(char *str, int l) 15 { 16 /* To be implemented. Really? */ 17 return str; 18 } 19 20 char * 21 dosdec(char *str, int *len) 22 { 23 char *ret; 24 int i, rlen; 25 26 ret = NULL; 27 for (i = 0, rlen = 0; i < *len; i++) { 28 if (str[i] == '\r' && i < (*len)-1 && str[i+1] == '\n') 29 continue; 30 31 ret = reallocz(ret, (++rlen)+1, 0); 32 ret[rlen-1] = str[i]; 33 ret[rlen] = '\0'; 34 } 35 *len = rlen; 36 37 return ret; 38 } 39