summaryrefslogtreecommitdiff
path: root/util/isel.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2016-08-24 05:56:37 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-08-24 05:56:37 +0200
commitdb5e8f26947114f06480dd22b9db7e22e50ee133 (patch)
treebb7418b545d295ea7cc4f5e7404d262e51082e0f /util/isel.c
parent55adddbc16f65732b57ab8585c47001fced91d77 (diff)
Imported Upstream version 3.0.0upstream/3.0.0
Diffstat (limited to 'util/isel.c')
-rw-r--r--util/isel.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/util/isel.c b/util/isel.c
index a6058e6..a2b5703 100644
--- a/util/isel.c
+++ b/util/isel.c
@@ -162,7 +162,7 @@ typedef struct
#define RDATA_OFFSET 13 //byte offset to the record event data
static char *progname = "isel";
-static char *progver = "2.99";
+static char *progver = "3.00";
#ifdef WIN32
#define IDXFILE "sel.idx"
static char idxfile[80] = IDXFILE;
@@ -651,14 +651,17 @@ int i_sel(int argc, char **argv)
char *s1;
printf("%s: version %s\n",progname,progver);
- while ((c = getopt(argc,argv,"a:b:cdef:h:l:m:np:rs:uwvx:T:V:J:EYF:P:N:U:R:Z:?")) != EOF)
+ while ((c = getopt(argc,argv,"a:b:cdef:h:i:l:m:np:rs:uwvxT:V:J:EYF:P:N:U:R:Z:?")) != EOF)
switch(c) {
case 'a': faddsel = 1; /*undocumented option, to prevent misuse*/
- addstr = optarg; /*text string, max 13 bytes*/
+ addstr = optarg; /*text string, max 13 bytes, no date*/
break;
- case 'h': faddsel = 1; /*undocumented option, to prevent misuse*/
+ case 'h': faddsel = 3; /*undocumented option, to prevent misuse*/
addhex = optarg; /*string of 16 hex characters, no spaces*/
break;
+ case 'i': faddsel = 2; /*undocumented option, to prevent misuse*/
+ addstr = optarg; /*text string, max 9 bytes, with date*/
+ break;
case 'b': fdecodebin = 1;
rawfile = optarg;
break;
@@ -805,15 +808,25 @@ int i_sel(int argc, char **argv)
/* use this sparingly, only for hardware-related events. */
char buf[16];
int i, len = 0;
- buf[0] = 0;
- buf[1] = 0;
+ memset(&buf[0],0,16);
if (addstr != NULL) { /*ASCII text string*/
+ if (faddsel == 1) { /* -a, Add a custom SEL record */
buf[2] = 0xf1; /*use SEL type OEM 0xF1*/
len = strlen_(addstr);
if (len > 13) len = 13;
if (len <= 0) ret = LAN_ERR_TOO_SHORT;
else memcpy(&buf[3],addstr,len);
len += 3;
+ }
+ if (faddsel == 2) { /* -i, Add a custom SEL record with date*/
+ buf[2] = RT_OEMIU; /*use SEL type OEM 0xDB*/
+ memset(&buf[3],0,4);
+ len = strlen_(addstr);
+ if (len > 9) len = 9;
+ if (len <= 0) ret = LAN_ERR_TOO_SHORT;
+ else memcpy(&buf[7],addstr,len);
+ len += 7;
+ }
}
if (addhex != NULL) { /*string of hex characters, no spaces*/
len = strlen_(addhex);