/[rdesktop]/sourceforge.net/trunk/rdesktop/parallel.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/parallel.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 664 by astrand, Sat Apr 17 07:14:41 2004 UTC revision 865 by stargo, Tue Mar 15 11:25:50 2005 UTC
# Line 18  extern int errno; Line 18  extern int errno;
18    
19  extern RDPDR_DEVICE g_rdpdr_device[];  extern RDPDR_DEVICE g_rdpdr_device[];
20    
 static PARALLEL_DEVICE *  
 get_parallel_data(HANDLE handle)  
 {  
         int index;  
   
         for (index = 0; index < RDPDR_MAX_DEVICES; index++)  
         {  
                 if (handle == g_rdpdr_device[index].handle)  
                         return (PARALLEL_DEVICE *) g_rdpdr_device[index].pdevice_data;  
         }  
         return NULL;  
 }  
   
21    
22  /* Enumeration of devices from rdesktop.c        */  /* Enumeration of devices from rdesktop.c        */
23  /* returns numer of units found and initialized. */  /* returns numer of units found and initialized. */
# Line 45  parallel_enum_devices(uint32 * id, char Line 32  parallel_enum_devices(uint32 * id, char
32          char *pos2;          char *pos2;
33          int count = 0;          int count = 0;
34    
35          // skip the first colon          /* skip the first colon */
36          optarg++;          optarg++;
37          while ((pos = next_arg(optarg, ',')) && *id < RDPDR_MAX_DEVICES)          while ((pos = next_arg(optarg, ',')) && *id < RDPDR_MAX_DEVICES)
38          {          {
# Line 60  parallel_enum_devices(uint32 * id, char Line 47  parallel_enum_devices(uint32 * id, char
47                  strcpy(g_rdpdr_device[*id].local_path, pos2);                  strcpy(g_rdpdr_device[*id].local_path, pos2);
48                  printf("PARALLEL %s to %s\n", optarg, pos2);                  printf("PARALLEL %s to %s\n", optarg, pos2);
49    
50                  // set device type                  /* set device type */
51                  g_rdpdr_device[*id].device_type = DEVICE_TYPE_PARALLEL;                  g_rdpdr_device[*id].device_type = DEVICE_TYPE_PARALLEL;
52                  g_rdpdr_device[*id].pdevice_data = (void *) ppar_info;                  g_rdpdr_device[*id].pdevice_data = (void *) ppar_info;
53                  g_rdpdr_device[*id].handle = 0;                  g_rdpdr_device[*id].handle = 0;
# Line 74  parallel_enum_devices(uint32 * id, char Line 61  parallel_enum_devices(uint32 * id, char
61    
62  static NTSTATUS  static NTSTATUS
63  parallel_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition,  parallel_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition,
64                  uint32 flags, char *filename, HANDLE * handle)                  uint32 flags, char *filename, NTHANDLE * handle)
65  {  {
66          int parallel_fd;          int parallel_fd;
67    
# Line 102  parallel_create(uint32 device_id, uint32 Line 89  parallel_create(uint32 device_id, uint32
89  }  }
90    
91  static NTSTATUS  static NTSTATUS
92  parallel_close(HANDLE handle)  parallel_close(NTHANDLE handle)
93  {  {
94          int i = get_device_index(handle);          int i = get_device_index(handle);
95          if (i >= 0)          if (i >= 0)
# Line 112  parallel_close(HANDLE handle) Line 99  parallel_close(HANDLE handle)
99  }  }
100    
101  static NTSTATUS  static NTSTATUS
102  parallel_read(HANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)  parallel_read(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
103  {  {
104          *result = read(handle, data, length);          *result = read(handle, data, length);
105          return STATUS_SUCCESS;          return STATUS_SUCCESS;
106  }  }
107    
108  static NTSTATUS  static NTSTATUS
109  parallel_write(HANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)  parallel_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result)
110  {  {
111          int rc = STATUS_SUCCESS;          int rc = STATUS_SUCCESS;
112    
113          int n = write(handle, data, length);          int n = write(handle, data, length);
114          if (n < 0)          if (n < 0)
115          {          {
116    #if defined(LPGETSTATUS)
117                  int status;                  int status;
118    #endif
119    
120                  *result = 0;                  *result = 0;
121                  switch (errno)                  switch (errno)
# Line 153  parallel_write(HANDLE handle, uint8 * da Line 142  parallel_write(HANDLE handle, uint8 * da
142  }  }
143    
144  static NTSTATUS  static NTSTATUS
145  parallel_device_control(HANDLE handle, uint32 request, STREAM in, STREAM out)  parallel_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out)
146  {  {
147          if ((request >> 16) != FILE_DEVICE_PARALLEL)          if ((request >> 16) != FILE_DEVICE_PARALLEL)
148                  return STATUS_INVALID_PARAMETER;                  return STATUS_INVALID_PARAMETER;

Legend:
Removed from v.664  
changed lines
  Added in v.865

  ViewVC Help
Powered by ViewVC 1.1.26