Subject: Conclusion of "Hard Return or Not"

From: Rupert Zhu <[email-masked]>
Date: Sat, 27 Apr 91 01:54:45 EDT

The following message was posted to Hua Xia Wen Zhai list two days
ago.  I repost it here for those of you who are not in HXWZ list.
Thanks.    --- Rupert Zhu

------------------------------------------------------------------

                Text Format And Utility Programs
                ================================

      As you may have noticed, CND Chinese Magazine (Hua Xia When Zhai)
has experimented two different text formats in the first three issues.

      In issue #1 and #2, each paragraph is actually a very long line.
(The <return> key is pressed only at end of each paragraph.)  This format
performed quite well on PC.  On PC screen, each over-long line (a paragraph)
breaks into several lines nicely and naturally.  However, some users of X
Window system suffered from this "no hard return" format, because some
existing softwares for X Window cannot handle an over-long line properly.

      In issue #3, we experimented the "hard return" format, that is, press
<return> key at end of each line.  In this case, a paragraph consists of
several real lines, instead of one over-long line.  This format saved users
of X Window, but annoyed many other users.  One problem is that different
Chinese viewers have different width of text display.  While some users feel
the text width is too narrow, other users may think it is too wide.  Another
problem is: Some popular printing programs (including BYX print command)
prefer the "no hard return" format.

      After consulting experts in CCNET-L (Chinese Computing Network) and
careful evaluation, we decide to adopt the "no hard return" format for
future CND-CM issues.  Meanwhile, we provide utility programs, so that users
can easily break each over-long line into lines of required length to fit
their own need.  The text width can be specified by users.

      The following are brief descriptions of two utility programs.

(1) Folding Program  (folding.c)
    This program adds a "hard return" (LF) after every  n  Chinese characters,
    where  n  is specified by user.  The default is  n = 36.  This program
    also strips off all <CR> code (ASCII 13) so that X Window users and PC
    users will both be happy.  (Those who prefer using a  CR/LF  pair as line
    separator, please see the next program.)
         To remove all <CR> code while leaving text format (line length)
    unchanged, just specify a very large text width ( such as n = 5000 ).
        |--------------------------------------------------------|
        | Usage 1:  folding [-wn] file_name       (Recommended)  |
        |    Option -wn: width = n Chinese characters.  Default  |
        |             n = 36.  (no space between w and number n) |
        |    Formatted text in file_name.gb0                     |
        | Usage 2:  folding  [-wn]  -s        (Not recommended)  |
        |    Flag -s:  input = stdin,  output = stdout           |
        | Example 1:  folding  CM9104A.GB                        |
        |     Formatted (folded) text in file CM9104A.gb0        |
        | Example 2:  folding  -w35  chinese                     |
        |     Formatted (folded) text in file chinese.gb0        |
        |--------------------------------------------------------|

(2) Adding <CR> Program  (addcr.c)
    This program replaces a UNIX style line separator (LF) by an MS-DOS
    style  (CR/LF)  pair.  It also reports the length of the longest line
    in input file.
        |---------------------------------------------------|
        | Usage 1:  addcr  file_name         (Recommended)  |
        |     Resulting text in file_name.gbm               |
        | Usage 2:  addcr  -s            (Not recommended)  |
        |     Flag -s:  input = stdin,  output = stdout     |
        | Example 1:  addcr  CM9104A.GB                     |
        |     Resulting text in file CM9104A.gbm            |
        | Example 2:  addcr -s  < input_file > output_file  |
        |---------------------------------------------------|

Who Need These Two Programs
^^^^^^^^^^^^^^^^^^^^^^^^^^^
PC Users:       Need neither of them (unless one wants to adjust text width);
X Window Users: Need folding program but not the adding <CR> program;
Mac Users:      Need both;
VT240 Users:    Need both.

      The C source code of these programs are available on request.
They can be compiled using any C compiler on any machine.

Prepared by: Rupert Zhu
           (For CND-CM)
April 24, 1991
==========================================================================