dtscreen: convert K&R prototypes to ansi C
authorPeter Howkins <flibble@users.sf.net>
Wed, 14 Jan 2015 15:06:33 +0000 (15:06 +0000)
committerPeter Howkins <flibble@users.sf.net>
Wed, 14 Jan 2015 15:06:33 +0000 (15:06 +0000)
14 files changed:
cde/programs/dtscreen/blank.c
cde/programs/dtscreen/dtscreen.c
cde/programs/dtscreen/flame.c
cde/programs/dtscreen/hopalong.c
cde/programs/dtscreen/hsbramp.c
cde/programs/dtscreen/image.c
cde/programs/dtscreen/life.c
cde/programs/dtscreen/pyro.c
cde/programs/dtscreen/qix.c
cde/programs/dtscreen/resource.c
cde/programs/dtscreen/rotor.c
cde/programs/dtscreen/swarm.c
cde/programs/dtscreen/usleep.c
cde/programs/dtscreen/worm.c

index c3b9def0f8d1d3916c58480833c3afb9184d67f5..b1bd43e0ae27ecdb03694c74bf5eef4de3df3334 100644 (file)
 
 /*ARGSUSED*/
 void
-drawblank(pwin)
-    perwindow  *pwin;
+drawblank(perwindow *pwin)
 {
 }
 
 void
-initblank(pwin)
-    perwindow  *pwin;
+initblank(perwindow *pwin)
 {
     XClearWindow(dsp, pwin->w);
 }
index 673c4d9a368fd5ef64d3e1739d14e785d6586ba1..97f151b89dbaecabd9ef9c2d3dd7507da35122d2 100644 (file)
@@ -150,7 +150,7 @@ error(s1, s2)
  * Restore all grabs, reset screensaver, restore colormap, close connection.
  */
 static void
-finish()
+finish(void)
 {
     XSync(dsp, False);
     if (winprop) 
@@ -161,7 +161,7 @@ finish()
 
 
 static void
-justDisplay()
+justDisplay(void)
 {
     XEvent      event;
     int window;
@@ -186,10 +186,7 @@ justDisplay()
 
 
 long
-allocpixel(cmap, name, def)
-    Colormap    cmap;
-    char       *name;
-    char       *def;
+allocpixel(Colormap cmap, char *name, char *def)
 {
     XColor      col;
     XColor      tmp;
@@ -214,9 +211,7 @@ allocpixel(cmap, name, def)
 
 
 int
-main(argc, argv)
-    int         argc;
-    char       *argv[];
+main(int argc, char *argv[])
 {
     XSetWindowAttributes xswa;
     XGCValues   xgcv;
index 48e7a0e276b3453ca00e5b5eb97c3b4deaabd977..780369d97f121a6f4b0c89b668656e1d674f47a7 100644 (file)
@@ -65,8 +65,7 @@ typedef struct {
 }           flamestruct;
 
 static short
-halfrandom(mv)
-    int         mv;
+halfrandom(int mv)
 {
     static short lasthalf = 0;
     unsigned long r;
@@ -82,8 +81,7 @@ halfrandom(mv)
 }
 
 void
-initflame(pwin)
-    perwindow      *pwin;
+initflame(perwindow *pwin)
 {
     XWindowAttributes xwa;
     flamestruct *fs;
@@ -113,11 +111,8 @@ initflame(pwin)
     }
 }
 
-static      Bool
-recurse(fs, x, y, l)
-    flamestruct *fs;
-    register double x, y;
-    register int l;
+static Bool
+recurse(flamestruct *fs, double x, double y, int l)
 {
     int         i;
     double      nx, ny;
@@ -154,8 +149,7 @@ recurse(fs, x, y, l)
 
 
 void
-drawflame(pwin)
-    perwindow *pwin;
+drawflame(perwindow *pwin)
 {
     flamestruct *fs = (flamestruct *)pwin->data;
 
index 8fd3cc1e0c10c9dce2ac1423b480faf66f00cd2c..67b290cdcc973f70ba780bc353a06aea88986c1d 100644 (file)
@@ -72,8 +72,7 @@ static XPoint *pointBuffer = 0;       /* pointer for XDrawPoints */
 #define TIMEOUT 30
 
 void
-inithop(pwin)
-    perwindow *pwin;
+inithop(perwindow *pwin)
 {
     double      range;
     XWindowAttributes xgwa;
@@ -112,8 +111,7 @@ inithop(pwin)
 
 
 void
-drawhop(pwin)
-    perwindow *pwin;
+drawhop(perwindow *pwin)
 {
     double      oldj;
     int         k = batchcount;
index d27982dd9bbd80933e7451a00a987eacd681dc00..32c23265cfe58399d649e0376aa127a9ffba1db0 100644 (file)
@@ -113,18 +113,10 @@ hsb2rgb(H, S, B, r, g, b)
  */
 
 void
-hsbramp(h1, s1, b1, h2, s2, b2, count, red, green, blue)
-    double      h1,
-                s1,
-                b1,
-                h2,
-                s2,
-                b2;
-    int         count;
-
-    u_char     *red,
-               *green,
-               *blue;
+hsbramp(double h1, double s1, double b1,
+        double h2, double s2, double b2,
+        int count,
+        u_char *red, u_char *green, u_char *blue)
 {
     double      dh;
     double      ds;
index d35625ba89433e6af91d20ca972a11736cb7d90b..6c3c9da692903def17001712c904c00a296b2741 100644 (file)
@@ -72,8 +72,7 @@ typedef struct {
 }           imagestruct;
 
 void
-drawimage(pwin)
-    perwindow *pwin;
+drawimage(perwindow *pwin)
 {
     imagestruct *ip;
     int         i;
@@ -106,8 +105,7 @@ drawimage(pwin)
 }
 
 void
-initimage(pwin)
-    perwindow *pwin;
+initimage(perwindow *pwin)
 {
     XWindowAttributes xgwa;
     imagestruct *ip;
index 7d5eef58e1b13c917fee9c87508f519bc4a3a80b..d7f11e2f7e94a2b947868ddad0bbd0eafb42135e 100644 (file)
@@ -321,9 +321,7 @@ const int  patterns[][128] = {
 
 
 static void
-drawcell(pwin, row, col)
-    perwindow *pwin;
-    int         row, col;
+drawcell(perwindow *pwin, int row, int col)
 {
     lifestruct *lp;
 
@@ -352,9 +350,7 @@ drawcell(pwin, row, col)
 
 
 static void
-erasecell(pwin, row, col)
-    perwindow *pwin;
-    int         row, col;
+erasecell(perwindow *pwin, int row, int col)
 {
     lifestruct *lp = (lifestruct *)pwin->data;
     XSetForeground(dsp, pwin->gc, BlackPixelOfScreen(pwin->perscreen->screen));
@@ -364,9 +360,7 @@ erasecell(pwin, row, col)
 
 
 static void
-spawn(pwin, loc)
-    perwindow *pwin;
-    unsigned char *loc;
+spawn(perwindow *pwin, unsigned char *loc)
 {
     lifestruct *lp = (lifestruct *)pwin->data;
     unsigned char *ulloc, *ucloc, *urloc, *clloc, *crloc, *llloc, *lcloc, *lrloc,
@@ -421,9 +415,7 @@ spawn(pwin, loc)
 
 
 static void
-life_kill(pwin, loc)
-    perwindow *pwin;
-    unsigned char *loc;
+life_kill(perwindow *pwin, unsigned char *loc)
 {
     lifestruct *lp = (lifestruct *)pwin->data;
 
@@ -478,10 +470,7 @@ life_kill(pwin, loc)
 
 
 static void
-setcell(pwin, row, col)
-    perwindow *pwin;
-    int         row;
-    int         col;
+setcell(perwindow *pwin, int row, int col)
 {
     lifestruct *lp = (lifestruct *)pwin->data;
     unsigned char *loc;
@@ -493,7 +482,7 @@ setcell(pwin, row, col)
 
 
 static void
-init_fates()
+init_fates(void)
 {
     int         i, bits, neighbors;
 
@@ -512,8 +501,7 @@ init_fates()
 
 
 void
-initlife(pwin)
-    perwindow *pwin;
+initlife(perwindow *pwin)
 {
     int         row, col;
     int        *patptr;
@@ -580,8 +568,7 @@ initlife(pwin)
 
 
 void
-drawlife(pwin)
-    perwindow *pwin;
+drawlife(perwindow *pwin)
 {
     unsigned char *loc, *temploc, *lastloc;
     int         row, col;
index e485a25f392e9d4c78805d8210eb7dec42f5342d..4920ee3003d50b2df600d107aa259fe713adead5 100644 (file)
@@ -143,8 +143,7 @@ static int  orig_p_ignite;
 static int  just_started = True;/* Greet the user right away */
 
 void
-initpyro(pwin)
-    perwindow *pwin;
+initpyro(perwindow *pwin)
 {
     pyrostruct *pp;
     rocket     *rp;
@@ -210,8 +209,7 @@ initpyro(pwin)
 
 /*ARGSUSED*/
 void
-drawpyro(pwin)
-    perwindow *pwin;
+drawpyro(perwindow *pwin)
 {
     pyrostruct *pp;
     rocket     *rp;
@@ -239,9 +237,7 @@ drawpyro(pwin)
 }
 
 static void
-ignite(pwin, pp)
-    perwindow *pwin;
-    pyrostruct *pp;
+ignite(perwindow *pwin, pyrostruct *pp)
 {
     rocket     *rp;
     int         multi, shelltype, nstars, fuse, npix, pix, color1, color2;
@@ -292,10 +288,7 @@ ignite(pwin, pp)
 }
 
 static void
-animate(pwin, pp, rp)
-    perwindow *pwin;
-    pyrostruct *pp;
-    rocket     *rp;
+animate(perwindow *pwin, pyrostruct *pp, rocket *rp)
 {
     int         starn;
     float       r, theta;
@@ -329,10 +322,7 @@ animate(pwin, pp, rp)
 }
 
 static void
-shootup(pwin, pp, rp)
-    perwindow *pwin;
-    pyrostruct *pp;
-    rocket     *rp;
+shootup(perwindow *pwin, pyrostruct *pp, rocket *rp)
 {
     XFillRectangle(dsp, pwin->w, pp->bgGC, (int) (rp->x), (int) (rp->y),
                   ROCKETW, ROCKETH + 3);
@@ -350,10 +340,7 @@ shootup(pwin, pp, rp)
 }
 
 static void
-burst(pwin, pp, rp)
-    perwindow *pwin;
-    pyrostruct *pp;
-    rocket     *rp;
+burst(perwindow *pwin, pyrostruct *pp, rocket *rp)
 {
     register int starn;
     register int nstars, stype;
index e497bdc9ed931e4a520884283cc6a76e6cff4eec..dd694a409a8a49e22220737a367ed080c51366c6 100644 (file)
@@ -78,8 +78,7 @@ typedef struct {
 }           qixstruct;
 
 void
-initqix(pwin)
-    perwindow *pwin;
+initqix(perwindow *pwin)
 {
     XWindowAttributes xgwa;
     qixstruct  *qp;
@@ -128,8 +127,7 @@ initqix(pwin)
 }
 
 void
-drawqix(pwin)
-    perwindow *pwin;
+drawqix(perwindow *pwin)
 {
     qixstruct  *qp = (qixstruct  *)pwin->data;
 
index c48ef550498abea1b9834a05957622e7352b233c..e8d747f42c986446e9019244edeb3569b89c323e 100644 (file)
@@ -239,8 +239,7 @@ static argtype modevars[] = {
 
 
 static void
-Syntax(badOption)
-    char       *badOption;
+Syntax(char *badOption)
 {
     int         col, len, i;
 
@@ -295,7 +294,7 @@ Syntax(badOption)
 }
 
 static void
-Help()
+Help(void)
 {
     int         i;
 
@@ -331,7 +330,7 @@ Help()
 }
 
 static void
-DumpResources()
+DumpResources(void)
 {
     int         i;
 
@@ -354,8 +353,7 @@ DumpResources()
 
 
 static void
-LowerString(s)
-    char       *s;
+LowerString(char *s)
 {
 
     while (*s) {
@@ -366,16 +364,9 @@ LowerString(s)
 }
 
 static void
-GetResource(database, parentname, parentclass,
-           name, class, valueType, def, valuep)
-    XrmDatabase database;
-    char       *parentname;
-    char       *parentclass;
-    char       *name;
-    char       *class;
-    int         valueType;
-    char       *def;
-    caddr_t    *valuep;                /* RETURN */
+GetResource(XrmDatabase database, char *parentname, char *parentclass,
+            char *name, char *class, int valueType, char *def,
+            caddr_t *valuep /* RETURN */)
 {
     char       *type;
     XrmValue    value;
@@ -435,10 +426,7 @@ GetResource(database, parentname, parentclass,
 
 
 static      XrmDatabase
-parsefilepath(xfilesearchpath, TypeName, ClassName)
-    char       *xfilesearchpath;
-    char       *TypeName;
-    char       *ClassName;
+parsefilepath(char *xfilesearchpath, char *TypeName, char *ClassName)
 {
     XrmDatabase database = NULL;
     char        appdefaults[1024];
@@ -497,15 +485,14 @@ parsefilepath(xfilesearchpath, TypeName, ClassName)
 /**                                                               **/
 /** this function will exit cleanly when the connection is broken **/
 /*******************************************************************/
-static int screenIOErrorHandler(dpy)
-       Display *dpy;
+static int screenIOErrorHandler(Display *dpy)
 {
        exit(1);
        return 1;
 }
 
 static void
-open_display()
+open_display(void)
 {
     if (display != NULL) {
        char       *colon = strchr(display, ':');
@@ -538,9 +525,7 @@ open_display()
 }
 
 void
-printvar(class, var)
-    char       *class;
-    argtype     var;
+printvar(char *class, argtype var)
 {
     switch (var.type) {
     case t_String:
@@ -565,9 +550,7 @@ printvar(class, var)
 
 
 void
-GetResources(argc, argv)
-    int         argc;
-    char       *argv[];
+GetResources(int argc, char *argv[])
 {
     XrmDatabase RDB = NULL;
     XrmDatabase modeDB = NULL;
index 99ef77560ee61630127b03792bfb0c7e7fd0c3b4..2758913818b424d4446c468c040be50eda070d02 100644 (file)
@@ -101,8 +101,7 @@ typedef struct flightstruct {
 
 
 void
-initrotor(pwin)
-    perwindow *pwin;
+initrotor(perwindow *pwin)
 {
     flightstruct *fs;
     XWindowAttributes xgwa;
@@ -167,8 +166,7 @@ initrotor(pwin)
 }
 
 void
-drawrotor(pwin)
-    perwindow *pwin;
+drawrotor(perwindow *pwin)
 {
     register flightstruct *fs;
     register struct elem *pelem;
index f72d42ac758a12873af1b8899a2afa52bdcecd30..33f2c880146d6bb606a7c3f20640715d2f692704 100644 (file)
@@ -72,8 +72,7 @@ typedef struct {
 }           swarmstruct;
 
 void
-initswarm(pwin)
-    perwindow *pwin;
+initswarm(perwindow *pwin)
 {
     XWindowAttributes xgwa;
     swarmstruct *sp;
@@ -127,8 +126,7 @@ initswarm(pwin)
 
 
 void
-drawswarm(pwin)
-    perwindow *pwin;
+drawswarm(perwindow *pwin)
 {
     swarmstruct *sp;
     int         b;
index 08968bbdbb6e3c919285aac5f11a601c6baa2392..7a62144fb24e22c008f7294aea1b971130c472cb 100644 (file)
@@ -62,7 +62,7 @@ usleep(unsigned long usec)
  * This is used to control rate and timeout in many of the animations.
  */
 long
-seconds()
+seconds(void)
 {
     struct timeval now;
 
index acf3ebdae07c5c4859c38e73a72fb9d59ca31ad4..e80c797e1ae6d2375d46e6ef35ffd838ca502467 100644 (file)
@@ -90,8 +90,7 @@ typedef struct {
 
 #if !defined(CSRG_BASED) && !defined(sun)
 int
-round(x)
-    float       x;
+round(float x)
 {
     return ((int) floor((double) x));
 }
@@ -99,11 +98,7 @@ round(x)
 
 
 void
-worm_doit(pwin, wp, which, color)
-    perwindow *pwin;
-    wormstruct *wp;
-    int         which;
-    unsigned long color;
+worm_doit(perwindow *pwin, wormstruct *wp, int which, unsigned long color)
 {
     wormstuff  *ws = &wp->worm[which];
     int         x, y;
@@ -137,8 +132,7 @@ worm_doit(pwin, wp, which, color)
 
 
 void
-initworm(pwin)
-    perwindow *pwin;
+initworm(perwindow *pwin)
 {
     int         i, j;
     wormstruct *wp;
@@ -199,8 +193,7 @@ initworm(pwin)
 
 
 void
-drawworm(pwin)
-    perwindow *pwin;
+drawworm(perwindow *pwin)
 {
     int         i;
     wormstruct *wp = (wormstruct *)pwin->data;