Ticket #9: 800_win32_apps.patch
| File 800_win32_apps.patch, 7.2 KB (added by hsattler, 18 months ago) |
|---|
-
openobex-anoncvs
old new 36 36 #include <config.h> 37 37 #endif 38 38 39 #ifdef _WIN32 40 #include <windows.h> 41 #define sleep(sec) Sleep(1000*sec) 42 #endif 43 39 44 #include <stdio.h> 40 45 #include <unistd.h> 41 46 #include <stdlib.h> -
apps/obex_test_client.c
old new 33 33 #include <stdlib.h> 34 34 #include <unistd.h> 35 35 #include <fcntl.h> 36 #include <libgen.h>37 36 #include <string.h> 38 37 38 #ifdef _WIN32 39 #warning "No implementation for basename() in win32!" 40 #define basename(x) (x) 41 #else 42 #include <libgen.h> 43 #endif 44 39 45 #include <openobex/obex.h> 40 46 41 47 #include "obex_io.h" -
apps/obex_test_cable.h
old new 33 33 34 34 #define CABLE_DEBUG 1 35 35 36 36 #ifdef _WIN32 37 #include <windows.h> 38 #define tty_desc_t DCB 39 #else 37 40 #include <termios.h> 41 #define tty_desc_t struct termios 42 #endif 38 43 39 44 #ifdef CABLE_DEBUG 40 45 #define CDEBUG(format, args...) printf("%s(): " format, __FUNCTION__ , ##args) … … 47 52 const char *portname; 48 53 int ttyfd; 49 54 char inputbuf[500]; 50 struct termiosoldtio, newtio;55 tty_desc_t oldtio, newtio; 51 56 int r320; 52 57 }; 53 58 -
apps/obex_test_cable.c
old new 35 35 #include <stdio.h> 36 36 #include <stdlib.h> 37 37 #include <sys/time.h> 38 #include <sys/ioctl.h>39 38 #include <fcntl.h> 40 39 #include <errno.h> 41 40 #include <string.h> 42 41 #include <unistd.h> 43 #include <termios.h> 42 43 #ifndef _WIN32 44 #include <sys/ioctl.h> 45 #endif 44 46 45 47 #include <openobex/obex.h> 46 48 … … 60 62 // 61 63 int cobex_do_at_cmd(struct cobex_context *gt, char *cmd, char *rspbuf, int rspbuflen, int timeout) 62 64 { 65 #ifdef _WIN32 66 #warning "Implementation for win32 is missing!" 67 return -1; 68 #else 63 69 fd_set ttyset; 64 70 struct timeval tv; 65 71 int fd; … … 151 157 strncpy(rspbuf, answer, answer_size); 152 158 rspbuf[answer_size] = 0; 153 159 return 0; 160 #endif 154 161 } 155 162 156 163 // … … 158 165 // 159 166 static int cobex_init(struct cobex_context *gt) 160 167 { 168 #ifdef _WIN32 169 #warning "Implementation for win32 is missing!" 170 #else 161 171 char rspbuf[200]; 162 172 163 173 CDEBUG("\n"); … … 214 224 return 1; 215 225 err: 216 226 cobex_cleanup(gt, TRUE); 227 #endif 217 228 return -1; 218 229 } 219 230 … … 222 233 // 223 234 static void cobex_cleanup(struct cobex_context *gt, int force) 224 235 { 236 #ifndef _WIN32 225 237 if(force) { 226 238 // Send a break to get out of OBEX-mode 227 239 #ifdef TCSBRKP … … 236 248 } 237 249 close(gt->ttyfd); 238 250 gt->ttyfd = -1; 251 #endif 239 252 } 240 253 241 254 // -
openobex-anoncvs
old new 205 205 * First remove path and add "/tmp/". Then save. 206 206 * 207 207 */ 208 #ifndef DEFFILEMODE 209 #define DEFFILEMODE 0 210 #endif 208 211 int safe_save_file(char *name, const uint8_t *buf, int len) 209 212 { 210 213 char *s = NULL; … … 222 225 s++; 223 226 224 227 strncat(filename, s, 250); 225 #ifdef _WIN32226 fd = open(filename, O_RDWR | O_CREAT, 0);227 #else228 228 fd = open(filename, O_RDWR | O_CREAT, DEFFILEMODE); 229 #endif230 229 231 230 if ( fd < 0) { 232 231 perror( filename); -
ircp/dirtraverse.c
old new 40 40 } 41 41 else { 42 42 snprintf(t, MAXPATHLEN, "%s/%s", path, dirent->d_name); 43 #ifdef _WIN32 44 #warning "Do not use symbolic links in Windows Vista or fix this." 45 if (stat(t, &statbuf) < 0) { 46 #else 43 47 if(lstat(t, &statbuf) < 0) { 48 #endif 44 49 return -1; 45 50 } 46 51 else if(S_ISREG(statbuf.st_mode)) { -
openobex-anoncvs
old new 115 115 // 116 116 // Open a file, but do some sanity-checking first. 117 117 // 118 #ifndef DEFFILEMODE 119 #define DEFFILEMODE 0 120 #endif 118 121 int ircp_open_safe(const char *path, const char *name) 119 122 { 120 123 char diskname[MAXPATHLEN]; … … 169 172 } 170 173 if(flags & CD_CREATE) { 171 174 DEBUG(4, "Will try to create %s\n", newpath); 175 #ifdef _WIN32 176 ret = _mkdir(newpath); 177 #else 172 178 ret = mkdir(newpath, DEFFILEMODE | S_IXGRP | S_IXUSR | S_IXOTH); 179 #endif 173 180 } 174 181 else { 175 182 ret = -1; -
apps/Makefile.am
old new 14 14 obex_test_server.c obex_test_server.h \ 15 15 obex_test_cable.c obex_test_cable.h 16 16 17 obex_test_LDADD = $(top_builddir)/lib/libopenobex.la @BLUETOOTH_LIBS@ libmisc.a17 obex_test_LDADD = libmisc.a $(top_builddir)/lib/libopenobex.la @BLUETOOTH_LIBS@ 18 18 19 LDADD = $(top_builddir)/lib/libopenobex.la libmisc.a 19 AM_CFLAGS = @OPENOBEX_CFLAGS@ 20 21 LDADD = libmisc.a $(top_builddir)/lib/libopenobex.la 20 22 21 23 INCLUDES = @BLUETOOTH_CFLAGS@ -I$(top_builddir)/include 22 24 endif -
apps/obex_test.c
old new 44 44 #endif /* _WIN32 */ 45 45 46 46 #ifdef HAVE_BLUETOOTH 47 #ifdef HAVE_BLUETOOTH_LINUX 48 #include <bluetooth/bluetooth.h> 49 #include <bluetooth/rfcomm.h> 50 #endif 51 #ifdef HAVE_BLUETOOTH_FREEBSD 52 #include <bluetooth.h> 53 #define sockaddr_rc sockaddr_rfcomm 54 #define rc_family rfcomm_family 55 #define rc_bdaddr rfcomm_bdaddr 56 #define rc_channel rfcomm_channel 57 #define str2ba bt_aton 58 #endif 59 #ifdef HAVE_BLUETOOTH_NETBSD 60 #define rc_family bt_family 61 #define rc_bdaddr bt_bdaddr 62 #define rc_channel bt_channel 63 #define sockaddr_rc sockaddr_bt 64 #define str2ba bt_aton 65 #include <bluetooth.h> 66 #include <netbt/rfcomm.h> 67 #endif 47 #include "../lib/bluez_compat.h" 68 48 #endif 69 49 70 50 #include <openobex/obex.h> -
ircp/Makefile.am
old new 11 11 12 12 bin_PROGRAMS = ircp 13 13 14 AM_CFLAGS = @OPENOBEX_CFLAGS@ 15 14 16 LDADD = libircp.a $(top_builddir)/lib/libopenobex.la 15 17 16 18 INCLUDES = -I$(top_builddir)/include
