summaryrefslogtreecommitdiff
path: root/src/args.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2011-09-06 14:56:17 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2011-09-06 14:56:17 +0200
commit78b663d0737016099098e8fdac52354549fdc26b (patch)
tree76d6f4c53ba3f835c60b088f53686bcf0eebecf9 /src/args.c
parent33450f9ba99022c4b89fecce07652c665ed9c3e6 (diff)
parent9f1fed3ed1f77620334302616a6ed881ca78878d (diff)
downloadcalcurse-78b663d0737016099098e8fdac52354549fdc26b.zip
Merge branch 'maint'
Conflicts: src/io.c
Diffstat (limited to 'src/args.c')
-rw-r--r--src/args.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/args.c b/src/args.c
index 060ac3d..8600d33 100644
--- a/src/args.c
+++ b/src/args.c
@@ -193,13 +193,19 @@ print_notefile (FILE *out, char *filename, int nbtab)
{
char path_to_notefile[BUFSIZ];
FILE *notefile;
- char linestarter[BUFSIZ] = "";
+ char linestarter[BUFSIZ];
char buffer[BUFSIZ];
int i;
int printlinestarter = 1;
- for (i = 0; i < nbtab; i++)
- (void)snprintf(linestarter, BUFSIZ, "%s\t", linestarter);
+ if (nbtab < BUFSIZ)
+ {
+ 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);
notefile = fopen (path_to_notefile, "r");