| 3404 | } |
| 3405 | |
| 3406 | void copy_string(lp_modes mode) |
| 3407 | { |
| 3408 | #ifdef STANDALONE_PARSER |
| 3409 | if ((texinfo_out |
| 3410 | && (last_cmd == LP_INFO || last_cmd == LP_CATEGORY || last_cmd == LP_URL)) |
| 3411 | || (category_out && last_cmd == LP_CATEGORY) |
| 3412 | ) |
| 3413 | { |
| 3414 | long current_location = ftell(yylpin), i = string_start, quote = 0; |
| 3415 | char c; |
| 3416 | if (texinfo_out) |
| 3417 | { |
| 3418 | if (last_cmd == LP_INFO) |
| 3419 | { |
| 3420 | printf("$info = <<EOT;\n"); |
| 3421 | } |
| 3422 | else if (last_cmd == LP_URL) |
| 3423 | { |
| 3424 | printf("$url = <<EOT;\n"); |
| 3425 | } |
| 3426 | else |
| 3427 | { |
| 3428 | printf("$category = <<EOT;\n"); |
| 3429 | } |
| 3430 | } |
| 3431 | fseek (yylpin, i, SEEK_SET); |
| 3432 | while (i< current_location) |
| 3433 | { |
| 3434 | c = fgetc(yylpin); |
| 3435 | if (c == '\\') |
| 3436 | { |
| 3437 | quote = (! quote); |
| 3438 | } |
| 3439 | else if (c == '"') |
| 3440 | { |
| 3441 | if (! quote) break; |
| 3442 | } |
| 3443 | else |
| 3444 | quote = 0; |
| 3445 | if (c == '@' || c == '$') putchar('\\'); |
| 3446 | if (c != '\r') putchar(c); |
| 3447 | i++; |
| 3448 | } |
| 3449 | if (category_out) exit(0); |
| 3450 | fseek (yylpin, current_location, SEEK_SET); |
| 3451 | printf("\nEOT\n"); |
| 3452 | } |
| 3453 | #else |
| 3454 | if((last_cmd == LP_INFO)&&(mode == GET_INFO)) |
| 3455 | { |
| 3456 | int i, offset=0; |
| 3457 | long current_location = ftell(yylpin); |
| 3458 | int len = (int)(current_pos(0) - string_start); |
| 3459 | fseek(yylpin, string_start, SEEK_SET); |
| 3460 | if (text_buffer!=NULL) omFree((ADDRESS)text_buffer); |
| 3461 | text_buffer = (char *)omAlloc(len+2); |
| 3462 | omMarkAsStaticAddr(text_buffer); |
| 3463 | myfread(text_buffer, len, 1, yylpin); |
no test coverage detected