public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: kerolasa@iki.fi
Subject: [PATCH 10/11] cal: trim three month display trailing white spaces
Date: Sun, 28 Apr 2013 18:11:06 +0100	[thread overview]
Message-ID: <1367169067-23705-11-git-send-email-kerolasa@iki.fi> (raw)
In-Reply-To: <1367169067-23705-1-git-send-email-kerolasa@iki.fi>

Includes fix to checks that conform earlier output practise.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 misc-utils/cal.c           | 11 +++++++----
 tests/expected/cal/3m      | 20 ++++++++++----------
 tests/expected/cal/sep1752 | 20 ++++++++++----------
 3 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index 949f003..a03cd3c 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -540,8 +540,10 @@ monthly3(int day, int month, int year) {
 	width = (julian ? J_WEEK_LEN : WEEK_LEN) -1;
 	for (i = 0; i < 2; i++) {
 		snprintf(lineout, sizeof(lineout),
-			"%s  %s  %s\n", out_prev.s[i], out_curm.s[i], out_next.s[i]);
+			"%s  %s  %s", out_prev.s[i], out_curm.s[i], out_next.s[i]);
+		trim_trailing_spaces(lineout);
 		my_putstring(lineout);
+		my_putstring("\n");
 	}
 	for (i = 2; i < FMT_ST_LINES; i++) {
 		int w1, w2, w3;
@@ -553,12 +555,13 @@ monthly3(int day, int month, int year) {
 		w2 += (out_curm.s[i] == Hrow ? Slen : 0);
 		w3 += (out_next.s[i] == Hrow ? Slen : 0);
 #endif
-		snprintf(lineout, sizeof(lineout), "%-*s  %-*s  %-*s\n",
+		snprintf(lineout, sizeof(lineout), "%-*s  %-*s  %s",
 		       w1, out_prev.s[i],
 		       w2, out_curm.s[i],
-		       w3, out_next.s[i]);
-
+		       out_next.s[i]);
+		trim_trailing_spaces(lineout);
 		my_putstring(lineout);
+		my_putstring("\n");
 	}
 }
 
diff --git a/tests/expected/cal/3m b/tests/expected/cal/3m
index 724d521..a7bdca4 100644
--- a/tests/expected/cal/3m
+++ b/tests/expected/cal/3m
@@ -1,37 +1,37 @@
 
 Gregorian - Monday-based week
-     August 2006         September 2006         October 2006    
+     August 2006         September 2006         October 2006
 Mo Tu We Th Fr Sa Su  Mo Tu We Th Fr Sa Su  Mo Tu We Th Fr Sa Su
     1  2  3  4  5  6               1  2  3                     1
  7  8  9 10 11 12 13   4  5  6  7  8  9 10   2  3  4  5  6  7  8
 14 15 16 17 18 19 20  11 12 13 14 15 16 17   9 10 11 12 13 14 15
 21 22 23 24 25 26 27  18 19 20 21 22 23 24  16 17 18 19 20 21 22
 28 29 30 31           25 26 ^[[7m27^[[27m 28 29 30     23 24 25 26 27 28 29
-                                            30 31               
+                                            30 31
 Gregorian - Sunday-based week
-     August 2006         September 2006         October 2006    
+     August 2006         September 2006         October 2006
 Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa
        1  2  3  4  5                  1  2   1  2  3  4  5  6  7
  6  7  8  9 10 11 12   3  4  5  6  7  8  9   8  9 10 11 12 13 14
 13 14 15 16 17 18 19  10 11 12 13 14 15 16  15 16 17 18 19 20 21
 20 21 22 23 24 25 26  17 18 19 20 21 22 23  22 23 24 25 26 27 28
-27 28 29 30 31        24 25 26 ^[[7m27^[[27m 28 29 30  29 30 31            
-                                                                
+27 28 29 30 31        24 25 26 ^[[7m27^[[27m 28 29 30  29 30 31
+
 Julian - Monday-based week
-        August 2006                 September 2006                October 2006       
+        August 2006                 September 2006                October 2006
 Mon Tue Wed Thu Fri Sat Sun  Mon Tue Wed Thu Fri Sat Sun  Mon Tue Wed Thu Fri Sat Sun
     213 214 215 216 217 218                  244 245 246                          274
 219 220 221 222 223 224 225  247 248 249 250 251 252 253  275 276 277 278 279 280 281
 226 227 228 229 230 231 232  254 255 256 257 258 259 260  282 283 284 285 286 287 288
 233 234 235 236 237 238 239  261 262 263 264 265 266 267  289 290 291 292 293 294 295
 240 241 242 243              268 269 ^[[7m270^[[27m 271 272 273      296 297 298 299 300 301 302
-                                                          303 304                    
+                                                          303 304
 Julian - Sunday-based week
-        August 2006                 September 2006                October 2006       
+        August 2006                 September 2006                October 2006
 Sun Mon Tue Wed Thu Fri Sat  Sun Mon Tue Wed Thu Fri Sat  Sun Mon Tue Wed Thu Fri Sat
         213 214 215 216 217                      244 245  274 275 276 277 278 279 280
 218 219 220 221 222 223 224  246 247 248 249 250 251 252  281 282 283 284 285 286 287
 225 226 227 228 229 230 231  253 254 255 256 257 258 259  288 289 290 291 292 293 294
 232 233 234 235 236 237 238  260 261 262 263 264 265 266  295 296 297 298 299 300 301
-239 240 241 242 243          267 268 269 ^[[7m270^[[27m 271 272 273  302 303 304                
-                                                                                     
+239 240 241 242 243          267 268 269 ^[[7m270^[[27m 271 272 273  302 303 304
+
diff --git a/tests/expected/cal/sep1752 b/tests/expected/cal/sep1752
index b718fa0..283983d 100644
--- a/tests/expected/cal/sep1752
+++ b/tests/expected/cal/sep1752
@@ -36,41 +36,41 @@ Sun Mon Tue Wed Thu Fri Sat
 
 
 Gregorian - Monday-based three months
-     August 1752         September 1752         October 1752    
+     August 1752         September 1752         October 1752
 Mo Tu We Th Fr Sa Su  Mo Tu We Th Fr Sa Su  Mo Tu We Th Fr Sa Su
                 1  2      1  2 14 15 16 17                     1
  3  4  5  6  7  8  9  18 19 20 21 22 23 24   2  3  4  5  6  7  8
 10 11 12 13 14 15 16  25 26 27 28 29 30      9 10 11 12 13 14 15
 17 18 19 20 21 22 23                        16 17 18 19 20 21 22
 24 25 26 27 28 29 30                        23 24 25 26 27 28 29
-31                                          30 31               
+31                                          30 31
 Gregorian - Sunday-based three months
-     August 1752         September 1752         October 1752    
+     August 1752         September 1752         October 1752
 Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa
                    1         1  2 14 15 16   1  2  3  4  5  6  7
  2  3  4  5  6  7  8  17 18 19 20 21 22 23   8  9 10 11 12 13 14
  9 10 11 12 13 14 15  24 25 26 27 28 29 30  15 16 17 18 19 20 21
 16 17 18 19 20 21 22                        22 23 24 25 26 27 28
-23 24 25 26 27 28 29                        29 30 31            
-30 31                                                           
+23 24 25 26 27 28 29                        29 30 31
+30 31
 Julian - Monday-based three months
-        August 1752                 September 1752                October 1752       
+        August 1752                 September 1752                October 1752
 Mon Tue Wed Thu Fri Sat Sun  Mon Tue Wed Thu Fri Sat Sun  Mon Tue Wed Thu Fri Sat Sun
                     214 215      245 246 258 259 260 261                          275
 216 217 218 219 220 221 222  262 263 264 265 266 267 268  276 277 278 279 280 281 282
 223 224 225 226 227 228 229  269 270 271 272 273 274      283 284 285 286 287 288 289
 230 231 232 233 234 235 236                               290 291 292 293 294 295 296
 237 238 239 240 241 242 243                               297 298 299 300 301 302 303
-244                                                       304 305                    
+244                                                       304 305
 Julian - Sunday-based three months
-        August 1752                 September 1752                October 1752       
+        August 1752                 September 1752                October 1752
 Sun Mon Tue Wed Thu Fri Sat  Sun Mon Tue Wed Thu Fri Sat  Sun Mon Tue Wed Thu Fri Sat
                         214          245 246 258 259 260  275 276 277 278 279 280 281
 215 216 217 218 219 220 221  261 262 263 264 265 266 267  282 283 284 285 286 287 288
 222 223 224 225 226 227 228  268 269 270 271 272 273 274  289 290 291 292 293 294 295
 229 230 231 232 233 234 235                               296 297 298 299 300 301 302
-236 237 238 239 240 241 242                               303 304 305                
-243 244                                                                              
+236 237 238 239 240 241 242                               303 304 305
+243 244
 Gregorian - Monday-based year
                                1752                               
 
-- 
1.8.2.2


  parent reply	other threads:[~2013-04-28 17:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-28 17:10 [PATCH 00/11] pull: cal(1) spring clean up Sami Kerola
2013-04-28 17:10 ` [PATCH 01/11] cal: fix preprocessor directive indendation Sami Kerola
2013-04-28 17:10 ` [PATCH 02/11] cal: convert function like definitions to functions Sami Kerola
2013-04-28 17:28   ` Dave Reisner
2013-04-28 20:20     ` Sami Kerola
2013-04-29 15:21   ` Thomas Bächler
2013-04-29 20:21     ` Sami Kerola
2013-04-28 17:10 ` [PATCH 03/11] cal: clean up use of constants Sami Kerola
2013-04-29 15:51   ` Thomas Bächler
2013-04-29 21:05     ` Sami Kerola
2013-04-28 17:11 ` [PATCH 04/11] tests: add calendar reformation check Sami Kerola
2013-04-28 17:11 ` [PATCH 05/11] cal: simplify calendar reformat calculations Sami Kerola
2013-04-28 17:11 ` [PATCH 06/11] cal: remove unnecessary initializations Sami Kerola
2013-04-28 17:11 ` [PATCH 07/11] cal: de-duplicate julian specific functions Sami Kerola
2013-04-28 17:11 ` [PATCH 08/11] cal: allow day highlight testing Sami Kerola
2013-04-29  0:24   ` Pádraig Brady
2013-04-29  8:59     ` Sami Kerola
2013-04-29  9:58       ` Karel Zak
2013-04-28 17:11 ` [PATCH 09/11] tests: add cal day highlight corner cases Sami Kerola
2013-04-28 17:11 ` Sami Kerola [this message]
2013-04-29  0:32   ` [PATCH 10/11] cal: trim three month display trailing white spaces Pádraig Brady
2013-04-29  9:11     ` Sami Kerola
2013-04-29 13:40       ` Pádraig Brady
2013-04-29 18:01         ` Sami Kerola
2013-05-01  0:54           ` Pádraig Brady
2013-04-28 17:11 ` [PATCH 11/11] cal: move global variables to local scope Sami Kerola

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367169067-23705-11-git-send-email-kerolasa@iki.fi \
    --to=kerolasa@iki.fi \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox