Make it compile on sparc/sparc64. Cast size_t to int for field precision.
This commit is contained in:
parent
5936836bb1
commit
ba2ee12485
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: var.c,v 1.1 2005/11/03 21:16:41 dillo Exp $ */
|
/* $NetBSD: var.c,v 1.2 2005/11/04 09:26:05 hannken Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
__RCSID("$NetBSD: var.c,v 1.1 2005/11/03 21:16:41 dillo Exp $");
|
__RCSID("$NetBSD: var.c,v 1.2 2005/11/04 09:26:05 hannken Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -87,7 +87,7 @@ var_get(const char *fname, const char *variable)
|
|||||||
else {
|
else {
|
||||||
value = malloc(thislen+1);
|
value = malloc(thislen+1);
|
||||||
}
|
}
|
||||||
sprintf(value+valuelen, "%.*s", thislen, p);
|
sprintf(value+valuelen, "%.*s", (int)thislen, p);
|
||||||
valuelen += thislen;
|
valuelen += thislen;
|
||||||
}
|
}
|
||||||
(void) fclose(fp);
|
(void) fclose(fp);
|
||||||
@ -146,7 +146,7 @@ var_set(const char *fname, const char *variable, const char *value)
|
|||||||
if (fp) {
|
if (fp) {
|
||||||
while ((line = fgetln(fp, &len)) != (char *) NULL) {
|
while ((line = fgetln(fp, &len)) != (char *) NULL) {
|
||||||
if (var_cmp(line, len, variable, varlen) == NULL)
|
if (var_cmp(line, len, variable, varlen) == NULL)
|
||||||
fprintf(fout, "%.*s", len, line);
|
fprintf(fout, "%.*s", (int)len, line);
|
||||||
else {
|
else {
|
||||||
if (!done && value) {
|
if (!done && value) {
|
||||||
var_print(fout, variable, value);
|
var_print(fout, variable, value);
|
||||||
@ -230,7 +230,7 @@ var_print(FILE *f, const char *variable, const char *value)
|
|||||||
|
|
||||||
while ((p=strchr(value, '\n')) != NULL) {
|
while ((p=strchr(value, '\n')) != NULL) {
|
||||||
if (p != value)
|
if (p != value)
|
||||||
fprintf(f, "%s=%.*s\n", variable, p-value, value);
|
fprintf(f, "%s=%.*s\n", variable, (int)(p-value), value);
|
||||||
value = p+1;
|
value = p+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user