democracy 1.0.93 → 1.0.94

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +56 -50
  3. data/VERSION_NUMBER +1 -1
  4. data/bin/autocorrect +312 -0
  5. data/bin/black +0 -0
  6. data/bin/black_bold +0 -0
  7. data/bin/black_bold_underline +0 -0
  8. data/bin/black_underline +0 -0
  9. data/bin/blue +0 -0
  10. data/bin/blue_bold +0 -0
  11. data/bin/blue_bold_underline +0 -0
  12. data/bin/blue_underline +0 -0
  13. data/bin/bold +0 -0
  14. data/bin/cyan +0 -0
  15. data/bin/cyan_bold +0 -0
  16. data/bin/cyan_bold_underline +0 -0
  17. data/bin/cyan_underline +0 -0
  18. data/bin/green +0 -0
  19. data/bin/green_bold +0 -0
  20. data/bin/green_bold_underline +0 -0
  21. data/bin/green_underline +0 -0
  22. data/bin/magenta +0 -0
  23. data/bin/magenta_bold +0 -0
  24. data/bin/magenta_bold_underline +0 -0
  25. data/bin/magenta_underline +0 -0
  26. data/bin/red +0 -0
  27. data/bin/red_bold +0 -0
  28. data/bin/red_bold_underline +0 -0
  29. data/bin/red_underline +0 -0
  30. data/bin/underline +0 -0
  31. data/bin/white +0 -0
  32. data/bin/white_bold +0 -0
  33. data/bin/white_bold_underline +0 -0
  34. data/bin/white_underline +0 -0
  35. data/bin/yellow +0 -0
  36. data/bin/yellow_bold +0 -0
  37. data/bin/yellow_bold_underline +0 -0
  38. data/bin/yellow_underline +0 -0
  39. data/documentation/autocorrect +3 -0
  40. data/documentation/email +2 -2
  41. data/documentation/left_right.exe +4 -3
  42. data/gem_data/VERSION_NUMBER +1 -1
  43. data/gem_data/push_snap +30 -0
  44. data/images/Store.png +0 -0
  45. data/index.html +59 -56
  46. data/non_compiled_programs/autocorrect +312 -0
  47. data/push_snap +30 -0
  48. data/src/color_tools/black +0 -0
  49. data/src/color_tools/black.c +9 -12
  50. data/src/color_tools/black_bold +0 -0
  51. data/src/color_tools/black_bold.c +9 -12
  52. data/src/color_tools/black_bold_underline +0 -0
  53. data/src/color_tools/black_bold_underline.c +9 -12
  54. data/src/color_tools/black_underline +0 -0
  55. data/src/color_tools/black_underline.c +9 -12
  56. data/src/color_tools/blue +0 -0
  57. data/src/color_tools/blue.c +9 -12
  58. data/src/color_tools/blue_bold +0 -0
  59. data/src/color_tools/blue_bold.c +9 -12
  60. data/src/color_tools/blue_bold_underline +0 -0
  61. data/src/color_tools/blue_bold_underline.c +9 -12
  62. data/src/color_tools/blue_underline +0 -0
  63. data/src/color_tools/blue_underline.c +9 -12
  64. data/src/color_tools/bold +0 -0
  65. data/src/color_tools/bold.c +9 -12
  66. data/src/color_tools/colors.rb +9 -12
  67. data/src/color_tools/cyan +0 -0
  68. data/src/color_tools/cyan.c +9 -12
  69. data/src/color_tools/cyan_bold +0 -0
  70. data/src/color_tools/cyan_bold.c +9 -12
  71. data/src/color_tools/cyan_bold_underline +0 -0
  72. data/src/color_tools/cyan_bold_underline.c +9 -12
  73. data/src/color_tools/cyan_underline +0 -0
  74. data/src/color_tools/cyan_underline.c +9 -12
  75. data/src/color_tools/green +0 -0
  76. data/src/color_tools/green.c +9 -12
  77. data/src/color_tools/green_bold +0 -0
  78. data/src/color_tools/green_bold.c +9 -12
  79. data/src/color_tools/green_bold_underline +0 -0
  80. data/src/color_tools/green_bold_underline.c +9 -12
  81. data/src/color_tools/green_underline +0 -0
  82. data/src/color_tools/green_underline.c +9 -12
  83. data/src/color_tools/magenta +0 -0
  84. data/src/color_tools/magenta.c +9 -12
  85. data/src/color_tools/magenta_bold +0 -0
  86. data/src/color_tools/magenta_bold.c +9 -12
  87. data/src/color_tools/magenta_bold_underline +0 -0
  88. data/src/color_tools/magenta_bold_underline.c +9 -12
  89. data/src/color_tools/magenta_underline +0 -0
  90. data/src/color_tools/magenta_underline.c +9 -12
  91. data/src/color_tools/red +0 -0
  92. data/src/color_tools/red.c +9 -12
  93. data/src/color_tools/red_bold +0 -0
  94. data/src/color_tools/red_bold.c +9 -12
  95. data/src/color_tools/red_bold_underline +0 -0
  96. data/src/color_tools/red_bold_underline.c +9 -12
  97. data/src/color_tools/red_underline +0 -0
  98. data/src/color_tools/red_underline.c +9 -12
  99. data/src/color_tools/underline +0 -0
  100. data/src/color_tools/underline.c +9 -12
  101. data/src/color_tools/white +0 -0
  102. data/src/color_tools/white.c +9 -12
  103. data/src/color_tools/white_bold +0 -0
  104. data/src/color_tools/white_bold.c +9 -12
  105. data/src/color_tools/white_bold_underline +0 -0
  106. data/src/color_tools/white_bold_underline.c +9 -12
  107. data/src/color_tools/white_underline +0 -0
  108. data/src/color_tools/white_underline.c +9 -12
  109. data/src/color_tools/yellow +0 -0
  110. data/src/color_tools/yellow.c +9 -12
  111. data/src/color_tools/yellow_bold +0 -0
  112. data/src/color_tools/yellow_bold.c +9 -12
  113. data/src/color_tools/yellow_bold_underline +0 -0
  114. data/src/color_tools/yellow_bold_underline.c +9 -12
  115. data/src/color_tools/yellow_underline +0 -0
  116. data/src/color_tools/yellow_underline.c +9 -12
  117. metadata +8 -2
