home *** CD-ROM | disk | FTP | other *** search
- /*
- * convert user shared filename to local server file name
- *
- * uses OS/2 Lan Manager NET Api calls
- * named pipes version of c-tree server
- *
- * This program is the CONFIDENTIAL and PROPRIETARY property
- * of FairCom(R) Corporation. Any unauthorized use, reproduction or
- * transfer of this program is strictly prohibited.
- *
- * Copyright (c) 1987, 1988, 1989 FairCom Corporation
- * (Subject to limited distribution and
- * restricted disclosure only.)
- * *** ALL RIGHTS RESERVED ***
- *
- * 4006 West Broadway
- * Columbia, MO 65203
- *
- *
- * c-tree(R) Version 4.3
- * Release C
- * February 7, 1989 17:30
- *
- */
-
- #include <net\netcons.h>
- #include <net\neterr.h>
- #include <net\wksta.h>
- #include <net\use.h>
- #include <net\shares.h>
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
-
- #include "ctpipes.h"
-
- static char full_fil_navn[PATHLEN+1];
-
- char *konvert_drive_to_local(char *filename)
- {
- int ret; /* return variable for NetServerEnum */
- unsigned short avail; /* size of avail info */
- struct use_info_1 *us1;
- struct share_info_2 *sh2;
- char *cp;
- char serv[RMLEN+1],
- name[RMLEN+1],
- shar[NNLEN];
- char buffer[256];
-
- strncpy(name,filename,2);
- name[2] = '\0';
- us1 = (struct use_info_1 *)buffer;
- ret = NetUseGetInfo ( 0L, /* servername (0L=local) */
- (char far *)name, /* local name */
- 1, /* level of info */
- (char far *)us1, /* return buffer */
- 255, /* sizeof return buffer */
- (unsigned short far *)&avail);
- if (ret)
- return 0L;
-
- /* copy char far* ASCIZ string to char near buffer */
- stfarmov(us1->ui1_remote,(char far*)name,0);
- strcpy(serv,name);
- cp = strchr(serv+2,'\\');
- *cp = '\0';
-
- cp = strchr(name+2,'\\');
- strcpy(shar,cp+1);
-
- sh2 = (struct share_info_2 *)buffer;
- ret = NetShareGetInfo ((char far *)serv, /* servername (0L=local) */
- shar, /* network name */
- 2, /* level of info */
- (char far *)sh2, /* return buffer */
- 255, /* sizeof return buffer */
- (unsigned short far *)&avail);
-
- if (!ret) { /* if successful call */
- /* copy char far* ASCIZ string to char near buffer */
- stfarmov(sh2->shi2_path,(char far*)full_fil_navn,0);
- cp = strchr(full_fil_navn,'\0');
- cp--;
- if (*cp != '\\')
- strcat(full_fil_navn,"\\");
- cp = filename+2;
- if (*cp == '\\')
- cp++;
- strcat(full_fil_navn,cp);
- return full_fil_navn;
- }
- else
- return 0L;
-
- }
-
-
-