diff options
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/replace/replace.h | 12 | ||||
-rw-r--r-- | source4/lib/tdr/tdr.c | 2 | ||||
-rw-r--r-- | source4/lib/xfile.h | 49 |
3 files changed, 49 insertions, 14 deletions
diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h index 0f1eb42ac0..63ec8cfd49 100644 --- a/source4/lib/replace/replace.h +++ b/source4/lib/replace/replace.h @@ -100,18 +100,6 @@ int vasprintf(char **ptr, const char *format, va_list ap); #define bzero(a,b) memset((a),'\0',(b)) #endif -#ifndef PRINTF_ATTRIBUTE -#if !defined(NO_PRINTF_ATTRIBUTE) && (__GNUC__ >= 3) -/** Use gcc attribute to check printf fns. a1 is the 1-based index of - * the parameter containing the format, and a2 the index of the first - * argument. Note that some gcc 2.x versions don't handle this - * properly **/ -#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2))) -#else -#define PRINTF_ATTRIBUTE(a1, a2) -#endif -#endif - /* add varargs prototypes with printf checking */ #ifndef HAVE_SNPRINTF_DECL int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4); diff --git a/source4/lib/tdr/tdr.c b/source4/lib/tdr/tdr.c index 5ebe3f0852..cd1650e30d 100644 --- a/source4/lib/tdr/tdr.c +++ b/source4/lib/tdr/tdr.c @@ -41,11 +41,9 @@ #define TDR_CVAL(tdr, ofs) CVAL(tdr->data.data,ofs) #define TDR_SVAL(tdr, ofs) (TDR_BE(tdr)?RSVAL(tdr->data.data,ofs):SVAL(tdr->data.data,ofs)) #define TDR_IVAL(tdr, ofs) (TDR_BE(tdr)?RIVAL(tdr->data.data,ofs):IVAL(tdr->data.data,ofs)) -#define TDR_IVALS(tdr, ofs) (TDR_BE(tdr)?RIVALS(tdr->data.data,ofs):IVALS(tdr->data.data,ofs)) #define TDR_SCVAL(tdr, ofs, v) SCVAL(tdr->data.data,ofs,v) #define TDR_SSVAL(tdr, ofs, v) do { if (TDR_BE(tdr)) { RSSVAL(tdr->data.data,ofs,v); } else SSVAL(tdr->data.data,ofs,v); } while (0) #define TDR_SIVAL(tdr, ofs, v) do { if (TDR_BE(tdr)) { RSIVAL(tdr->data.data,ofs,v); } else SIVAL(tdr->data.data,ofs,v); } while (0) -#define TDR_SIVALS(tdr, ofs, v) do { if (TDR_BE(tdr)) { RSIVALS(tdr->data.data,ofs,v); } else SIVALS(tdr->data.data,ofs,v); } while (0) /* expand the available space in the buffer to 'size' diff --git a/source4/lib/xfile.h b/source4/lib/xfile.h new file mode 100644 index 0000000000..89fa9d1e11 --- /dev/null +++ b/source4/lib/xfile.h @@ -0,0 +1,49 @@ +/* + Unix SMB/CIFS implementation. + stdio replacement + Copyright (C) Andrew Tridgell 2001 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _XFILE_H_ +#define _XFILE_H_ +/* + see xfile.c for explanations +*/ + +typedef struct { + int fd; + char *buf; + char *next; + int bufsize; + int bufused; + int open_flags; + int buftype; + int flags; +} XFILE; + +extern XFILE *x_stdin, *x_stdout, *x_stderr; + +/* buffering type */ +#define X_IOFBF 0 +#define X_IOLBF 1 +#define X_IONBF 2 + +#define x_getc(f) x_fgetc(f) + +int x_vfprintf(XFILE *f, const char *format, va_list ap) PRINTF_ATTRIBUTE(2, 0); +int x_fprintf(XFILE *f, const char *format, ...) PRINTF_ATTRIBUTE(2, 3); +#endif /* _XFILE_H_ */ |