BUGFIX: SMBWRAPPER/*.C from Jul 9th CVS snapshot.
John E. Malmberg
malmberg at Encompasserve.org
Tue Jul 10 14:19:23 GMT 2001
The following changes were needed to get SAMBA 2.2.x Jul 9th CVS snapshot
to compile on OpenVMS 7.2-1 Alpha using Compaq C Version 6.4-005.
Note that this is just for compiling. I still have a bit of work to do to
get it to actually run.
Compaq C is common to Tru-64 Unix, Linux on Alpha, and OpenVMS.
-----------------
SMBW_SAMPLE.C
Compaq C needs the functions to be prototyped, and can not deal with
a string constant that is longer than one line.
SMBW_SAMBPLE_C.DIFF
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_SAMPLE.C;1
1 #include <stdio.h>
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]SMBW_SAMPLE.C;9
1 #include "config.h"
2 #include <stdio.h>
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_SAMPLE.C;1
6
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]SMBW_SAMPLE.C;9
7 #include <string.h> /* JEM */
8
9 int smbw_closedir(DIR *dirp);
10 void smbw_init(void);
11 DIR *smbw_opendir(const char *fname);
12 struct dirent *smbw_readdir(DIR *dirp);
13 void smbw_setshared(const char *name, const char *val);
14 void smbw_setup_shared(void);
15
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_SAMPLE.C;1
9 printf("
10 smbw_sample - a sample program that uses smbw
11
12 smbw_sample <options> path
13
14 options:
15 -W workgroup
16 -l logfile
17 -P prefix
18 -d debuglevel
19 -U username%%password
20 -R resolve order
21
22 note that path must start with /smb/
23 ");
24 }
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]SMBW_SAMPLE.C;9
18 puts("\nsmbw_sample - a sample program that uses smbw\n");
19
20 puts("smbw_sample <options> path\n");
21
22 puts(" options:");
23 puts(" -W workgroup");
24 puts(" -l logfile");
25 puts(" -P prefix");
26 puts(" -d debuglevel");
27 puts(" -U username%%password");
28 puts(" -R resolve order\n");
29
30 puts("note that path must start with /smb/\n");
31
32 }
************
Number of difference sections found: 3
Number of difference records found: 24
DIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_SAMPLE_C.DIFF;1-
PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_SAMPLE.C;1-
PROJECT_ROOT:[SAMBA_VMS.SOURCE.UTILS]SMBW_SAMPLE.C;9
-------------------
SMBW_STAT.C
Apparently the structure "st" is not defined, and it is assumed that
the structure has the members st_blksize and st_blocks. Neither of these
members are listed in The Open Group's Single Unix Specification.
This file seemed a bit incomplete.
SMBW_STAT_C.DIFF
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_STAT.C;1
34 st->st_mode = 0;
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]SMBW_STAT.C;4
34 SMB_STRUCT_STAT *smb_st;
35
36 smb_st = (SMB_STRUCT_STAT *)st;
37 st->st_mode = 0;
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_STAT.C;1
48 st->st_blksize = 512;
49 st->st_blocks = (size+511)/512;
50 st->st_uid = getuid();
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]SMBW_STAT.C;4
51 #ifdef HAVE_STAT_ST_BLKSIZE
52 st->st_blksize = 512;
53 st->st_blocks = (size+511)/512;
54 #endif
55 st->st_uid = getuid();
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_STAT.C;1
57 if (st->st_ino == 0) {
58 st->st_ino = smbw_inode(fname);
59 }
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]SMBW_STAT.C;4
62 if (smb_st->st_ino == 0) {
63 smb_st->st_ino = smbw_inode(fname);
64 }
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_STAT.C;1
130 struct smbw_file *file;
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]SMBW_STAT.C;4
135 SMB_STRUCT_STAT *smb_st;
136
137 struct smbw_file *file;
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_STAT.C;1
136 smbw_busy++;
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]SMBW_STAT.C;4
143 smb_st = (SMB_STRUCT_STAT *)st;
144 smbw_busy++;
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_STAT.C;1
157 st->st_ino = ino;
158
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]SMBW_STAT.C;4
165 smb_st->st_ino = ino;
166
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_STAT.C;1
184
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]SMBW_STAT.C;4
192 SMB_STRUCT_STAT *smb_st;
193
194 smb_st = (SMB_STRUCT_STAT *)st;
195
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_STAT.C;1
241 st->st_ino = ino;
242
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]SMBW_STAT.C;4
252 smb_st->st_ino = ino;
253
************
Number of difference sections found: 8
Number of difference records found: 17
DIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_STAT_C.DIFF;1-
PROJECT_ROOT:[SAMBA_VMS.SOURCE]SMBW_STAT.C;1-
PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]SMBW_STAT.C;4
-------------------
WRAPPED.C
This module will not compile portably as it is assuming foo() and foo(...) can
be interchanged, and the C standard, as was pointed out to me on comp.std.c
does not allow this. These changes actually should make the module to
be portable across compilers and operating systems.
This actually allows SMBWRAPPER to be used on NON-LINUX systems as either
a shared image or statically linked. The realcalls.h must be modified to
be operating system specific in this case.
The function calls now match both the standard library calls and the usage
by the module.
WRAPPED_C.DIFF
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
28 #include "config.h"
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
28 /* Compaq C on OpenVMS will not allow these compiler warnings, and they
29 must be fixed, or it can not be compiled. This means that portability
30 already was broken.
31
32 */
33
34 #include "config.h"
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
37 int open(char *name, int flags, mode_t mode)
38 {
39 if (smbw_path(name)) {
40 return smbw_open(name, flags, mode);
41 }
42
43 return real_open(name, flags, mode);
44 }
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
43 int open(const char *name, int flags, ...)
44 {
45 int arg_cnt;
46 va_list ap;
47 mode_t mode;
48
49 va_count(arg_cnt);
50
51 if (arg_cnt >= 3)
52 {
53 va_start(ap, flags);
54 mode = va_arg(ap, mode_t);
55 }
56
57 if (smbw_path(name)) {
58 if (arg_cnt == 3)
59 return smbw_open(name, flags, mode);
60 else
61 return -1;
62 }
63
64 if (arg_cnt >= 3)
65 return real_open(name, flags, mode);
66 else
67 return real_open(name, flags);
68 }
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
51 #elif HAVE___OPEN
52 int __open(char *name, int flags, mode_t mode)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
75 #elif defined(HAVE___OPEN)
76 int __open(char *name, int flags, mode_t mode)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
76 #elif HAVE___OPEN64
77 int __open64(char *name, int flags, mode_t mode)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
100 #elif defined(HAVE___OPEN64)
101 int __open64(char *name, int flags, mode_t mode)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
129 int chdir(char *name)
130 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
153 int chdir(const char *name)
154 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
139 #elif HAVE__CHDIR
140 int _chdir(char *name)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
163 #elif defined(HAVE__CHDIR)
164 int _chdir(char *name)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
165 #elif HAVE__CLOSE
166 int _close(int fd)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
189 #elif defined(HAVE__CLOSE)
190 int _close(int fd)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
183 #elif HAVE__FCHDIR
184 int _fchdir(int fd)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
207 #elif defined(HAVE__FCHDIR)
208 int _fchdir(int fd)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
191 int fcntl(int fd, int cmd, long arg)
192 {
193 if (smbw_fd(fd)) {
194 return smbw_fcntl(fd, cmd, arg);
195 }
196
197 return real_fcntl(fd, cmd, arg);
198 }
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
215 int fcntl(int fd, int cmd, ...)
216 {
217 int arg_cnt;
218 va_list ap;
219 long * arg;
220
221 va_count(arg_cnt);
222
223
224 if (arg_cnt >= 3)
225 {
226 va_start(ap, cmd);
227 arg = va_arg(ap, long *);
228 }
229
230 if (smbw_fd(fd)) {
231 if (arg_cnt == 3)
232 return smbw_fcntl(fd, cmd, arg);
233 else
234 return -1;
235 }
236
237 if (arg_cnt >= 3)
238 {
239 return real_fcntl(fd, cmd, arg);
240 }
241 else
242 {
243 return real_fcntl(fd, cmd);
244 }
245 }
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
206 #elif HAVE__FCNTL
207 int _fcntl(int fd, int cmd, long arg)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
253 #elif defined(HAVE__FCNTL)
254 int _fcntl(int fd, int cmd, long arg)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
231 #elif HAVE__GETDENTS
232 int _getdents(int fd, void *dirp, unsigned int count)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
278 #elif defined(HAVE__GETDENTS)
279 int _getdents(int fd, void *dirp, unsigned int count)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
253 #elif HAVE__LSEEK
254 off_t _lseek(int fd, off_t offset, int whence)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
300 #elif defined(HAVE__LSEEK)
301 off_t _lseek(int fd, off_t offset, int whence)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
275 #elif HAVE__READ
276 ssize_t _read(int fd, void *buf, size_t count)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
322 #elif defined(HAVE__READ)
323 ssize_t _read(int fd, void *buf, size_t count)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
297 #elif HAVE__WRITE
298 ssize_t _write(int fd, void *buf, size_t count)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
344 #elif defined(HAVE__WRITE)
345 ssize_t _write(int fd, void *buf, size_t count)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
306 int access(char *name, int mode)
307 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
353 int access(const char *name, int mode)
354 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
317 int chmod(char *name,mode_t mode)
318 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
364 int chmod(const char *name, mode_t mode)
365 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
328 int chown(char *name,uid_t owner, gid_t group)
329 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
375 int chown(const char *name,uid_t owner, gid_t group)
376 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
346 int mkdir(char *name, mode_t mode)
347 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
393 int mkdir(const char *name, mode_t mode)
394 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
356 #if HAVE___FXSTAT
357 int __fxstat(int vers, int fd, void *st)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
403 #ifdef HAVE___FXSTAT
404 int __fxstat(int vers, int fd, void *st)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
372 #if HAVE___XSTAT
373 int __xstat(int vers, char *name, void *st)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
419 #ifdef HAVE___XSTAT
420 int __xstat(int vers, char *name, void *st)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
389 #if HAVE___LXSTAT
390 int __lxstat(int vers, char *name, void *st)
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
436 #ifdef HAVE___LXSTAT
437 int __lxstat(int vers, char *name, void *st)
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
406 int stat(char *name, void *st)
407 {
408 #if HAVE___XSTAT
409 return __xstat(0, name, st);
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
453 int stat(const char *name, void *st)
454 {
455 #ifdef HAVE___XSTAT
456 return __xstat(0, name, st);
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
418 int lstat(char *name, void *st)
419 {
420 #if HAVE___LXSTAT
421 return __lxstat(0, name, st);
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
465 int lstat(const char *name, void *st)
466 {
467 #ifdef HAVE___LXSTAT
468 return __lxstat(0, name, st);
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
432 #if HAVE___LXSTAT
433 return __fxstat(0, fd, st);
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
479 #ifdef HAVE___LXSTAT
480 return __fxstat(0, fd, st);
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
443 int unlink(char *name)
444 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
490 int unlink(const char *name)
491 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
454 int utime(char *name,void *tvp)
455 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
501 int utime(const char *name, const void *tvp)
502 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
465 int utimes(char *name,void *tvp)
466 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
512 int utimes(const char *name, const void *tvp)
513 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
475 int readlink(char *path, char *buf, size_t bufsize)
476 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
522 int readlink(const char *path, char *buf, size_t bufsize)
523 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
485 int rename(char *oldname,char *newname)
486 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
532 int rename(const char *oldname, const char *newname)
533 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
502 int rmdir(char *name)
503 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
549 int rmdir(const char *name)
550 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
512 int symlink(char *topath,char *frompath)
513 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
559 int symlink(const char *topath, const char *frompath)
560 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
549 void *opendir(char *name)
550 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
596 void *opendir(const char *name)
597 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
607 int acl(char *pathp, int cmd, int nentries, void *aclbufp)
608 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
654 int acl(const char *pathp, int cmd, int nentries, void *aclbufp)
655 {
************
************
File PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1
628 int creat(char *path, mode_t mode)
629 {
******
File PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
675 int creat(const char *path, mode_t mode)
676 {
************
Number of difference sections found: 34
Number of difference records found: 96
DIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED_C.DIFF;1-
PROJECT_ROOT:[SAMBA_VMS.SOURCE]WRAPPED.C;1-
PROJECT_ROOT:[SAMBA_VMS.SOURCE.SMBWRAPPER]WRAPPED.C;13
-John
wb8tyw at qsl.network
Personal Opinion Only
More information about the samba-technical
mailing list