diff -urN gnuplot-3.7.1.orig/bitmap.c gnuplot-3.7.1/bitmap.c
--- gnuplot-3.7.1.orig/bitmap.c	Mon Oct 11 18:10:54 1999
+++ gnuplot-3.7.1/bitmap.c	Thu Mar 30 21:49:13 2000
@@ -75,6 +75,7 @@
 unsigned int b_psize;		/* size of each plane */
 unsigned int b_rastermode;	/* raster mode rotates -90deg */
 unsigned int b_linemask = 0xffff;	/* 16 bit mask for dotted lines */
+unsigned int b_masksize = 16;	/* number of bits in linemask */
 unsigned int b_value = 1;	/* colour of lines */
 unsigned int b_hchar;		/* width of characters */
 unsigned int b_hbits;		/* actual bits in char horizontally */
@@ -954,7 +955,7 @@
     if ((b_linemask >> b_maskcount) & (unsigned int) (1)) {
 	b_setpixel(x, y, value);
     }
-    b_maskcount = (b_maskcount + 1) % 16;
+    b_maskcount = (b_maskcount + 1) % b_masksize;
     b_lastx = x;		/* last pixel set with mask */
     b_lasty = y;
 }
@@ -1120,9 +1121,76 @@
     if (linetype >= 7)
 	linetype %= 7;
     b_linemask = b_pattern[linetype + 2];
+    b_masksize = 16;  /* all of the default patterns are 16 bits */
     b_maskcount = 0;
 }
 
+/*
+ * set b_linemask and b_masksize to custom values
+ */
+void b_setlinemask(linemask,masksize)
+unsigned int linemask;
+int masksize;
+{
+  b_linemask = linemask;
+  b_masksize = masksize;
+}
+
+/*
+ * Cruft alert!  The postscript and X11 terminal drivers use a nice big
+ * character array to store dash patterns.  In this bitmap code, we use a
+ * single int.  Rather than expand the bitmap code to use the larger
+ * dash form, lets patch on a quick layer of cruft to squeeze the characters
+ * into the int.
+ */
+void b_setdashtype(dashtype)
+char *dashtype;
+{
+   unsigned int linemask;
+   int i,count,maxcount;
+   float scale;
+
+   if (!dashtype||!dashtype[0]||!(dashtype[0]-'0')) {
+    /* just use a solid line if we didn't get anything */
+     b_linemask=0xffff;
+     b_masksize=16;
+     return;
+   }
+
+   for(count=i=0;dashtype[i]&&(dashtype[i]-'0');i++) {
+     count+=dashtype[i]-'0';
+   }
+
+   maxcount=sizeof(unsigned int)*(8 /* bits per byte */);
+
+   if (count>maxcount) {
+     /* Oh no! They asked for a bit pattern longer than we can
+      * represent.  We'll have to scale it down and live with it.
+      *
+      * Anybody want to code up antialiasing support?
+      */
+
+     /* This isn't the best way to do this, but I don't have enough
+      * caffeine right now to think of a better way.
+      */
+     scale=(float)maxcount/(float)count;
+     b_linemask=0;
+     for(count=i=0;dashtype[i]&&(dashtype[i]-'0');i++) {
+       if ((i+1)%2)
+         b_linemask|=((1<<(int)((dashtype[i]-'0')*scale+0.5))-1)<<count;
+       count+=(dashtype[i]-'0')*scale+0.5;
+     }
+     b_masksize=(count>maxcount)?maxcount:count; /* allow for rounding error */
+   } else {
+     b_masksize=count;
+     b_linemask=0;
+     for(count=i=0;dashtype[i]&&(dashtype[i]-'0');i++) {
+       if ((i+1)%2)
+         b_linemask|=((1<<(dashtype[i]-'0'))-1)<<count;
+       count+=dashtype[i]-'0';
+     }
+   }
+}
 
 /*
  * set b_value to value
diff -urN gnuplot-3.7.1.orig/gplt_x11.c gnuplot-3.7.1/gplt_x11.c
--- gnuplot-3.7.1.orig/gplt_x11.c	Fri Oct 15 17:04:50 1999
+++ gnuplot-3.7.1/gplt_x11.c	Thu Mar 30 21:48:36 2000
@@ -840,6 +840,7 @@
 {
     int n, x, y, sw, sl, lt = 0, width, type, point, px, py;
     int user_width = 1;		/* as specified by plot...linewidth */
+    char user_dash[8] = "\0";	/* as specified by plot...dashtype */
     char *buffer, *str;
     enum JUSTIFY jmode;
 
@@ -948,15 +949,27 @@
 	else if (*buffer == 'W')
 	    sscanf(buffer + 1, "%4d", &user_width);
 
+	/*  X11_dashtype(dashtype) - set dash pattern */
+	else if (*buffer == 'D') {
+	    sscanf(buffer + 1, "%8s", user_dash);
+            for (str=user_dash;(*str)&&((str-user_dash)<sizeof(user_dash));str++)
+              *str-='0';
+        }
+
 	/*   X11_linetype(type) - set line type  */
 	else if (*buffer == 'L') {
 	    sscanf(buffer, "L%4d", &lt);
 	    lt = (lt % 8) + 2;
 	    /* default width is 0 {which X treats as 1} */
 	    width = widths[lt] ? user_width * widths[lt] : user_width;
-	    if (dashes[lt][0]) {
+            if (user_width)
+	    if (dashes[lt][0]||user_dash[0]) {
 		type = LineOnOffDash;
-		XSetDashes(dpy, gc, 0, dashes[lt], strlen(dashes[lt]));
+                if (user_dash[0]) {
+		  XSetDashes(dpy, gc, 0, user_dash, strlen(user_dash));
+                } else {
+		  XSetDashes(dpy, gc, 0, dashes[lt], strlen(dashes[lt]));
+                }
 	    } else {
 		type = LineSolid;
 	    }
diff -urN gnuplot-3.7.1.orig/plot.h gnuplot-3.7.1/plot.h
--- gnuplot-3.7.1.orig/plot.h	Tue Oct 19 14:32:17 1999
+++ gnuplot-3.7.1/plot.h	Thu Mar 30 21:48:36 2000
@@ -518,6 +518,7 @@
                 p_type;
         double  l_width,
                 p_size;
+        char    l_dash[8];
                                 /* more to come ? */
 };
 
@@ -619,6 +620,7 @@
 	void (*resume)  __PROTO((void)); /* called before plots of multiplot */
 	void (*fillbox) __PROTO((int, unsigned int, unsigned int, unsigned int, unsigned int)); /* clear in multiplot mode */
    void (*linewidth) __PROTO((double linewidth));
+   void (*dashtype) __PROTO((char * dashtype));
 };
 
 #ifdef WIN16
@@ -792,8 +794,8 @@
 #if defined(__FILE__) && defined(__LINE__) && defined(DEBUG_LP)
 # define LP_DUMP(lp) \
  fprintf(stderr, \
-  "lp_properties at %s:%d : lt: %d, lw: %.3f, pt: %d, ps: %.3f\n", \
-  __FILE__, __LINE__, lp.l_type, lp.l_width, lp.p_type, lp.p_size)
+  "lp_properties at %s:%d : lt: %d, lw: %.3f, pt: %d, ps: %.3f, dt: %s\n", \
+  __FILE__, __LINE__, lp.l_type, lp.l_width, lp.p_type, lp.p_size, lp.p_dash)
 #else
 # define LP_DUMP(lp)
 #endif
@@ -821,6 +823,11 @@
          lp.p_size = real(const_express(&t)); \
       } else lp.p_size = pointsize; /* as in "set pointsize" */ \
    } else lp.p_size = pointsize; /* give it a value */ \
+   if (almost_equals(c_token,"dasht$ype") || equals(c_token, "dt" )) { \
+	   ++c_token; \
+	   copy_str(lp.l_dash,c_token,8); \
+	   ++c_token; \
+   } else lp.l_dash[0]='\0';\
    LP_DUMP(lp); \
 }
    
diff -urN gnuplot-3.7.1.orig/set.c gnuplot-3.7.1/set.c
--- gnuplot-3.7.1.orig/set.c	Thu Aug 19 15:36:35 1999
+++ gnuplot-3.7.1/set.c	Thu Mar 30 21:48:36 2000
@@ -79,7 +79,7 @@
 TBOOLEAN clip_points = FALSE;
 TBOOLEAN clip_lines1 = TRUE;
 TBOOLEAN clip_lines2 = FALSE;
