⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mh-format.man

📁 早期freebsd实现
💻 MAN
📖 第 1 页 / 共 2 页
字号:
       proper     addr     string   official 822 rendering       friendly   addr     string   user-friendly rendering       addr       addr     string   mbox@host or host!mbox rendering*       pers       addr     string   the personal name*       note       addr     string   commentary text*       mbox       addr     string   the local mailbox*       mymbox     addr     integer  the user's addresses? (0=no,1=yes)       host       addr     string   the host domain*       nohost     addr     integer  no host was present*       type       addr     integer  host type* (0=local,1=network,                                    -1=uucp,2=unknown)       path       addr     string   any leading host route*       ingrp      addr     integer  address was inside a group*       gname      addr     string   name of group*       formataddr expr              append _a_r_g to _s_t_r as a                                    (comma separated) address list       putaddr    literal           print _s_t_r address list with                                    _a_r_g as optional label;                                    get line width from _n_u_m       When  escapes  are  nested, evaluation is done from inner-       most to outer-most.  The outer-most escape must begin with       `%'; the inner escapes must not.  For example,[mh.6]                        MH.6.8                            5MH-FORMAT(5)         BSD Programmer's Manual         MH-FORMAT(5)            %<(mymbox{from}) To: %{to}%>       writes  the  value of the header component "From:" to _s_t_r;       then (_m_y_m_b_o_x) reads _s_t_r and writes its result to _n_u_m; then       the control escape evaluates _n_u_m.  If _n_u_m is non-zero, the       string "To: " is printed followed  by  the  value  of  the       header component "To:".       A  minor  explanation  of  (_m_y_m_b_o_x{_c_o_m_p}) is in order.  In       general, it checks each of the  addresses  in  the  header       component  "_c_o_m_p"  against the user's mailbox name and any       _A_l_t_e_r_n_a_t_e_-_M_a_i_l_b_o_x_e_s.   It  returns  true  if  any  address       matches,  however,  it  also  returns  true  if the "_c_o_m_p"       header is not present in  the  message.   If  needed,  the       (_n_u_l_l)  function  can  be used to explicitly test for this       condition.       When a function or component escape is interpreted and the       result  will  be  immediately  printed,  an optional field       width can be specified to print the  field  in  exactly  a       given number of characters.  For example, a numeric escape       like %4(_s_i_z_e) will print at most 4 digits of  the  message       size;  overflow  will  be  indicated by a `?' in the first       position (like `?234').  A string escape like %4(_m_e)  will       print  the  first  4  characters  and truncate at the end.       Short fields are padded at the right with the fill charac-       ter  (normally,  a  blank).   If  the field width argument       begins with a leading zero, then the fill character is set       to a zero.       As  above,  the  functions  (_p_u_t_n_u_m_f)  and (_p_u_t_s_t_r_f) print       their result in exactly the number of characters specified       by  their  leading  field  width  argument.   For example,       %06(_p_u_t_n_u_m_f(_s_i_z_e)) will print the message size in a  field       six   characters   wide   filled   with   leading   zeros;       %14(_p_u_t_s_t_r_f{_f_r_o_m}) will print the "From:" header component       in  fourteen  characters  with  trailing  spaces  added as       needed.  For _p_u_t_s_t_r_f, using a negative value for the field       width  causes right-justification of the string within the       field, with padding on the left up  to  the  field  width.       The  functions (_p_u_t_n_u_m) and (_p_u_t_s_t_r) print their result in       the minimum number of characters required, and ignore  any       leading field width argument.       The  available  output width is kept in an internal regis-       ter; any output past this width will be truncated.       Comments may be inserted in most places where  a  function       argument  is not expected.  A comment begins with `%;' and       ends with a (non-escaped) newline.[mh.6]                        MH.6.8                            6MH-FORMAT(5)         BSD Programmer's Manual         MH-FORMAT(5)       With all this in mind, here's the  default  format  string       for _s_c_a_n.  It's been divided into several pieces for read-       ability.  The first part is:            %4(msg)%<(cur)+%| %>%<{replied}-%?{encrypted}E%| %>       which says that the message number should  be  printed  in       four  digits, if the message is the current message then a       `+' else a space should be printed, and  if  a  "Replied:"       field  is present then a `-' else if an "Encrypted:" field       is present  then  an  `E'  otherwise  a  space  should  be       printed.  Next:            %02(mon{date})/%02(mday{date})       the month and date are printed in two digits (zero filled)       separated by a slash.  Next,            %<{date} %|*>       If a "Date:" field was present, then a space  is  printed,       otherwise a `*'.  Next,            %<(mymbox{from})%<{to}To:%14(friendly{to})%>%>       if  the  message  is from me, and there is a "To:" header,       print `To:' followed by a "user-friendly" rendering of the       first address in the "To:" field.  Continuing,            %<(zero)%17(friendly{from})%>       if  either of the above two tests failed, then the "From:"       address is  printed  in  a  "user-friendly"  format.   And       finally,            %{subject}%<{body}<<%{body}%>       the subject and initial body (if any) are printed.       For  a more complicated example, next consider the default       _r_e_p_l_c_o_m_p_s format file.            %(lit)%(formataddr %<{reply-to}       This clears _s_t_r and formats the "Reply-To:" header if pre-       sent.  If not present, the else-if clause is executed.            %?{from}%?{sender}%?{return-path}%>)\       This  formats  the  "From:",  "Sender:" and "Return-Path:"       headers, stopping as soon  as  one  of  them  is  present.[mh.6]                        MH.6.8                            7MH-FORMAT(5)         BSD Programmer's Manual         MH-FORMAT(5)       Next:            %<(nonnull)%(void(width))%(putaddr To: )\n%>\       If  the _f_o_r_m_a_t_a_d_d_r result is non-null, it is printed as an       address (with line folding if needed)  in  a  field  _w_i_d_t_h       wide with a leading label of "To: ".            %(lit)%(formataddr{to})%(formataddr{cc})%(formataddr(me))\       _s_t_r is cleared, and the "To:"  and  "Cc:"  headers,  along       with  the  user's address (depending on what was specified       with the "-cc" switch to _r_e_p_l) are formatted.            %<(nonnull)%(void(width))%(putaddr cc: )\n%>\       If the result is non-null, it is printed as above  with  a       leading label of "cc: ".            %<{fcc}Fcc: %{fcc}\n%>\       If  a "-fcc folder" switch was given to _r_e_p_l (see _r_e_p_l (1)       for more details about %{_f_c_c}), an "Fcc:" header  is  out-       put.            %<{subject}Subject: Re: %{subject}\n%>\       If  a subject component was present, a suitable reply sub-       ject is output.            %<{date}In-reply-to: Your message of "\            %<(nodate{date})%{date}%|%(pretty{date})%>."%<{message-id}                         %{message-id}%>\n%>\            --------       If a date component was present, an "In-Reply-To:"  header       is  output  with  the  preface "Your message of ".  If the       date was parseable, it is output in a  user-friendly  for-       mat,  otherwise  it  is  output  as-is.  The message-id is       included if present.  As with all plain-text, the  row  of       dashes are output as-is.       This  last part is a good example for a little more elabo-       ration.  Here's that part again in pseudo-code:            if (comp_exists(date))  then                 print ("In-reply-to: Your message of \"")                 if (not_date_string(date.value) then                      print (date.value)                 else                      print (pretty(date.value))[mh.6]                        MH.6.8                            8MH-FORMAT(5)         BSD Programmer's Manual         MH-FORMAT(5)                 endif                 print ("\"")                 if (comp_exists(message-id)) then                      print ("\n\t")                      print (message-id.value)                 endif                 print ("\n")            endif       Although this seems complicated, in point  of  fact,  this       method is flexible enough to extract individual fields and       print them in any format the user desires.FFIILLEESS       NonePPRROOFFIILLEE CCOOMMPPOONNEENNTTSS       NoneSSEEEE AALLSSOO       scan(1), repl(1), ap(8), dp(8)DDEEFFAAUULLTTSS       NoneCCOONNTTEEXXTT       NoneHHIISSTTOORRYY       This software was contributed for MH 6.3.  Prior to  this,       output  format  specifications  were much easier to write,       but considerably less flexible.BBUUGGSS       On hosts where _M_H was configured  with  the  BERK  option,       address parsing is not enabled.[mh.6]                        MH.6.8                            9

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -