/[mailutils]/mailutils/mh/mh_format.c
ViewVC logotype

Diff of /mailutils/mh/mh_format.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by gray, Fri Sep 27 14:37:18 2002 UTC revision 1.16 by gray, Mon Nov 4 17:32:27 2002 UTC
# Line 165  compress_ws (char *str, size_t *size) Line 165  compress_ws (char *str, size_t *size)
165    
166  /* Print len bytes from str into mach->outbuf */  /* Print len bytes from str into mach->outbuf */
167  static void  static void
168  print_string (struct mh_machine *mach, size_t width, char *str, size_t len)  print_string (struct mh_machine *mach, size_t width, char *str, size_t fmtlen)
169  {  {
170    size_t rest;    size_t rest, len;
171      
172    if (!str)    if (!str)
173      {      str = "";
       str = "";  
       len = 0;  
     }  
174    
   rest = strlen (str);  
   if (len > rest)  
     len = rest;  
175    if (!width)    if (!width)
176      width = mach->width;      width = mach->width;
177    rest = mach->width - mach->ind;    len = strlen (str);
178      rest = width - mach->ind;
179    if (len > rest)    if (len > rest)
180      len = rest;      {
181          if (fmtlen >= len)
182            fmtlen = rest;
183          len = rest;
184        }
185      
186      if (fmtlen < len)
187        len = fmtlen;
188      
189    memcpy (mach->outbuf + mach->ind, str, len);    memcpy (mach->outbuf + mach->ind, str, len);
190    mach->ind += len;    mach->ind += len;
191    
192      if (fmtlen > len)
193        {
194          fmtlen -= len;
195          memset (mach->outbuf + mach->ind, ' ', fmtlen);
196          mach->ind += fmtlen;
197        }
198  }  }
199    
200  static void  static void

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26