printing/load.c

説明を見る。
00001 /* 
00002    Unix SMB/CIFS implementation.
00003    load printer lists
00004    Copyright (C) Andrew Tridgell 1992-2000
00005    
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010    
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015    
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 */
00020 
00021 #include "includes.h"
00022 
00023 
00024 /***************************************************************************
00025 auto-load some homes and printer services
00026 ***************************************************************************/
00027 static void add_auto_printers(void)
00028 {
00029         const char *p;
00030         int pnum = lp_servicenumber(PRINTERS_NAME);
00031         char *str;
00032 
00033         if (pnum < 0)
00034                 return;
00035 
00036         if ((str = SMB_STRDUP(lp_auto_services())) == NULL)
00037                 return;
00038 
00039         for (p = strtok(str, LIST_SEP); p; p = strtok(NULL, LIST_SEP)) {
00040                 if (lp_servicenumber(p) >= 0)
00041                         continue;
00042                 
00043                 if (pcap_printername_ok(p))
00044                         lp_add_printer(p, pnum);
00045         }
00046 
00047         SAFE_FREE(str);
00048 }
00049 
00050 /***************************************************************************
00051 load automatic printer services
00052 ***************************************************************************/
00053 void load_printers(void)
00054 {
00055         if (!pcap_cache_loaded())
00056                 pcap_cache_reload();
00057 
00058         add_auto_printers();
00059 
00060         /* load all printcap printers */
00061         if (lp_load_printers() && lp_servicenumber(PRINTERS_NAME) >= 0)
00062                 pcap_printer_fn(lp_add_one_printer);
00063 }

Sambaに対してSat Aug 29 21:23:13 2009に生成されました。  doxygen 1.4.7