comparison src/help.cc @ 5765:7ba9ad1fec11

[project @ 2006-04-17 05:05:15 by jwe]
author jwe
date Mon, 17 Apr 2006 05:05:17 +0000
parents 126d7f1945ee
children 412f72146ab5
comparison
equal deleted inserted replaced
5764:80409c2defcc 5765:7ba9ad1fec11
28 #include <cstdlib> 28 #include <cstdlib>
29 #include <cstring> 29 #include <cstring>
30 30
31 #include <iostream> 31 #include <iostream>
32 #include <fstream> 32 #include <fstream>
33 #include <sstream>
33 #include <string> 34 #include <string>
34 35
35 #ifdef HAVE_UNISTD_H 36 #ifdef HAVE_UNISTD_H
36 #ifdef HAVE_SYS_TYPES_H 37 #ifdef HAVE_SYS_TYPES_H
37 #include <sys/types.h> 38 #include <sys/types.h>
39 #include <unistd.h> 40 #include <unistd.h>
40 #endif 41 #endif
41 42
42 #include "cmd-edit.h" 43 #include "cmd-edit.h"
43 #include "file-ops.h" 44 #include "file-ops.h"
44 #include "lo-sstream.h"
45 #include "oct-env.h" 45 #include "oct-env.h"
46 #include "str-vec.h" 46 #include "str-vec.h"
47 47
48 #include <defaults.h> 48 #include <defaults.h>
49 #include "defun.h" 49 #include "defun.h"
642 cols -= 7; 642 cols -= 7;
643 643
644 if (cols > 80) 644 if (cols > 80)
645 cols = 72; 645 cols = 72;
646 646
647 OSSTREAM buf; 647 std::ostringstream buf;
648 648
649 buf << "sed -e 's/^[#%][#%]* *//' -e 's/^ *@/@/' | " 649 buf << "sed -e 's/^[#%][#%]* *//' -e 's/^ *@/@/' | "
650 << "\"" << Vmakeinfo_prog << "\"" 650 << "\"" << Vmakeinfo_prog << "\""
651 << " -D \"VERSION " << OCTAVE_VERSION << "\"" 651 << " -D \"VERSION " << OCTAVE_VERSION << "\""
652 << " -D \"OCTAVEHOME " << OCTAVE_PREFIX << "\"" 652 << " -D \"OCTAVEHOME " << OCTAVE_PREFIX << "\""
654 << " --fill-column " << cols 654 << " --fill-column " << cols
655 << " --no-warn" 655 << " --no-warn"
656 << " --no-validate" 656 << " --no-validate"
657 << " --no-headers" 657 << " --no-headers"
658 << " --force" 658 << " --force"
659 << " --output \"" << tmp_file_name << "\"" 659 << " --output \"" << tmp_file_name << "\"";
660 << OSSTREAM_ENDS; 660
661 661 oprocstream filter (buf.str ());
662 oprocstream filter (OSSTREAM_STR (buf));
663
664 OSSTREAM_FREEZE (buf);
665 662
666 if (filter && filter.is_open ()) 663 if (filter && filter.is_open ())
667 { 664 {
668 filter << "@macro seealso {args}\n" 665 filter << "@macro seealso {args}\n"
669 << "@sp 1\n" 666 << "@sp 1\n"
997 break; 994 break;
998 } 995 }
999 996
1000 if (idx < argc) 997 if (idx < argc)
1001 { 998 {
1002 OSSTREAM output_buf; 999 std::ostringstream output_buf;
1003 1000
1004 for (int i = idx; i < argc; i++) 1001 for (int i = idx; i < argc; i++)
1005 { 1002 {
1006 std::string id = argv[i]; 1003 std::string id = argv[i];
1007 1004
1013 if (error_state) 1010 if (error_state)
1014 goto abort; 1011 goto abort;
1015 } 1012 }
1016 1013
1017 if (nargout != 0) 1014 if (nargout != 0)
1018 { 1015 retval = output_buf.str ();
1019 output_buf << OSSTREAM_ENDS;
1020
1021 retval = OSSTREAM_STR (output_buf);
1022
1023 OSSTREAM_FREEZE (output_buf);
1024 }
1025 } 1016 }
1026 else 1017 else
1027 print_usage ("type"); 1018 print_usage ("type");
1028 } 1019 }
1029 else 1020 else
1129 1120
1130 if (looks_like_texinfo (h, pos)) 1121 if (looks_like_texinfo (h, pos))
1131 { 1122 {
1132 // Get the parsed help string. 1123 // Get the parsed help string.
1133 pos = 0; 1124 pos = 0;
1134 OSSTREAM os; 1125 std::ostringstream os;
1135 display_help_text (os, h); 1126 display_help_text (os, h);
1136 std::string h2 = os.str (); 1127 std::string h2 = os.str ();
1137 1128
1138 while (1) 1129 while (1)
1139 { 1130 {