-struct lp_style_type border_lp = { 0, -2, 0, 1.0, 1.0 };
+struct lp_style_type border_lp = { 0, -2, 0, 1.0, 1.0, "\0" };
 int draw_border = 31;
 TBOOLEAN draw_surface = TRUE;
 char dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1] = { "x", "y" };
@@ -102,14 +102,14 @@
 enum PLOT_STYLE data_style = POINTSTYLE;
 enum PLOT_STYLE func_style = LINES;
 double bar_size = 1.0;
-struct lp_style_type work_grid = { 0, GRID_OFF, 0, 1.0, 1.0 };
-struct lp_style_type grid_lp   = { 0, -1, 0, 1.0, 1.0 };
-struct lp_style_type mgrid_lp  = { 0, -1, 0, 1.0, 1.0 };
+struct lp_style_type work_grid = { 0, GRID_OFF, 0, 1.0, 1.0, "\0" };
+struct lp_style_type grid_lp   = { 0, -1, 0, 1.0, 1.0, "\0" };
+struct lp_style_type mgrid_lp  = { 0, -1, 0, 1.0, 1.0, "\0" };
 double polar_grid_angle = 0;	/* nonzero means a polar grid */
 int key = -1;			/* default position */
 struct position key_user_pos;	/* user specified position for key */
 TBOOLEAN key_reverse = FALSE;	/* reverse text & sample ? */
-struct lp_style_type key_box = { 0, -3, 0, 1.0, 1.0 };		/* -3 = no linetype */
+struct lp_style_type key_box = { 0, -3, 0, 1.0, 1.0, "\0" };		/* -3 = no linetype */
 double key_swidth = 4.0;
 double key_vert_factor = 1.0;
 double key_width_fix = 0.0;
@@ -205,10 +205,10 @@
 int dgrid3d_norm_value = 1;
 TBOOLEAN dgrid3d = FALSE;
 
-struct lp_style_type xzeroaxis = { 0, -3, 0, 1.0, 1.0 };
-struct lp_style_type yzeroaxis = { 0, -3, 0, 1.0, 1.0 };
-struct lp_style_type x2zeroaxis = { 0, -3, 0, 1.0, 1.0 };
-struct lp_style_type y2zeroaxis = { 0, -3, 0, 1.0, 1.0 };
+struct lp_style_type xzeroaxis = { 0, -3, 0, 1.0, 1.0, "\0" };
+struct lp_style_type yzeroaxis = { 0, -3, 0, 1.0, 1.0, "\0" };
+struct lp_style_type x2zeroaxis = { 0, -3, 0, 1.0, 1.0, "\0" };
+struct lp_style_type y2zeroaxis = { 0, -3, 0, 1.0, 1.0, "\0" };
 
 /* perhaps make these into an array one day */
 
@@ -336,7 +336,7 @@
 static TBOOLEAN set_two __PROTO((void));
 static TBOOLEAN set_three __PROTO((void));
 static int looks_like_numeric __PROTO((char *));
-static void set_lp_properties __PROTO((struct lp_style_type * arg, int allow_points, int lt, int pt, double lw, double ps));
+static void set_lp_properties __PROTO((struct lp_style_type * arg, int allow_points, int lt, int pt, double lw, double ps, char *dt));
 static void reset_lp_properties __PROTO((struct lp_style_type *arg));
 static void set_locale __PROTO((char *));
 
@@ -418,15 +418,15 @@
     clip_points = FALSE;
     clip_lines1 = TRUE;
     clip_lines2 = FALSE;
-    set_lp_properties(&border_lp, 0, -2, 0, 1.0, 1.0);
+    set_lp_properties(&border_lp, 0, -2, 0, 1.0, 1.0,NULL);
     draw_border = 31;
     draw_surface = TRUE;
     data_style = POINTSTYLE;
     func_style = LINES;
     bar_size = 1.0;
-    set_lp_properties(&work_grid, 0, GRID_OFF, 0, 0.5, 1.0);
-    set_lp_properties(&grid_lp, 0, -1, 0, 0.5, 1.0);
-    set_lp_properties(&mgrid_lp, 0, -1, 0, 0.5, 1.0);
+    set_lp_properties(&work_grid, 0, GRID_OFF, 0, 0.5, 1.0,NULL);
+    set_lp_properties(&grid_lp, 0, -1, 0, 0.5, 1.0,NULL);
+    set_lp_properties(&mgrid_lp, 0, -1, 0, 0.5, 1.0,NULL);
     polar_grid_angle = 0;
     key = -1;
     is_log_x = FALSE;
@@ -520,10 +520,10 @@
     dgrid3d_col_fineness = 10;
     dgrid3d_norm_value = 1;
     dgrid3d = FALSE;
-    set_lp_properties(&xzeroaxis, 0, -3, 0, 1.0, 1.0);
-    set_lp_properties(&yzeroaxis, 0, -3, 0, 1.0, 1.0);
-    set_lp_properties(&x2zeroaxis, 0, -3, 0, 1.0, 1.0);
-    set_lp_properties(&y2zeroaxis, 0, -3, 0, 1.0, 1.0);
+    set_lp_properties(&xzeroaxis, 0, -3, 0, 1.0, 1.0,NULL);
+    set_lp_properties(&yzeroaxis, 0, -3, 0, 1.0, 1.0,NULL);
+    set_lp_properties(&x2zeroaxis, 0, -3, 0, 1.0, 1.0,NULL);
+    set_lp_properties(&y2zeroaxis, 0, -3, 0, 1.0, 1.0,NULL);
     xtics =
 	ytics = TICS_ON_BORDER | TICS_MIRROR;
     ztics = TICS_ON_BORDER;	/* no mirror by default */
@@ -556,7 +556,7 @@
     key_vpos = TTOP;
     key_just = JRIGHT;
     key_reverse = FALSE;
-    set_lp_properties(&key_box, 0, -3, 0, 1.0, 1.0);
+    set_lp_properties(&key_box, 0, -3, 0, 1.0, 1.0,NULL);
     key_swidth = 4;
     key_vert_factor = 1;
     key_width_fix = 0;
@@ -1459,7 +1459,7 @@
 	/* For now, you have to give a border bitpattern to be able to specify a linestyle. Sorry for this,
 	 * but the gnuplot parser really is too messy for any other solution, currently */
 	if(END_OF_COMMAND) {
-	    set_lp_properties(&border_lp, 0, -2, 0, 1.0, 1.0);
+	    set_lp_properties(&border_lp, 0, -2, 0, 1.0, 1.0,NULL);
 	} else {
 	    LP_PARSE(border_lp, 1, 0, -2, 0);
 	}
@@ -1472,7 +1472,7 @@
 	    key_hpos = TRIGHT;
 	    key_just = JRIGHT;
 	    key_reverse = FALSE;
-	    set_lp_properties(&key_box,0,-3,0,1.0,1.0);
+	    set_lp_properties(&key_box,0,-3,0,1.0,1.0,NULL);
 	    key_swidth = 4;
 	    key_vert_factor = 1;
 	    key_width_fix = 0;
@@ -2593,7 +2593,8 @@
 
 /* ======================================================== */
 /* process a 'set linestyle' command */
-/* set linestyle {tag} {linetype n} {linewidth x} {pointtype n} {pointsize x} */
+/* set linestyle {tag} {linetype n} {linewidth x} {pointtype n}
+   {pointsize x} {dashtype jk} */
 static void set_linestyle()
 {
     struct value a;
@@ -3118,9 +3119,10 @@
     }
 }
 
-static void set_lp_properties(arg, allow_points, lt, pt, lw, ps)
+static void set_lp_properties(arg, allow_points, lt, pt, lw, ps, dt)
 struct lp_style_type *arg;
 int allow_points, lt, pt;
+char *dt;
 double lw, ps;
 {
     arg->pointflag = allow_points;
@@ -3128,6 +3130,7 @@
     arg->p_type = pt;
     arg->l_width = lw;
     arg->p_size = ps;
+    strncpy(arg->l_dash,dt,sizeof(arg->l_dash));
 }
 
 static void reset_lp_properties(arg)
@@ -3136,6 +3139,7 @@
     /* See plot.h for struct lp_style_type */
     arg->pointflag = arg->l_type = arg->p_type = 0;
     arg->l_width = arg->p_size = 1.0;
