Lines Matching refs:flags

62 	shf->flags = SHF_ALLOCS;  in shf_open()
100 int flags = fcntl(fd, F_GETFL, 0); in shf_open_hlp() local
102 if (flags < 0) in shf_open_hlp()
106 switch (flags & O_ACCMODE) { in shf_open_hlp()
152 shf->flags = sflags; in shf_fdopen()
179 shf->flags = (shf->flags & (SHF_ALLOCS | SHF_ALLOCB)) | sflags; in shf_reopen()
219 shf->flags = sflags | SHF_STRING; in shf_sopen()
237 if (shf->flags & SHF_ALLOCS) in shf_close()
239 else if (shf->flags & SHF_ALLOCB) in shf_close()
275 if (shf->flags & SHF_WR) { in shf_sclose()
279 if (shf->flags & SHF_ALLOCS) in shf_sclose()
291 if (shf->flags & SHF_STRING) in shf_flush()
292 return ((shf->flags & SHF_WR) ? -1 : 0); in shf_flush()
297 if (shf->flags & SHF_ERROR) { in shf_flush()
302 if (shf->flags & SHF_READING) { in shf_flush()
303 shf->flags &= ~(SHF_EOF | SHF_READING); in shf_flush()
310 } else if (shf->flags & SHF_WRITING) in shf_flush()
321 shf_emptybuf(struct shf *shf, int flags) in shf_emptybuf() argument
325 if (!(shf->flags & SHF_STRING) && shf->fd < 0) in shf_emptybuf()
328 if (shf->flags & SHF_ERROR) { in shf_emptybuf()
333 if (shf->flags & SHF_READING) { in shf_emptybuf()
334 if (flags & EB_READSW) in shf_emptybuf()
338 shf->flags &= ~SHF_READING; in shf_emptybuf()
340 if (shf->flags & SHF_STRING) { in shf_emptybuf()
348 if (!(flags & EB_GROW) || !(shf->flags & SHF_DYNAMIC) || in shf_emptybuf()
349 !(shf->flags & SHF_ALLOCB)) in shf_emptybuf()
360 if (shf->flags & SHF_WRITING) { in shf_emptybuf()
368 !(shf->flags & SHF_INTERRUPT)) in shf_emptybuf()
370 shf->flags |= SHF_ERROR; in shf_emptybuf()
387 if (flags & EB_READSW) { in shf_emptybuf()
390 shf->flags &= ~SHF_WRITING; in shf_emptybuf()
397 shf->flags |= SHF_WRITING; in shf_emptybuf()
408 if (shf->flags & SHF_STRING) in shf_fillbuf()
414 if (shf->flags & (SHF_EOF | SHF_ERROR)) { in shf_fillbuf()
415 if (shf->flags & SHF_ERROR) in shf_fillbuf()
420 if ((shf->flags & SHF_WRITING) && shf_emptybuf(shf, EB_READSW) == -1) in shf_fillbuf()
423 shf->flags |= SHF_READING; in shf_fillbuf()
428 if (n < 0 && errno == EINTR && !(shf->flags & SHF_INTERRUPT)) in shf_fillbuf()
433 shf->flags |= SHF_ERROR; in shf_fillbuf()
440 shf->flags |= SHF_EOF; in shf_fillbuf()
454 if (!(shf->flags & SHF_RD)) in shf_read()
455 internal_errorf("%s: flags 0x%X", "shf_read", shf->flags); in shf_read()
491 if (!(shf->flags & SHF_RD)) in shf_getse()
492 internal_errorf("%s: flags 0x%X", "shf_getse", shf->flags); in shf_getse()
527 if (!(shf->flags & SHF_RD)) in shf_getchar()
528 internal_errorf("%s: flags 0x%X", "shf_getchar", shf->flags); in shf_getchar()
543 if (!(shf->flags & SHF_RD)) in shf_ungetc()
544 internal_errorf("%s: flags 0x%X", "shf_ungetc", shf->flags); in shf_ungetc()
546 if ((shf->flags & SHF_ERROR) || c == -1 || in shf_ungetc()
550 if ((shf->flags & SHF_WRITING) && shf_emptybuf(shf, EB_READSW) == -1) in shf_ungetc()
555 if (shf->flags & SHF_STRING) { in shf_ungetc()
562 shf->flags &= ~SHF_EOF; in shf_ungetc()
567 shf->flags &= ~SHF_EOF; in shf_ungetc()
580 if (!(shf->flags & SHF_WR)) in shf_putchar()
581 internal_errorf("%s: flags 0x%X", "shf_putchar", shf->flags); in shf_putchar()
586 if (shf->flags & SHF_UNBUF) { in shf_putchar()
592 if (shf->flags & SHF_ERROR) { in shf_putchar()
599 !(shf->flags & SHF_INTERRUPT)) in shf_putchar()
601 shf->flags |= SHF_ERROR; in shf_putchar()
635 if (!(shf->flags & SHF_WR)) in shf_write()
636 internal_errorf("%s: flags 0x%X", "shf_write", shf->flags); in shf_write()
653 if (shf->flags & SHF_STRING) { in shf_write()
673 !(shf->flags & SHF_INTERRUPT)) in shf_write()
675 shf->flags |= SHF_ERROR; in shf_write()
766 int tmp = 0, flags; in shf_vfprintf() local
792 flags = 0; in shf_vfprintf()
797 flags |= FL_HASH; in shf_vfprintf()
801 flags |= FL_PLUS; in shf_vfprintf()
805 flags |= FL_RIGHT; in shf_vfprintf()
809 flags |= FL_BLANK; in shf_vfprintf()
813 if (!(flags & FL_DOT)) in shf_vfprintf()
814 flags |= FL_ZERO; in shf_vfprintf()
818 flags |= FL_DOT; in shf_vfprintf()
824 if (flags & FL_DOT) in shf_vfprintf()
828 flags |= FL_RIGHT; in shf_vfprintf()
833 flags &= ~FM_SIZES; in shf_vfprintf()
834 flags |= FL_LONG; in shf_vfprintf()
838 flags &= ~FM_SIZES; in shf_vfprintf()
839 flags |= FL_SHORT; in shf_vfprintf()
843 flags &= ~FM_SIZES; in shf_vfprintf()
844 flags |= FL_SIZET; in shf_vfprintf()
859 if (flags & FL_DOT) in shf_vfprintf()
876 flags |= FL_UPPER; in shf_vfprintf()
883 if (flags & FL_SIZET) in shf_vfprintf()
885 else if (flags & FL_LONG) in shf_vfprintf()
887 else if (flags & FL_SHORT) in shf_vfprintf()
896 if (flags & FL_SIZET) in shf_vfprintf()
898 else if (flags & FL_LONG) in shf_vfprintf()
900 else if (flags & FL_SHORT) in shf_vfprintf()
906 flags |= FL_NUMBER; in shf_vfprintf()
927 else if (flags & FL_PLUS) in shf_vfprintf()
929 else if (flags & FL_BLANK) in shf_vfprintf()
940 if ((flags & FL_HASH) && *cp != '0') in shf_vfprintf()
945 const char *digits = (flags & FL_UPPER) ? in shf_vfprintf()
952 if (flags & FL_HASH) { in shf_vfprintf()
953 *--cp = (flags & FL_UPPER) ? 'X' : 'x'; in shf_vfprintf()
959 if (flags & FL_DOT) { in shf_vfprintf()
962 flags |= FL_ZERO; in shf_vfprintf()
972 else if (flags & FL_HASH) { in shf_vfprintf()
980 flags &= ~FL_DOT; in shf_vfprintf()
997 if (!(flags & FL_DOT) || len < precision) in shf_vfprintf()
1001 if (!(flags & FL_RIGHT)) { in shf_vfprintf()
1004 if ((flags & FL_ZERO) && (flags & FL_NUMBER)) { in shf_vfprintf()
1025 c = flags & FL_ZERO ? '0' : ' '; in shf_vfprintf()