Mercurial > hg > octave-lyh
comparison scripts/gethelp.cc @ 3427:e098ebb77023
[project @ 2000-01-13 09:25:53 by jwe]
author | jwe |
---|---|
date | Thu, 13 Jan 2000 09:25:59 +0000 |
parents | 35a6d027772c |
children | 7576a76f6d7b |
comparison
equal
deleted
inserted
replaced
3426:f8dde1807dee | 3427:e098ebb77023 |
---|---|
8 static bool | 8 static bool |
9 looks_like_octave_copyright (const string& s) | 9 looks_like_octave_copyright (const string& s) |
10 { | 10 { |
11 bool retval = false; | 11 bool retval = false; |
12 | 12 |
13 string t = s.substr (0, 15); | 13 string t = s.substr (0, 14); |
14 | 14 |
15 if (t == " Copyright (C) ") | 15 if (t == "Copyright (C) ") |
16 { | 16 { |
17 size_t pos = s.find ('\n'); | 17 size_t pos = s.find ('\n'); |
18 | 18 |
19 if (pos != NPOS) | 19 if (pos != NPOS) |
20 { | 20 { |
22 | 22 |
23 if (pos != NPOS) | 23 if (pos != NPOS) |
24 { | 24 { |
25 pos++; | 25 pos++; |
26 | 26 |
27 t = s.substr (pos, 29); | 27 t = s.substr (pos, 28); |
28 | 28 |
29 if (t == " This file is part of Octave." | 29 if (t == "This file is part of Octave." |
30 || t == " This program is free softwar") | 30 || t == "This program is free softwar") |
31 retval = true; | 31 retval = true; |
32 } | 32 } |
33 } | 33 } |
34 } | 34 } |
35 | 35 |
46 | 46 |
47 bool first_comments_seen = false; | 47 bool first_comments_seen = false; |
48 bool begin_comment = false; | 48 bool begin_comment = false; |
49 bool have_help_text = false; | 49 bool have_help_text = false; |
50 bool in_comment = false; | 50 bool in_comment = false; |
51 bool discard_space = true; | |
51 int c; | 52 int c; |
52 | 53 |
53 while ((c = cin.get ()) != EOF) | 54 while ((c = cin.get ()) != EOF) |
54 { | 55 { |
55 if (begin_comment) | 56 if (begin_comment) |
56 { | 57 { |
57 if (c == '%' || c == '#') | 58 if (c == '%' || c == '#') |
58 continue; | 59 continue; |
60 else if (discard_space && c == ' ') | |
61 { | |
62 discard_space = false; | |
63 continue; | |
64 } | |
59 else | 65 else |
60 begin_comment = false; | 66 begin_comment = false; |
61 } | 67 } |
62 | 68 |
63 if (in_comment) | 69 if (in_comment) |
69 } | 75 } |
70 | 76 |
71 if (c == '\n') | 77 if (c == '\n') |
72 { | 78 { |
73 in_comment = false; | 79 in_comment = false; |
80 discard_space = true; | |
74 | 81 |
75 if ((c = cin.get ()) != EOF) | 82 if ((c = cin.get ()) != EOF) |
76 { | 83 { |
77 if (c == '\n') | 84 if (c == '\n') |
78 break; | 85 break; |