common code for checking if rm==localhost
[unix-history] / usr / src / usr.sbin / lpr / common_source / displayq.c
index 71a7a6b..e08c274 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)displayq.c 5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)displayq.c 5.11 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -24,6 +24,7 @@ static char sccsid[] = "@(#)displayq.c        5.8 (Berkeley) %G%";
  */
 
 #include "lp.h"
  */
 
 #include "lp.h"
+#include "pathnames.h"
 
 #define JOBCOL 40              /* column for job # in -l format */
 #define OWNCOL 7               /* start of Owner column in normal */
 
 #define JOBCOL 40              /* column for job # in -l format */
 #define OWNCOL 7               /* start of Owner column in normal */
@@ -44,7 +45,6 @@ int   rank;           /* order to be printed (-1=none, 0=active) */
 long   totsize;        /* total print job size in bytes */
 int    first;          /* first file in ``files'' column? */
 int    col;            /* column on screen */
 long   totsize;        /* total print job size in bytes */
 int    first;          /* first file in ``files'' column? */
 int    col;            /* column on screen */
-int    sendtorem;      /* are we sending to a remote? */
 char   file[132];      /* print file name */
 
 char   *head0 = "Rank   Owner      Job  Files";
 char   file[132];      /* print file name */
 
 char   *head0 = "Rank   Owner      Job  Files";
@@ -73,51 +73,18 @@ displayq(format)
        else if (i == 0)
                fatal("unknown printer");
        if ((LP = pgetstr("lp", &bp)) == NULL)
        else if (i == 0)
                fatal("unknown printer");
        if ((LP = pgetstr("lp", &bp)) == NULL)
-               LP = DEFDEVLP;
+               LP = _PATH_DEFDEVLP;
        if ((RP = pgetstr("rp", &bp)) == NULL)
                RP = DEFLP;
        if ((SD = pgetstr("sd", &bp)) == NULL)
        if ((RP = pgetstr("rp", &bp)) == NULL)
                RP = DEFLP;
        if ((SD = pgetstr("sd", &bp)) == NULL)
-               SD = DEFSPOOL;
+               SD = _PATH_DEFSPOOL;
        if ((LO = pgetstr("lo", &bp)) == NULL)
                LO = DEFLOCK;
        if ((ST = pgetstr("st", &bp)) == NULL)
                ST = DEFSTAT;
        RM = pgetstr("rm", &bp);
        if ((LO = pgetstr("lo", &bp)) == NULL)
                LO = DEFLOCK;
        if ((ST = pgetstr("st", &bp)) == NULL)
                ST = DEFSTAT;
        RM = pgetstr("rm", &bp);
-
-       /*
-        * Figure out whether the local machine is the same as the remote 
-        * machine entry (if it exists).  If not, then ignore the local
-        * queue information.
-        */
-        if (RM != (char *) NULL) {
-               char name[256];
-               struct hostent *hp;
-
-               /* get the standard network name of the local host */
-               gethostname(name, sizeof(name));
-               name[sizeof(name)-1] = '\0';
-               hp = gethostbyname(name);
-               if (hp == (struct hostent *) NULL) {
-                   printf("unable to get network name for local machine %s\n",
-                       name);
-                   goto localcheck_done;
-               } else (void) strcpy(name, hp->h_name);
-
-               /* get the network standard name of RM */
-               hp = gethostbyname(RM);
-               if (hp == (struct hostent *) NULL) {
-                   printf("unable to get hostname for remote machine %s\n",
-                       RM);
-                   goto localcheck_done;
-               }
-
-               /* if printer is not on local machine, ignore LP */
-               if (strcmp(name, hp->h_name)) {
-                       *LP = '\0';
-                       ++sendtorem;
-               }
-       }
-localcheck_done:
+       if (cp = checkremote())
+               printf("Warning: %s\n", cp);
 
        /*
         * Print out local queue
 
        /*
         * Print out local queue
@@ -435,7 +402,7 @@ prank(n)
                col += 6;
                return;
        }
                col += 6;
                return;
        }
-       if ((n/10) == 1)
+       if ((n/10)%10 == 1)
                (void) sprintf(line, "%dth", n);
        else
                (void) sprintf(line, "%d%s", n, r[n%10]);
                (void) sprintf(line, "%dth", n);
        else
                (void) sprintf(line, "%d%s", n, r[n%10]);