Lines Matching defs:fp
57 static int inc_soa_serial (FILE *fp, int use_unixtime);
85 FILE *fp;
98 if ( (fp = fopen (fname, "r+")) == NULL )
102 while ( fgets (buf, sizeof buf, fp) && !is_soa_rr (buf) )
105 if ( feof (fp) )
107 fclose (fp);
111 error = inc_soa_serial (fp, use_unixtime); /* .. inc soa serial no ... */
113 if ( fclose (fp) != 0 )
185 ** inc_soa_serial (fp, use_unixtime)
186 ** increment the soa serial number of the file 'fp'
187 ** 'fp' must be opened "r+"
189 static int inc_soa_serial (FILE *fp, int use_unixtime)
198 while ( (c = getc (fp)) != EOF && isspace (c) )
200 ungetc (c, fp); /* push back the last char */
202 pos = ftell (fp); /* mark position */
206 if ( fscanf (fp, "%lu ", &serial) != 1 ) /* try to get serial no */
208 eos = ftell (fp); /* mark first non digit/ws character pos */
223 fseek (fp, pos, SEEK_SET); /* go back to the beginning */
224 fprintf (fp, "%-*lu", digits, serial); /* write as many chars as before */