[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[openap-cvs] : erase update.c,1.1.1.1,1.2
From: |
Pavel Roskin <address@hidden> |
Subject: |
[openap-cvs] : erase update.c,1.1.1.1,1.2 |
Date: |
Wed, 23 Oct 2002 18:49:14 -0400 |
Update of /cvsroot/openap/erase
In directory subversions:/tmp/cvs-serv18487
Modified Files:
update.c
Log Message:
Open flash image read-only.
Enable error messages by default, leave debug messages disabled.
Consistently use perror() to report errors.
Don't print obscenities on stdout.
Index: update.c
===================================================================
RCS file: /cvsroot/openap/erase/update.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- update.c 11 May 2002 16:51:04 -0000 1.1.1.1
+++ update.c 23 Oct 2002 22:49:10 -0000 1.2
@@ -18,9 +18,16 @@
#include <linux/mtd/mtd.h>
-#undef DEBUG
-#ifndef DEBUG
+#ifndef DEBUG
+/* 0 - no messages, 1 - only error messages, 2 - all messages */
+#define DEBUG 1
+#endif
+
+#if DEBUG < 2
#define printf(arg, ...) ;
+#endif
+
+#if DEBUG < 1
#define fprintf(arg, ...) ;
#define perror(arg) ;
#endif
@@ -165,7 +172,6 @@
if( ioctl(fd, MEMERASE, &erase) )
{
perror("region block erase failure\n");
- printf("we are fucked!\n");
close(fd);
return 1;
}
@@ -223,7 +229,7 @@
// open the device
if ((fd = open(argv[1],O_RDWR)) < 0) {
- fprintf(stderr,"device open error\n");
+ perror("device open error");
return 1;
}
// open the file
@@ -231,9 +237,9 @@
if (strcmp(argv[4],"-") == 0)
fd2 = 0;
else {
- fd2 = open(argv[4],O_RDWR);
+ fd2 = open(argv[4],O_RDONLY);
if (fd2 < 0) {
- fprintf(stderr,"file open error\n");
+ perror("file open error");
return 1;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [openap-cvs] : erase update.c,1.1.1.1,1.2,
Pavel Roskin <address@hidden> <=