r11855: patch from Aruna Prabakar for checking that the spooler si running on HP-UX
authorGerald Carter <jerry@samba.org>
Tue, 22 Nov 2005 14:20:02 +0000 (14:20 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:05:30 +0000 (11:05 -0500)
(This used to be commit 017775f2879454f939c35196b3db6d1f2b9d1333)

source3/printing/print_svid.c

index 1213b917342b01ff78f328b6d52016943a1ca02e..c369e52cd91e997ab41b4460d2cfe63429efa2c9 100644 (file)
@@ -40,10 +40,39 @@ BOOL sysv_cache_reload(void)
        char **lines;
        int i;
 
+#if defined(HPUX)
+       DEBUG(5, ("reloading hpux printcap cache\n"));
+#else
        DEBUG(5, ("reloading sysv printcap cache\n"));
+#endif
 
        if ((lines = file_lines_pload("/usr/bin/lpstat -v", NULL)) == NULL)
+       {
+#if defined(HPUX)
+      
+                      /*
+               * if "lpstat -v" is NULL then we check if schedular is running if it is
+               * that means no printers are added on the HP-UX system, if schedular is not
+               * running we display reload error.
+               */
+
+               char **scheduler;
+                scheduler = file_lines_pload("/usr/bin/lpstat -r", NULL);
+                if(!strcmp(*scheduler,"scheduler is running")){
+                        DEBUG(3,("No Printers found!!!\n"));
+                       file_lines_free(scheduler);
+                        return True;
+                }
+                else{
+                        DEBUG(3,("Scheduler is not running!!!\n"));
+                       file_lines_free(scheduler);
+                       return False;
+               }
+#else
+               DEBUG(3,("No Printers found!!!\n"));
                return False;
+#endif
+       }
 
        for (i = 0; lines[i]; i++) {
                char *name, *tmp;