"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "roff.c" between
mdocml-1.14.1rc1.tar.gz and mdocml-1.14.1rc2.tar.gz

About: mdocml is a suite of tools compiling "-mdoc", the roff macro package of choice for BSD manual pages, and "-man", the predominant historical package for UNIX manuals. Hint: The installed binary name is "mandoc". Release candidate.

roff.c  (mdocml-1.14.1rc1):roff.c  (mdocml-1.14.1rc2)
/* $Id: roff.c,v 1.288 2017/01/12 18:02:20 schwarze Exp $ */ /* $Id: roff.c,v 1.289 2017/02/17 03:03:03 schwarze Exp $ */
/* /*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies. * copyright notice and this permission notice appear in all copies.
* *
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
skipping to change at line 1228 skipping to change at line 1228
if (n->type != ROFFT_TEXT) { if (n->type != ROFFT_TEXT) {
for (n = n->child; n != NULL; n = n->next) for (n = n->child; n != NULL; n = n->next)
deroff(dest, n); deroff(dest, n);
return; return;
} }
/* Skip leading whitespace. */ /* Skip leading whitespace. */
for (cp = n->string; *cp != '\0'; cp++) { for (cp = n->string; *cp != '\0'; cp++) {
if (cp[0] == '\\' && strchr(" %&0^|~", cp[1]) != NULL) if (cp[0] == '\\' && cp[1] != '\0' &&
strchr(" %&0^|~", cp[1]) != NULL)
cp++; cp++;
else if ( ! isspace((unsigned char)*cp)) else if ( ! isspace((unsigned char)*cp))
break; break;
} }
/* Skip trailing backslash. */
sz = strlen(cp);
if (cp[sz - 1] == '\\')
sz--;
/* Skip trailing whitespace. */ /* Skip trailing whitespace. */
for (sz = strlen(cp); sz; sz--) for (; sz; sz--)
if ( ! isspace((unsigned char)cp[sz-1])) if ( ! isspace((unsigned char)cp[sz-1]))
break; break;
/* Skip empty strings. */ /* Skip empty strings. */
if (sz == 0) if (sz == 0)
return; return;
if (*dest == NULL) { if (*dest == NULL) {
*dest = mandoc_strndup(cp, sz); *dest = mandoc_strndup(cp, sz);
skipping to change at line 3360 skipping to change at line 3367
* (remember that a `tr' can be invoked with an escape, which is * (remember that a `tr' can be invoked with an escape, which is
* a glyph but the escape is multi-character). * a glyph but the escape is multi-character).
* We only do this if the character hash has been initialised * We only do this if the character hash has been initialised
* and the string is >0 length. * and the string is >0 length.
*/ */
res = NULL; res = NULL;
ssz = 0; ssz = 0;
while ('\0' != *p) { while ('\0' != *p) {
if ('\\' != *p && r->xtab && r->xtab[(int)*p].p) { assert((unsigned int)*p < 128);
if ('\\' != *p && r->xtab && r->xtab[(unsigned int)*p].p) {
sz = r->xtab[(int)*p].sz; sz = r->xtab[(int)*p].sz;
res = mandoc_realloc(res, ssz + sz + 1); res = mandoc_realloc(res, ssz + sz + 1);
memcpy(res + ssz, r->xtab[(int)*p].p, sz); memcpy(res + ssz, r->xtab[(int)*p].p, sz);
ssz += sz; ssz += sz;
p++; p++;
continue; continue;
} else if ('\\' != *p) { } else if ('\\' != *p) {
res = mandoc_realloc(res, ssz + 2); res = mandoc_realloc(res, ssz + 2);
res[ssz++] = *p++; res[ssz++] = *p++;
continue; continue;
 End of changes. 5 change blocks. 
4 lines changed or deleted 12 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS