CVS commit: src/usr.sbin/tpctl

2018-07-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul 16 01:04:47 UTC 2018

Modified Files:
src/usr.sbin/tpctl: main.c

Log Message:
cast through intptr_t


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/tpctl/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/tpctl

2018-07-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul 16 01:04:47 UTC 2018

Modified Files:
src/usr.sbin/tpctl: main.c

Log Message:
cast through intptr_t


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/tpctl/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/tpctl/main.c
diff -u src/usr.sbin/tpctl/main.c:1.6 src/usr.sbin/tpctl/main.c:1.7
--- src/usr.sbin/tpctl/main.c:1.6	Fri Nov 29 18:01:05 2013
+++ src/usr.sbin/tpctl/main.c	Sun Jul 15 21:04:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.6 2013/11/29 23:01:05 joerg Exp $	*/
+/*	$NetBSD: main.c,v 1.7 2018/07/16 01:04:47 christos Exp $	*/
 
 /*-
  * Copyright (c) 2002 TAKEMRUA Shin
@@ -49,7 +49,7 @@
 
 #ifndef lint
 #include 
-__RCSID("$NetBSD: main.c,v 1.6 2013/11/29 23:01:05 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.7 2018/07/16 01:04:47 christos Exp $");
 #endif /* not lint */
 
 void load_data(const char *, struct tpctl_data *);
