1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Mozilla Public License Version
6
* 1.1 (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/MPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is the Netscape Portable Runtime (NSPR).
17
* The Initial Developer of the Original Code is
18
* Netscape Communications Corporation.
19
* Portions created by the Initial Developer are Copyright (C) 1998-2000
20
* the Initial Developer. All Rights Reserved.
24
* Alternatively, the contents of this file may be used under the terms of
25
* either the GNU General Public License Version 2 or later (the "GPL"), or
26
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
* in which case the provisions of the GPL or the LGPL are applicable instead
28
* of those above. If you wish to allow use of your version of this file only
29
* under the terms of either the GPL or the LGPL, and not to allow others to
30
* use your version of this file under the terms of the MPL, indicate your
31
* decision by deleting the provisions above and replace them with the notice
32
* and other provisions required by the GPL or the LGPL. If you do not delete
33
* the provisions above, a recipient may use your version of this file under
34
* the terms of any one of the MPL, the GPL or the LGPL.
36
* ***** END LICENSE BLOCK ***** */
39
** w16stdio.c -- Callback functions for Win16 stdio read/write.
46
** _PL_MDStdioWrite() -- Win16 hackery to get console output
48
** Returns: number of bytes written.
52
_PL_W16StdioWrite( void *buf, PRInt32 amount )
56
rc = fputs( buf, stdout );
59
// something about errno
63
} /* end _PL_fputs() */
66
** _PL_W16StdioRead() -- Win16 hackery to get console input
70
_PL_W16StdioRead( void *buf, PRInt32 amount )
74
bp = fgets( buf, (int) amount, stdin );
77
// something about errno
82
} /* end _PL_fgets() */
83
/* --- end w16stdio.c --- */
86
** Wrappers, linked into the client, that call
92
** _PL_W16CallBackPuts() -- Wrapper for puts()
95
int PR_CALLBACK _PL_W16CallBackPuts( const char *outputString )
97
return( puts( outputString ));
98
} /* end _PL_W16CallBackPuts() */
101
** _PL_W16CallBackStrftime() -- Wrapper for strftime()
104
size_t PR_CALLBACK _PL_W16CallBackStrftime(
110
return( strftime( s, len, fmt, p ));
111
} /* end _PL_W16CallBackStrftime() */
114
** _PL_W16CallBackMalloc() -- Wrapper for malloc()
117
void * PR_CALLBACK _PL_W16CallBackMalloc( size_t size )
119
return( malloc( size ));
120
} /* end _PL_W16CallBackMalloc() */
123
** _PL_W16CallBackCalloc() -- Wrapper for calloc()
126
void * PR_CALLBACK _PL_W16CallBackCalloc( size_t n, size_t size )
128
return( calloc( n, size ));
129
} /* end _PL_W16CallBackCalloc() */
132
** _PL_W16CallBackRealloc() -- Wrapper for realloc()
135
void * PR_CALLBACK _PL_W16CallBackRealloc(
139
return( realloc( old_blk, size ));
140
} /* end _PL_W16CallBackRealloc() */
143
** _PL_W16CallBackFree() -- Wrapper for free()
146
void PR_CALLBACK _PL_W16CallBackFree( void *ptr )
150
} /* end _PL_W16CallBackFree() */
153
** _PL_W16CallBackGetenv() -- Wrapper for getenv()
156
void * PR_CALLBACK _PL_W16CallBackGetenv( const char *name )
158
return( getenv( name ));
159
} /* end _PL_W16CallBackGetenv */
163
** _PL_W16CallBackPutenv() -- Wrapper for putenv()
166
int PR_CALLBACK _PL_W16CallBackPutenv( const char *assoc )
168
return( putenv( assoc ));
169
} /* end _PL_W16CallBackGetenv */