upas/fs: fix %.*s format usage

front
cinap_lenrek 2019-02-25 03:39:31 +01:00
parent 2e5cd278d7
commit 5ec91a6413
5 changed files with 7 additions and 12 deletions

View File

@ -591,9 +591,8 @@ imap4cram(Imap *imap)
if(n == -1)
return "cannot find IMAP password";
for(i = 0; i < n; i++)
if(rbuf[i] >= 'A' && rbuf[i] <= 'Z')
rbuf[i] += 'a' - 'A';
l = snprint(ubuf, sizeof ubuf, "%s %.*s", usr, n, rbuf);
rbuf[i] = tolower(rbuf[i]);
l = snprint(ubuf, sizeof ubuf, "%s %.*s", usr, utfnlen(rbuf, n), rbuf);
idprint(imap, "raw cram [%s]\n", ubuf);
snprint(ebuf, sizeof ebuf, "%.*[", l, ubuf);

View File

@ -26,10 +26,8 @@ static void
parseunix(Message *m)
{
char *s, *p;
int l;
l = m->header - m->start;
m->unixheader = smprint("%.*s", l, m->start);
m->unixheader = smprint("%.*s", utfnlen(m->start, m->header - m->start), m->start);
s = m->start + 5;
if((p = strchr(s, ' ')) == nil)
return;

View File

@ -46,7 +46,7 @@ chkunix(char *s, int n)
r = chkunix0(s, n);
if(r == -1)
eprint("plan9: warning naked from [%.*s]\n", n, s);
eprint("plan9: warning naked from [%.*s]\n", utfnlen(s, n), s);
return r;
}
@ -54,11 +54,9 @@ static char*
parseunix(Message *m)
{
char *s, *p, *q;
int l;
Tm tm;
l = m->header - m->start;
m->unixheader = smprint("%.*s", l, m->start);
m->unixheader = smprint("%.*s", utfnlen(m->start, m->header - m->start), m->start);
s = m->start + 5;
if((p = strchr(s, ' ')) == nil)
return s;

View File

@ -182,7 +182,7 @@ pop3login(Pop *pop)
if(s = pop3capa(pop))
return s;
pop3cmd(pop, "APOP %s %.*s", user, n, buf);
pop3cmd(pop, "APOP %s %.*s", user, utfnlen(buf, n), buf);
if(!isokay(s = pop3resp(pop)))
return s;

View File

@ -85,7 +85,7 @@ strtotm(char *p, Tm *t)
tm.year = j - 1900;
continue;
}
//eprint("strtotm: garbage %.*s\n", q - p, p);
//eprint("strtotm: garbage %.*s\n", utfnlen(p, q - p), p);
}
if(tm.mon < 0 || tm.year < 0
|| tm.hour < 0 || tm.min < 0