@@ -380,7 +380,7 @@ drawcross(struct fb *fb, int x, int y, i
 int
 check_esc(void *data)
 {
-	int fd = (int)data;
+	int fd = (int)(intptr_t)data;
 	int flg, n, error;
 	char buf[1];
 	struct termios tm, raw;



CVS commit: src/usr.sbin/tpctl

2017-08-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug 27 02:19:08 UTC 2017

Modified Files:
src/usr.sbin/tpctl: fb.c

Log Message:
Try to use standard wsdisplay ioctls when HPCFBIO_GCONF is not available.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/tpctl/fb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/tpctl/fb.c
diff -u src/usr.sbin/tpctl/fb.c:1.4 src/usr.sbin/tpctl/fb.c:1.5
--- src/usr.sbin/tpctl/fb.c:1.4	Sat May 10 15:31:05 2008
+++ src/usr.sbin/tpctl/fb.c	Sun Aug 27 02:19:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fb.c,v 1.4 2008/05/10 15:31:05 martin Exp $	*/
+/*	$NetBSD: fb.c,v 1.5 2017/08/27 02:19:08 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2002 TAKEMRUA Shin
@@ -41,7 +41,7 @@
 
 #ifndef lint
 #include 
-__RCSID("$NetBSD: fb.c,v 1.4 2008/05/10 15:31:05 martin Exp $");
+__RCSID("$NetBSD: fb.c,v 1.5 2017/08/27 02:19:08 jmcneill Exp $");
 #endif /* not lint */
 
 #define INVALID_CACHE -1
@@ -69,6 +69,8 @@ fb_dispmode(struct fb *fb, int dispmode)
 int
 fb_init(struct fb *fb, int fd)
 {
+	struct wsdisplay_fbinfo fbinfo;
+	u_int linebytes;
 	int y;
 	size_t size;
 
@@ -77,8 +79,22 @@ fb_init(struct fb *fb, int fd)
 	fb->conf.hf_conf_index = HPCFB_CURRENT_CONFIG;
 	if (ioctl(fb->fd, WSDISPLAYIO_GMODE, >dispmode) < 0)
 		return (-1);
-	if (ioctl(fb->fd, HPCFBIO_GCONF, >conf) < 0)
-		return (-1);
+	if (ioctl(fb->fd, HPCFBIO_GCONF, >conf) < 0) {
+		if (ioctl(fb->fd, WSDISPLAYIO_GINFO, ) < 0 ||
+		ioctl(fb->fd, WSDISPLAYIO_LINEBYTES, ) < 0)
+			return (-1);
+		memset(>conf, 0, sizeof(fb->conf));
+		fb->conf.hf_width = fbinfo.width;
+		fb->conf.hf_height = fbinfo.height;
+		fb->conf.hf_bytes_per_line = linebytes;
+		fb->conf.hf_nplanes = 1;
+		fb->conf.hf_bytes_per_plane = fbinfo.height * linebytes;
+		fb->conf.hf_pack_width = fbinfo.depth;
+		fb->conf.hf_pixels_per_pack = 1;
+		fb->conf.hf_pixel_width = 1;
+		fb->conf.hf_access_flags = HPCFB_ACCESS_STATIC |
+		HPCFB_ACCESS_BYTE | HPCFB_ACCESS_WORD | HPCFB_ACCESS_DWORD;
+	}
 
 	if (fb_dispmode(fb, WSDISPLAYIO_MODE_MAPPED) < 0)
 		return (-1);



CVS commit: src/usr.sbin/tpctl

2017-08-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug 27 02:19:08 UTC 2017

Modified Files:
src/usr.sbin/tpctl: fb.c

Log Message:
Try to use standard wsdisplay ioctls when HPCFBIO_GCONF is not available.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/tpctl/fb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/tpctl

2013-11-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Nov 29 23:01:06 UTC 2013

Modified Files:
src/usr.sbin/tpctl: main.c

Log Message:
Mark usage as dead.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/tpctl/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/tpctl/main.c
diff -u src/usr.sbin/tpctl/main.c:1.5 src/usr.sbin/tpctl/main.c:1.6
--- src/usr.sbin/tpctl/main.c:1.5	Tue Apr 28 10:57:24 2009
+++ src/usr.sbin/tpctl/main.c	Fri Nov 29 23:01:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.5 2009/04/28 10:57:24 nonaka Exp $	*/
+/*	$NetBSD: main.c,v 1.6 2013/11/29 23:01:05 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2002 TAKEMRUA Shin
@@ -49,7 +49,7 @@
 
 #ifndef lint
 #include sys/cdefs.h
-__RCSID($NetBSD: main.c,v 1.5 2009/04/28 10:57:24 nonaka Exp $);
+__RCSID($NetBSD: main.c,v 1.6 2013/11/29 23:01:05 joerg Exp $);
 #endif /* not lint */
 
 void load_data(const char *, struct tpctl_data *);
@@ -62,7 +62,7 @@ int opt_verbose;
 int opt_noupdate;
 int opt_forceupdate;
 
-static void
+static __dead void
 usage(void)
 {
 



CVS commit: src/usr.sbin/tpctl

2013-11-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Nov 29 23:01:06 UTC 2013

Modified Files:
src/usr.sbin/tpctl: main.c

Log Message:
Mark usage as dead.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/tpctl/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/tpctl

2009-04-28 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 28 10:57:24 UTC 2009

Modified Files:
src/usr.sbin/tpctl: data.c main.c tp.c tpctl.h

Log Message:
Fix WARNS=4 issues.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/tpctl/data.c src/usr.sbin/tpctl/tpctl.h
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/tpctl/main.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/tpctl/tp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/tpctl/data.c
diff -u src/usr.sbin/tpctl/data.c:1.5 src/usr.sbin/tpctl/data.c:1.6
--- src/usr.sbin/tpctl/data.c:1.5	Sat May 10 15:31:05 2008
+++ src/usr.sbin/tpctl/data.c	Tue Apr 28 10:57:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: data.c,v 1.5 2008/05/10 15:31:05 martin Exp $	*/
+/*	$NetBSD: data.c,v 1.6 2009/04/28 10:57:24 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2002 TAKEMRUA Shin
@@ -41,7 +41,7 @@
 
 #ifndef lint
 #include sys/cdefs.h
-__RCSID($NetBSD: data.c,v 1.5 2008/05/10 15:31:05 martin Exp $);
+__RCSID($NetBSD: data.c,v 1.6 2009/04/28 10:57:24 nonaka Exp $);
 #endif /* not lint */
 
 static void *
@@ -86,7 +86,7 @@
 }
 
 int
-read_data(char *filename, struct tpctl_data *data)
+read_data(const char *filename, struct tpctl_data *data)
 {
 	int res, len, n, i, t;
 	char buf[MAXDATALEN + 2], *p, *p2;
@@ -252,32 +252,32 @@
 }
 
 int
-write_data(char *filename, struct tpctl_data *data)
+write_data(const char *filename, struct tpctl_data *data)
 {
 	int res, fd;
 	FILE *fp;
 	struct tpctl_data_elem *elem;
-	char *p, tmpfile[MAXPATHLEN + 1];
+	char *p, tempfile[MAXPATHLEN + 1];
 
 	fd = 0;		/* XXXGCC -Wuninitialized [hpcarm] */
 
 	if (filename == NULL) {
 		fp = stdout;
 	} else {
-		strncpy(tmpfile, filename, MAXPATHLEN);
-		tmpfile[MAXPATHLEN] = '\0';
-		if ((p = strrchr(tmpfile, '/')) == NULL) {
-			strcpy(tmpfile, TPCTL_TMP_FILENAME);
+		strncpy(tempfile, filename, MAXPATHLEN);
+		tempfile[MAXPATHLEN] = '\0';
+		if ((p = strrchr(tempfile, '/')) == NULL) {
+			strcpy(tempfile, TPCTL_TMP_FILENAME);
 		} else {
 			p++;
 			if (MAXPATHLEN 
-			p - tmpfile + strlen(TPCTL_TMP_FILENAME))
+			p - tempfile + strlen(TPCTL_TMP_FILENAME))
 return (ERR_NOFILE);/* file name is too long */
-			strcat(tmpfile, TPCTL_TMP_FILENAME);
+			strcat(tempfile, TPCTL_TMP_FILENAME);
 		}
-		if ((fd = open(tmpfile, O_RDWR|O_CREAT|O_EXCL, 0644))  0) {
+		if ((fd = open(tempfile, O_RDWR|O_CREAT|O_EXCL, 0644))  0) {
 			fprintf(stderr, %s: can't create %s\n,
-			getprogname(), tmpfile);
+			getprogname(), tempfile);
 			return (ERR_NOFILE);
 		}
 		if ((fp = fdopen(fd, w)) == NULL) {
@@ -304,8 +304,8 @@
 	if (filename != NULL) {
 		fclose(fp);
 		close(fd);
-		if (rename(tmpfile, filename)  0) {
-			unlink(tmpfile);
+		if (rename(tempfile, filename)  0) {
+			unlink(tempfile);
 			return (ERR_NOFILE);
 		}
 	}
Index: src/usr.sbin/tpctl/tpctl.h
diff -u src/usr.sbin/tpctl/tpctl.h:1.5 src/usr.sbin/tpctl/tpctl.h:1.6
--- src/usr.sbin/tpctl/tpctl.h:1.5	Sat May 10 15:31:05 2008
+++ src/usr.sbin/tpctl/tpctl.h	Tue Apr 28 10:57:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: tpctl.h,v 1.5 2008/05/10 15:31:05 martin Exp $	*/
+/*	$NetBSD: tpctl.h,v 1.6 2009/04/28 10:57:24 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2003 TAKEMRUA Shin
@@ -86,8 +86,8 @@
 };
 
 int init_data(struct tpctl_data *);
-int read_data(char *, struct tpctl_data *);
-int write_data(char *, struct tpctl_data *);
+int read_data(const char *, struct tpctl_data *);
+int write_data(const char *, struct tpctl_data *);
 void write_coords(FILE *, char *, struct wsmouse_calibcoords *);
 void free_data(struct tpctl_data *);
 int replace_data(struct tpctl_data *, char *, struct wsmouse_calibcoords *);

Index: src/usr.sbin/tpctl/main.c
diff -u src/usr.sbin/tpctl/main.c:1.4 src/usr.sbin/tpctl/main.c:1.5
--- src/usr.sbin/tpctl/main.c:1.4	Sat May 10 15:31:05 2008
+++ src/usr.sbin/tpctl/main.c	Tue Apr 28 10:57:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.4 2008/05/10 15:31:05 martin Exp $	*/
+/*	$NetBSD: main.c,v 1.5 2009/04/28 10:57:24 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2002 TAKEMRUA Shin
@@ -49,12 +49,12 @@
 
 #ifndef lint
 #include sys/cdefs.h
-__RCSID($NetBSD: main.c,v 1.4 2008/05/10 15:31:05 martin Exp $);
+__RCSID($NetBSD: main.c,v 1.5 2009/04/28 10:57:24 nonaka Exp $);
 #endif /* not lint */
 
-void load_data(char *data_file, struct tpctl_data *);
-void save_data(char *data_file, struct tpctl_data *);
-int do_calibration(char *, struct tp *, struct wsmouse_calibcoords *);
+void load_data(const char *, struct tpctl_data *);
+void save_data(const char *, struct tpctl_data *);
+int do_calibration(const char *, struct tp *, struct wsmouse_calibcoords *);
 void drawcross(struct fb *, int, int, int, fb_pixel_t);
 int check_esc(void *);
 
@@ -79,9 +79,9 @@
 	struct tp tp;
 	struct wsmouse_calibcoords *pref;
 	struct tpctl_data data;
-	char *data_file;
-	char *dev_name;
-	char *dispdev_name;
+	const char *data_file;
+	const