- Timestamp:
- Jan 22, 2012, 6:26:57 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/libfits/header/F_print.c
r28246 r33128 65 65 /* string value. Quotes must be at least 18 chars apart. Longer lines will this should be fixed to allow arbitrary string lengths, up to 69 chars */ 66 66 if (!strcmp (mode, "%s")) { 67 strcpy (line, va_arg (argp, char *)); 67 char *ptr = va_arg (argp, char *); 68 if (!ptr) goto invalid; 69 strcpy (line, ptr); 68 70 line[68] = 0; 69 71 snprintf (string, 81, "%-8s= '%-18s' / %46s ", field, line, blank); 70 72 goto found_it; 71 73 } 74 75 invalid: 76 va_end (argp); 72 77 return (FALSE); 73 78 … … 76 81 va_end (argp); 77 82 return (TRUE); 78 79 83 } 80 84 … … 130 134 if (!strcmp (mode, "%S")) { 131 135 /* we are forcing the entry to be <= 69 char long */ 132 strcpy (line, va_arg (argp, char *)); 133 line[71] = 0; 136 char *ptr = va_arg (argp, char *); 137 if (!ptr) goto invalid; 138 bzero (line, 80); 139 strncpy (line, ptr, 71); 134 140 snprintf (string, 81, "%-8s %-71s", field, line); 135 141 } … … 146 152 147 153 /* can't write the comment in gfits_print - use gfits_modify */ 148 if (!strcmp (mode, "%C")) return (FALSE);154 if (!strcmp (mode, "%C")) goto invalid; 149 155 150 156 strncpy (p, string, 80); … … 153 159 return (TRUE); 154 160 161 invalid: 162 va_end (argp); 163 return (FALSE); 155 164 }
Note:
See TracChangeset
for help on using the changeset viewer.
