home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume3
/
pcmail
/
part07
/
rmtname.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-02-03
|
3KB
|
103 lines
/*++
/* NAME
/* rmtname 3
/* SUMMARY
/* mapping between local and remote spool-file names
/* PROJECT
/* pc-mail
/* PACKAGE
/* cico
/* SYNOPSIS
/* #include "params.h"
/* #include "comm.h"
/*
/* char *rmtname(head,tail)
/* int head;
/* char *tail;
/*
/* char *locname(rname)
/* char *rname;
/* DESCRIPTION
/* locname() translates a remote spool-file name to one suitable
/* for the local file system. Remote X.* file names are converted
/* to the name of the local null device. All other remote file
/* names are mapped to names of the form n<seqno> in the local
/* spool directory.
/*
/* rmtname() constructs a remote spool file name from its arguments,
/* which are a sort of broken-down local spool file name.
/* "head" specifies the type of file (Data or eXecute file).
/* "tail" is a character string holding a sequence number.
/*
/* The output for D files is: D.<rmtsys>S<xseq>
/*
/* The output for X files is: X.<thissys>X<xseq>
/*
/* xseq is the four-digit hexadecimal representation of
/* the sequence number in tail.
/* SEE ALSO
/* getwork()
/* DIAGNOSTICS
/* rmtname() returns via longjmp(systrap,E_CONFUSED) if its
/* arguments are incorrect.
/* BUGS
/* locname() and rmtname() store their result in a static area which
/* is overwritten upon each call.
/* AUTHOR(S)
/* W.Z. Venema
/* Eindhoven University of Technology
/* Department of Mathematics and Computer Science
/* Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
/* CREATION DATE
/* Thu Mar 26 14:08:07 GMT+1:00 1987
/* LAST MODIFICATION
/* Mon Apr 4 23:48:20 MET 1988
/* VERSION/RELEASE
/* 1.3
/*--*/
#include "defs.h"
#include "params.h"
#include "comm.h"
#include "logs.h"
#include "status.h"
#include "path.h"
hidden char buf[BUFSIZ]; /* storage for the result */
/* rmtname - map local spool file name to remote spool file name */
public char *rmtname(head,tail)
register int head;
register char *tail;
{
int seqno;
sscanf(tail,"%d",&seqno); /* get sequence number */
seqno &= 0xffff; /* truncate to four hex digs */
switch(head) {
case 'D': /* data file */
sprintf(buf,"D.%sS%04x",rmthost,seqno);
return(buf);
case 'X': /* execute file */
sprintf(buf,"X.%sX%04x",LOGIN_NAME,seqno);
return(buf);
default: /* oops */
trap(E_CONFUSED,"INTERNAL ERROR (unexpected file type: %c)",head);
/* NOTREACHED */
}
}
/* locname - map remote spool-file name to local name */
char *locname(rname)
char *rname;
{
if (strncmp(rname,"X.",2) == 0) { /* X. files are ignored */
return(NULLDEV);
} else { /* everything else is kept */
return(new_mesg(newseqno()));
}
}