print out certain types of phone numbers in US formats
[unix-history] / usr / src / usr.bin / finger / sprint.c
index ffb3333..82a63c0 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)sprint.c   5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)sprint.c   5.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -36,7 +36,7 @@ sflag_print()
        register char *p;
        PERSON **list, **sort();
        time_t time();
        register char *p;
        PERSON **list, **sort();
        time_t time();
-       char *ctime();
+       char *ctime(), *prphone();
 
        list = sort();
        /*
 
        list = sort();
        /*
@@ -54,7 +54,7 @@ sflag_print()
         */
 #define        MAXREALNAME     20
        (void)printf("%-*s %-*s %s\n", UT_NAMESIZE, "Login", MAXREALNAME,
         */
 #define        MAXREALNAME     20
        (void)printf("%-*s %-*s %s\n", UT_NAMESIZE, "Login", MAXREALNAME,
-           "Name", "Tty  Idle  Login        Office      Office Phone");
+           "Name", "Tty  Idle  Login        Office     Office Phone");
        for (cnt = 0; cnt < entries; ++cnt) {
                pn = list[cnt];
                for (w = pn->whead; w != NULL; w = w->next) {
        for (cnt = 0; cnt < entries; ++cnt) {
                pn = list[cnt];
                for (w = pn->whead; w != NULL; w = w->next) {
@@ -85,11 +85,12 @@ sflag_print()
                        else
                                (void)printf(" %.5s", p + 11);
 office:                        if (pn->office)
                        else
                                (void)printf(" %.5s", p + 11);
 office:                        if (pn->office)
-                               (void)printf(" %-11.11s", pn->office);
+                               (void)printf(" %-10.10s", pn->office);
                        else if (pn->officephone)
                        else if (pn->officephone)
-                               (void)printf(" %-11.11s", " ");
+                               (void)printf(" %-10.10s", " ");
                        if (pn->officephone)
                        if (pn->officephone)
-                               (void)printf(" %-.14s", pn->officephone);
+                               (void)printf(" %-.15s",
+                                   prphone(pn->officephone));
                        putchar('\n');
                }
        }
                        putchar('\n');
                }
        }