[BACK]Return to term.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mandoc

Diff for /src/usr.bin/mandoc/term.c between version 1.35 and 1.36

version 1.35, 2010/05/26 02:39:58 version 1.36, 2010/06/08 00:11:47
Line 18 
Line 18 
   
 #include <assert.h>  #include <assert.h>
 #include <ctype.h>  #include <ctype.h>
   #include <stdint.h>
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
Line 31 
Line 32 
 #include "mdoc.h"  #include "mdoc.h"
 #include "main.h"  #include "main.h"
   
 static  struct termp     *term_alloc(enum termenc, size_t);  static  struct termp     *term_alloc(char *, enum termenc);
 static  void              term_free(struct termp *);  static  void              term_free(struct termp *);
 static  void              spec(struct termp *, const char *, size_t);  static  void              spec(struct termp *, const char *, size_t);
 static  void              res(struct termp *, const char *, size_t);  static  void              res(struct termp *, const char *, size_t);
Line 42 
Line 43 
   
   
 void *  void *
 ascii_alloc(size_t width)  ascii_alloc(char *outopts)
 {  {
   
         return(term_alloc(TERMENC_ASCII, width));          return(term_alloc(outopts, TERMENC_ASCII));
 }  }
   
   
Line 71 
Line 72 
   
   
 static struct termp *  static struct termp *
 term_alloc(enum termenc enc, size_t width)  term_alloc(char *outopts, enum termenc enc)
 {  {
         struct termp *p;          struct termp    *p;
           const char      *toks[2];
           char            *v;
           size_t           width;
   
           toks[0] = "width";
           toks[1] = NULL;
   
         p = calloc(1, sizeof(struct termp));          p = calloc(1, sizeof(struct termp));
         if (NULL == p) {          if (NULL == p) {
                 perror(NULL);                  perror(NULL);
                 exit(EXIT_FAILURE);                  exit(EXIT_FAILURE);
         }          }
   
         p->tabwidth = 5;          p->tabwidth = 5;
         p->enc = enc;          p->enc = enc;
           width = 80;
   
           while (outopts && *outopts)
                   switch (getsubopt(&outopts, UNCONST(toks), &v)) {
                   case (0):
                           width = (size_t)atoi(v);
                           break;
                   default:
                           break;
                   }
   
         /* Enforce some lower boundary. */          /* Enforce some lower boundary. */
         if (width < 60)          if (width < 60)
                 width = 60;                  width = 60;

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36