Home » Archimedes archive » Acorn User » AU 1997-Xmas B.adf » PD » NetPlex/!Netplex/SocketFS/C/Tstnmproc

NetPlex/!Netplex/SocketFS/C/Tstnmproc

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-Xmas B.adf » PD
Filename: NetPlex/!Netplex/SocketFS/C/Tstnmproc
Read OK:
File size: 09D0 bytes
Load address: 0000
Exec address: 0000
File contents
/***************************************************************************/
/* Program       : SocketFS                                                */
/* Purpose       : A BSD sockets filesystem for RISCOS                     */
/* File          : TstNmProc.c                                             */
/* Description   : Tests the filename processor.                           */
/* Author        : R G Gammans                                             */
/* Date Created  :                                                         */
/* Last Edited   :                                                         */
/*                                                                         */
/* Copyright Date:                                                         */
/*                                                                         */
/***************************************************************************/
/*
 *   SocketFS - BSD sockets filing system for RISC-OS.
 *   Copyright (C) 1997 Roger G Gammans
 *
 *   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.
 *
 *   Author: R Gammans <rgammans@compsurg,demon.co.uk>
 *   Snailmail  : 20 Trenches Rd, Crowborough, E Sussex, TN6 1ES UK.
 */

#include <stdio.h>
#include <errno.h>

extern int  makeSocket(char*, char*);
extern void inithandlerlist();

extern char* errstr;

int main (int argc,char* argv[])
 {
   int s;

   if  (argc>1) {
     argc--;
     argv++;
     inithandlerlist();
     while (argc>0) {
       errstr="";
       s=makeSocket(0,argv[0]);
       if (s!=-1) {
         printf("%s is sockect number - %d\n",argv[0],s);
        } else {
         printf("Err no %d\n errmsg %s",errno,errstr);
       }
       argc--;
       argv++;
     }
   } else {
     printf("TstNmPrc takes socketfs style filenames as parameters\n");
   }
  return 0;

 }


