This article uses the following steps to implement vs programming and debugging in windows.ProgramRun on UNIX.
The required software is as follows:
Cwrsync: Client/Server synchronization software
The installation of cwrsync is not described here. For more information, see:
Http://www.cnblogs.com/me115/archive/2011/02/28/1967213.html
Http://www.cnblogs.com/me115/archive/2011/02/28/1967214.html
The Windows Server is installed with cwrsync_server_2.1.5_installer.exe (the latest version is 4. **, which is easier to install)
Rsync is not installed on UNIX by default, and 3.0.7 is installed on the local machine;
I. cwrsync settings
Use the locally developed machine as the cwrsync server, install the server version, and set the program path in rsyncd. conf:
[Test]
Path =/cygdrive/D/ondeving/unixap
Read Only = false
Transfer logging = Yes
Ii. Script settings on UNIX machines
Create two scripts tow and tou under the bin directory of UNIX:
Tow:
/Userhome/jhuang/soft/rsync/bin/rsync-vzrtopgu -- Progress -- delete/userhome/jhuang/cltest/unixap/colin@172.22.2.58: Test
Tou:
/Userhome/jhuang/soft/rsync/bin/rsync-vzrtopgu -- Progress -- delete colin@172.22.2.58: Test/userhome/jhuang/cltest/unixap/
Rsync parameters are described as follows:
-Vzrtopgu:-V:-verbose output in detail mode;-Z: Compressed transmission;-u, -- Update is only updated, that is, skipping all existing DST instances, and the file time is later than the file to be backed up. (Update files are not overwritten). Other parameters are used to keep document attributes and groups unchanged;
-- Progress indicates that the detailed progress is displayed.
-- Delete: if the server deletes the file, the client also deletes the file.
Colin in colin@172.22.2.58 is the user name in the specified password file
: Test refers to the module name defined in rsyncd. conf.
/Userhome/jhuang/cltest/unixap/indicates the local directory to be backed up.
(For backup mode: Use-AV)
3. compile program rules
A project created using Vs will contain an stdafx. h file, which is a pre-compiled file. We do not need it for files running on UNIX machines. Here to reduce the programCodeModified quantity. For CPP files that contain unxi system calls, this file must be included.
1. stdafx. H content:
# Pragma once # If defined (_ Win32) | defined (win32) // Windows platform # else # define unix_platform 67800 # endif
2. files containing UNIX system calls (eg: fig4243.cpp ):
# Include "fig1_3.h" # include <iostream> # include "stdafx. H "# ifdef unix_platform # include" include/apue. H "# include <dirent. h> // the library here belongs to the UNIX system # endifvoid fig1_3: egexe1 (string strparam) {# ifdef unix_platformdir * DP; struct dirent * dirp; If (strparam. empty () err_quit ("Usage: ls directory_name"); If (dp = opendir (strparam. c_str () = NULL) err_sys ("can't open % s", strparam. c_str (); While (dirp = readdir (DP ))! = NULL) printf ("% s \ n", dirp-> d_name); closedir (DP); exit (0); # endif}
Iv. Summary
You can use the preceding steps to write and debug code unrelated to system calls in vs. For code that needs to call UNIX library functions, you can use the TOU script command, synchronize the latest code to the unix machine, and then call the test run.
Appendix:
Detailed parameters of the rsync command are described as follows:
-V, -- verbose detailed mode output
-Q, -- Quiet simplified output mode
-C, -- checksum: enable the verification switch to force file transfer verification
-A, -- Archive mode, indicating that the file is transmitted recursively and all file attributes are kept, equal to-rlptgod.
-R, -- Recursive processes subdirectories in recursive Mode
-R, -- relative uses relative path information
-B, -- backup creates a backup, that is, if the object already has the same file name, rename the old file ~ Filename. You can use the -- suffix option to specify different backup file prefixes.
-- Backup-Dir: backs up files (for example ~ Filename) is stored in the directory.
-Suffix = suffix defines the backup file prefix.
-U, -- Update only performs updates, that is, skipping all files that already exist in DST and whose file time is later than the time to be backed up. (Do not overwrite the updated file)
-L, -- links retains soft links
-L, -- copy-links: process soft links like regular files
-- Copy-unsafe-links: only copies links other than the SRC path directory tree.
-- Safe-links ignores links other than the SRC path directory tree
-H, -- hard-links keep hard links-P, -- perms keep File Permissions
-O, -- owner keep file owner information-G, -- group keep file owner information
-D, -- devices: Keep Device File Information-T, -- times: Keep file time information
-S, -- sparse performs special processing on sparse files to save DST Space
-N, -- dry-run which files will be transmitted
-W, -- whole-file: Copy files without incremental Detection
-X, -- one-file-system do not span the boundaries of the file system
-B, -- block-size = Size TestAlgorithmThe block size. The default value is 700 bytes.
-E, -- RSH = command specifies that RSH and SSH are used for data synchronization.
-- Rsync-Path = path specifies the path of the rsync command on the remote server
-C, -- CVS-exclude automatically ignores files in the same way as CVS to exclude files that do not want to be transmitted
-- Existing only updates the files that already exist in DST, instead of backing up the new files.
-- Delete: delete the files that are not in the SRC file in DST.
-- Delete-excluded: Delete Files specified by this option at the receiving end.
-- Delete-after: delete after transmission
-- Ignore-errors is deleted when an IO error occurs in a timely manner.
-- Max-delete = num: a maximum of num files can be deleted.
-- Partial retains the files that are not completely transferred for any reason, so as to speed up subsequent re-transmission.
-- Force directory deletion, even if not empty
-- Numeric-IDs does not match the number user and group ID with the user name and group name.
-- Timeout = time IP timeout, in seconds
-I, -- ignore-times do not skip files with the same time and length
-- Size-only: when determining whether to back up a file, only check the file size, regardless of the file time
-- Modify-window = num determines whether the timestamp window of the file is used at the same time. The default value is 0.
-T -- temp-Dir = dir create a temporary file in Dir
-- Compare-Dest = dir: Compare the files in Dir to determine whether to back up data.
-P is equivalent to -- partial
-- Progress displays the backup process
-Z, -- compress compresses backup files during transmission
-- Exclude = pattern specifies to exclude file modes that do not need to be transmitted
-- Include = pattern specifies the file mode to be transmitted without exclusion
-- Exclude-from = file: exclude files in the specified mode in the file.
-- Include-from = file: files with the specified file pattern matching are not excluded.
-- Version: prints version information.
-- Address: bind to a specific address
-- Config = file: specify other configuration files. The default rsyncd. conf file is not used.
-- Port = port specify other rsync service ports
-- Blocking-io: block Io for remote shell
-Stats indicates the transmission status of some files.
-- SS actual transmission process during transmission
-- Log-format = format specifies the log file format
-- Password-file = file get password from File
-- Bwlimit = kbps limits I/O bandwidth, Kbytes per second-h, -- help displays help information
More: http://blog.donews.com/me1105/archive/2011/02/28/137.aspx