Commit 8312e9df authored by Stewart Brodie's avatar Stewart Brodie
Browse files

New export phase for exporting SWI number symbols.

Detail:
  Exports a header file for C code to use to define SWI numbers for
    the URL module.  Include "Interface/URL.h" to get the header.
  Updated to use DebugLib instead of its own private debugging system.
Admin:
  Requires RiscOS/BuildSys 2.51 or later.
  Requires RiscOS/Library 0.53 or later

Version 0.49. Tagged as 'URL-0_49'
parent d3823094
| Copyright 2000 Pace Micro Technology plc
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine export PHASE=hdrs
......@@ -38,38 +38,23 @@ RESFSDIR = Resources.URL.${COMPONENT}
# Export Paths for Messages module
#
RESDIR = <resource$dir>.Resources2.URL
EXP_HDR = <cexport$dir>.Interface
#
# Generic options:
#
MKDIR = mkdir -p
CC = cc
CMHG = cmhg
CP = copy
LD = link
TLD = tlink
RM = remove
WIPE = -wipe
MODSQZ = modsqz
TOUCH = create
CFLAGS = ${INCLUDES} -zM -Wp -ffah -zps1 ${DFLAGS}
CDEFINES = -D${SYSTEM} -DCOMPAT_INET4 -UTML -UDIRECTSWI
CINCLUDES = -IC: -IC:TCPIPLibs
ROMFLAGS = -DROM
DBGFLAGS = -DDEBUGLIB
CPFLAGS = ~cfr~v
WFLAGS = ~c~v
CFLAGS = -c -depend !Depend ${INCLUDES} -zM -Wp -ffah -zps1 ${DFLAGS}
DFLAGS = -D${SYSTEM} -DCOMPAT_INET4 -UTML -UDIRECTSWI
ROMFLAGS = -DROM
INCLUDES = -ITCPIPLibs:,C:
include Makefiles:StdTools
#
# Libraries
#
ANSILIB = CLib:o.ansilib
CLIB = CLIB:o.stubs
RLIB = RISCOSLIB:o.risc_oslib
ROMCSTUBS = RISCOSLIB:o.romcstubs
ABSSYM = RISC_OSLib:o.abssym
TCPIPLIBS = TCPIPLibs:o.inetlibzm TCPIPLIBS:o.socklibzm
include Makefiles:ModuleLibs
OBJS =\
o.directswi\
......@@ -84,7 +69,6 @@ OBJS =\
o.register\
o.status\
o.stop\
o.svcprint\
o.utils\
o.URLHdr
......@@ -101,7 +85,6 @@ RAM_OBJS =\
o.register\
o.status\
o.stop\
o.svcprint\
o.utils\
o.URLHdr
......@@ -118,13 +101,11 @@ DBG_OBJS =\
od.register\
od.status\
od.stop\
od.svcprint\
od.utils\
o.URLHdr
MSGSF=o.msgs
DBGFLAGS=-DTRACE -DUSE_SYSLOG
PNGS=\
LocalRes:images.internal-gopher-binary\
......@@ -143,12 +124,12 @@ PNGS=\
# Rule patterns
#
.SUFFIXES: .c .s .o .od .i .oi .inst
.c.o:; ${CC} ${CFLAGS} ${ROMFLAGS} -o $@ $<
.c.o:; ${CC} ${CFLAGS} ${ROMFLAGS} -o $@ $<
.c.i:; ${CC} ${CFLAGS} ${ROMFLAGS} -C -E $< >$@
.s.o:; objasm -depend !Depend -throwback -o $@ $<
.c.od:; ${CC} ${CFLAGS} ${ROMFLAGS} ${DBGFLAGS} -o $@ $<
.cmhg.o:; ${CMHG} -p -o $@ $<
.cmhg.h:; ${CMHG} -p -d $@ $<
.s.o:; ${AS} ${ASFLAGS} -o $@ $<
.c.od:; ${CC} ${CFLAGS} ${ROMFLAGS} ${DBGFLAGS} -o $@ $<
.cmhg.o:; ${CMHG} ${CMHGFLAGS} -o $@ $<
.cmhg.h:; ${CMHG} ${CMHGFLAGS} -d $@ $<
od.protocol protocol.o: URLHdr.h
......@@ -183,6 +164,15 @@ resources: LocalRes:Messages LocalRes:ResList ${PNGS}
${CP} LocalRes:* ${RESDIR}.${COMPONENT}.* ${CPFLAGS}
@echo ${COMPONENT}: resource files copied to Messages module
export: export_${PHASE}
export_hdrs: ${EXP_HDR}.h.${COMPONENT}
@echo ${COMPONENT}: export complete
${EXP_HDR}.h.${COMPONENT}: h.URLHdr
awk -- "/.define URL\_00/,/endif/" h.URLHdr { > $@ }
@SetType $@ Text
o.dirs:
${MKDIR} o
${MKDIR} od
......@@ -205,7 +195,7 @@ clean:
${ROM_MODULE}: ${OBJS} ${ROMCSTUBS}
${MKDIR} aof
${LD} -o $@ -aof ${OBJS} ${TCPIPLIBS} ${ROMCSTUBS}
${LD} -o $@ -aof ${OBJS} ${NET4LIBS} ${ROMCSTUBS}
# final link for ROM Image (using given base address)
rom_link: o.dirs
......@@ -218,16 +208,16 @@ ${MSGSF}: LocalRes:Messages LocalRes:ResList ${PNGS}
TokenCheck LocalRes:Messages
resgen messages_file ${MSGSF} -via LocalRes:ResList
${RAM_MODULE}: ${RAM_OBJS} ${MSGSF} ${TCPIPLIBS} ${CLIB}
${RAM_MODULE}: ${RAM_OBJS} ${MSGSF} ${NET4LIBS} ${CLIB}
${mkdir} rm
${LD} -o $@ -module ${RAM_OBJS} ${MSGSF} ${TCPIPLIBS} ${CLIB}
${LD} -o $@ -module ${RAM_OBJS} ${MSGSF} ${NET4LIBS} ${CLIB}
${MODSQZ} $@
Access $@ RW/R
${CHMOD} u+w,a+r $@
${DBG_MODULE}: ${DBG_OBJS} ${MSGSF} ${TCPIPLIBS} ${CLIB}
${DBG_MODULE}: ${DBG_OBJS} ${MSGSF} ${NET4LIBS} ${CLIB} ${DEBUGLIB}
${mkdir} rm
${LD} -o $@ -module ${DBG_OBJS} ${MSGSF} ${TCPIPLIBS} ${CLIB} c:o.syslog
Access $@ RW/R
${LD} -o $@ -module ${DBG_OBJS} ${MSGSF} ${DEBUGLIB} ${NET4LIBS} ${CLIB}
${CHMOD} u+w,a+r $@
o.moduleRAM: module.c
$(CC) ${CFLAGS} -o $@ module.c
......
/* (0.48)
/* (0.49)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.48
#define Module_MajorVersion_CMHG 0.49
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 04 May 2000
#define Module_Date_CMHG 14 Sep 2000
#define Module_MajorVersion "0.48"
#define Module_Version 48
#define Module_MajorVersion "0.49"
#define Module_Version 49
#define Module_MinorVersion ""
#define Module_Date "04 May 2000"
#define Module_Date "14 Sep 2000"
#define Module_FullVersion "0.48"
#define Module_ApplicationDate2 "14-Sep-00"
#define Module_ApplicationDate4 "14-Sep-2000"
#define Module_FullVersion "0.49"
......@@ -14,11 +14,7 @@
*/
/* -*-C-*-
*
* $Version: networking $
*
* $Source$
*
* Acorn Computers Ltd. 1995-1999
* Copyright Pace Micro Technology plc. 1995-2000
*
* Get a URL handler
*/
......@@ -40,127 +36,121 @@ static int make_proxyed(const char *request, Proxy *proxy, char **address);
_kernel_oserror *geturl(_kernel_swi_regs *r)
{
Client *list = find_client(r->r[1]);
/* Return an error if we arent registered */
if (list == NULL) {
return make_error(url_ERROR_CLIENT_ID_NOT_FOUND, 0);
Client *list = find_client(r->r[1]);
/* Return an error if we arent registered */
if (list == NULL) {
return make_error(url_ERROR_CLIENT_ID_NOT_FOUND, 0);
}
if (list->client.protocol != 0) {
return make_error(url_ERROR_ALREADY_CONNECTED, 0);
if (list->client.protocol != 0) {
return make_error(url_ERROR_ALREADY_CONNECTED, 0);
}
/* try and do something */
return get_process(&(list->client),r);
/* try and do something */
return get_process(&(list->client),r);
}
static _kernel_oserror *get_process(Control *client, _kernel_swi_regs *r)
{
Control c=*client;
char *buffer=NULL;
char *request=NULL;
int no_proxy=-1;
int done_proxy = 0;
_kernel_oserror *error;
int original_request_r3 = r->r[3];
request = URL_canonicalise(parseurlflags_APPLY_HEX_ENCODE, (char *)r->r[3]);
if (request == NULL) {
return make_error(url_ERROR_NO_PARSE_URL, 0);
}
buffer = NULL;
#ifdef TRACE
protocol_debug("GetURL: Canonical URL is `%s'\n", request);
#endif
/* first check to see if this is an explicit no-proxy request */
if (c.no_proxy != NULL) {
done_proxy = make_proxyed(request,c.no_proxy,&buffer);
no_proxy=1;
Control c=*client;
char *buffer=NULL;
char *request=NULL;
int no_proxy=-1;
int done_proxy = 0;
_kernel_oserror *error;
int original_request_r3 = r->r[3];
request = URL_canonicalise(parseurlflags_APPLY_HEX_ENCODE, (char *)r->r[3]);
if (request == NULL) {
return make_error(url_ERROR_NO_PARSE_URL, 0);
}
buffer = NULL;
dprintf(("geturl", "GetURL: Canonical URL is `%s'\n", request));
/* first check to see if this is an explicit no-proxy request */
if (c.no_proxy != NULL) {
done_proxy = make_proxyed(request,c.no_proxy,&buffer);
no_proxy=1;
}
/* Now find out if there is a client proxy requirement. */
if(done_proxy == 0 && (c.proxy != NULL)) {
done_proxy = make_proxyed(request,c.proxy,&buffer);
no_proxy=0;
/* Now find out if there is a client proxy requirement. */
if(done_proxy == 0 && (c.proxy != NULL)) {
done_proxy = make_proxyed(request,c.proxy,&buffer);
no_proxy=0;
}
/* Now look at the global no_proxy bits */
if((done_proxy == 0) && (no_proxy_list != NULL)) {
done_proxy = make_proxyed(request,global_proxy_list,&buffer);
no_proxy=1;
/* Now look at the global no_proxy bits */
if((done_proxy == 0) && (no_proxy_list != NULL)) {
done_proxy = make_proxyed(request,global_proxy_list,&buffer);
no_proxy=1;
}
/*
* Do the same for the global proxy list only if the session one
* didn't override it
*/
if((done_proxy == 0) && (global_proxy_list != NULL)) {
done_proxy=make_proxyed(request,global_proxy_list,&buffer);
no_proxy=0;
/*
* Do the same for the global proxy list only if the session one
* didn't override it
*/
if((done_proxy == 0) && (global_proxy_list != NULL)) {
done_proxy=make_proxyed(request,global_proxy_list,&buffer);
no_proxy=0;
}
/*
* Ensure that the final check doesn't break things for URLs
* that are not proxied.
*/
/*
* Ensure that the final check doesn't break things for URLs
* that are not proxied.
*/
/* Based upon what went on above, decide what URL to use */
/* Based upon what went on above, decide what URL to use */
if (buffer && !*buffer) buffer = NULL;
if (buffer && !*buffer) buffer = NULL;
#ifdef TRACE
protocol_debug("Request is `%s'\n", request);
protocol_debug("Proxy is `%s'\n", buffer?buffer:"<UNSET>");
#endif
dprintf(("geturl", "Request is `%s'\n", request));
dprintf(("geturl", "Proxy is `%s'\n", buffer?buffer:"<UNSET>"));
/* Look for a protocol module */
client->protocol = protocol_get_swibase(buffer?buffer:request);
/* Look for a protocol module */
client->protocol = protocol_get_swibase(buffer?buffer:request);
if (!client->protocol) {
if (request) free(request);
r->r[3] = original_request_r3;
return make_error(url_ERROR_NO_FETCHER_SERVICE, 0);
if (!client->protocol) {
if (request) free(request);
r->r[3] = original_request_r3;
return make_error(url_ERROR_NO_FETCHER_SERVICE, 0);
}
/* We now have a request that we can send on */
r->r[3] = (int)request;
if (buffer != NULL) {
r->r[7] = (int)buffer;
r->r[0] |= (1U<<31);
}
error = _kernel_swi(client->protocol + 0,r,r);
if (buffer != NULL) {
if (error == NULL) {
r->r[0] &= ~(1U<<31);
}
}
/* We now have a request that we can send on */
r->r[3] = (int)request;
if (buffer != NULL) {
r->r[7] = (int)buffer;
r->r[0] |= (1U<<31);
}
error = _kernel_swi(client->protocol + 0,r,r);
if (buffer != NULL) {
if (error == NULL) {
r->r[0] &= ~(1U<<31);
}
}
if (request) free(request);
r->r[3] = original_request_r3;
return error;
if (request) free(request);
r->r[3] = original_request_r3;
return error;
}
int make_proxyed(const char *request, Proxy *proxy, char **host)
{
while (proxy != NULL) {
if (proxy->url_base==NULL) {
proxy=proxy->next;
continue;
while (proxy != NULL) {
if (proxy->url_base==NULL) {
proxy=proxy->next;
continue;
}
if (!strncmp(request, proxy->url_base, strlen(proxy->url_base))) {
/* yes there is */
#ifdef TRACE
protocol_debug("Matched an entry (%s) => %s\n", proxy->url_base,
proxy->proxy ? proxy->proxy : "<NONE>");
#endif
*host = proxy->proxy;
return 1;
if (!strncmp(request, proxy->url_base, strlen(proxy->url_base))) {
/* yes there is */
dprintf(("proxy", "Matched an entry (%s) => %s\n",
proxy->url_base, proxy->proxy ? proxy->proxy : "<NONE>"));
*host = proxy->proxy;
return 1;
}
proxy=proxy->next;
proxy=proxy->next;
}
return 0;
return 0;
}
......@@ -14,9 +14,7 @@
*/
/* -*-C-*-
*
* $Version: networking $
*
* $Source$
* $Id$
*
* The URL module performs a number of tasks. These are related to providing
* a protocol independant view of the WWW/FTP/Gopher etc. This routine
......@@ -47,22 +45,6 @@
#define CMHG_CONST const
#endif
/* TinySupport SWIs. This does not work if any library static data
* is used within the module. This means errno (__errno) and __ctype
* (as used by any macro call to is.... functions) If you re-enable
* this SWI call, this module will fail to work at all.
*/
#define NO_TINYSTUBS
#ifdef ROM
#ifndef NO_TINYSTUBS
static _kernel_oserror *__ROM;
#define TinySupport_Share (0x82c43)
#define TinySupport_Die (0x82c41)
#endif
#endif
/*
* These are the global variables (see url.h)
*/
......@@ -105,11 +87,8 @@ _kernel_oserror *module_init(CMHG_CONST char *cmd_fail, int podule_base, void *p
(void) podule_base;
(void) pw;
#ifdef ROM
#ifndef NO_TINYSTUBS
__ROM = _swix(TinySupport_Share, _IN(0), pw);
#endif
#endif
debug_initialise("URL", NULL, NULL);
debug_set_device(DEBUGIT_OUTPUT);
callback_pending_flag = 0;
......@@ -180,12 +159,6 @@ _kernel_oserror *module_kill(int fatal, int podule, void *pw)
#endif
(void) _swix(OS_ServiceCall, _INR(0,2), 1, URL_00, Module_VersionNumber);
#ifdef ROM
#ifndef NO_TINYSTUBS
if(!__ROM) _swix(TinySupport_Die, 0);
#endif
#endif
return NULL;
}
......@@ -330,9 +303,7 @@ _kernel_oserror *command_line_handler(CMHG_CONST char *a, int ac, int cmd_no, vo
/* RISC OS 3.1 SVC mode realloc is broken, so we must provide our own */
void *module_realloc(void *ptr, size_t size)
{
#ifdef TRACE
protocol_debug("module_realloc(%p, %d)\n", ptr, size);
#endif
dprintf(("realloc", "module_realloc(%p, %d)\n", ptr, size));
if (!clibrary_realloc_routine_is_buggy) return realloc(ptr, size);
if (ptr == NULL) {
......
......@@ -295,106 +295,6 @@ _kernel_oserror *protocol_list(void)
return NULL;
}
#ifdef USE_SYSLOG
#include "<syslog$dir>.C-veneer.h.syslog"
#endif
/*#define DEBUG_FILENAME "ADFS::4.$.Trace.ProtoURL"*/
#define DEBUG_FILENAME "RAM:$.URL_Trace"
/*************************************************************/
/* static void protocol_debug(const char *format, ... */
/*************************************************************/
/* Output trace information to the TRACE_FILE */
/*************************************************************/
#ifdef TRACE
#include <stdarg.h>
void protocol_debug(const char *format, ...)
{
#ifdef TRACE
if (getenv("NoTrace$URL")) return; else {
va_list ap;
#ifdef USE_SYSLOG
static char buffer[1024];
va_start(ap, format);
vsprintf(buffer, format, ap);
va_end(ap);
(void) xsyslog_logmessage("URL", buffer, 100);
#else
FILE *fp = fopen(DEBUG_FILENAME, "a");
if (fp != 0) {
va_start(ap, format);
(void) vfprintf(fp, format, ap);
va_end(ap);
fclose(fp);
}
#endif
}
#else
(void) format;
#endif
}
#endif
#ifdef TRACE
#ifndef USE_SYSLOG
static char *filter(char *buf, const char *ptr, int max)
{
int i;
for (i=0; i<=max; ++i) {
int p = ptr[i];
if (p<32 || p == 127) buf[i] = '.'; else buf[i] = p;
}
buf[i] = '\0';
return buf;
}
#endif
void protocol_dump(const char *ptr, int size)
{
#ifdef TRACE
if (getenv("NoTrace$URL") || getenv("NoTrace$URL")) return; else {
#ifdef USE_SYSLOG
(void) xsyslog_logdata("URL", 100, ptr, size, 0);
#else
FILE *fp = fopen(DEBUG_FILENAME, "a");
if (fp != NULL) {
int ctr;
char buf[48];
fprintf(fp, "%08x: ", 0);
for (ctr=0; ctr<size; ++ctr) {
fprintf(fp, "%02x ", ptr[ctr]);
if ((ctr & 31) == 31) {
fprintf(fp, " %s",
filter(buf, ptr+(ctr & ~31), ctr & 31));
fprintf(fp, "\n%08x: ", ctr+1);
}
}
if (ctr & 31) {
const char *start = ptr + (ctr & ~31);
while (ctr & 31) {
fprintf(fp, " ");
++ctr;
}
fprintf(fp, " %s", filter(buf, start, (size & 31)-1));
}
fputc('\n', fp);
fclose(fp);
}
#endif
}
#else
(void) ptr;
(void) size;
#endif
}
#endif
static struct proto_default_details {
const char *scheme;
int flags;
......@@ -411,6 +311,8 @@ static struct proto_default_details {
{ "http:", proto_STRIP_DOT_DOT, 80 },
{ "https:", proto_STRIP_DOT_DOT, 443 },
{ "whois:", proto_DOES_NOT_PARSE, 43 },
{ "ldap:", proto_PATH_NOT_UNIX, 389 },
{ "data:", proto_DOES_NOT_PARSE, 0 },
{ NULL, 0, 0 }
};
......
......@@ -14,9 +14,7 @@
*/
/* -*-C-*-
*
* $Version: networking $
*
* $Source$
* Copyright (C) Pace Micro Technology, 2000.
*
* SetProxy sets up a proxy service for all or some requests.
*/
......@@ -122,11 +120,9 @@ _kernel_oserror *setproxy(_kernel_swi_regs *r)
char *method = (char *) r->r[3];
int op = r->r[4];
#ifdef TRACE
protocol_debug("setproxy: flags: %08x Session: %08x Base: `%s' Method: `%s' <%sProxy>\n",
r->r[0], r->r[1], base?base:"<NULL>", method?method:"<NULL>",
r->r[4] == op_no_proxy ? "Don't ": "");
#endif
dprintf(("setproxy", "setproxy: flags: %08x Session: %08x Base: `%s' Method: `%s'"
"<%sProxy>\n", r->r[0], r->r[1], base?base:"<NULL>", method?method:"<NULL>",
r->r[4] == op_no_proxy ? "Don't ": ""));
if (base == NULL) {
return deleteproxy(r->r[1]);
......
/* Copyright 1998 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* -*-C-*-
*
* svcprint.c
*
* print debugging information down the TML tube link.
*
* provides:
* %s - string
* %C - character in range 20->7F (space printed if outside range)
* %c - any character
* %X - reverses order of bytes if >2 (or >4) specified as width
* %x - hex
* %B - reverses order of bytes if >2 (or >4) specified as width
* %b - binary
* %D - reverses order of bytes if >2 (or >4) specified as width
* %d - decimal
*
* field width can be specified by placing a decimal number after the "%"
* character... if the width is started by a "0" then numbers are padded
* with "0"...
*
* standard format specifiers o,u,e,f and g are NOT supported
*/
#include "kernel.h"
#include "swis.h"
#include "debug.h"
#ifndef NULL
# define NULL ((void *)0)
#endif
/**********************************************************************/
static unsigned short ntohs(unsigned short n)
{
return(((n << 8) & 0xff00) | ((n >> 8) & 0x00ff));
}
/**********************************************************************/
static unsigned long ntohl(unsigned long n)
{
return(((n >> 24) & 0x000000ff) | ((n >> 8) & 0x0000ff00) |
((n << 8) & 0x00ff0000) | ((n << 24) & 0xff000000) );
}
/**********************************************************************/
/*
* call processor mode independant character output routine
*/
static void oswrch(unsigned char ch)
{
_kernel_swi_regs regset;
/*
* use HostFS_WriteC (SWI 0x40102) to print the character
*/
regset.r[0] = ch;
(void)_kernel_swi(0x40102, &regset, &regset);
}
/**********************************************************************/
/*
* Printn prints a number n in base b, minimum width w adding pad chars
* if needed.
*/
static void printn(unsigned n, unsigned b, int w, char pad)
{
if( n >= b )
{
printn(n / b, b, --w, pad);
oswrch("0123456789abcdef"[n % b]);
}
else
{
while (--w > 0)
oswrch(pad);
oswrch("0123456789abcdef"[n]);
}
}
/**********************************************************************/
static void prf(char *format, unsigned *argp, ...)
{
register int b; /* base to be used when displaying numbers */
register int c; /* current character read from format string */
register int w; /* field width */
char pad; /* field padding character */
unsigned val; /* value of argument */
loop:
val = *argp;
w = 0;
pad = ' ';
while( (c = *format++) != '%' )
{
if( c == '\0' )
return;
if( c == '\n' )
oswrch('\r');
oswrch(c);
}
again:
/*
* we have a special format command
*/
c = *format++;
switch( c )
{
case 's':
{
/* string */
char *p = (char *)*argp++;
int width = 0;
if (p != NULL)
{
/* NOT a NULL pointer */
while (*p)
{
oswrch(*p++);
width++;
}
}
while( width++ < w )
oswrch(' ');
goto loop;
}
case 'C':
if( (*argp < ' ') || (*argp > '~') )
{
oswrch(' ');
argp++;
goto loop;
}
case 'c':
/* character */
oswrch(*argp++);
goto loop;
case '0':
if (w == 0)
pad = '0';
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
/* field width */
w = (w * 10) + ((int) c - '0');
goto again;
case 'X':
/* hex number */
if (w > 4)
val = (unsigned)ntohl(val);
else
{
if (w > 2)
val = (unsigned)ntohs(val);
}
/*
* NB
*
* fall through to set base
*/
case 'x':
/* hex number */
b = 16;
goto number;
case 'B':
/* binary number */
if (w > 4)
val = (unsigned)ntohl(val);
else
{
if( w > 2 )
val = (unsigned)ntohs(val);
}
/*
* NB
*
* fall through to set base
*/
case 'b':
/* binary number */
b = 2;
goto number;
case 'D':
/* decimal number */
if (w > 4)
val = (unsigned)ntohl(val);
else
{
if (w > 2)
val = (unsigned)ntohs(val);
}
/*
* NB
*
* fall through to set base
*/
case 'd':
b = 10;
/*
* NB
*
* fall through to write number
*/
number:
printn(val,b,w,pad);
argp++;
break;
} /* switch */
goto loop;
}
/**********************************************************************/
#if 0
# define USETUBE
#endif /* 0/1 */
extern void Printf(char *format, ...);
void Printf(char *format, ...)
{
unsigned *argp = (unsigned *)&format;
#ifdef USETUBE
_kernel_swi_regs reglist;
_kernel_oserror *err;
reglist.r[0] = (int)"HostVDU";
if( (err = _kernel_swi(OS_CLI, &reglist, &reglist)) != NULL )
{
prf("HostVDU: ", 0);
prf(err->errmess, 0);
return;
}
#endif /* USETUBE */
prf(format, (argp + 1));
#ifdef USETUBE
reglist.r[0] = (int)"TubeVDU";
if( (err = _kernel_swi(OS_CLI, &reglist, &reglist)) != NULL )
{
prf("TubeVDU: ", 0);
prf(err->errmess, 0);
return;
}
#endif /* USETUBE */
}
/**********************************************************************/
/* EOF svcprint.c */
......@@ -68,7 +68,7 @@ extern _kernel_oserror *make_error (int err_num, int num_args, ...)
va_list ap;
char *s, token[4];
int i=4;
int i=0;
_kernel_oserror *e, *ptr;
char *sub[4]={0,0,0,0};
......
......@@ -12,9 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* File: protocol.h
* Author: SNB
* Acorn Computers Ltd. 1993-1997
/*
* $Id$
*
* Copyright Pace Micro Technology plc. 1993-2000
*
*/
......@@ -45,7 +47,7 @@ enum {
/*************************************************************/
/* The following error messages have been reserved for other */
/* URL fetcher modules. */
/* URL fetcher modules. */
/*************************************************************/
#define HTTP_MODULE_OFFSET 0x000020 /* 0x80de20 to */
#define HTTP_MODULE_SIZE 0x00001f /* 0x80de3f */
......@@ -63,12 +65,7 @@ enum {
#define FINGER_MODULE_SIZE 0x00001f /* 0x80deff */
#ifdef TRACE
#pragma -v1
extern void protocol_debug(const char */*format*/, ...);
#pragma -v0
extern void protocol_dump(const char *ptr, int size);
#endif
#include "DebugLib/DebugLib.h"
#ifdef DIRECTSWI
#error "Do not use DIRECTSWI"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment