/[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 569 by n-ki, Wed Jan 21 14:40:40 2004 UTC revision 584 by n-ki, Tue Jan 27 21:06:22 2004 UTC
# Line 4  Line 4 
4    
5  #define IOCTL_PAR_QUERY_RAW_DEVICE_ID   0x0c  #define IOCTL_PAR_QUERY_RAW_DEVICE_ID   0x0c
6    
 #define PARALLELDEV0                    "/dev/lp0"  
   
7  #include "rdesktop.h"  #include "rdesktop.h"
8  #include <unistd.h>  #include <unistd.h>
9  #include <fcntl.h>  #include <fcntl.h>
10    
11  extern RDPDR_DEVICE g_rdpdr_device[];  extern RDPDR_DEVICE g_rdpdr_device[];
12    
13  PARALLEL_DEVICE * get_parallel_data(HANDLE handle)  PARALLEL_DEVICE *
14    get_parallel_data(HANDLE handle)
15  {  {
16          int index;          int index;
17    
# Line 32  PARALLEL_DEVICE * get_parallel_data(HAND Line 31  PARALLEL_DEVICE * get_parallel_data(HAND
31  int  int
32  parallel_enum_devices(int *id, char *optarg)  parallel_enum_devices(int *id, char *optarg)
33  {  {
         //TODO: Read from configuration file? CUPS?  
34          PARALLEL_DEVICE *ppar_info;          PARALLEL_DEVICE *ppar_info;
35    
36          char *pos = optarg;          char *pos = optarg;
# Line 48  parallel_enum_devices(int *id, char *opt Line 46  parallel_enum_devices(int *id, char *opt
46                  pos2 = next_arg(optarg, '=');                  pos2 = next_arg(optarg, '=');
47                  strcpy(g_rdpdr_device[*id].name, optarg);                  strcpy(g_rdpdr_device[*id].name, optarg);
48    
49                  toupper(g_rdpdr_device[*id].name);                  toupper_str(g_rdpdr_device[*id].name);
50    
51                  g_rdpdr_device[*id].local_path = xmalloc(strlen(pos2) + 1);                  g_rdpdr_device[*id].local_path = xmalloc(strlen(pos2) + 1);
52                  strcpy(g_rdpdr_device[*id].local_path, pos2);                  strcpy(g_rdpdr_device[*id].local_path, pos2);
# Line 66  parallel_enum_devices(int *id, char *opt Line 64  parallel_enum_devices(int *id, char *opt
64  }  }
65    
66  static NTSTATUS  static NTSTATUS
67  parallel_create(uint32 device_id, HANDLE * handle)  parallel_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition, uint32 flags,
68                   char *filename, HANDLE * handle)
69  {  {
70          int parallel_fd;          int parallel_fd;
71    
72          parallel_fd = open(PARALLELDEV0, O_WRONLY);          parallel_fd = open(g_rdpdr_device[device_id].local_path, O_WRONLY);
73          if (parallel_fd == -1)          if (parallel_fd == -1)
74                  return STATUS_ACCESS_DENIED;                  return STATUS_ACCESS_DENIED;
75    
76            g_rdpdr_device[device_id].handle = parallel_fd;
77    
78          *handle = parallel_fd;          *handle = parallel_fd;
79          return STATUS_SUCCESS;          return STATUS_SUCCESS;
80  }  }
# Line 81  parallel_create(uint32 device_id, HANDLE Line 82  parallel_create(uint32 device_id, HANDLE
82  static NTSTATUS  static NTSTATUS
83  parallel_close(HANDLE handle)  parallel_close(HANDLE handle)
84  {  {
85            g_rdpdr_device[get_device_index(handle)].handle = 0;
86          close(handle);          close(handle);
87          return STATUS_SUCCESS;          return STATUS_SUCCESS;
88  }  }

Legend:
Removed from v.569  
changed lines
  Added in v.584

  ViewVC Help
Powered by ViewVC 1.1.26