mailing list of musl libc
 help / color / mirror / code / Atom feed
From: ojab <ojab@ojab.ru>
To: musl@lists.openwall.com
Subject: SoX & pipe rewinding
Date: Fri, 14 Dec 2012 17:35:52 +0400	[thread overview]
Message-ID: <50CB2B38.8070703@ojab.ru> (raw)

[-- Attachment #1: Type: text/plain, Size: 207 bytes --]

Hi list,
SoX use some kind of hackery for pipe rewinding (see the attached file). 
So I have two questions:
1. If something like that possible using musl?
2. Is there any musl specific #define?

//wbr ojab


[-- Attachment #2: rewind_pipe.txt --]
[-- Type: text/plain, Size: 854 bytes --]


/* Hack to rewind pipes (a small amount).
 * Works by resetting the FILE buffer pointer */
static void UNUSED rewind_pipe(FILE * fp)
{
/* _FSTDIO is for Torek stdio (i.e. most BSD-derived libc's)
 * In theory, we no longer need to check _NEWLIB_VERSION or __APPLE__ */
#if defined _FSTDIO || defined _NEWLIB_VERSION || defined __APPLE__
  fp->_p -= AUTO_DETECT_SIZE;
  fp->_r += AUTO_DETECT_SIZE;
#elif defined __GLIBC__
  fp->_IO_read_ptr = fp->_IO_read_base;
#elif defined _MSC_VER || defined __MINGW_H || defined _ISO_STDIO_ISO_H
  fp->_ptr = fp->_base;
#else
  /* To fix this #error, either simply remove the #error line and live without
   * file-type detection with pipes, or add support for your compiler in the
   * lines above.  Test with cat monkey.au | ./sox --info - */
  #error FIX NEEDED HERE
  #define NO_REWIND_PIPE
  (void)fp;
#endif
}

             reply	other threads:[~2012-12-14 13:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-14 13:35 ojab [this message]
2012-12-14 13:40 ` Rich Felker
2012-12-14 13:51   ` ojab
2012-12-14 16:47     ` John Spencer
2012-12-14 17:57       ` ojab
2012-12-14 19:09     ` Rich Felker
2012-12-14 21:11       ` ojab
2012-12-14 21:21         ` Rich Felker
2012-12-14 22:17   ` Rob Landley
2012-12-15  0:05     ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50CB2B38.8070703@ojab.ru \
    --to=ojab@ojab.ru \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).