/*
* $Log$
+ * Revision 1.22 2008/02/28 01:47:44 james
+ * *** empty log message ***
+ *
+ * Revision 1.21 2008/02/27 16:01:24 james
+ * *** empty log message ***
+ *
* Revision 1.20 2008/02/27 10:00:34 james
* *** empty log message ***
*
#include <string.h>
#include <strings.h>
#include <malloc.h>
+#include <fcntl.h>
#include "mainloop.h"
/*Fold -r into -c */
if (oflags['r'])
{
- int id = safe_atoi (oargs['r']);
+ char *id = oargs['r'];
if (id < 0)
fatal_moan ("cannot parse -r %s as an integer", oargs['r']);
oflags['k']++;
- oargs['k'] = mome ("/.sympathy/%s%d", hostname, id);
+ if (safe_atoi(id)>0) {
+ oargs['k'] = mome ("/.sympathy/%s%d", hostname, safe_atoi(id));
+ } else {
+ oargs['k'] = mome ("/.sympathy/%s", id);
+ }
oflags['r'] = 0;
oflags['c']++;
}
}
else
{
+ /*HACK-- check that console=device does not occur in */
+ /*/proc/cmdline*/
+ if (!oargs['d'])
+ fatal_moan("no argument to -d");
+
+ {
+ char kernel_cmdline[4096]={0};
+ char search_string[1024]="console=";
+ char *ptr=oargs['d'];
+ int fd;
+
+ if (!strncmp("/dev/",ptr,5)) ptr+=5;
+
+ strcat(search_string,ptr);
+
+ fd=open("/proc/cmdline",O_RDONLY);
+ read(fd,kernel_cmdline,sizeof(kernel_cmdline));
+ close(fd);
+
+ kernel_cmdline[sizeof(kernel_cmdline)-1]=0;
+
+ if (strstr(kernel_cmdline,search_string))
+ fatal_moan("/proc/cmdline contains %s",search_string);
+ }
+
tty =
serial_open (oargs['d'],
oflags['K'] ? SERIAL_LOCK_ACTIVE :