SFDISC(3)
π NAME π
sfdisc β sfio disciplines. Okay bestie, you've landed on the SFDISC(3) manual page, and it's literally the group chat for sfio disciplines: the plug-in little guys that extend what a stream can do β¨.
β¨ SYNOPSIS β¨
#include <sfdisc.h>
extern Sfdisc_t* dcnewskable(Sfio_t* f);
extern int dcdelskable(Sfdisc_t* disc);
extern Sfdisc_t* dcnewtee(Sfio_t* tee);
extern int dcdeltee(Sfdisc_t* disc);
extern Sfdisc_t* dcnewfilter(char* cmd);
extern int dcdelfilter(Sfdisc_t* disc);
extern Sfdisc_t* dcnewsubstream(Sfio_t* f, long offset, long extent);
extern int dcdelsubstream(Sfdisc_t* disc);
extern Sfdisc_t* dcnewlzw(void);
extern int dcdellzw(Sfdisc_t* disc);
extern Sfdisc_t* dcnewunion(Sfio_t** flist, int n);
extern int dcdelunion(Sfdisc_t* disc);
π¦ DESCRIPTION π¦
I/O disciplines are used to extend the data processing power of sfio streams. The convention for using the disciplines in this package is: use the call dcnewXXX() to create a discipline of the type XXX, and use dcdelXXX() to destroy it. A discipline is enabled by inserting it into the desired stream using the sfdisc() call. A discipline can be used on only one stream. It is unsafe to share a discipline on two or more streams since the discipline may maintain states between successive IO calls β like, do not do that, fr fr. For multiple uses, dcnewXXX() should be used to create a distinct discipline for each stream. Each discipline structure is equipped with an exception handler that causes self-destruction when the associated stream is closed. Cleanup? She does it herself π
.
β¨ dcnewskable / dcdelskable β¨
Sfdisc_t* dcnewskable(Sfio_t* f);
int dcdelskable(Sfdisc_t* disc);
dcnewskable() creates a discipline that when inserted on the stream f will ensure that f is seekable. If f is originally unseekable, data will be shadowed in a temporary file stream to allow seekability. dcnewskable() returns the discipline on success and NULL on failure. Slay.
β¨ dcnewtee / dcdeltee β¨
Sfdisc_t* dcnewtee(Sfio_t* tee);
int dcdeltee(Sfdisc_t* disc);
dcnewtee() creates a discipline that when inserted into a stream f will duplicate to the stream tee any data written to f. dcnewtee() returns the discipline on success and NULL on failure. Tea spilled? No, tee'd π
.
β¨ dcnewfilter / dcdelfilter β¨
Sfdisc_t* dcnewfilter(char* cmd);
int dcdelfilter(Sfdisc_t* disc);
dcnewfilter() creates a discipline that when inserted into a stream f will run the command cmd to process any input data before making it available to the application. For example, dcnewfilter("uncompress") is an equivalent but slower alternative to the lzw discipline below. dcnewfilter() returns the discipline on success and NULL on failure. It's giving "middleware, but make it vintage" π.
β¨ dcnewsubstream / dcdelsubstream β¨
Sfdisc_t* dcnewsubstream(Sfio_t* base, long offset, long extent);
int dcdelsubstream(Sfdisc_t* disc);
dcnewsubstream() creates a discipline that reserves a portion of the stream base starting at offset with length extent and makes this portion appear as if it is a stream. When this discipline is inserted into a stream, it will cause all IO operations on this stream to take place in the reserved portion of the base stream. dcnewsubstream() returns the discipline on success and NULL on failure. Substream era π¦.
β¨ dcnewlzw / dcdellzw β¨
Sfdisc_t* dcnewlzw(void);
int dcdellzw(Sfdisc_t* disc);
dcnewlzw() creates a discipline that when inserted into a stream f will run the uncompress algorithm on input data from f before making it available to the application. This is useful to allow applications to process data from a file packed with the UNIX compress utility as if the data is in plain text. dcnewlzw() returns the discipline on success and NULL on failure. Old-school compression but make it transparent β¨.
β¨ dcnewunion / dcdelunion β¨
Sfdisc_t* dcnewunion(Sfio_t** list, int n);
int dcdelunion(Sfdisc_t* disc);
dcnewunion() creates a discipline that concatenates input data from all n streams in list. When inserted into a stream f, this discipline will cause all input operations on f to come from the merged data stream. dcnewunion() returns the discipline on success and NULL on failure. Union! The friend group of streams, all reading together π«Ά.
πΈ ACKNOWLEDGMENTS πΈ
Dave Korn contributed the substream discipline. Jim Arnold contributed the lzw discipline. Give them their flowers π.
π NOTES π
Since we are not sure of the legal responsibilities concerning the lzw patent, the lzw discipline is not currently distributed with any release of sfio outside of AT&T. That's the note, bestie β legal stuff said what it said π.
π AUTHOR π
Kiem-Phong Vo, kpv@research.att.com. Icon.
mwah π that's the whole page β dated 16 June 1993, from the Library Functions Manual source line, and it's literally SFDISC(3). Byeee πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms