From: Ben Gras Date: Thu, 23 Jun 2011 17:25:36 +0000 (+0200) Subject: fix many clang warnings in lib/ X-Git-Tag: v3.2.0~527 X-Git-Url: http://zhaoyanbai.com/repos/doc/mandoc_char.7.html?a=commitdiff_plain;h=e3f68488ee1359988fc7ac942963ddb89df5c630;p=minix.git fix many clang warnings in lib/ --- diff --git a/lib/libarchive/archive_read.c b/lib/libarchive/archive_read.c index 4c03bef29..c03a5a168 100644 --- a/lib/libarchive/archive_read.c +++ b/lib/libarchive/archive_read.c @@ -1214,7 +1214,7 @@ __archive_read_skip(struct archive_read *a, int64_t request) ssize_t __archive_read_skip(struct archive_read *a, ssize_t request) { - size_t skipped = __archive_read_skip_lenient(a, request); + ssize_t skipped = __archive_read_skip_lenient(a, request); if (skipped == request) return (skipped); /* We hit EOF before we satisfied the skip request. */ @@ -1319,7 +1319,7 @@ __archive_read_filter_skip(struct archive_read_filter *filter, int64_t request) ssize_t __archive_read_filter_skip(struct archive_read_filter *filter, ssize_t request) { - size_t bytes_skipped, total_bytes_skipped = 0; + ssize_t bytes_skipped, total_bytes_skipped = 0; size_t min; if (filter->fatal) diff --git a/lib/libc/ansi/ext_comp.c b/lib/libc/ansi/ext_comp.c index 76d73c2d1..8404edb30 100644 --- a/lib/libc/ansi/ext_comp.c +++ b/lib/libc/ansi/ext_comp.c @@ -323,110 +323,111 @@ for (i=1;i<20;i++) { */ static struct EXTEND ten_powers[] = { /* representation of 10 ** i */ - { 0, 0, 0x80000000, 0 }, - { 0, 3, 0xA0000000, 0 }, - { 0, 6, 0xC8000000, 0 }, - { 0, 9, 0xFA000000, 0 }, - { 0, 13, 0x9C400000, 0 }, - { 0, 16, 0xC3500000, 0 }, - { 0, 19, 0xF4240000, 0 }, - { 0, 23, 0x98968000, 0 }, - { 0, 26, 0xBEBC2000, 0 }, - { 0, 29, 0xEE6B2800, 0 }, - { 0, 33, 0x9502F900, 0 }, - { 0, 36, 0xBA43B740, 0 }, - { 0, 39, 0xE8D4A510, 0 }, - { 0, 43, 0x9184E72A, 0 }, - { 0, 46, 0xB5E620F4, 0x80000000 }, - { 0, 49, 0xE35FA931, 0xA0000000 }, - { 0, 53, 0x8E1BC9BF, 0x04000000 }, - { 0, 56, 0xB1A2BC2E, 0xC5000000 }, - { 0, 59, 0xDE0B6B3A, 0x76400000 }, - { 0, 63, 0x8AC72304, 0x89E80000 }, - { 0, 66, 0xAD78EBC5, 0xAC620000 }, - { 0, 69, 0xD8D726B7, 0x177A8000 }, - { 0, 73, 0x87867832, 0x6EAC9000 }, - { 0, 76, 0xA968163F, 0x0A57B400 }, - { 0, 79, 0xD3C21BCE, 0xCCEDA100 }, - { 0, 83, 0x84595161, 0x401484A0 }, - { 0, 86, 0xA56FA5B9, 0x9019A5C8 }, - { 0, 89, 0xCECB8F27, 0xF4200F3A } + { 0, 0, { 0x80000000, 0 } }, + { 0, 3, { 0xA0000000, 0 } }, + { 0, 6, { 0xC8000000, 0 } }, + { 0, 9, { 0xFA000000, 0 } }, + { 0, 13, { 0x9C400000, 0 } }, + { 0, 16, { 0xC3500000, 0 } }, + { 0, 19, { 0xF4240000, 0 } }, + { 0, 23, { 0x98968000, 0 } }, + { 0, 26, { 0xBEBC2000, 0 } }, + { 0, 29, { 0xEE6B2800, 0 } }, + { 0, 33, { 0x9502F900, 0 } }, + { 0, 36, { 0xBA43B740, 0 } }, + { 0, 39, { 0xE8D4A510, 0 } }, + { 0, 43, { 0x9184E72A, 0 } }, + { 0, 46, { 0xB5E620F4, 0x80000000 } }, + { 0, 49, { 0xE35FA931, 0xA0000000 } }, + { 0, 53, { 0x8E1BC9BF, 0x04000000 } }, + { 0, 56, { 0xB1A2BC2E, 0xC5000000 } }, + { 0, 59, { 0xDE0B6B3A, 0x76400000 } }, + { 0, 63, { 0x8AC72304, 0x89E80000 } }, + { 0, 66, { 0xAD78EBC5, 0xAC620000 } }, + { 0, 69, { 0xD8D726B7, 0x177A8000 } }, + { 0, 73, { 0x87867832, 0x6EAC9000 } }, + { 0, 76, { 0xA968163F, 0x0A57B400 } }, + { 0, 79, { 0xD3C21BCE, 0xCCEDA100 } }, + { 0, 83, { 0x84595161, 0x401484A0 } }, + { 0, 86, { 0xA56FA5B9, 0x9019A5C8 } }, + { 0, 89, { 0xCECB8F27, 0xF4200F3A } } }; + static struct EXTEND big_ten_powers[] = { /* representation of 10 ** (28*i) */ - { 0, 0, 0x80000000, 0 }, - { 0, 93, 0x813F3978, 0xF8940984 }, - { 0, 186, 0x82818F12, 0x81ED44A0 }, - { 0, 279, 0x83C7088E, 0x1AAB65DB }, - { 0, 372, 0x850FADC0, 0x9923329E }, - { 0, 465, 0x865B8692, 0x5B9BC5C2 }, - { 0, 558, 0x87AA9AFF, 0x79042287 }, - { 0, 651, 0x88FCF317, 0xF22241E2 }, - { 0, 744, 0x8A5296FF, 0xE33CC930 }, - { 0, 837, 0x8BAB8EEF, 0xB6409C1A }, - { 0, 930, 0x8D07E334, 0x55637EB3 }, - { 0, 1023, 0x8E679C2F, 0x5E44FF8F }, - { 0, 1116, 0x8FCAC257, 0x558EE4E6 }, - { 0, 1209, 0x91315E37, 0xDB165AA9 }, - { 0, 1302, 0x929B7871, 0xDE7F22B9 }, - { 0, 1395, 0x940919BB, 0xD4620B6D }, - { 0, 1488, 0x957A4AE1, 0xEBF7F3D4 }, - { 0, 1581, 0x96EF14C6, 0x454AA840 }, - { 0, 1674, 0x98678061, 0x27ECE4F5 }, - { 0, 1767, 0x99E396C1, 0x3A3ACFF2 } + { 0, 0, { 0x80000000, 0 } }, + { 0, 93, { 0x813F3978, 0xF8940984 } }, + { 0, 186, { 0x82818F12, 0x81ED44A0 } }, + { 0, 279, { 0x83C7088E, 0x1AAB65DB } }, + { 0, 372, { 0x850FADC0, 0x9923329E } }, + { 0, 465, { 0x865B8692, 0x5B9BC5C2 } }, + { 0, 558, { 0x87AA9AFF, 0x79042287 } }, + { 0, 651, { 0x88FCF317, 0xF22241E2 } }, + { 0, 744, { 0x8A5296FF, 0xE33CC930 } }, + { 0, 837, { 0x8BAB8EEF, 0xB6409C1A } }, + { 0, 930, { 0x8D07E334, 0x55637EB3 } }, + { 0, 1023, { 0x8E679C2F, 0x5E44FF8F } }, + { 0, 1116, { 0x8FCAC257, 0x558EE4E6 } }, + { 0, 1209, { 0x91315E37, 0xDB165AA9 } }, + { 0, 1302, { 0x929B7871, 0xDE7F22B9 } }, + { 0, 1395, { 0x940919BB, 0xD4620B6D } }, + { 0, 1488, { 0x957A4AE1, 0xEBF7F3D4 } }, + { 0, 1581, { 0x96EF14C6, 0x454AA840 } }, + { 0, 1674, { 0x98678061, 0x27ECE4F5 } }, + { 0, 1767, { 0x99E396C1, 0x3A3ACFF2 } } }; static struct EXTEND r_ten_powers[] = { /* representation of 10 ** -i */ - { 0, 0, 0x80000000, 0 }, - { 0, -4, 0xCCCCCCCC, 0xCCCCCCCD }, - { 0, -7, 0xA3D70A3D, 0x70A3D70A }, - { 0, -10, 0x83126E97, 0x8D4FDF3B }, - { 0, -14, 0xD1B71758, 0xE219652C }, - { 0, -17, 0xA7C5AC47, 0x1B478423 }, - { 0, -20, 0x8637BD05, 0xAF6C69B6 }, - { 0, -24, 0xD6BF94D5, 0xE57A42BC }, - { 0, -27, 0xABCC7711, 0x8461CEFD }, - { 0, -30, 0x89705F41, 0x36B4A597 }, - { 0, -34, 0xDBE6FECE, 0xBDEDD5BF }, - { 0, -37, 0xAFEBFF0B, 0xCB24AAFF }, - { 0, -40, 0x8CBCCC09, 0x6F5088CC }, - { 0, -44, 0xE12E1342, 0x4BB40E13 }, - { 0, -47, 0xB424DC35, 0x095CD80F }, - { 0, -50, 0x901D7CF7, 0x3AB0ACD9 }, - { 0, -54, 0xE69594BE, 0xC44DE15B }, - { 0, -57, 0xB877AA32, 0x36A4B449 }, - { 0, -60, 0x9392EE8E, 0x921D5D07 }, - { 0, -64, 0xEC1E4A7D, 0xB69561A5 }, - { 0, -67, 0xBCE50864, 0x92111AEB }, - { 0, -70, 0x971DA050, 0x74DA7BEF }, - { 0, -74, 0xF1C90080, 0xBAF72CB1 }, - { 0, -77, 0xC16D9A00, 0x95928A27 }, - { 0, -80, 0x9ABE14CD, 0x44753B53 }, - { 0, -84, 0xF79687AE, 0xD3EEC551 }, - { 0, -87, 0xC6120625, 0x76589DDB }, - { 0, -90, 0x9E74D1B7, 0x91E07E48 } + { 0, 0, { 0x80000000, 0 } }, + { 0, -4, { 0xCCCCCCCC, 0xCCCCCCCD } }, + { 0, -7, { 0xA3D70A3D, 0x70A3D70A } }, + { 0, -10, { 0x83126E97, 0x8D4FDF3B } }, + { 0, -14, { 0xD1B71758, 0xE219652C } }, + { 0, -17, { 0xA7C5AC47, 0x1B478423 } }, + { 0, -20, { 0x8637BD05, 0xAF6C69B6 } }, + { 0, -24, { 0xD6BF94D5, 0xE57A42BC } }, + { 0, -27, { 0xABCC7711, 0x8461CEFD } }, + { 0, -30, { 0x89705F41, 0x36B4A597 } }, + { 0, -34, { 0xDBE6FECE, 0xBDEDD5BF } }, + { 0, -37, { 0xAFEBFF0B, 0xCB24AAFF } }, + { 0, -40, { 0x8CBCCC09, 0x6F5088CC } }, + { 0, -44, { 0xE12E1342, 0x4BB40E13 } }, + { 0, -47, { 0xB424DC35, 0x095CD80F } }, + { 0, -50, { 0x901D7CF7, 0x3AB0ACD9 } }, + { 0, -54, { 0xE69594BE, 0xC44DE15B } }, + { 0, -57, { 0xB877AA32, 0x36A4B449 } }, + { 0, -60, { 0x9392EE8E, 0x921D5D07 } }, + { 0, -64, { 0xEC1E4A7D, 0xB69561A5 } }, + { 0, -67, { 0xBCE50864, 0x92111AEB } }, + { 0, -70, { 0x971DA050, 0x74DA7BEF } }, + { 0, -74, { 0xF1C90080, 0xBAF72CB1 } }, + { 0, -77, { 0xC16D9A00, 0x95928A27 } }, + { 0, -80, { 0x9ABE14CD, 0x44753B53 } }, + { 0, -84, { 0xF79687AE, 0xD3EEC551 } }, + { 0, -87, { 0xC6120625, 0x76589DDB } }, + { 0, -90, { 0x9E74D1B7, 0x91E07E48 } } }; static struct EXTEND r_big_ten_powers[] = { /* representation of 10 ** -(28*i) */ - { 0, 0, 0x80000000, 0 }, - { 0, -94, 0xFD87B5F2, 0x8300CA0E }, - { 0, -187, 0xFB158592, 0xBE068D2F }, - { 0, -280, 0xF8A95FCF, 0x88747D94 }, - { 0, -373, 0xF64335BC, 0xF065D37D }, - { 0, -466, 0xF3E2F893, 0xDEC3F126 }, - { 0, -559, 0xF18899B1, 0xBC3F8CA2 }, - { 0, -652, 0xEF340A98, 0x172AACE5 }, - { 0, -745, 0xECE53CEC, 0x4A314EBE }, - { 0, -838, 0xEA9C2277, 0x23EE8BCB }, - { 0, -931, 0xE858AD24, 0x8F5C22CA }, - { 0, -1024, 0xE61ACF03, 0x3D1A45DF }, - { 0, -1117, 0xE3E27A44, 0x4D8D98B8 }, - { 0, -1210, 0xE1AFA13A, 0xFBD14D6E }, - { 0, -1303, 0xDF82365C, 0x497B5454 }, - { 0, -1396, 0xDD5A2C3E, 0xAB3097CC }, - { 0, -1489, 0xDB377599, 0xB6074245 }, - { 0, -1582, 0xD91A0545, 0xCDB51186 }, - { 0, -1675, 0xD701CE3B, 0xD387BF48 }, - { 0, -1768, 0xD4EEC394, 0xD6258BF8 } + { 0, 0, { 0x80000000, 0 } }, + { 0, -94, { 0xFD87B5F2, 0x8300CA0E } }, + { 0, -187, { 0xFB158592, 0xBE068D2F } }, + { 0, -280, { 0xF8A95FCF, 0x88747D94 } }, + { 0, -373, { 0xF64335BC, 0xF065D37D } }, + { 0, -466, { 0xF3E2F893, 0xDEC3F126 } }, + { 0, -559, { 0xF18899B1, 0xBC3F8CA2 } }, + { 0, -652, { 0xEF340A98, 0x172AACE5 } }, + { 0, -745, { 0xECE53CEC, 0x4A314EBE } }, + { 0, -838, { 0xEA9C2277, 0x23EE8BCB } }, + { 0, -931, { 0xE858AD24, 0x8F5C22CA } }, + { 0, -1024, { 0xE61ACF03, 0x3D1A45DF } }, + { 0, -1117, { 0xE3E27A44, 0x4D8D98B8 } }, + { 0, -1210, { 0xE1AFA13A, 0xFBD14D6E } }, + { 0, -1303, { 0xDF82365C, 0x497B5454 } }, + { 0, -1396, { 0xDD5A2C3E, 0xAB3097CC } }, + { 0, -1489, { 0xDB377599, 0xB6074245 } }, + { 0, -1582, { 0xD91A0545, 0xCDB51186 } }, + { 0, -1675, { 0xD701CE3B, 0xD387BF48 } }, + { 0, -1768, { 0xD4EEC394, 0xD6258BF8 } } }; #define TP (int)(sizeof(ten_powers)/sizeof(ten_powers[0])) @@ -462,7 +463,7 @@ void _str_ext_cvt(const char *s, char **ss, struct EXTEND *e) int exp = 0; if (ss) *ss = (char *)s; - while (isspace(*s)) s++; + while (isspace((unsigned char) *s)) s++; e->sign = 0; e->exp = 0; diff --git a/lib/libc/ansi/misc.c b/lib/libc/ansi/misc.c index 3a7139c75..6a06b81ae 100644 --- a/lib/libc/ansi/misc.c +++ b/lib/libc/ansi/misc.c @@ -17,8 +17,6 @@ * These strings probably contain the wrong value, and we cannot obtain the * right value from the system. TZ is the only help. */ -static char ntstr[TZ_LEN + 1] = "GMT"; /* string for normal time */ -static char dststr[TZ_LEN + 1] = "GDT"; /* string for daylight saving */ long _timezone = 0; long _dst_off = 60 * 60; @@ -32,8 +30,7 @@ static struct dsttype { char ds_type; /* Unknown, Julian, Zero-based or M */ int ds_date[3]; /* months, weeks, days */ long ds_sec; /* usually 02:00:00 */ -} dststart = { 'U', { 0, 0, 0 }, 2 * 60 * 60 } - , dstend = { 'U', { 0, 0, 0 }, 2 * 60 * 60 }; +}; const char *_days[] = { "Sunday", "Monday", "Tuesday", "Wednesday", @@ -52,175 +49,3 @@ const int _ytab[2][12] = { { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } }; -static const char * -parseZoneName(register char *buf, register const char *p) -{ - register int n = 0; - - if (*p == ':') return NULL; - while (*p && !isdigit(*p) && *p != ',' && *p != '-' && *p != '+') { - if (n < TZ_LEN) - *buf++ = *p; - p++; - n++; - } - if (n < 3) return NULL; /* error */ - *buf = '\0'; - return p; -} - -static const char * -parseTime(register long *tm, const char *p, register struct dsttype *dst) -{ - register int n = 0; - register const char *q = p; - char ds_type = (dst ? dst->ds_type : '\0'); - - if (dst) dst->ds_type = 'U'; - - *tm = 0; - while(*p >= '0' && *p <= '9') { - n = 10 * n + (*p++ - '0'); - } - if (q == p) return NULL; /* "The hour shall be required" */ - if (n < 0 || n >= 24) return NULL; - *tm = n * 60 * 60; - if (*p == ':') { - p++; - n = 0; - while(*p >= '0' && *p <= '9') { - n = 10 * n + (*p++ - '0'); - } - if (q == p) return NULL; /* format error */ - if (n < 0 || n >= 60) return NULL; - *tm += n * 60; - if (*p == ':') { - p++; - n = 0; - while(*p >= '0' && *p <= '9') { - n = 10 * n + (*p++ - '0'); - } - if (q == p) return NULL; /* format error */ - if (n < 0 || n >= 60) return NULL; - *tm += n; - } - } - if (dst) { - dst->ds_type = ds_type; - dst->ds_sec = *tm; - } - return p; -} - -static const char * -parseDate(register char *buf, register const char *p, struct dsttype *dstinfo) -{ - register const char *q; - register int n = 0; - int cnt = 0; - const int bnds[3][2] = { { 1, 12 }, - { 1, 5 }, - { 0, 6} - }; - char ds_type; - - if (*p != 'M') { - if (*p == 'J') { - *buf++ = *p++; - ds_type = 'J'; - } - else ds_type = 'Z'; - q = p; - while(*p >= '0' && *p <= '9') { - n = 10 * n + (*p - '0'); - *buf++ = *p++; - } - if (q == p) return NULL; /* format error */ - if (n < (ds_type == 'J') || n > 365) return NULL; - dstinfo->ds_type = ds_type; - dstinfo->ds_date[0] = n; - return p; - } - ds_type = 'M'; - do { - *buf++ = *p++; - q = p; - n = 0; - while(*p >= '0' && *p <= '9') { - n = 10 * n + (*p - '0'); - *buf++ = *p++; - } - if (q == p) return NULL; /* format error */ - if (n < bnds[cnt][0] || n > bnds[cnt][1]) return NULL; - dstinfo->ds_date[cnt] = n; - cnt++; - } while (cnt < 3 && *p == '.'); - if (cnt != 3) return NULL; - *buf = '\0'; - dstinfo->ds_type = ds_type; - return p; -} - -static const char * -parseRule(register char *buf, register const char *p) -{ - long time; - register const char *q; - - if (!(p = parseDate(buf, p, &dststart))) return NULL; - buf += strlen(buf); - if (*p == '/') { - q = ++p; - if (!(p = parseTime(&time, p, &dststart))) return NULL; - while( p != q) *buf++ = *q++; - } - if (*p != ',') return NULL; - p++; - if (!(p = parseDate(buf, p, &dstend))) return NULL; - buf += strlen(buf); - if (*p == '/') { - q = ++p; - if (!(p = parseTime(&time, p, &dstend))) return NULL; - while((*buf++ = *q++)); - } - if (*p) return NULL; - return p; -} - -static int -last_sunday(register int day, const register struct tm *timep) -{ - int first = FIRSTSUNDAY(timep); - - if (day >= 58 && LEAPYEAR(YEAR0 + timep->tm_year)) day++; - if (day < first) return first; - return day - (day - first) % 7; -} - -static int -date_of(const register struct dsttype *dst, const struct tm *timep) -{ - int leap = LEAPYEAR(YEAR0 + timep->tm_year); - int firstday, tmpday; - register int day, month; - - if (dst->ds_type != 'M') { - return dst->ds_date[0] - - ((dst->ds_type == 'J') - && leap - && dst->ds_date[0] < 58); - } - day = 0; - month = 1; - while (month < dst->ds_date[0]) { - day += _ytab[leap][month - 1]; - month++; - } - firstday = (day + FIRSTDAYOF(timep)) % 7; - tmpday = day; - day += (dst->ds_date[2] - firstday + 7) % 7 - + 7 * (dst->ds_date[1] - 1); - if (day >= tmpday + _ytab[leap][month-1]) day -= 7; - return day; -} - diff --git a/lib/libc/other/termcap.c b/lib/libc/other/termcap.c index 4d3fa2f02..0ddd9c891 100644 --- a/lib/libc/other/termcap.c +++ b/lib/libc/other/termcap.c @@ -96,7 +96,7 @@ char *name; def_len = strlen(bp) - 2; } while (bp[def_len] == '\\'); - while (isspace(*cp)) cp++; + while (isspace((unsigned char) *cp)) cp++; /* Comment lines start with a '#' */ if (*cp == '#') continue; @@ -132,7 +132,7 @@ char *id; while (*cp++ != ':') if (cp[-1] == '\0') return(-1); - while (isspace(*cp)) cp++; + while (isspace((unsigned char) *cp)) cp++; if (strncmp(cp, id, 2) == 0 && cp[2] == '#') return(atoi(cp + 3)); } @@ -156,7 +156,7 @@ char *id; while (*cp++ != ':') if (cp[-1] == '\0') return(0); - while (isspace(*cp)) cp++; + while (isspace((unsigned char) *cp)) cp++; if (strncmp(cp, id, 2) == 0) return(1); } @@ -182,7 +182,7 @@ char **area; while (*cp++ != ':') if (cp[-1] == '\0') return((char *)NULL); - while (isspace(*cp)) cp++; + while (isspace((unsigned char) *cp)) cp++; if (strncmp(cp, id, 2) == 0 && cp[2] == '=') { for (cp += 3; *cp && *cp != ':'; wsp++, cp++) switch (*cp) { diff --git a/lib/libc/regex/cclass.h b/lib/libc/regex/cclass.h index a29a92ee9..c351c7c1c 100644 --- a/lib/libc/regex/cclass.h +++ b/lib/libc/regex/cclass.h @@ -43,28 +43,17 @@ static struct cclass { char *chars; char *multis; } cclasses[] = { - "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ -0123456789", "", - "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", - "", - "blank", " \t", "", - "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\ -\25\26\27\30\31\32\33\34\35\36\37\177", "", - "digit", "0123456789", "", - "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ -0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", - "", - "lower", "abcdefghijklmnopqrstuvwxyz", - "", - "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ -0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", - "", - "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", - "", - "space", "\t\n\v\f\r ", "", - "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", - "", - "xdigit", "0123456789ABCDEFabcdef", - "", - NULL, 0, "" + { "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "" }, + { "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "" }, + { "blank", " \t", "" }, + { "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177", "" }, + { "digit", "0123456789", "" }, + { "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "" }, + { "lower", "abcdefghijklmnopqrstuvwxyz", "" }, + { "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", "" }, + { "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "" }, + { "space", "\t\n\v\f\r ", "" }, + { "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "" }, + { "xdigit", "0123456789ABCDEFabcdef", "" }, + { NULL, 0, "" } }; diff --git a/lib/libc/regex/cname.h b/lib/libc/regex/cname.h index c1632ebb1..4af7134fc 100644 --- a/lib/libc/regex/cname.h +++ b/lib/libc/regex/cname.h @@ -42,100 +42,100 @@ static struct cname { char *name; char code; } cnames[] = { - "NUL", '\0', - "SOH", '\001', - "STX", '\002', - "ETX", '\003', - "EOT", '\004', - "ENQ", '\005', - "ACK", '\006', - "BEL", '\007', - "alert", '\007', - "BS", '\010', - "backspace", '\b', - "HT", '\011', - "tab", '\t', - "LF", '\012', - "newline", '\n', - "VT", '\013', - "vertical-tab", '\v', - "FF", '\014', - "form-feed", '\f', - "CR", '\015', - "carriage-return", '\r', - "SO", '\016', - "SI", '\017', - "DLE", '\020', - "DC1", '\021', - "DC2", '\022', - "DC3", '\023', - "DC4", '\024', - "NAK", '\025', - "SYN", '\026', - "ETB", '\027', - "CAN", '\030', - "EM", '\031', - "SUB", '\032', - "ESC", '\033', - "IS4", '\034', - "FS", '\034', - "IS3", '\035', - "GS", '\035', - "IS2", '\036', - "RS", '\036', - "IS1", '\037', - "US", '\037', - "space", ' ', - "exclamation-mark", '!', - "quotation-mark", '"', - "number-sign", '#', - "dollar-sign", '$', - "percent-sign", '%', - "ampersand", '&', - "apostrophe", '\'', - "left-parenthesis", '(', - "right-parenthesis", ')', - "asterisk", '*', - "plus-sign", '+', - "comma", ',', - "hyphen", '-', - "hyphen-minus", '-', - "period", '.', - "full-stop", '.', - "slash", '/', - "solidus", '/', - "zero", '0', - "one", '1', - "two", '2', - "three", '3', - "four", '4', - "five", '5', - "six", '6', - "seven", '7', - "eight", '8', - "nine", '9', - "colon", ':', - "semicolon", ';', - "less-than-sign", '<', - "equals-sign", '=', - "greater-than-sign", '>', - "question-mark", '?', - "commercial-at", '@', - "left-square-bracket", '[', - "backslash", '\\', - "reverse-solidus", '\\', - "right-square-bracket", ']', - "circumflex", '^', - "circumflex-accent", '^', - "underscore", '_', - "low-line", '_', - "grave-accent", '`', - "left-brace", '{', - "left-curly-bracket", '{', - "vertical-line", '|', - "right-brace", '}', - "right-curly-bracket", '}', - "tilde", '~', - "DEL", '\177', - NULL, 0, + { "NUL", '\0' }, + { "SOH", '\001' }, + { "STX", '\002' }, + { "ETX", '\003' }, + { "EOT", '\004' }, + { "ENQ", '\005' }, + { "ACK", '\006' }, + { "BEL", '\007' }, + { "alert", '\007' }, + { "BS", '\010' }, + { "backspace", '\b' }, + { "HT", '\011' }, + { "tab", '\t' }, + { "LF", '\012' }, + { "newline", '\n' }, + { "VT", '\013' }, + { "vertical-tab", '\v' }, + { "FF", '\014' }, + { "form-feed", '\f' }, + { "CR", '\015' }, + { "carriage-return", '\r' }, + { "SO", '\016' }, + { "SI", '\017' }, + { "DLE", '\020' }, + { "DC1", '\021' }, + { "DC2", '\022' }, + { "DC3", '\023' }, + { "DC4", '\024' }, + { "NAK", '\025' }, + { "SYN", '\026' }, + { "ETB", '\027' }, + { "CAN", '\030' }, + { "EM", '\031' }, + { "SUB", '\032' }, + { "ESC", '\033' }, + { "IS4", '\034' }, + { "FS", '\034' }, + { "IS3", '\035' }, + { "GS", '\035' }, + { "IS2", '\036' }, + { "RS", '\036' }, + { "IS1", '\037' }, + { "US", '\037' }, + { "space", ' ' }, + { "exclamation-mark", '!' }, + { "quotation-mark", '"' }, + { "number-sign", '#' }, + { "dollar-sign", '$' }, + { "percent-sign", '%' }, + { "ampersand", '&' }, + { "apostrophe", '\'' }, + { "left-parenthesis", '(' }, + { "right-parenthesis", ')' }, + { "asterisk", '*' }, + { "plus-sign", '+' }, + { "comma", ',' }, + { "hyphen", '-' }, + { "hyphen-minus", '-' }, + { "period", '.' }, + { "full-stop", '.' }, + { "slash", '/' }, + { "solidus", '/' }, + { "zero", '0' }, + { "one", '1' }, + { "two", '2' }, + { "three", '3' }, + { "four", '4' }, + { "five", '5' }, + { "six", '6' }, + { "seven", '7' }, + { "eight", '8' }, + { "nine", '9' }, + { "colon", ':' }, + { "semicolon", ';' }, + { "less-than-sign", '<' }, + { "equals-sign", '=' }, + { "greater-than-sign", '>' }, + { "question-mark", '?' }, + { "commercial-at", '@' }, + { "left-square-bracket", '[' }, + { "backslash", '\\' }, + { "reverse-solidus", '\\' }, + { "right-square-bracket", ']' }, + { "circumflex", '^' }, + { "circumflex-accent", '^' }, + { "underscore", '_' }, + { "low-line", '_' }, + { "grave-accent", '`' }, + { "left-brace", '{' }, + { "left-curly-bracket", '{' }, + { "vertical-line", '|' }, + { "right-brace", '}' }, + { "right-curly-bracket", '}' }, + { "tilde", '~' }, + { "DEL", '\177' }, + { NULL, 0 } }; diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c index cd15a1680..9b616a8b5 100644 --- a/lib/libc/regex/regcomp.c +++ b/lib/libc/regex/regcomp.c @@ -107,9 +107,6 @@ static int freezeset(struct parse *p, cset *cs); static int firstch(struct parse *p, cset *cs); static int nch(struct parse *p, cset *cs); static void mcadd(struct parse *p, cset *cs, char *cp); -static void mcsub(cset *cs, char *cp); -static int mcin(cset *cs, char *cp); -static char *mcfind(cset *cs, char *cp); static void mcinvert(struct parse *p, cset *cs); static void mccase(struct parse *p, cset *cs); static int isinsets(struct re_guts *g, int c); @@ -677,7 +674,6 @@ static void p_bracket(p) register struct parse *p; { - register char c; register cset *cs = allocset(p); register int invert = 0; @@ -825,7 +821,7 @@ register cset *cs; register char *u; register char c; - while (MORE() && isalpha(PEEK())) + while (MORE() && isalpha((unsigned char) (PEEK()))) NEXT(); len = p->next - sp; for (cp = cclasses; cp->name != NULL; cp++) @@ -893,7 +889,6 @@ int endc; /* name ended by endc,']' */ register char *sp = p->next; register struct cname *cp; register int len; - register char c; while (MORE() && !SEETWO(endc, ']')) NEXT(); @@ -1268,64 +1263,6 @@ register char *cp; cs->multis[cs->smultis - 1] = '\0'; } -/* - - mcsub - subtract a collating element from a cset - == static void mcsub(register cset *cs, register char *cp); - */ -static void -mcsub(cs, cp) -register cset *cs; -register char *cp; -{ - register char *fp = mcfind(cs, cp); - register size_t len = strlen(fp); - - assert(fp != NULL); - (void) memmove(fp, fp + len + 1, - cs->smultis - (fp + len + 1 - cs->multis)); - cs->smultis -= len; - - if (cs->smultis == 0) { - free(cs->multis); - cs->multis = NULL; - return; - } - - cs->multis = realloc(cs->multis, cs->smultis); - assert(cs->multis != NULL); -} - -/* - - mcin - is a collating element in a cset? - == static int mcin(register cset *cs, register char *cp); - */ -static int -mcin(cs, cp) -register cset *cs; -register char *cp; -{ - return(mcfind(cs, cp) != NULL); -} - -/* - - mcfind - find a collating element in a cset - == static char *mcfind(register cset *cs, register char *cp); - */ -static char * -mcfind(cs, cp) -register cset *cs; -register char *cp; -{ - register char *p; - - if (cs->multis == NULL) - return(NULL); - for (p = cs->multis; *p != '\0'; p += strlen(p) + 1) - if (strcmp(cp, p) == 0) - return(p); - return(NULL); -} - /* - mcinvert - invert the list of collating elements in a cset == static void mcinvert(register struct parse *p, register cset *cs); diff --git a/lib/libc/regex/regerror.c b/lib/libc/regex/regerror.c index 76f7f8d9c..c207cb1e8 100644 --- a/lib/libc/regex/regerror.c +++ b/lib/libc/regex/regerror.c @@ -91,23 +91,23 @@ static struct rerr { char *name; char *explain; } rerrs[] = { - REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match", - REG_BADPAT, "REG_BADPAT", "invalid regular expression", - REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element", - REG_ECTYPE, "REG_ECTYPE", "invalid character class", - REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)", - REG_ESUBREG, "REG_ESUBREG", "invalid backreference number", - REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced", - REG_EPAREN, "REG_EPAREN", "parentheses not balanced", - REG_EBRACE, "REG_EBRACE", "braces not balanced", - REG_BADBR, "REG_BADBR", "invalid repetition count(s)", - REG_ERANGE, "REG_ERANGE", "invalid character range", - REG_ESPACE, "REG_ESPACE", "out of memory", - REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid", - REG_EMPTY, "REG_EMPTY", "empty (sub)expression", - REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug", - REG_INVARG, "REG_INVARG", "invalid argument to regex routine", - 0, "", "*** unknown regexp error code ***", + { REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match" }, + { REG_BADPAT, "REG_BADPAT", "invalid regular expression" }, + { REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" }, + { REG_ECTYPE, "REG_ECTYPE", "invalid character class" }, + { REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)" }, + { REG_ESUBREG, "REG_ESUBREG", "invalid backreference number" }, + { REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced" }, + { REG_EPAREN, "REG_EPAREN", "parentheses not balanced" }, + { REG_EBRACE, "REG_EBRACE", "braces not balanced" }, + { REG_BADBR, "REG_BADBR", "invalid repetition count(s)" }, + { REG_ERANGE, "REG_ERANGE", "invalid character range" }, + { REG_ESPACE, "REG_ESPACE", "out of memory" }, + { REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid" }, + { REG_EMPTY, "REG_EMPTY", "empty (sub)expression" }, + { REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug" }, + { REG_INVARG, "REG_INVARG", "invalid argument to regex routine" }, + { 0, "", "*** unknown regexp error code ***" } }; /* @@ -169,8 +169,6 @@ const regex_t *preg; char *localbuf; { register struct rerr *r; - register size_t siz; - register char *p; for (r = rerrs; r->code != 0; r++) if (strcmp(r->name, preg->re_endp) == 0) diff --git a/lib/libc/stdtime/asctime.c b/lib/libc/stdtime/asctime.c index f5d8f533e..957fdba40 100644 --- a/lib/libc/stdtime/asctime.c +++ b/lib/libc/stdtime/asctime.c @@ -11,7 +11,6 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)asctime.c 7.32"; #endif /* !defined NOID */ #endif /* !defined lint */ diff --git a/lib/libc/stdtime/date.c b/lib/libc/stdtime/date.c index 5f5c8b6ad..6dcd53684 100644 --- a/lib/libc/stdtime/date.c +++ b/lib/libc/stdtime/date.c @@ -1,6 +1,5 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)date.c 7.45"; /* ** Modified from the UCB version with the SCCS ID appearing below. */ diff --git a/lib/libc/stdtime/difftime.c b/lib/libc/stdtime/difftime.c index c5efbcae7..f6295277b 100644 --- a/lib/libc/stdtime/difftime.c +++ b/lib/libc/stdtime/difftime.c @@ -5,7 +5,6 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)difftime.c 7.19"; #endif /* !defined NOID */ #endif /* !defined lint */ diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c index 465fc5f23..15f417eea 100644 --- a/lib/libc/stdtime/localtime.c +++ b/lib/libc/stdtime/localtime.c @@ -5,7 +5,6 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)localtime.c 7.99"; #endif /* !defined NOID */ #endif /* !defined lint */ diff --git a/lib/libc/stdtime/logwtmp.c b/lib/libc/stdtime/logwtmp.c index 9840df4c4..d41f8e1a6 100644 --- a/lib/libc/stdtime/logwtmp.c +++ b/lib/libc/stdtime/logwtmp.c @@ -1,6 +1,5 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)logwtmp.c 7.7"; /* As received from UCB, with include reordering and OLD_TIME condition. */ #endif /* !defined NOID */ #endif /* !defined lint */ diff --git a/lib/libc/stdtime/private.h b/lib/libc/stdtime/private.h index 85ad102ad..460e4eb88 100644 --- a/lib/libc/stdtime/private.h +++ b/lib/libc/stdtime/private.h @@ -21,7 +21,6 @@ #ifndef lint #ifndef NOID -static char privatehid[] = "@(#)private.h 7.55"; #endif /* !defined NOID */ #endif /* !defined lint */ diff --git a/lib/libc/stdtime/strftime.c b/lib/libc/stdtime/strftime.c index af328ce54..892d742e3 100644 --- a/lib/libc/stdtime/strftime.c +++ b/lib/libc/stdtime/strftime.c @@ -1,6 +1,5 @@ #ifndef lint #ifndef NOID -static char elsieid[] = "@(#)strftime.c 7.75"; /* ** Based on the UCB version with the ID appearing below. ** This is ANSIish only when "multibyte character == plain character". diff --git a/lib/libedit/editline.c b/lib/libedit/editline.c index 355063a19..e32b71464 100644 --- a/lib/libedit/editline.c +++ b/lib/libedit/editline.c @@ -294,7 +294,7 @@ reposition() CHAR *p; TTYput('\r'); - TTYputs((CONST CHAR *)Prompt); + TTYputs((CHAR *)Prompt); for (i = Point, p = Line; --i >= 0; p++) TTYshow(*p); } @@ -487,8 +487,8 @@ insert_string(p) STATIC STATUS redisplay() { - TTYputs((CONST CHAR *)NEWLINE); - TTYputs((CONST CHAR *)Prompt); + TTYputs((CHAR *) NEWLINE); + TTYputs((CHAR *)Prompt); TTYstring(Line); return CSmove; } @@ -640,12 +640,12 @@ h_search() clear_line(); old_prompt = Prompt; Prompt = "Search: "; - TTYputs((CONST CHAR *)Prompt); + TTYputs((CHAR *)Prompt); move = Repeat == NO_ARG ? prev_hist : next_hist; p = editinput(); Prompt = old_prompt; Searching = 0; - TTYputs((CONST CHAR *)Prompt); + TTYputs((CHAR *)Prompt); if (p == NULL && Signal > 0) { Signal = 0; clear_line(); @@ -1007,7 +1007,7 @@ readline(prompt) ScreenSize = SCREEN_INC; Screen = NEW(char, ScreenSize); Prompt = prompt ? prompt : (char *)NIL; - TTYputs((CONST CHAR *)Prompt); + TTYputs((CHAR *)Prompt); if ((line = editinput()) != NULL) { line = (CHAR *)strdup((char *)line); TTYputs((CHAR *)NEWLINE); diff --git a/lib/libsys/gcov.c b/lib/libsys/gcov.c index 9a8a70d7b..ab5eb8cc4 100644 --- a/lib/libsys/gcov.c +++ b/lib/libsys/gcov.c @@ -16,7 +16,6 @@ #include static int grant, pos; /* data-buffer pointer from user space tool */ -static int gcov_fd=0; /* file descriptor for writing gcov data */ static int gcov_enable=0; /* nothing will be done with gcov-data if zero */ static int gcov_buff_sz; /* size of user space buffer */ static FILE gcov_file; /* used as fopen() return value. */ diff --git a/lib/libsys/get_randomness.c b/lib/libsys/get_randomness.c index d603735b9..5313c4e7b 100644 --- a/lib/libsys/get_randomness.c +++ b/lib/libsys/get_randomness.c @@ -5,6 +5,7 @@ #include #include #include +#include #include /*===========================================================================* diff --git a/lib/libsys/getidle.c b/lib/libsys/getidle.c index ce7ddf70d..9a57ae884 100644 --- a/lib/libsys/getidle.c +++ b/lib/libsys/getidle.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include static u64_t start, idle; static int running = 0; diff --git a/lib/libsys/profile.c b/lib/libsys/profile.c index d325749d0..9438712fa 100644 --- a/lib/libsys/profile.c +++ b/lib/libsys/profile.c @@ -18,6 +18,7 @@ #include #include #include +#include PRIVATE char cpath[CPROF_CPATH_MAX_LEN]; /* current call path string */ PRIVATE int cpath_len; /* current call path len */ diff --git a/lib/libsys/sef.c b/lib/libsys/sef.c index 5be45ae6f..796da4c18 100644 --- a/lib/libsys/sef.c +++ b/lib/libsys/sef.c @@ -2,6 +2,9 @@ #include #include #include +#include +#include +#include /* Self variables. */ #define SEF_SELF_NAME_MAXLEN 20 @@ -21,6 +24,7 @@ FORWARD _PROTOTYPE( void sef_debug_refresh_params, (void) ); PUBLIC _PROTOTYPE( char* sef_debug_header, (void) ); /* SEF Init prototypes. */ +EXTERN _PROTOTYPE( int do_sef_gcov_request, (message *m_ptr) ); EXTERN _PROTOTYPE( int do_sef_rs_init, (endpoint_t old_endpoint) ); EXTERN _PROTOTYPE( int do_sef_init_request, (message *m_ptr) ); diff --git a/lib/libsys/spin.c b/lib/libsys/spin.c index 43eaca7cb..ce06b0dde 100644 --- a/lib/libsys/spin.c +++ b/lib/libsys/spin.c @@ -12,6 +12,7 @@ */ #include "sysutil.h" #include +#include /* Number of microseconds to keep spinning initially, without performing a * system call. We pick a value somewhat smaller than a typical clock tick. diff --git a/lib/libsys/timing.c b/lib/libsys/timing.c index 89c036294..12b39ba57 100644 --- a/lib/libsys/timing.c +++ b/lib/libsys/timing.c @@ -3,6 +3,7 @@ #include #include #include +#include #define HIGHCOUNT 0 #define LOWCOUNT 1 diff --git a/lib/libusb/usb.c b/lib/libusb/usb.c index 2f550ecbc..43ea2c4b5 100644 --- a/lib/libusb/usb.c +++ b/lib/libusb/usb.c @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include #include #include