]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Makefile.in added PRINTER_OBJ to SWAT_OBJ so swat can
authorHerb Lewis <herb@samba.org>
Thu, 10 Dec 1998 23:43:16 +0000 (23:43 +0000)
committerHerb Lewis <herb@samba.org>
Thu, 10 Dec 1998 23:43:16 +0000 (23:43 +0000)
enumerate printers
param/loadparm.c added parameter to lp_dump to limit number of items
dumped. Pulled real dump code into new function
lp_dump_one so it can be called by swat
utils/testparm.c extra parameter added for lp_dump call
web/statuspage.c got rid of extra > being printed when smbd not
running
web/swat.c allow auto loaded printers to be enumerated in
printer page
include/proto.h changed number of parameters in lp_dump and new
function lp_dump_one defined.

source/Makefile.in
source/include/proto.h
source/param/loadparm.c
source/utils/testparm.c
source/web/statuspage.c
source/web/swat.c

index ded8da71359da244b5543f4d3f045a1a344b2ad5..184165abacc06e95c8e82c746338c8716134b8e2 100644 (file)
@@ -174,7 +174,7 @@ NMBD_OBJ = $(NMBD_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) \
 SWAT_OBJ = web/cgi.o web/diagnose.o web/startstop.o web/statuspage.o \
            web/swat.o $(LIBSMB_OBJ) $(LOCKING_OBJ) \
            $(PARAM_OBJ) $(PASSDB_OBJ) $(RPC_CLIENT_OBJ) $(RPC_PARSE_OBJ) \
-           $(UBIQX_OBJ) $(LIB_OBJ)
+           $(UBIQX_OBJ) $(LIB_OBJ) $(PRINTING_OBJ)
 
 SMBRUN_OBJ = utils/smbrun.o
 
index 419e0b6117c2bd640f6e4e19b2599cad4e6170ce..c06d7e517507e4b3cf003c39f3038e009fb33aec 100644 (file)
@@ -1155,7 +1155,8 @@ BOOL lp_loaded(void);
 void lp_killunused(BOOL (*snumused)(int ));
 BOOL lp_load(char *pszFname,BOOL global_only, BOOL save_defaults, BOOL add_ipc);
 int lp_numservices(void);
-void lp_dump(FILE *f, BOOL show_defaults);
+void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint);
+void lp_dump_one(FILE *f, BOOL show_defaults, int snum);
 int lp_servicenumber(char *pszServiceName);
 char *volume_label(int snum);
 void lp_remove_service(int snum);
index 6f270eb0f553c8b8f891d088dda94c71908306c7..48ddefcccaa07042328b96252d88c66e2d664f78 100644 (file)
@@ -2539,7 +2539,7 @@ int lp_numservices(void)
 /***************************************************************************
 Display the contents of the services array in human-readable form.
 ***************************************************************************/
-void lp_dump(FILE *f, BOOL show_defaults)
+void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint)
 {
    int iService;
 
@@ -2551,15 +2551,21 @@ void lp_dump(FILE *f, BOOL show_defaults)
    
    dump_a_service(&sDefault, f);
 
-   for (iService = 0; iService < iNumServices; iService++)
-   {
-     if (VALID(iService))
-       {
-        if (iSERVICE(iService).szService[0] == '\0')
-          break;
-        dump_a_service(pSERVICE(iService), f);
-       }
-   }
+   for (iService = 0; iService < maxtoprint; iService++)
+     lp_dump_one(f, show_defaults, iService);
+}
+
+/***************************************************************************
+Display the contents of one service in human-readable form.
+***************************************************************************/
+void lp_dump_one(FILE *f, BOOL show_defaults, int snum)
+{
+   if (VALID(snum))
+     {
+       if (iSERVICE(snum).szService[0] == '\0')
+        return;
+       dump_a_service(pSERVICE(snum), f);
+     }
 }
 
 
index 50e8cc3d74d53162577ec742ce3eff41a602cfcb..5c2d4a4c02515a3c0a1a9b9e5704f056caab6c90 100644 (file)
@@ -161,7 +161,7 @@ cannot be set in the smb.conf file. nmbd will abort with this setting.\n");
        fflush(stdout);
        getc(stdin);
       }
-      lp_dump(stdout,True);
+      lp_dump(stdout,True, lp_numservices());
     }
   
   if (argc >= 3)
index 260e00cb83d1df400acbbf8d5a07c8596cb82ce9..94ca4525b1a1ae22e6c2e5bb1e44276989e1b7e0 100644 (file)
@@ -173,7 +173,7 @@ void status_page(void)
        if (smbd_running()) {
                printf("<tr><td>smbd:</td><td>running</td><td><input type=submit name=\"smbd_stop\" value=\"Stop smbd\"></td><td><input type=submit name=\"smbd_restart\" value=\"Restart smbd\"></td></tr>\n");
        } else {
-               printf("<tr><td>smbd:</td><td>not running</td><td><input type=submit name=\"smbd_start\" value=\"Start smbd\"></td>><td><input type=submit name=\"smbd_restart\" value=\"Restart smbd\"></td></tr>\n");
+               printf("<tr><td>smbd:</td><td>not running</td><td><input type=submit name=\"smbd_start\" value=\"Start smbd\"></td><td><input type=submit name=\"smbd_restart\" value=\"Restart smbd\"></td></tr>\n");
        }
 
        fflush(stdout);
index aa9f8790299bcacb48e7ee66469f7c65b96b789b..9a0198920c40ecbec2f607eea6602e7053e814fb 100644 (file)
@@ -32,6 +32,7 @@ static pstring servicesf = CONFIGFILE;
 static BOOL demo_mode = False;
 static BOOL have_write_access = False;
 static BOOL have_read_access = False;
+static int iNumNonAutoPrintServices = 0;
 
 /*
  * Password Management Globals
@@ -309,13 +310,13 @@ static void write_config(FILE *f, BOOL show_defaults)
        fprintf(f, "# from %s (%s)\n", cgi_remote_host(), cgi_remote_addr());
        fprintf(f, "# Date: %s\n\n", timestring());
        
-       lp_dump(f, show_defaults);      
+       lp_dump(f, show_defaults, iNumNonAutoPrintServices);    
 }
 
 /****************************************************************************
   save and reoad the smb.conf config file 
 ****************************************************************************/
-static int save_reload(void)
+static int save_reload(int snum)
 {
        FILE *f;
 
@@ -326,6 +327,8 @@ static int save_reload(void)
        }
 
        write_config(f, False);
+       if (snum)
+               lp_dump_one(f, False, snum);
        fclose(f);
 
        lp_killunused(NULL);
@@ -464,7 +467,7 @@ static void globals_page(void)
 
        if (cgi_variable("Commit")) {
                commit_parameters(GLOBALS_SNUM);
-               save_reload();
+               save_reload(0);
        }
 
        printf("<FORM name=\"swatform\" method=post>\n");
@@ -513,19 +516,19 @@ static void shares_page(void)
 
        if (cgi_variable("Commit") && snum >= 0) {
                commit_parameters(snum);
-               save_reload();
+               save_reload(0);
        }
 
        if (cgi_variable("Delete") && snum >= 0) {
                lp_remove_service(snum);
-               save_reload();
+               save_reload(0);
                share = NULL;
                snum = -1;
        }
 
        if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) {
                lp_copy_service(GLOBALS_SNUM, share);
-               save_reload();
+               save_reload(0);
                snum = lp_servicenumber(share);
        }
 
@@ -817,12 +820,15 @@ static void printers_page(void)
 
        if (cgi_variable("Commit") && snum >= 0) {
                commit_parameters(snum);
-               save_reload();
+               if (snum >= iNumNonAutoPrintServices)
+                   save_reload(snum);
+               else
+                   save_reload(0);
        }
 
        if (cgi_variable("Delete") && snum >= 0) {
                lp_remove_service(snum);
-               save_reload();
+               save_reload(0);
                share = NULL;
                snum = -1;
        }
@@ -831,7 +837,7 @@ static void printers_page(void)
                lp_copy_service(GLOBALS_SNUM, share);
                snum = lp_servicenumber(share);
                lp_do_parameter(snum, "print ok", "Yes");
-               save_reload();
+               save_reload(0);
                snum = lp_servicenumber(share);
        }
 
@@ -914,6 +920,8 @@ static void printers_page(void)
 
        charset_initialise();
        load_config();
+       iNumNonAutoPrintServices = lp_numservices();
+       load_printers();
 
        cgi_setup(SWATDIR, !demo_mode);