[tz] zic tweak to warn about non-ASCII in filenames
Arthur David Olson
arthurdavidolson at gmail.com
Wed Jun 25 23:37:28 UTC 2014
To help ensure that non-ASCII characters don't appear in distribution
filenames,
changes to zic.c so that the "-v" option warns about them. Both attached and
tab-mangled below.
--ado
*** /tmp/,azic.c 2014-06-25 19:32:44.803874900 -0400
--- /tmp/,bzic.c 2014-06-25 19:32:44.906880800 -0400
***************
*** 134,139 ****
--- 134,140 ----
static int itsdir(const char * name);
static int lowerit(int c);
static int mkdirs(char * filename);
+ static void namecheck(const char * name);
static void newabbr(const char * abbr);
static zic_t oadd(zic_t t1, zic_t t2);
static void outzone(const struct zone * zp, int ntzones);
***************
*** 621,632 ****
--- 622,652 ----
return (errors == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
+ #define BENIGN "+-_/"
+
+ static void
+ namecheck(const char * const name)
+ {
+ register const char * cp;
+
+ if (!noise)
+ return;
+ for (cp = name; *cp != '\0'; ++cp)
+ if (!isascii(*cp) ||
+ (!isalnum(*cp) && strchr(BENIGN, *cp) == NULL)) {
+ warning(_("file name %s has non-ASCII-alphanumeric character other than
%s"),
+ name, BENIGN);
+ return;
+ }
+ }
+
static void
dolink(const char *const fromfield, const char *const tofield)
{
register char * fromname;
register char * toname;
+ namecheck(tofield);
if (fromfield[0] == '/')
fromname = ecpyalloc(fromfield);
else {
***************
*** 1495,1500 ****
--- 1515,1521 ----
void *typesptr = ats + timecnt;
unsigned char *types = typesptr;
+ namecheck(name);
/*
** Sort.
*/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mm.icann.org/pipermail/tz/attachments/20140625/bb59621a/attachment.htm>
-------------- next part --------------
*** /tmp/,azic.c 2014-06-25 19:32:44.803874900 -0400
--- /tmp/,bzic.c 2014-06-25 19:32:44.906880800 -0400
***************
*** 134,139 ****
--- 134,140 ----
static int itsdir(const char * name);
static int lowerit(int c);
static int mkdirs(char * filename);
+ static void namecheck(const char * name);
static void newabbr(const char * abbr);
static zic_t oadd(zic_t t1, zic_t t2);
static void outzone(const struct zone * zp, int ntzones);
***************
*** 621,632 ****
--- 622,652 ----
return (errors == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
+ #define BENIGN "+-_/"
+
+ static void
+ namecheck(const char * const name)
+ {
+ register const char * cp;
+
+ if (!noise)
+ return;
+ for (cp = name; *cp != '\0'; ++cp)
+ if (!isascii(*cp) ||
+ (!isalnum(*cp) && strchr(BENIGN, *cp) == NULL)) {
+ warning(_("file name %s has non-ASCII-alphanumeric character other than %s"),
+ name, BENIGN);
+ return;
+ }
+ }
+
static void
dolink(const char *const fromfield, const char *const tofield)
{
register char * fromname;
register char * toname;
+ namecheck(tofield);
if (fromfield[0] == '/')
fromname = ecpyalloc(fromfield);
else {
***************
*** 1495,1500 ****
--- 1515,1521 ----
void *typesptr = ats + timecnt;
unsigned char *types = typesptr;
+ namecheck(name);
/*
** Sort.
*/
More information about the tz
mailing list