- Timestamp:
- Aug 9, 2017, 12:47:22 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20170809/src/libfits/header/F_print.c
r34577 r40113 7 7 /* this function expects one more argument, the value to be written */ 8 8 9 static char blank[] = " "; 10 char string[82], line[80]; 9 char string[82], line[82], blank[82]; 11 10 char *p; 12 11 va_list argp; … … 41 40 memset (p, ' ', FT_LINE_LENGTH); 42 41 42 memset (blank, ' ', FT_LINE_LENGTH); blank[FT_LINE_LENGTH] = 0; 43 43 44 /* write the new FITS card, setting the comment to be blank */ 44 45 /* in these lines, the value field will expand as needed, forcing out the comment … … 67 68 char *ptr = va_arg (argp, char *); 68 69 if (!ptr) goto invalid; 69 strcpy (line, ptr); 70 line[68] = 0; 70 strncpy (line, ptr, 68); line[68] = 0; 71 71 snprintf (string, 81, "%-8s= '%-8s' / %46s ", field, line, blank); 72 72 goto found_it; … … 88 88 /* this function expects one more argument, the value to be written */ 89 89 90 static char blank[] = " "; 91 char string[82], line[80]; 92 char *p, a; 90 char string[82], line[82], blank[82]; 91 char *p; 93 92 va_list argp; 94 93 95 94 va_start (argp, N); 95 bzero (line, 82); 96 bzero (string, 82); 97 bzero (blank, 82); 96 98 97 99 if (mode[0] != '%') { … … 122 124 memset (p, ' ', FT_LINE_LENGTH); 123 125 126 memset (blank, ' ', FT_LINE_LENGTH); blank[FT_LINE_LENGTH] = 0; 127 124 128 /* write the boolean mode */ 125 129 if (!strcmp (mode, "%t")) { 126 a = va_arg (argp, int);127 if (a == 1) 130 int a = va_arg (argp, int); 131 if (a == 1) { 128 132 snprintf (string, 81, "%-8s= %18s T / %46s ", field, blank, blank); 129 else133 } else { 130 134 snprintf (string, 81, "%-8s= %18s F / %46s ", field, blank, blank); 135 } 131 136 } 132 137
Note:
See TracChangeset
for help on using the changeset viewer.
