Skip to content

Commit cec7f34

Browse files
Merge pull request #37 from dreamer-coding/add_streams
2 parents b20ad74 + c0e0016 commit cec7f34

File tree

3 files changed

+125
-45
lines changed

3 files changed

+125
-45
lines changed

code/logic/fossil/io/stream.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern "C" {
2525
* Structure representing a file stream.
2626
*/
2727
typedef struct {
28-
FILE *file; // Pointer to the FILE structure for the stream
28+
FILE *file; // Pointer to the FILE structure for the stream
2929
char filename[500]; // Array to store the filename
3030
} fossil_fstream_t;
3131

@@ -71,6 +71,16 @@ int32_t fossil_fstream_open(fossil_fstream_t *stream, const char *filename, cons
7171
*/
7272
void fossil_fstream_close(fossil_fstream_t *stream);
7373

74+
/**
75+
* Redirect a stream to /dev/null.
76+
*
77+
* This function redirects the given stream to /dev/null, effectively discarding any data written to it.
78+
*
79+
* @param stream Pointer to the fossil_fstream_t structure to redirect.
80+
* @return 0 on success, non-zero on failure.
81+
*/
82+
int32_t fossil_fstream_redirect_to_devnull(fossil_fstream_t *stream);
83+
7484
/**
7585
* Check if a stream is open.
7686
*
@@ -418,6 +428,18 @@ namespace fossil {
418428
fossil_fstream_close(stream);
419429
}
420430

431+
/**
432+
* Redirect a stream to /dev/null.
433+
*
434+
* This function redirects the given stream to /dev/null, effectively discarding any data written to it.
435+
*
436+
* @param stream Pointer to the fossil_fstream_t structure to redirect.
437+
* @return 0 on success, non-zero on failure.
438+
*/
439+
static int32_t redirect_to_devnull(fossil_fstream_t *stream) {
440+
return fossil_fstream_redirect_to_devnull(stream);
441+
}
442+
421443
/**
422444
* Check if a stream is open.
423445
*

0 commit comments

Comments
 (0)