Rework indentation code in print_notefile()
Do not use snprintf() here as printf() behaviour is undefined if the destination pointer is used as a parameter. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
806a13ed8a
commit
b59070a49e
12
src/args.c
12
src/args.c
@ -199,13 +199,19 @@ print_notefile (FILE *out, char *filename, int nbtab)
|
|||||||
{
|
{
|
||||||
char path_to_notefile[BUFSIZ];
|
char path_to_notefile[BUFSIZ];
|
||||||
FILE *notefile;
|
FILE *notefile;
|
||||||
char linestarter[BUFSIZ] = "";
|
char linestarter[BUFSIZ];
|
||||||
char buffer[BUFSIZ];
|
char buffer[BUFSIZ];
|
||||||
int i;
|
int i;
|
||||||
int printlinestarter = 1;
|
int printlinestarter = 1;
|
||||||
|
|
||||||
for (i = 0; i < nbtab; i++)
|
if (nbtab < BUFSIZ)
|
||||||
(void)snprintf(linestarter, BUFSIZ, "%s\t", linestarter);
|
{
|
||||||
|
for (i = 0; i < nbtab; i++)
|
||||||
|
linestarter[i] = '\t';
|
||||||
|
linestarter[nbtab] = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
linestarter[0] = '\0';
|
||||||
|
|
||||||
(void)snprintf (path_to_notefile, BUFSIZ, "%s/%s", path_notes, filename);
|
(void)snprintf (path_to_notefile, BUFSIZ, "%s/%s", path_notes, filename);
|
||||||
notefile = fopen (path_to_notefile, "r");
|
notefile = fopen (path_to_notefile, "r");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user