mars_nwe-0.98.pl05

This commit is contained in:
Mario Fetka
2011-11-13 00:38:57 +01:00
parent 758f245d47
commit 1eac63223b
36 changed files with 1506 additions and 567 deletions

View File

@@ -30,7 +30,7 @@ static int usage(char *progname)
int main(int argc, char **argv)
{
char *unxcomm=getenv("UNXCOMM");
char *unxcomm=getenv(ENV_UNXCOMM);
if (NULL == unxcomm) unxcomm=DEFAULT_COMM;
if (argc > 1) {
int fdout = open(unxcomm, O_RDWR);

0
examples/comm.exe Executable file → Normal file
View File

View File

@@ -1,4 +1,4 @@
/* config.h: 18-Jul-96 */
/* config.h: 04-Nov-96 */
/* some of this config is needed by make, others by cc */
#define DO_DEBUG 1 /* compile in debug code */
@@ -32,7 +32,9 @@
#define MAX_CONNECTIONS 5 /* max. number of simultaneous */
/* connections handled by mars_nwe */
#define IPX_DATA_GR_546 1 /* allow ipx packets > 546+30 Byte */
#define IPX_DATA_GR_546 1 /* 0 = max. IPX Packets = 546 +30 Byte ( 512 Byte RWBuff) */
/* 1 = max. IPX packets = 1058 +30 Byte (1024 Byte RWBuff) */
/* 2 = max. IPX packets = 1470 +30 Byte (1444 Byte RWBuff) */
#define USE_MMAP 1 /* use mmap systen call */
@@ -58,6 +60,10 @@
#define MAX_NW_SERVERS 40 /* max. number of nw-servers on your */
/* network */
#define HANDLE_ALL_SAP_TYPS 0 /* if set to 0 only SAP-Typ 4 Servers */
/* will be put into routing table and */
/* if set to 1 all SAP Typs will be */
/* used. */
/* <--------------- next is for linux only ----------------------------> */
#define INTERNAL_RIP_SAP 1 /* use internal/own rip/sap routines */
/* -------------------- */

View File

@@ -1,5 +1,5 @@
#!/bin/sh
# mk.li 10-Jul-96 ###
# mk.li 19-Oct-96
# please edit this file !
mk()
@@ -15,7 +15,25 @@ mk()
if [ $V_VPATH = '..' ] ; then
cd ..;
fi
chmod 666 $ERRFILE
if [ -f $ERRFILE ] ; then
chmod 666 $ERRFILE
fi
}
print_error()
{
if [ "$UNX" = 'linux' ]; then
if [ ! -f /usr/include/ndbm.h ] ; then
echo "-------------------------------------------------------------"
echo "probably you have a broken Linux installation because"
echo "'/usr/include/ndbm.h' the include file for the Linux database"
echo "is missing."
echo "-------------------------------------------------------------"
fi
fi
echo ""
echo "The errors are also reported in '$ERRFILE'"
echo "============================================================="
}
TOLOWER='tr "[A-Z]" "[a-z]"'
@@ -23,7 +41,8 @@ UNX=`uname -s | $TOLOWER`
MASCHINE=`uname -m`
MK_PPID=$$
export MK_PPID
trap 'echo "Error: Try again :)" && exit 1' 1
trap 'print_error; exit 1' 1
case $UNX in
linux)
@@ -55,7 +74,7 @@ fi
TMP=/tmp
INSTALL=install
;;
########### USL UNIX ##############
########### SYSV (UnixWare) ##############
unix_sv)
V_VPATH="."
OBJDIR="."

View File

@@ -2,7 +2,7 @@
# This is the configuration-file for "mars_nwe", a free netware-emulator
# for Linux.
#
# last change: 04-Oct-96
# last changed: 09-Nov-96
# This file specifies which Linux-resources (printers, users, directories)
# should be accessible to the DOS-clients via "mars_nwe". Furthermore
@@ -72,6 +72,7 @@
#
# m removable volume (e.g. cd-roms) or volumes, which
# should be remountable when mars_nwe is running.
# Should also be used for 'HOME' volumes.
# r volume is read-only and always reports "0 byte free"
# (this is intended for copies of CD-ROMs on harddisks)
# o (lowercase o)
@@ -91,7 +92,7 @@
# Examples:
# 1 SYS /var/local/nwe/SYS k
# 1 CDROM /cdrom kmr
# 1 HOME ~ k
# 1 HOME ~ km
1 SYS /u3/SYS/ k
@@ -259,8 +260,11 @@
#
# SERVER_VERSION: the version-number reported to DOS-clients
# 0 Version 2.15 (default)
# 1 Version 3.11
# 2 Version 3.12 (not implemented yet)
# 1 Version 3.11 (will be default soon)
# 2 Version 3.12 (burst mode is not implemented yet)
#
# If you want to use longfilenamesupport and/or namespace routines
# you should set this section to '1'.
# -------------------------------------------------------------------------
#
@@ -301,12 +305,16 @@
7 0
# Section 8: special login/logout/security flags.
# Section 8: special login/logout/security and other flags.
# =========================================================================
# Flags
# 0x1 allow changing dir/accessing other files than login/*
# when not logged in, if the client supports it.
# ( this was standard till mars_nwe-0.98.pl4 )
# 0x2 switch on strange compatibility mode for opening files.
# If an opencall do an open for writing but
# the file is readonly then this call will not fail
# but open the file readonly.
#
# other flags may follow.
# value will be interpreted as hex value.
@@ -537,7 +545,7 @@
101 1 # debug NWSERV
102 0 # debug NCPSERV
103 0 # debug NWCONN
104 0 # debug (start) NWCLIENT
104 0 # debug (start) NWCLIENT, should *always* be '0' !
105 0 # debug NWBIND
106 1 # debug NWROUTED
@@ -561,9 +569,12 @@
300 1 # > 0 print routing info to file every x broadcasts.
# ( normally minutes )
301 /tmp/nw.routes # filename of logfile
302 1 # 1 = creat new routing info file
# 0 = append to this file
302 0x1 # flags will be interpreted as hex value.
# 0 = append to this file
# & 0x1 = creat new routing info file
# & 0x2 = split info into several files
# (extensions = .1, .2, .3 ... )
# Section 310: watchdogs

