]> git.sur5r.net Git - openldap/blob - libraries/msdos/msdos.c
Allow using real db1 on glibc 2.1 instead of the db1 compatiblity in db2.
[openldap] / libraries / msdos / msdos.c
1 #ifndef PCNFS
2 #include <stdio.h>
3 #include <string.h>
4 #include <stdlib.h>
5 #include <dos.h>
6 #include <stdarg.h>
7 #include <io.h>
8 #include <time.h>
9 #define ffblk find_t
10 #define ff_name name
11 #include <signal.h>
12 #include <direct.h>
13 #include <malloc.h>
14
15 #define WINMASTER
16 #define LPR
17
18 #ifdef MEMORY_DEBUG
19 #include "memdebug.h"
20 #endif
21 #include "whatami.h"
22 #include "hostform.h"
23 #include "windat.h"
24 #include "lp.h"
25 #include "externs.h"
26 #include "msdos.h"
27
28 /*  Function prototypes  */
29
30 int     netup = 0;
31 int     connection_id;
32 int     cf_length = 0;      /* current length of control_file */
33 int     sequence_number;    /* sequence number for spooled file names */
34 struct config *cp;          /* configuration information */
35 char    username[9];        /* name of user */
36 int     debug = 0;          /* 1 = print debugging info; set with -D option */
37
38 int     ftppassword,        /* not used; just to avoid unresolved external */
39 bypass_passwd=0;        /* whether to bypass the password check */
40
41 unsigned char path_name[_MAX_DRIVE+_MAX_DIR],           /* character storage for the path name */
42 temp_str[20],s[_MAX_DIR],temp_data[30];
43
44 /* Do session initialization.  Snetinit reads config file. */
45 ncsainit()
46 {
47         char *ptr;
48         int i;
49         if (netup) return;
50         ptr = getenv("CONFIG.TEL");
51         if (ptr != NULL) Shostfile(ptr);
52         if(i=Snetinit()) {
53                 if(i==-2)               /* BOOTP server not responding */
54                         netshut();      /* release network */
55                 crash("network initialization failed.");
56         }       /* end if */
57         netup = 1;
58 }
59
60
61 int ncsaopen( address, port )
62 unsigned long    address;
63 short     port;
64 {
65         unsigned char  *bob;
66         struct machinfo *mr;
67         short source_port;
68         short handle;
69         char s[256];
70
71         bob = (unsigned char *) &address;
72         sprintf(s,"%u.%u.%u.%u\n",bob[0],bob[1],bob[2],bob[3]);
73         mr = lookup(s);
74
75         /* open connection */
76         /* pick a source port at random from the set of privileged ports */
77
78         srand((unsigned)time(NULL));
79
80         source_port = rand() % MAX_PRIV_PORT;
81         handle = open_connection(mr, source_port, port);
82         return(handle);
83 }
84 #endif /* PCNFS */