Add support for tab-completion when selecting by rule
[alpine.git] / pico / osdep / popen.c
blobaa5090cbd7a11c927d4f2cab486e8660cb5f6b7e
1 /*
2 * ========================================================================
3 * Copyright 2006 University of Washington
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * ========================================================================
14 #include <system.h>
15 #include <general.h>
16 #include "../estruct.h"
22 * P_open - run the given command in a sub-shell returning a file pointer
23 * from which to read the output
25 * note:
26 * For OS's other than unix, you will have to rewrite this function.
27 * Hopefully it'll be easy to exec the command into a temporary file,
28 * and return a file pointer to that opened file or something.
30 int
31 P_open(char *s)
33 #if HAVE_POPEN
34 extern FIOINFO g_pico_fio;
36 g_pico_fio.flags = FIOINFO_READ;
37 g_pico_fio.name = "pipe";
39 if((g_pico_fio.fp = popen(s, "r")) != NULL)
40 return(FIOSUC);
42 return(FIOERR);
43 #else
44 /* Windows never did this, but piping has been done elsewhere */
45 return(0);
46 #endif
52 * P_close - close the given descriptor
55 void
56 P_close(void)
58 #if HAVE_PCLOSE
59 extern FIOINFO g_pico_fio;
61 if(g_pico_fio.fp)
62 (void) pclose(g_pico_fio.fp);
63 #endif