|
samba unix风格的配置文件配置信息读取C代码.(1)
samba是个开源的文件服务器软件,可以在多个平台上运行.如果你使用过,那么一定设置过它的配置文件. 如果你想写一个类似读这样的配置文件的代码,那么下面的从samba提取出来的代码讲对你很有用.它采用 回调的机制,获取配置信息. smb.conf 如下 # This is the main Samba configuration file. You should read the # smb.conf(5) manual page in order to understand the options listed # here. Samba has a huge number of configurable options (perhaps too # many!) most of which are not shown in this example # # Any line which starts with a ; (semi-colon) or a # (hash) # is a comment and is ignored. In this example we will use a # # for commentry and a ; for parts of the config file that you # may wish to enable # # NOTE: Whenever you modify this file you should run the command "testparm" # to check that you have not made any basic syntactic errors. # #======================= Global Settings ===================================== [global] # workgroup = NT-Domain-Name or Workgroup-Name workgroup = gdcattsoft # server string is the equivalent of the NT Description field server string = samba server # This option is important for security. It allows you to restrict # connections to machines which are on your local network. The # following example restricts Access to two C class networks and # the "loopback" interface. For more examples of the syntax see # the smb.conf man page ; hosts allow = 192.168.1. 192.168.2. 127. # if you want to automatically load your printer list rather # than setting them up individually then you'll need this printcap name = /etc/printcap load printers = yes # It should not be necessary to spell out the print system type unless # yours is non-standard. Currently supported print systems include: # bsd, sysv, plp, lprng, aix, hpux, qnx, cups
|