Lines Matching refs:flags
61 shf->flags = SHF_ALLOCS; in shf_open()
95 int flags = fcntl(fd, F_GETFL, 0); in shf_open_hlp() local
97 if (flags < 0) in shf_open_hlp()
101 switch (flags & O_ACCMODE) { in shf_open_hlp()
147 shf->flags = sflags; in shf_fdopen()
174 shf->flags = (shf->flags & (SHF_ALLOCS | SHF_ALLOCB)) | sflags; in shf_reopen()
214 shf->flags = sflags | SHF_STRING; in shf_sopen()
232 if (shf->flags & SHF_ALLOCS) in shf_close()
234 else if (shf->flags & SHF_ALLOCB) in shf_close()
270 if (shf->flags & SHF_WR) { in shf_sclose()
274 if (shf->flags & SHF_ALLOCS) in shf_sclose()
286 if (shf->flags & SHF_STRING) in shf_flush()
287 return ((shf->flags & SHF_WR) ? EOF : 0); in shf_flush()
292 if (shf->flags & SHF_ERROR) { in shf_flush()
297 if (shf->flags & SHF_READING) { in shf_flush()
298 shf->flags &= ~(SHF_EOF | SHF_READING); in shf_flush()
305 } else if (shf->flags & SHF_WRITING) in shf_flush()
316 shf_emptybuf(struct shf *shf, int flags) in shf_emptybuf() argument
320 if (!(shf->flags & SHF_STRING) && shf->fd < 0) in shf_emptybuf()
323 if (shf->flags & SHF_ERROR) { in shf_emptybuf()
328 if (shf->flags & SHF_READING) { in shf_emptybuf()
329 if (flags & EB_READSW) in shf_emptybuf()
333 shf->flags &= ~SHF_READING; in shf_emptybuf()
335 if (shf->flags & SHF_STRING) { in shf_emptybuf()
343 if (!(flags & EB_GROW) || !(shf->flags & SHF_DYNAMIC) || in shf_emptybuf()
344 !(shf->flags & SHF_ALLOCB)) in shf_emptybuf()
355 if (shf->flags & SHF_WRITING) { in shf_emptybuf()
363 !(shf->flags & SHF_INTERRUPT)) in shf_emptybuf()
365 shf->flags |= SHF_ERROR; in shf_emptybuf()
382 if (flags & EB_READSW) { in shf_emptybuf()
385 shf->flags &= ~SHF_WRITING; in shf_emptybuf()
392 shf->flags |= SHF_WRITING; in shf_emptybuf()
403 if (shf->flags & SHF_STRING) in shf_fillbuf()
409 if (shf->flags & (SHF_EOF | SHF_ERROR)) { in shf_fillbuf()
410 if (shf->flags & SHF_ERROR) in shf_fillbuf()
415 if ((shf->flags & SHF_WRITING) && shf_emptybuf(shf, EB_READSW) == EOF) in shf_fillbuf()
418 shf->flags |= SHF_READING; in shf_fillbuf()
423 if (n < 0 && errno == EINTR && !(shf->flags & SHF_INTERRUPT)) in shf_fillbuf()
428 shf->flags |= SHF_ERROR; in shf_fillbuf()
435 shf->flags |= SHF_EOF; in shf_fillbuf()
449 if (!(shf->flags & SHF_RD)) in shf_read()
450 internal_errorf("%s: flags 0x%X", "shf_read", shf->flags); in shf_read()
486 if (!(shf->flags & SHF_RD)) in shf_getse()
487 internal_errorf("%s: flags 0x%X", "shf_getse", shf->flags); in shf_getse()
522 if (!(shf->flags & SHF_RD)) in shf_getchar()
523 internal_errorf("%s: flags 0x%X", "shf_getchar", shf->flags); in shf_getchar()
538 if (!(shf->flags & SHF_RD)) in shf_ungetc()
539 internal_errorf("%s: flags 0x%X", "shf_ungetc", shf->flags); in shf_ungetc()
541 if ((shf->flags & SHF_ERROR) || c == EOF || in shf_ungetc()
545 if ((shf->flags & SHF_WRITING) && shf_emptybuf(shf, EB_READSW) == EOF) in shf_ungetc()
550 if (shf->flags & SHF_STRING) { in shf_ungetc()
557 shf->flags &= ~SHF_EOF; in shf_ungetc()
562 shf->flags &= ~SHF_EOF; in shf_ungetc()
575 if (!(shf->flags & SHF_WR)) in shf_putchar()
576 internal_errorf("%s: flags 0x%X", "shf_putchar", shf->flags); in shf_putchar()
581 if (shf->flags & SHF_UNBUF) { in shf_putchar()
587 if (shf->flags & SHF_ERROR) { in shf_putchar()
594 !(shf->flags & SHF_INTERRUPT)) in shf_putchar()
596 shf->flags |= SHF_ERROR; in shf_putchar()
630 if (!(shf->flags & SHF_WR)) in shf_write()
631 internal_errorf("%s: flags 0x%X", "shf_write", shf->flags); in shf_write()
648 if (shf->flags & SHF_STRING) { in shf_write()
668 !(shf->flags & SHF_INTERRUPT)) in shf_write()
670 shf->flags |= SHF_ERROR; in shf_write()
763 int tmp = 0, flags; in shf_vfprintf() local
794 flags = 0; in shf_vfprintf()
799 flags |= FL_HASH; in shf_vfprintf()
803 flags |= FL_PLUS; in shf_vfprintf()
807 flags |= FL_RIGHT; in shf_vfprintf()
811 flags |= FL_BLANK; in shf_vfprintf()
815 if (!(flags & FL_DOT)) in shf_vfprintf()
816 flags |= FL_ZERO; in shf_vfprintf()
820 flags |= FL_DOT; in shf_vfprintf()
826 if (flags & FL_DOT) in shf_vfprintf()
830 flags |= FL_RIGHT; in shf_vfprintf()
835 flags &= ~FM_SIZES; in shf_vfprintf()
836 flags |= FL_LONG; in shf_vfprintf()
840 flags &= ~FM_SIZES; in shf_vfprintf()
841 flags |= FL_SHORT; in shf_vfprintf()
845 flags &= ~FM_SIZES; in shf_vfprintf()
846 flags |= FL_SIZET; in shf_vfprintf()
861 if (flags & FL_DOT) in shf_vfprintf()
878 flags |= FL_UPPER; in shf_vfprintf()
885 if (flags & FL_SIZET) in shf_vfprintf()
887 else if (flags & FL_LONG) in shf_vfprintf()
889 else if (flags & FL_SHORT) in shf_vfprintf()
898 if (flags & FL_SIZET) in shf_vfprintf()
900 else if (flags & FL_LONG) in shf_vfprintf()
902 else if (flags & FL_SHORT) in shf_vfprintf()
908 flags |= FL_NUMBER; in shf_vfprintf()
939 else if (flags & FL_PLUS) in shf_vfprintf()
941 else if (flags & FL_BLANK) in shf_vfprintf()
952 if ((flags & FL_HASH) && *cp != '0') in shf_vfprintf()
957 const char *digits = (flags & FL_UPPER) ? in shf_vfprintf()
964 if (flags & FL_HASH) { in shf_vfprintf()
965 *--cp = (flags & FL_UPPER) ? 'X' : 'x'; in shf_vfprintf()
975 if (flags & FL_DOT) { in shf_vfprintf()
978 flags |= FL_ZERO; in shf_vfprintf()
992 flags &= ~FL_DOT; in shf_vfprintf()
1009 if (!(flags & FL_DOT) || len < precision) in shf_vfprintf()
1013 if (!(flags & FL_RIGHT)) { in shf_vfprintf()
1016 if ((flags & FL_ZERO) && (flags & FL_NUMBER)) { in shf_vfprintf()
1037 c = flags & FL_ZERO ? '0' : ' '; in shf_vfprintf()