+    arg->l_dash[0]='\0';
 }
 
 static void set_locale(lcl)
diff -urN gnuplot-3.7.1.orig/term/pbm.trm gnuplot-3.7.1/term/pbm.trm
--- gnuplot-3.7.1.orig/term/pbm.trm	Tue Dec 15 20:21:52 1998
+++ gnuplot-3.7.1/term/pbm.trm	Thu Mar 30 21:49:13 2000
@@ -364,6 +364,12 @@
     }
 }
 
+TERM_PUBLIC void PBMdashtype(dashtype)
+char * dashtype;
+{
+  b_setdashtype(dashtype); 
+}
+
 TERM_PUBLIC void PBMpoint(x, y, point)
 unsigned int x, y;
 int point;
@@ -392,7 +398,10 @@
     PBMput_text, PBMtext_angle, null_justify_text, PBMpoint,
     do_arrow, set_font_null,
     0,				/* pointsize */
-    TERM_CAN_MULTIPLOT | TERM_BINARY
+    TERM_CAN_MULTIPLOT | TERM_BINARY,
+    0 /* suspend */, 0 /* resume */,
+    0 /* fillbox */, 0 /* linewidth */,
+    PBMdashtype
 TERM_TABLE_END(pbm_driver)
 
 #undef LAST_TERM
diff -urN gnuplot-3.7.1.orig/term/post.trm gnuplot-3.7.1/term/post.trm
--- gnuplot-3.7.1.orig/term/post.trm	Thu Aug 19 15:16:33 1999
+++ gnuplot-3.7.1/term/post.trm	Thu Mar 30 21:48:36 2000
@@ -82,6 +82,7 @@
 TERM_PUBLIC int ENHPS_set_font __PROTO((char * font));
 TERM_PUBLIC void PS_fillbox __PROTO((int style, unsigned int x1, unsigned int y1, unsigned int width, unsigned int height));
 TERM_PUBLIC void PS_linewidth __PROTO((double linewidth)); /* JFi [linewidth] */
+TERM_PUBLIC void PS_dashtype __PROTO((char * dashtype)); /* JFi [dashtype] */
 TERM_PUBLIC void PS_pointsize __PROTO((double ptsize)); /* JFi [pointsize] */
 
 #define PS_POINT_TYPES 8
@@ -159,8 +160,10 @@
 "/UP { dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def\n",
 "  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def } def\n",
 /* Dash or Color Line */
-"/DL { Color {setrgbcolor Solid {pop []} if 0 setdash }\n",
-" {pop pop pop Solid {pop []} if 0 setdash} ifelse } def\n",
+"/DL { Color {setrgbcolor UserDash {pop userdashtype} {Solid {pop []} if}\n",
+" ifelse 0 setdash }\n",
+" {pop pop pop UserDash {pop userdashtype} {Solid {pop []} if} ifelse\n",
+" 0 setdash} ifelse } def\n",
 /* Border Lines */
 "/BL { stroke userlinewidth 2 mul setlinewidth } def\n",
 /* Axes Lines */
@@ -168,6 +171,9 @@
 /* set user defined linewidth */
 "/UL { dup gnulinewidth mul /userlinewidth exch def\n",
 "      10 mul /udl exch def } def\n",
+/* set user defined dashtype */
+"/UD {  /userdashtype exch def\n",
+"       } def\n",
 /* Plot Lines */
 "/PL { stroke userlinewidth setlinewidth } def\n",
 /* Line Types */
@@ -664,6 +670,7 @@
 /gnudict 256 dict def\ngnudict begin\n\
 /Color %s def\n\
 /Solid %s def\n\
+/UserDash false def\n\
 /gnulinewidth %.3f def\n\
 /userlinewidth gnulinewidth def\n\
 /vshift %d def\n\
@@ -1038,6 +1045,40 @@
 }
 
 