70
examples/sendm.c Normal file
View File

@@ -0,0 +1,70 @@
/* sendm.c 23-Oct-96 */
/*
* simple demo for a sendmail acces under DOS
* DOS <-> UNX command handling using PIPE filesystem.
* can be used with unxsendm for UNX.
*
* Can also be used under Linux for ncpfs <-> mars_nwe.
* but do not use it directly (the opencall will destroy unxsendm)!!
*
* QUICK + DIRTY !!!
*/
#define ENV_UNXCOMM "UNXSENDM"
#ifdef LINUX
# define DEFAULT_COMM "/pipes/unxsendm"
# else
# define DEFAULT_COMM "p:/unxsendm"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#ifndef LINUX
# include <io.h>
#endif
#include <fcntl.h>
int main(int argc, char **argv)
{
char *unxcomm=getenv(ENV_UNXCOMM);
int fdout;
int fdin;
int is_pipe=isatty(0) ? 0 :1;
if (NULL == unxcomm)
unxcomm=DEFAULT_COMM;
fdout = open(unxcomm, O_RDWR);
fdin = dup(fdout);
if (fdout > -1 && fdin > -1) {
char **pp=argv+1;
unsigned char b=32;
int size;
char buf[1024];
while(--argc >0) {
write(fdout, *pp, strlen(*pp));
++pp;
write(fdout, &b, 1);
}
b=0;
write(fdout, &b, 1);
close(fdout);
fdout=dup(fdin);
if (6 == (size = read(fdin, buf, 6)) && !memcmp(buf, "+++++\n", 6)) {
/* now write stdin -> sendmail */
if (is_pipe) {
while (0 < (size = fread(buf, 1, sizeof(buf), stdin)))
write(fdout, buf, size);
}
} else if (size > 0)
write(1, buf, size); /* probably errormessage */
close(fdout);
/* now we print errors */
while (0 < (size = read(fdin, buf, sizeof(buf)))) {
write(1, buf, size);
}
close(fdin);
return(0);
} else
fprintf(stderr, "Cannot open PIPECOMMAND '%s'\n", unxcomm);
return(1);
}

View File

@@ -1,6 +1,12 @@
/* unxcomm.c 24-Oct-96 */
/* simple UNX program to work together with 'comm' */
/* to domonstrate usage of pipefilesystem */
#include <stdio.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/types.h>
static char **build_argv(int bufsize, char *command, int len)
/* routine returns **argv for use with execv routines */
@@ -38,15 +44,28 @@ static char **build_argv(int bufsize, char *command, int len)
}
#define MAXARGLEN 1024
int bl_read(int fd, void *buf, int size)
{
fd_set fdin;
struct timeval t;
int result;
FD_ZERO(&fdin);
FD_SET(fd, &fdin);
t.tv_sec = 1; /* 1 sec should be enough */
t.tv_usec = 0;
result = select(fd+1, &fdin, NULL, NULL, &t);
if (result > 0)
result=read(fd, buf, size);
return(result);
}
int main(int argc, char *argv[])
{
int status=fcntl(0, F_GETFL);
int size;
char buf[MAXARGLEN+1024];
if (status != -1) fcntl(0, F_SETFL, status|O_NONBLOCK);
close(2);
dup2(1,2);
if (-1 < (size=read(0, buf, MAXARGLEN))){
if (0 < (size=bl_read(0, buf, MAXARGLEN))){
char **argvv=build_argv(sizeof(buf), buf, size);
if (argvv) {
char path[300];

53
examples/unxsendm.c Normal file
View File

@@ -0,0 +1,53 @@
/* unxsendm.c 23-Oct-96 */
/* simple UNX program to work together with 'pipe-filesystem'
* and DOS sendm.exe to get sendmail functionality under DOS
* QUICK + DIRTY !!!
*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/types.h>
#define MAXARGLEN 100
int bl_read(int fd, void *buf, int size)
{
fd_set fdin;
struct timeval t;
int result;
FD_ZERO(&fdin);
FD_SET(fd, &fdin);
t.tv_sec = 1; /* 1 sec should be enough */
t.tv_usec = 0;
result = select(fd+1, &fdin, NULL, NULL, &t);
if (result > 0)
result=read(fd, buf, size);
return(result);
}
int main(int argc, char *argv[])
{
int size;
char buf[1024];
close(2);
dup2(1,2); /* we want stdout and errout */
if (-1 < (size=bl_read(0, buf, MAXARGLEN))){
FILE *f;
char path[MAXARGLEN+200];
buf[size]='\0';
sprintf(path, "/usr/sbin/sendmail %s", buf);
f=popen(path, "w");
if (NULL != f) {
write(1, "+++++\n", 6);
while (0 < (size=bl_read(0, buf, sizeof(buf)))){
fwrite(buf, size, 1, f);
}
pclose(f);
return(0);
}
perror(path);
} else
perror("read stdin");
return(1);
}