00000000  2f 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |/***************|
00000010  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000040  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2f 0a 2f 2a  |************/./*|
00000050  20 50 72 6f 67 72 61 6d  20 20 20 20 20 20 20 3a  | Program       :|
00000060  20 53 6f 63 6b 65 74 46  53 20 20 20 20 20 20 20  | SocketFS       |
00000070  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000090  20 20 20 20 20 20 20 20  20 2a 2f 0a 2f 2a 20 50  |         */./* P|
000000a0  75 72 70 6f 73 65 20 20  20 20 20 20 20 3a 20 41  |urpose       : A|
000000b0  20 42 53 44 20 73 6f 63  6b 65 74 73 20 66 69 6c  | BSD sockets fil|
000000c0  65 73 79 73 74 65 6d 20  66 6f 72 20 52 49 53 43  |esystem for RISC|
000000d0  4f 53 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |OS              |
000000e0  20 20 20 20 20 20 20 2a  2f 0a 2f 2a 20 46 69 6c  |       */./* Fil|
000000f0  65 20 20 20 20 20 20 20  20 20 20 3a 20 54 73 74  |e          : Tst|
00000100  4e 6d 50 72 6f 63 2e 63  20 20 20 20 20 20 20 20  |NmProc.c        |
00000110  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000130  20 20 20 20 20 2a 2f 0a  2f 2a 20 44 65 73 63 72  |     */./* Descr|
00000140  69 70 74 69 6f 6e 20 20  20 3a 20 54 65 73 74 73  |iption   : Tests|
00000150  20 74 68 65 20 66 69 6c  65 6e 61 6d 65 20 70 72  | the filename pr|
00000160  6f 63 65 73 73 6f 72 2e  20 20 20 20 20 20 20 20  |ocessor.        |
00000170  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000180  20 20 20 2a 2f 0a 2f 2a  20 41 75 74 68 6f 72 20  |   */./* Author |
00000190  20 20 20 20 20 20 20 3a  20 52 20 47 20 47 61 6d  |       : R G Gam|
000001a0  6d 61 6e 73 20 20 20 20  20 20 20 20 20 20 20 20  |mans            |
000001b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000001d0  20 2a 2f 0a 2f 2a 20 44  61 74 65 20 43 72 65 61  | */./* Date Crea|
000001e0  74 65 64 20 20 3a 20 20  20 20 20 20 20 20 20 20  |ted  :          |
000001f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000210  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 2a  |               *|
00000220  2f 0a 2f 2a 20 4c 61 73  74 20 45 64 69 74 65 64  |/./* Last Edited|
00000230  20 20 20 3a 20 20 20 20  20 20 20 20 20 20 20 20  |   :            |
00000240  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000260  20 20 20 20 20 20 20 20  20 20 20 20 20 2a 2f 0a  |             */.|
00000270  2f 2a 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |/*              |
00000280  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000002b0  20 20 20 20 20 20 20 20  20 20 20 2a 2f 0a 2f 2a  |           */./*|
000002c0  20 43 6f 70 79 72 69 67  68 74 20 44 61 74 65 3a  | Copyright Date:|
000002d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000300  20 20 20 20 20 20 20 20  20 2a 2f 0a 2f 2a 20 20  |         */./*  |
00000310  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000350  20 20 20 20 20 20 20 2a  2f 0a 2f 2a 2a 2a 2a 2a  |       */./*****|
00000360  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000003a0  2a 2a 2a 2a 2a 2a 2f 0a  2f 2a 0a 20 2a 20 20 20  |******/./*. *   |
000003b0  53 6f 63 6b 65 74 46 53  20 2d 20 42 53 44 20 73  |SocketFS - BSD s|
000003c0  6f 63 6b 65 74 73 20 66  69 6c 69 6e 67 20 73 79  |ockets filing sy|
000003d0  73 74 65 6d 20 66 6f 72  20 52 49 53 43 2d 4f 53  |stem for RISC-OS|
000003e0  2e 0a 20 2a 20 20 20 43  6f 70 79 72 69 67 68 74  |.. *   Copyright|
000003f0  20 28 43 29 20 31 39 39  37 20 52 6f 67 65 72 20  | (C) 1997 Roger |
00000400  47 20 47 61 6d 6d 61 6e  73 0a 20 2a 0a 20 2a 20  |G Gammans. *. * |
00000410  20 20 54 68 69 73 20 70  72 6f 67 72 61 6d 20 69  |  This program i|
00000420  73 20 66 72 65 65 20 73  6f 66 74 77 61 72 65 3b  |s free software;|
00000430  20 79 6f 75 20 63 61 6e  20 72 65 64 69 73 74 72  | you can redistr|
00000440  69 62 75 74 65 20 69 74  20 61 6e 64 2f 6f 72 20  |ibute it and/or |
00000450  6d 6f 64 69 66 79 0a 20  2a 20 20 20 69 74 20 75  |modify. *   it u|
00000460  6e 64 65 72 20 74 68 65  20 74 65 72 6d 73 20 6f  |nder the terms o|
00000470  66 20 74 68 65 20 47 4e  55 20 47 65 6e 65 72 61  |f the GNU Genera|
00000480  6c 20 50 75 62 6c 69 63  20 4c 69 63 65 6e 73 65  |l Public License|
00000490  20 61 73 20 70 75 62 6c  69 73 68 65 64 20 62 79  | as published by|
000004a0  0a 20 2a 20 20 20 74 68  65 20 46 72 65 65 20 53  |. *   the Free S|
000004b0  6f 66 74 77 61 72 65 20  46 6f 75 6e 64 61 74 69  |oftware Foundati|
000004c0  6f 6e 3b 20 65 69 74 68  65 72 20 76 65 72 73 69  |on; either versi|
000004d0  6f 6e 20 32 20 6f 66 20  74 68 65 20 4c 69 63 65  |on 2 of the Lice|
000004e0  6e 73 65 2c 20 6f 72 0a  20 2a 20 20 20 28 61 74  |nse, or. *   (at|
000004f0  20 79 6f 75 72 20 6f 70  74 69 6f 6e 29 20 61 6e  | your option) an|
00000500  79 20 6c 61 74 65 72 20  76 65 72 73 69 6f 6e 2e  |y later version.|
00000510  0a 20 2a 0a 20 2a 0a 20  2a 20 20 20 54 68 69 73  |. *. *. *   This|
00000520  20 70 72 6f 67 72 61 6d  20 69 73 20 64 69 73 74  | program is dist|
00000530  72 69 62 75 74 65 64 20  69 6e 20 74 68 65 20 68  |ributed in the h|
00000540  6f 70 65 20 74 68 61 74  20 69 74 20 77 69 6c 6c  |ope that it will|
00000550  20 62 65 20 75 73 65 66  75 6c 2c 0a 20 2a 20 20  | be useful,. *  |
00000560  20 62 75 74 20 57 49 54  48 4f 55 54 20 41 4e 59  | but WITHOUT ANY|
00000570  20 57 41 52 52 41 4e 54  59 3b 20 77 69 74 68 6f  | WARRANTY; witho|
00000580  75 74 20 65 76 65 6e 20  74 68 65 20 69 6d 70 6c  |ut even the impl|
00000590  69 65 64 20 77 61 72 72  61 6e 74 79 20 6f 66 0a  |ied warranty of.|
000005a0  20 2a 20 20 20 4d 45 52  43 48 41 4e 54 41 42 49  | *   MERCHANTABI|
000005b0  4c 49 54 59 20 6f 72 20  46 49 54 4e 45 53 53 20  |LITY or FITNESS |
000005c0  46 4f 52 20 41 20 50 41  52 54 49 43 55 4c 41 52  |FOR A PARTICULAR|
000005d0  20 50 55 52 50 4f 53 45  2e 20 20 53 65 65 20 74  | PURPOSE.  See t|
000005e0  68 65 0a 20 2a 20 20 20  47 4e 55 20 47 65 6e 65  |he. *   GNU Gene|
000005f0  72 61 6c 20 50 75 62 6c  69 63 20 4c 69 63 65 6e  |ral Public Licen|
00000600  73 65 20 66 6f 72 20 6d  6f 72 65 20 64 65 74 61  |se for more deta|
00000610  69 6c 73 2e 0a 20 2a 0a  20 2a 20 20 20 59 6f 75  |ils.. *. *   You|
00000620  20 73 68 6f 75 6c 64 20  68 61 76 65 20 72 65 63  | should have rec|
00000630  65 69 76 65 64 20 61 20  63 6f 70 79 20 6f 66 20  |eived a copy of |
00000640  74 68 65 20 47 4e 55 20  47 65 6e 65 72 61 6c 20  |the GNU General |
00000650  50 75 62 6c 69 63 20 4c  69 63 65 6e 73 65 0a 20  |Public License. |
00000660  2a 20 20 20 61 6c 6f 6e  67 20 77 69 74 68 20 74  |*   along with t|
00000670  68 69 73 20 70 72 6f 67  72 61 6d 3b 20 69 66 20  |his program; if |
00000680  6e 6f 74 2c 20 77 72 69  74 65 20 74 6f 20 74 68  |not, write to th|
00000690  65 20 46 72 65 65 20 53  6f 66 74 77 61 72 65 0a  |e Free Software.|
000006a0  20 2a 20 20 20 46 6f 75  6e 64 61 74 69 6f 6e 2c  | *   Foundation,|
000006b0  20 49 6e 63 2e 2c 20 36  37 35 20 4d 61 73 73 20  | Inc., 675 Mass |
000006c0  41 76 65 2c 20 43 61 6d  62 72 69 64 67 65 2c 20  |Ave, Cambridge, |
000006d0  4d 41 20 30 32 31 33 39  2c 20 55 53 41 2e 0a 20  |MA 02139, USA.. |
000006e0  2a 0a 20 2a 20 20 20 41  75 74 68 6f 72 3a 20 52  |*. *   Author: R|
000006f0  20 47 61 6d 6d 61 6e 73  20 3c 72 67 61 6d 6d 61  | Gammans <rgamma|
00000700  6e 73 40 63 6f 6d 70 73  75 72 67 2c 64 65 6d 6f  |ns@compsurg,demo|
00000710  6e 2e 63 6f 2e 75 6b 3e  0a 20 2a 20 20 20 53 6e  |n.co.uk>. *   Sn|
00000720  61 69 6c 6d 61 69 6c 20  20 3a 20 32 30 20 54 72  |ailmail  : 20 Tr|
00000730  65 6e 63 68 65 73 20 52  64 2c 20 43 72 6f 77 62  |enches Rd, Crowb|
00000740  6f 72 6f 75 67 68 2c 20  45 20 53 75 73 73 65 78  |orough, E Sussex|
00000750  2c 20 54 4e 36 20 31 45  53 20 55 4b 2e 0a 20 2a  |, TN6 1ES UK.. *|
00000760  2f 0a 0a 23 69 6e 63 6c  75 64 65 20 3c 73 74 64  |/..#include <std|
00000770  69 6f 2e 68 3e 0a 23 69  6e 63 6c 75 64 65 20 3c  |io.h>.#include <|
00000780  65 72 72 6e 6f 2e 68 3e  0a 0a 65 78 74 65 72 6e  |errno.h>..extern|
00000790  20 69 6e 74 20 20 6d 61  6b 65 53 6f 63 6b 65 74  | int  makeSocket|
000007a0  28 63 68 61 72 2a 2c 20  63 68 61 72 2a 29 3b 0a  |(char*, char*);.|
000007b0  65 78 74 65 72 6e 20 76  6f 69 64 20 69 6e 69 74  |extern void init|
000007c0  68 61 6e 64 6c 65 72 6c  69 73 74 28 29 3b 0a 0a  |handlerlist();..|
000007d0  65 78 74 65 72 6e 20 63  68 61 72 2a 20 65 72 72  |extern char* err|
000007e0  73 74 72 3b 0a 0a 69 6e  74 20 6d 61 69 6e 20 28  |str;..int main (|
000007f0  69 6e 74 20 61 72 67 63  2c 63 68 61 72 2a 20 61  |int argc,char* a|
00000800  72 67 76 5b 5d 29 0a 20  7b 0a 20 20 20 69 6e 74  |rgv[]). {.   int|
00000810  20 73 3b 0a 0a 20 20 20  69 66 20 20 28 61 72 67  | s;..   if  (arg|
00000820  63 3e 31 29 20 7b 0a 20  20 20 20 20 61 72 67 63  |c>1) {.     argc|
00000830  2d 2d 3b 0a 20 20 20 20  20 61 72 67 76 2b 2b 3b  |--;.     argv++;|
00000840  0a 20 20 20 20 20 69 6e  69 74 68 61 6e 64 6c 65  |.     inithandle|
00000850  72 6c 69 73 74 28 29 3b  0a 20 20 20 20 20 77 68  |rlist();.     wh|
00000860  69 6c 65 20 28 61 72 67  63 3e 30 29 20 7b 0a 20  |ile (argc>0) {. |
00000870  20 20 20 20 20 20 65 72  72 73 74 72 3d 22 22 3b  |      errstr="";|
00000880  0a 20 20 20 20 20 20 20  73 3d 6d 61 6b 65 53 6f  |.       s=makeSo|
00000890  63 6b 65 74 28 30 2c 61  72 67 76 5b 30 5d 29 3b  |cket(0,argv[0]);|
000008a0  0a 20 20 20 20 20 20 20  69 66 20 28 73 21 3d 2d  |.       if (s!=-|
000008b0  31 29 20 7b 0a 20 20 20  20 20 20 20 20 20 70 72  |1) {.         pr|
000008c0  69 6e 74 66 28 22 25 73  20 69 73 20 73 6f 63 6b  |intf("%s is sock|
000008d0  65 63 74 20 6e 75 6d 62  65 72 20 2d 20 25 64 5c  |ect number - %d\|
000008e0  6e 22 2c 61 72 67 76 5b  30 5d 2c 73 29 3b 0a 20  |n",argv[0],s);. |
000008f0  20 20 20 20 20 20 20 7d  20 65 6c 73 65 20 7b 0a  |       } else {.|
00000900  20 20 20 20 20 20 20 20  20 70 72 69 6e 74 66 28  |         printf(|
00000910  22 45 72 72 20 6e 6f 20  25 64 5c 6e 20 65 72 72  |"Err no %d\n err|
00000920  6d 73 67 20 25 73 22 2c  65 72 72 6e 6f 2c 65 72  |msg %s",errno,er|
00000930  72 73 74 72 29 3b 0a 20  20 20 20 20 20 20 7d 0a  |rstr);.       }.|
00000940  20 20 20 20 20 20 20 61  72 67 63 2d 2d 3b 0a 20  |       argc--;. |
00000950  20 20 20 20 20 20 61 72  67 76 2b 2b 3b 0a 20 20  |      argv++;.  |
00000960  20 20 20 7d 0a 20 20 20  7d 20 65 6c 73 65 20 7b  |   }.   } else {|
00000970  0a 20 20 20 20 20 70 72  69 6e 74 66 28 22 54 73  |.     printf("Ts|
00000980  74 4e 6d 50 72 63 20 74  61 6b 65 73 20 73 6f 63  |tNmPrc takes soc|
00000990  6b 65 74 66 73 20 73 74  79 6c 65 20 66 69 6c 65  |ketfs style file|
000009a0  6e 61 6d 65 73 20 61 73  20 70 61 72 61 6d 65 74  |names as paramet|
000009b0  65 72 73 5c 6e 22 29 3b  0a 20 20 20 7d 0a 20 20  |ers\n");.   }.  |
000009c0  72 65 74 75 72 6e 20 30  3b 0a 0a 20 7d 0a 0a 0a  |return 0;.. }...|
000009d0