-/* $OpenBSD: html.c,v 1.149 2022/07/06 14:27:55 schwarze Exp $ */
+/* $OpenBSD: html.c,v 1.150 2022/08/09 11:21:50 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017-2021 Ingo Schwarze <schwarze@openbsd.org>
* In addition, reserve '~' for ordinal suffixes.
*/
- for (cp = buf; *cp != '\0'; cp++)
- if (isalnum((unsigned char)*cp) == 0 &&
+ for (cp = buf; *cp != '\0'; cp++) {
+ if (*cp == ASCII_HYPH)
+ *cp = '-';
+ else if (isalnum((unsigned char)*cp) == 0 &&
strchr("!$&'()*+,-./:;=?@_", *cp) == NULL)
*cp = '_';
+ }
if (unique == 0)
return buf;