File: fixing-garbled-output-for-no-trailing-newline-in-input

package info (click to toggle)
braillefont 1.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 144 kB
  • sloc: ansic: 204; makefile: 28; perl: 20; sh: 13
file content (50 lines) | stat: -rw-r--r-- 1,740 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Author: Judit Foglszinger <urbec@debian.org>
Description: Fixing garbled output for no trailing newline in input
 Printing newline in case of eof to emulate a trailing newline.
 .
 Due to how fgetws works (reading until meeting a newline,
 returning NULL, if end of stream is reached),
 if there would be a trailing newline,  we never would see the eof,
 so we wouldn't print double newlines.
 .
 This patch only fixes the case of a non-interactive input,
 because in the interactive case, the input itself shifts the output,
 if there is no new line -
 example:
 test⠤⡧⠄⡠⠤⡀⡠⠤⠄⠤⡧⠄
⠀⠣⠄⠫⠭⠁⠬⠭⠂⠀⠣⠄
 .
 The patch has been forwarded to upstream via IRC on Fri Jul 23 22:00:36 2021
 .
 Despite of https://dep-team.pages.debian.net/deps/dep3/ saying
 'Any value other than "no" or "not-needed"
 means that the patch has been forwarded upstream', there has been
 a quite visible warning about 'patch with invalid metadata' on tracker.
 Something seems to regard any value other than an URL as invalid.
 To get rid of that warning, switched to 'Forwarded: not-needed',
 what is kinda correct, as it has been forwarded, so not needed to do it again :)
Forwarded: not-needed
Last-Update: 2021-07-23

--- braillefont-1.0.orig/braillefont.c
+++ braillefont-1.0/braillefont.c
@@ -62,6 +62,9 @@ int main()
             else
                 phalf(map_character(*b), 0);
         }
+        if(feof(stdin)) {
+            printf("\n");
+        }
         for (b=buf; *b; b++)
         {
             if (*b < 32)
@@ -69,6 +72,9 @@ int main()
             else
                 phalf(map_character(*b), 4*L);
         }
+        if(feof(stdin)) {
+            printf("\n");
+        }
     }
 
     return 0;