", 5); /*HARD CARRIAGE RETURN*/ is_attr[bold_attr] = 0; is_attr[doub_attr] = 0; is_attr[undl_attr] = 0; is_attr[sup_attr] = 0; is_attr[sub_attr] = 0; /* makes the assumption that special attributes dont persist across a CR */ } else if( c == '\x8d') write(f_out, "\r\n", 2); /*SOFT CARRIAGE RETURN*/ else if( c == '\x02') flip_attr(bold_attr, f_out, "", ""); else if( c == '\x04') flip_attr(doub_attr, f_out, "", ""); else if( c == '\x13') flip_attr(undl_attr, f_out, "", ""); else if( c == '\x14') flip_attr(sup_attr, f_out, ""); else if( c == '\x16') flip_attr(sub_attr, f_out, ""); else { } } /* now add the tail and close*/ put_line(f_out, ""); put_line(f_out, ""); close(f_in); close(f_out); _exit(0); } flip_attr(int this_attr, int f_out, char *beg_str, char *end_str) { if(is_attr[this_attr]) { is_attr[this_attr] = 0; write(f_out, end_str, strlen(end_str)); } else { is_attr[this_attr] = 1; write(f_out, beg_str, strlen(beg_str)); } } send_char(int f_out, char c) { char *send_str; if(c == "\"") strcpy(send_str, """); else if(c == "&") strcpy(send_str, "&"); else if(c == "<") strcpy(send_str, "<"); else if(c == ">") strcpy(send_str, ">"); else { send_str[0] = c; send_str[1] = '\0'; } /*always*/ write(f_out, send_str, strlen(send_str)); } put_line(int f_out, char *line_str) { write(f_out, line_str, strlen(line_str)); write(f_out, "\r\n", 2); }