@@ -0,0 +1,312 @@
1
+ #!/usr/bin/ruby
2
+
3
+ # frozen_string_literal: false
4
+ SPECIAL = {"cmd" => "command", "unix" => "UNIX"}
5
+
6
+ print "\rAUTOCORRECT\r\n"
7
+ require 'set'
8
+ $ln = Set.new File.read("/usr/share/dict/words").split
9
+ exc = %w[coo verb cad Mar Mao ma Mai Mae wag wan T's Th wad cab mad strep pi goo fob foe yo yon fog fop war i ] # '
10
+
11
+ exc.each do |i|
12
+ raise "No #{i}" unless $ln.include?(i)
13
+ end
14
+
15
+ $ln -= exc
16
+
17
+ LINES = "\n" << $ln.sort.reverse.join("\n") << "\n"
18
+
19
+ AMOUNT = 1
20
+ PUNCT = (("!".."@")).map do |i|
21
+ i.chr
22
+ end.reject do |i|
23
+ ("0".."9").include? i
24
+ end
25
+
26
+ #puts PUNCT.to_a.to_s
27
+
28
+ def get_word_(word)
29
+ return word if $ln.include? word
30
+ return word if $ln.include? word.downcase
31
+ return word.capitalize if $ln.include? word.capitalize
32
+
33
+ special = SPECIAL[word]
34
+ if special; return special; end
35
+
36
+ c = word.chars
37
+
38
+ i = c.size
39
+
40
+ def get(c, i)
41
+ return "" if c.size.zero?
42
+ while i != 0
43
+ c.permutation(i).each do |q|
44
+ # if q == first_len
45
+ # i-=1
46
+ # next
47
+ # end
48
+ q = q.join
49
+ len = LINES.scan(reg = /\n#{q}[^\n]*/i).map do |i|
50
+ i[1..-1]
51
+ end.sort do |a, b|
52
+ if a[0].downcase? == b[0].downcase?
53
+ a <=> b
54
+ else
55
+ b <=> a
56
+ end
57
+ end
58
+ # puts (len.reject do |i| i.size != 3; end.to_a.to_s)
59
+
60
+ # warn "\n#{q}[^\n]".inspect[1..-2].prepend('/').concat('/')
61
+ # warn format('permutation of %s chars of %s len of %s', i, q, len.inspect)
62
+ # return len
63
+ next if len.empty?
64
+
65
+ char_size = c.size
66
+ # puts char_size, len[0].size, len.to_s
67
+ # sleep
68
+ # puts len.inspect
69
+
70
+ len.each do |i|
71
+ cur_siz = i.size
72
+ # puts [i, c].to_s
73
+ next if cur_siz < char_size
74
+ next if cur_siz > char_size + AMOUNT
75
+
76
+ funcs = []
77
+ q.chars.each do |i|
78
+ funcs << if ("A".."Z").cover? i
79
+ :upcase
80
+ else
81
+ :downcase
82
+ end
83
+ end
84
+
85
+ funcs.size.times do |q|
86
+ i[q] = i[q].send funcs[q]
87
+ end
88
+ return i
89
+ end
90
+ end
91
+
92
+ i -= 1
93
+ end
94
+
95
+ "ERROR text is #{c.join.inspect}"
96
+ end
97
+
98
+ if i > 4
99
+ max = 0
100
+ l = $ln
101
+ maxes = {}
102
+
103
+ j = c.join
104
+
105
+ # puts 55
106
+
107
+ (c.size - c.size).times do |n|
108
+ n += 1
109
+ cont = 0
110
+ while cont < c.size
111
+ first = j[0..cont - 1]
112
+ second = j[cont..cont + n - 1].upcase.clear
113
+ third = j[n + cont..-1]
114
+ unless third
115
+ cont += 1
116
+ next
117
+ end
118
+ first = "" if cont.zero?
119
+
120
+ puts first + second + third
121
+ cont += 1
122
+ end
123
+
124
+ puts "DONE"
125
+ end
126
+ # puts 'DO'
127
+
128
+ l.each_with_index do |a, _index|
129
+ count = 0
130
+ orig_a = a.dup
131
+ a = a.dup
132
+
133
+ c.each do |char|
134
+ if a.include? char
135
+ count += 1
136
+ a.sub! char, ""
137
+ end
138
+ end
139
+
140
+ next unless count >= max && count != 0
141
+
142
+ # puts [count, max].to_s
143
+ maxes[orig_a] = count
144
+ max = count
145
+ end
146
+
147
+ maxes.select! do |_k, v|
148
+ v == max
149
+ end
150
+
151
+ l.each do |i_|
152
+ next if i_.size < c.size
153
+
154
+ maxes[i_] = max if i_[0..3] == c.join[0..3]
155
+ end
156
+ #puts l.size
157
+ def foo(a, b, c)
158
+ p = 0
159
+ while p < c.size && p < a.size
160
+ break if c[p] != a[p]
161
+
162
+ p += 1
163
+ end
164
+ p2 = 0
165
+ while p2 < c.size && p2 < b.size
166
+ break if c[p2] != b[p2]
167
+
168
+ p2 += 1
169
+ end
170
+
171
+ [p, p2]
172
+ end
173
+
174
+ val = maxes.keys.sort do |a, b|
175
+ p, p2 = foo(a, b, c)
176
+
177
+ if p2 - p >= 1
178
+ 1
179
+ elsif p2 == p2
180
+ 0
181
+ elsif p2 - p <= 1
182
+ -1
183
+ end
184
+ end[0..20].sort_by(&:size)[0..10].sort do |a, b|
185
+ p, p2 = foo(a, b, c)
186
+
187
+ if p2 - p >= 1
188
+ 1
189
+ elsif p2 == p2
190
+ 0
191
+ elsif p2 - p <= 1
192
+ -1
193
+ end
194
+ end[0]
195
+
196
+ raise unless val.class == String
197
+
198
+ return val
199
+ else
200
+ get(c, i)
201
+ end
202
+ end
203
+
204
+ require "io/console"
205
+
206
+ class String
207
+ def end?
208
+ self == "\r" || self == "\n" || self == "\t"
209
+ end
210
+
211
+ def downcase?
212
+ !!match(/[a-z]/)
213
+ end
214
+ end
215
+
216
+ class DoneException < Exception
217
+ end
218
+
219
+ def _get
220
+ a = nil
221
+ $c = ""
222
+ while a != " "
223
+ a = $stdin.getc
224
+ #print a.inspect
225
+ raise DoneException.new if a == "\x03"
226
+ if a == "\u007F"
227
+ $all_text = $all_text[0..-2]
228
+ $c = $c[0..-2]
229
+ print "\e[1D \e[1D"
230
+ next
231
+ end
232
+ $c << a
233
+ $all_text << a
234
+ putc(a) unless a.end?
235
+ return nil if a.end?
236
+ end
237
+
238
+ $c.chomp! " "
239
+ # $c.gsub!(/\e\[[A-Z]/, "")
240
+
241
+ # print c.inspect
242
+
243
+ File.open("words", "a") do |f|
244
+ f.puts c.inspect
245
+ end if false
246
+ c = $c
247
+
248
+ $c = ""
249
+ c
250
+ end
251
+
252
+ str = ""
253
+ $all_text = ""
254
+
255
+ $stdin.tty? && $stdin.raw do
256
+ last_char = "."
257
+ loop do
258
+ qi = _get
259
+ i=qi&.gsub(/\e\[[A-Z]/, "")
260
+
261
+
262
+ if i.nil?
263
+ print "\r\n"
264
+ next
265
+ end
266
+ if i.empty?
267
+ # print ' '
268
+ next
269
+ end
270
+
271
+ # raise if / |\e/.match?(i)
272
+
273
+ new_word = get_word_(i.sub(/[[:punct:]]+/, "")) + i.match(/[[:punct:]]+$/ ).to_s; if PUNCT.include?(last_char); new_word[0]=new_word[0].upcase; end
274
+ puts new_word.inspect if false
275
+
276
+ amount = i.size + 1
277
+ f = File.open("words", "a") if false
278
+
279
+ # if amount == 0
280
+ #
281
+ # text = ""/
282
+ #else
283
+ if new_word == i
284
+ else
285
+ print "\e[#{amount}D" << new_word << " "
286
+ end
287
+
288
+ $all_text = $all_text[0..-(1 + i.size + " ".size)]
289
+ $all_text << new_word << " "
290
+ last_char = new_word[-1]
291
+ # end
292
+
293
+ # puts new_word.inspect
294
+
295
+ #print "\u001b[0K"
296
+
297
+ #{new_word} "
298
+ end
299
+ rescue DoneException
300
+ end #rescue DoneException
301
+
302
+
303
+ #$all_text << $c
304
+ #system 'tput reset'
305
+ at=nil
306
+
307
+ #puts "\n\nYour story\n\n"
308
+ IO.popen("xclip -selection c", 'w') do |i|
309
+ i.print at=$all_text.strip
310
+ end
311
+ puts "YOUR STORY COPIED"
312
+ print at
data/push_snap ADDED
@@ -0,0 +1,30 @@
1
+ #!/bin/bash
2
+
3
+ set -x
4
+ set -e
5
+
6
+ if [[ $2 = "" ]]; then
7
+ red_bold_underline OLD
8
+ nth 3 < *yaml | red_bold
9
+ red_bold VERSION AND REVISION ARE ARGS
10
+ exit 1
11
+ fi
12
+
13
+ rm -rf *snap democracy* 2>/dev/null
14
+
15
+
16
+
17
+ gsubip "1\.0\.\d+" 1.0.$1 snapcraft.yaml
18
+
19
+
20
+ cp /home/a/democracy -r . &>/dev/null
21
+ cd democracy
22
+ rm -fr .git
23
+ cd ..
24
+ tar cfz democracy.tar.gz democracy
25
+
26
+ snapcraft
27
+
28
+ snapcraft push democracy*snap
29
+
30
+ snapcraft release democracy $2 stable
Binary file
@@ -42,11 +42,11 @@
42
42
  #define FIRST_COLOR "\e[30m"
43
43
  #define SECOND_COLOR "\e[0m"
44
44
 
45
- int main(int argc, char** argv) {
46
- fputs(FIRST_COLOR, stdout);
47
45
 
48
-
46
+ int main(int argc, char** argv) {
49
47
  if (argc != 1) {
48
+ fputs(FIRST_COLOR, stdout);
49
+
50
50
  for (int i = 1; i < argc; ++i) {
51
51
  if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
52
52
  fputs(HELP_STR, stdout);
@@ -57,22 +57,19 @@ int main(int argc, char** argv) {
57
57
  }
58
58
 
59
59
  putchar('\n');
60
-
61
- goto end;
60
+
61
+ fputs(SECOND_COLOR, stdout);
62
+ return 0;
62
63
  }
64
+
65
+ fputs(FIRST_COLOR, stdout);
63
66
 
64
67
  for (;;) {
65
68
  const int c = getchar();
66
69
 
67
- if (c == EOF) goto end;
68
-
70
+ if (c == EOF) { fputs(SECOND_COLOR, stdout); return 0; }
69
71
  putchar(c);
70
72
  }
71
-
72
-
73
- end:
74
- fputs(SECOND_COLOR, stdout);
75
- return 0;
76
73
  }
77
74
 
78
75
 
Binary file
@@ -42,11 +42,11 @@
42
42
  #define FIRST_COLOR "\e[1m\e[30m"
43
43
  #define SECOND_COLOR "\e[0m\e[0m"
44
44
 
45
- int main(int argc, char** argv) {
46
- fputs(FIRST_COLOR, stdout);
47
45
 
48
-
46
+ int main(int argc, char** argv) {
49
47
  if (argc != 1) {
48
+ fputs(FIRST_COLOR, stdout);
49
+
50
50
  for (int i = 1; i < argc; ++i) {
51
51
  if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
52
52
  fputs(HELP_STR, stdout);
@@ -57,22 +57,19 @@ int main(int argc, char** argv) {
57
57
  }
58
58
 
59
59
  putchar('\n');
60
-
61
- goto end;
60
+
61
+ fputs(SECOND_COLOR, stdout);
62
+ return 0;
62
63
  }
64
+
65
+ fputs(FIRST_COLOR, stdout);
63
66
 
64
67
  for (;;) {
65
68
  const int c = getchar();
66
69
 
67
- if (c == EOF) goto end;
68
-
70
+ if (c == EOF) { fputs(SECOND_COLOR, stdout); return 0; }
69
71
  putchar(c);
70
72
  }
71
-
72
-
73
- end:
74
- fputs(SECOND_COLOR, stdout);
75
- return 0;
76
73
  }
77
74
 
78
75
 
Binary file
@@ -42,11 +42,11 @@
42
42
  #define FIRST_COLOR "\e[4m\e[1m\e[30m"
43
43
  #define SECOND_COLOR "\e[0m\e[0m\e[0m"
44
44
 
45
- int main(int argc, char** argv) {
46
- fputs(FIRST_COLOR, stdout);
47
45
 
48
-
46
+ int main(int argc, char** argv) {
49
47
  if (argc != 1) {
48
+ fputs(FIRST_COLOR, stdout);
49
+
50
50
  for (int i = 1; i < argc; ++i) {
51
51
  if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
52
52
  fputs(HELP_STR, stdout);
@@ -57,22 +57,19 @@ int main(int argc, char** argv) {
57
57
  }
58
58
 
59
59
  putchar('\n');
60
-
61
- goto end;
60
+
61
+ fputs(SECOND_COLOR, stdout);
62
+ return 0;
62
63
  }
64
+
65
+ fputs(FIRST_COLOR, stdout);
63
66
 
64
67
  for (;;) {
65
68
  const int c = getchar();
66
69
 
67
- if (c == EOF) goto end;
68
-
70
+ if (c == EOF) { fputs(SECOND_COLOR, stdout); return 0; }
69
71
  putchar(c);
70
72
  }
71
-
72
-
73
- end:
74
- fputs(SECOND_COLOR, stdout);
75
- return 0;
76
73
  }
77
74
 
78
75
 
Binary file
@@ -42,11 +42,11 @@
42
42
  #define FIRST_COLOR "\e[4m\e[30m"
43
43
  #define SECOND_COLOR "\e[0m\e[0m"
44
44
 
45
- int main(int argc, char** argv) {
46
- fputs(FIRST_COLOR, stdout);
47
45
 
48
-
46
+ int main(int argc, char** argv) {
49
47
  if (argc != 1) {
48
+ fputs(FIRST_COLOR, stdout);
49
+
50
50
  for (int i = 1; i < argc; ++i) {
51
51
  if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
52
52
  fputs(HELP_STR, stdout);
@@ -57,22 +57,19 @@ int main(int argc, char** argv) {
57
57
  }
58
58
 
59
59
  putchar('\n');
60
-
61
- goto end;
60
+
61
+ fputs(SECOND_COLOR, stdout);
62
+ return 0;
62
63
  }
64
+
65
+ fputs(FIRST_COLOR, stdout);
63
66
 
64
67
  for (;;) {
65
68
  const int c = getchar();
66
69
 
67
- if (c == EOF) goto end;
68
-
70
+ if (c == EOF) { fputs(SECOND_COLOR, stdout); return 0; }
69
71
  putchar(c);
70
72
  }
71
-
72
-
73
- end:
74
- fputs(SECOND_COLOR, stdout);
75
- return 0;
76
73
  }
77
74
 
78
75
 
data/src/color_tools/blue CHANGED
Binary file
@@ -42,11 +42,11 @@
42
42
  #define FIRST_COLOR "\e[34m"
43
43
  #define SECOND_COLOR "\e[0m"
44
44
 
45
- int main(int argc, char** argv) {
46
- fputs(FIRST_COLOR, stdout);
47
45
 
48
-
46
+ int main(int argc, char** argv) {
49
47
  if (argc != 1) {
48
+ fputs(FIRST_COLOR, stdout);
49
+
50
50
  for (int i = 1; i < argc; ++i) {
51
51
  if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
52
52
  fputs(HELP_STR, stdout);
@@ -57,22 +57,19 @@ int main(int argc, char** argv) {
57
57
  }
58
58
 
59
59
  putchar('\n');
60
-
61
- goto end;
60
+
61
+ fputs(SECOND_COLOR, stdout);
62
+ return 0;
62
63
  }
64
+
65
+ fputs(FIRST_COLOR, stdout);
63
66
 
64
67
  for (;;) {
65
68
  const int c = getchar();
66
69
 
67
- if (c == EOF) goto end;
68
-
70
+ if (c == EOF) { fputs(SECOND_COLOR, stdout); return 0; }
69
71
  putchar(c);
70
72
  }
71
-
72
-
73
- end:
74
- fputs(SECOND_COLOR, stdout);
75
- return 0;
76
73
  }
77
74
 
78
75
 
Binary file
@@ -42,11 +42,11 @@
42
42
  #define FIRST_COLOR "\e[1m\e[34m"
43
43
  #define SECOND_COLOR "\e[0m\e[0m"
44
44
 
45
- int main(int argc, char** argv) {
46
- fputs(FIRST_COLOR, stdout);
47
45
 
48
-
46
+ int main(int argc, char** argv) {
49
47
  if (argc != 1) {
48
+ fputs(FIRST_COLOR, stdout);
49
+
50
50
  for (int i = 1; i < argc; ++i) {
51
51
  if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
52
52
  fputs(HELP_STR, stdout);
@@ -57,22 +57,19 @@ int main(int argc, char** argv) {
57
57
  }
58
58
 
59
59
  putchar('\n');
60
-
61
- goto end;
60
+
61
+ fputs(SECOND_COLOR, stdout);
62
+ return 0;
62
63
  }
64
+
65
+ fputs(FIRST_COLOR, stdout);
63
66
 
64
67
  for (;;) {
65
68
  const int c = getchar();
66
69
 
67
- if (c == EOF) goto end;
68
-
70
+ if (c == EOF) { fputs(SECOND_COLOR, stdout); return 0; }
69
71
  putchar(c);
70
72
  }
71
-
72
-
73
- end:
74
- fputs(SECOND_COLOR, stdout);
75
- return 0;
76
73
  }
77
74
 
78
75
 
Binary file
@@ -42,11 +42,11 @@
42
42
  #define FIRST_COLOR "\e[4m\e[1m\e[34m"
43
43
  #define SECOND_COLOR "\e[0m\e[0m\e[0m"
44
44
 
45
- int main(int argc, char** argv) {
46
- fputs(FIRST_COLOR, stdout);
47
45
 
48
-
46
+ int main(int argc, char** argv) {
49
47
  if (argc != 1) {
48
+ fputs(FIRST_COLOR, stdout);
49
+
50
50
  for (int i = 1; i < argc; ++i) {
51
51
  if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
52
52
  fputs(HELP_STR, stdout);
@@ -57,22 +57,19 @@ int main(int argc, char** argv) {
57
57
  }
58
58
 
59
59
  putchar('\n');
60
-
61
- goto end;
60
+
61
+ fputs(SECOND_COLOR, stdout);
62
+ return 0;
62
63
  }
64
+
65
+ fputs(FIRST_COLOR, stdout);
63
66
 
64
67
  for (;;) {
65
68
  const int c = getchar();
66
69
 
67
- if (c == EOF) goto end;
68
-
70
+ if (c == EOF) { fputs(SECOND_COLOR, stdout); return 0; }
69
71
  putchar(c);
70
72
  }
71
-
72
-
73
- end:
74
- fputs(SECOND_COLOR, stdout);
75
- return 0;
76
73
  }
77
74
 
78
75
 
Binary file
@@ -42,11 +42,11 @@
42
42
  #define FIRST_COLOR "\e[4m\e[34m"
43
43
  #define SECOND_COLOR "\e[0m\e[0m"
44
44
 
45
- int main(int argc, char** argv) {
46
- fputs(FIRST_COLOR, stdout);
47
45
 
48
-
46
+ int main(int argc, char** argv) {
49
47
  if (argc != 1) {
48
+ fputs(FIRST_COLOR, stdout);
49
+
50
50
  for (int i = 1; i < argc; ++i) {
51
51
  if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
52
52
  fputs(HELP_STR, stdout);
@@ -57,22 +57,19 @@ int main(int argc, char** argv) {
57
57
  }
58
58
 
59
59
  putchar('\n');
60
-
61
- goto end;
60
+
61
+ fputs(SECOND_COLOR, stdout);
62
+ return 0;
62
63
  }
64
+
65
+ fputs(FIRST_COLOR, stdout);
63
66
 
64
67
  for (;;) {
65
68
  const int c = getchar();
66
69
 
67
- if (c == EOF) goto end;
68
-
70
+ if (c == EOF) { fputs(SECOND_COLOR, stdout); return 0; }
69
71
  putchar(c);
70
72
  }
71
-
72
-
73
- end:
74
- fputs(SECOND_COLOR, stdout);
75
- return 0;
76
73
  }
77
74
 
78
75