+TERM_PUBLIC void PS_dashtype (dashtype)
+char * dashtype;
+{
+        fprintf(gpoutfile,"/UserDash %s def\n",(*dashtype)&&(*dashtype-'0')?"true":"false");
+        fprintf(gpoutfile,"[");
+        while (*dashtype) {
+          fprintf(gpoutfile,"%c dl ",*(dashtype++));
+        }
+        fprintf(gpoutfile,"] UD\n");
+
+/*  
+  Documentation of the 'change dashtype' strategy of the postscript terminal:
+
+  1. define a new postscript variable with a default value:
+     /userdashtype gnudashtype def
+
+  2. define a new postscript command to change the contents of that variable:
+     /UD { gnudashtype /userdashtype exch def } def
+     usage:  multiplication_factor UL
+
+  3. modify the already known postscript command /DL for the plot lines:
+     /PL { stroke userlinewidth setlinewidth } def
+
+  4. issue the new command before every change of the plot linestyle:
+     example:
+         4.0 UL
+         LT0
+     result:
+         Linetype 0 is drawn four times as thick as defined by the contents
+         of the postscript variable 'gnulinewidth'.
+*/
+}
+
+
 TERM_PUBLIC void PS_pointsize (ptsize)
 double ptsize;
 {
@@ -1650,7 +1691,8 @@
 	   PS_text, null_scale, PS_graphics, PS_move, PS_vector, 
 	   PS_linetype, PS_put_text, PS_text_angle, 
 	   PS_justify_text, PS_point, do_arrow, PS_set_font, PS_pointsize,
-	   0 /*flags*/, 0 /*suspend*/, 0 /*resume*/, PS_fillbox, PS_linewidth
+	   0 /*flags*/, 0 /*suspend*/, 0 /*resume*/, PS_fillbox, PS_linewidth,
+           PS_dashtype
 
 TERM_TABLE_END(post_driver)
 
diff -urN gnuplot-3.7.1.orig/term/x11.trm gnuplot-3.7.1/term/x11.trm
--- gnuplot-3.7.1.orig/term/x11.trm	Wed Aug 25 17:16:40 1999
+++ gnuplot-3.7.1/term/x11.trm	Thu Mar 30 21:48:36 2000
@@ -53,6 +53,7 @@
 TERM_PUBLIC void X11_move __PROTO((unsigned int x, unsigned int y));
 TERM_PUBLIC void X11_vector __PROTO((unsigned int x, unsigned int y));
 TERM_PUBLIC void X11_linewidth __PROTO((double lw));
+TERM_PUBLIC void X11_dashtype __PROTO((char * lw));
 TERM_PUBLIC void X11_pointsize __PROTO((double ps));
 TERM_PUBLIC void X11_linetype __PROTO((int lt));
 TERM_PUBLIC void X11_put_text __PROTO((unsigned int x, unsigned int y, char str[]));
@@ -584,6 +585,13 @@
 }
 
 TERM_PUBLIC void
+X11_dashtype(dt)
+char *dt;
+{
+    PRINT1("D%s\n", dt);
+}
+
+TERM_PUBLIC void
 X11_linetype(lt)
 int lt;
 {
@@ -641,7 +649,7 @@
     X11_justify_text, X11_point, do_arrow, set_font_null,
     X11_pointsize, TERM_CAN_MULTIPLOT,
     X11_text /* suspend can use same routine */ , 0 /* resume */ ,
-    X11_fillbox, X11_linewidth
+    X11_fillbox, X11_linewidth, X11_dashtype
 TERM_TABLE_END(x11_driver)
 
 #undef LAST_TERM
@@ -656,7 +664,7 @@
     X11_justify_text, X11_point, do_arrow, set_font_null,
     X11_pointsize, TERM_CAN_MULTIPLOT,
     X11_text /* suspend can use same routine */ , 0 /* resume */ ,
-    X11_fillbox, X11_linewidth
+    X11_fillbox, X11_linewidth, X11_dashtype
 TERM_TABLE_END(X11_driver)
 
 #undef LAST_TERM
diff -urN gnuplot-3.7.1.orig/term.c gnuplot-3.7.1/term.c
--- gnuplot-3.7.1.orig/term.c	Fri Oct  1 11:37:23 1999
+++ gnuplot-3.7.1/term.c	Thu Mar 30 21:48:36 2000
@@ -439,6 +439,7 @@
      *  The linetype might depend on the linewidth in some terminals.
      */
     (*term->linewidth) (lp->l_width);
+    (*term->dashtype) (lp->l_dash);
     (*term->linetype) (lp->l_type);
 }