mirror of https://github.com/dirtbags/moth.git
I found %*s in printf! Converting...
This commit is contained in:
parent
7305ae79cb
commit
cf282dff48
|
@ -70,9 +70,10 @@ int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char service[50];
|
char service[50];
|
||||||
|
size_t servicelen;
|
||||||
char token[80];
|
char token[80];
|
||||||
uint32_t key[4];
|
|
||||||
size_t tokenlen;
|
size_t tokenlen;
|
||||||
|
uint32_t key[4];
|
||||||
|
|
||||||
/* Seed the random number generator. This ought to be unpredictable
|
/* Seed the random number generator. This ought to be unpredictable
|
||||||
enough for a contest. */
|
enough for a contest. */
|
||||||
|
@ -80,12 +81,12 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
/* Read service name. */
|
/* Read service name. */
|
||||||
{
|
{
|
||||||
size_t len;
|
ssize_t len;
|
||||||
int i;
|
|
||||||
|
|
||||||
len = read(0, service, sizeof(service) - 1);
|
len = read(0, service, sizeof(service) - 1);
|
||||||
for (i = 0; (i < len) && isalnum(service[i]); i += 1);
|
for (servicelen = 0;
|
||||||
service[i] = '\0';
|
(servicelen < len) && isalnum(service[servicelen]);
|
||||||
|
servicelen += 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read in that service's key. */
|
/* Read in that service's key. */
|
||||||
|
@ -121,9 +122,9 @@ main(int argc, char *argv[])
|
||||||
bubblebabble(digest, (char *)crap, itokenlen);
|
bubblebabble(digest, (char *)crap, itokenlen);
|
||||||
|
|
||||||
/* Append digest to service name. */
|
/* Append digest to service name. */
|
||||||
tokenlen = (size_t)my_snprintf(token, sizeof(token),
|
tokenlen = (size_t)snprintf(token, sizeof(token),
|
||||||
"%s:%s",
|
"%*s:%s",
|
||||||
service, digest);
|
servicelen, service, digest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write that token out now. */
|
/* Write that token out now. */
|
||||||
|
|
Loading…
Reference in New Issue