comparison src/process.c @ 74420:7f2e7cb6b161

(parse_signal): Rename macro from handle_signal. (Fsignal_process): Also accept lower-case variants of signal names (to align with signal names generated by Emacs itself).
author Kim F. Storm <storm@cua.dk>
date Mon, 04 Dec 2006 15:21:39 +0000
parents 6bc8bd6fe72c
children 7714fd14ce36 f1d13e615070
comparison
equal deleted inserted replaced
74419:9d28e2b1c05c 74420:7f2e7cb6b161
6145 if (pid <= 0) 6145 if (pid <= 0)
6146 error ("Cannot signal process %s", SDATA (XPROCESS (process)->name)); 6146 error ("Cannot signal process %s", SDATA (XPROCESS (process)->name));
6147 6147
6148 got_it: 6148 got_it:
6149 6149
6150 #define handle_signal(NAME, VALUE) \ 6150 #define parse_signal(NAME, VALUE) \
6151 else if (!strcmp (name, NAME)) \ 6151 else if (!strcasecmp (name, NAME)) \
6152 XSETINT (sigcode, VALUE) 6152 XSETINT (sigcode, VALUE)
6153 6153
6154 if (INTEGERP (sigcode)) 6154 if (INTEGERP (sigcode))
6155 ; 6155 ;
6156 else 6156 else
6158 unsigned char *name; 6158 unsigned char *name;
6159 6159
6160 CHECK_SYMBOL (sigcode); 6160 CHECK_SYMBOL (sigcode);
6161 name = SDATA (SYMBOL_NAME (sigcode)); 6161 name = SDATA (SYMBOL_NAME (sigcode));
6162 6162
6163 if (!strncmp(name, "SIG", 3)) 6163 if (!strncasecmp(name, "sig", 3))
6164 name += 3; 6164 name += 3;
6165 6165
6166 if (0) 6166 if (0)
6167 ; 6167 ;
6168 #ifdef SIGUSR1
6169 parse_signal ("usr1", SIGUSR1);
6170 #endif
6171 #ifdef SIGUSR2
6172 parse_signal ("usr2", SIGUSR2);
6173 #endif
6174 #ifdef SIGTERM
6175 parse_signal ("term", SIGTERM);
6176 #endif
6168 #ifdef SIGHUP 6177 #ifdef SIGHUP
6169 handle_signal ("HUP", SIGHUP); 6178 parse_signal ("hup", SIGHUP);
6170 #endif 6179 #endif
6171 #ifdef SIGINT 6180 #ifdef SIGINT
6172 handle_signal ("INT", SIGINT); 6181 parse_signal ("int", SIGINT);
6173 #endif 6182 #endif
6174 #ifdef SIGQUIT 6183 #ifdef SIGQUIT
6175 handle_signal ("QUIT", SIGQUIT); 6184 parse_signal ("quit", SIGQUIT);
6176 #endif 6185 #endif
6177 #ifdef SIGILL 6186 #ifdef SIGILL
6178 handle_signal ("ILL", SIGILL); 6187 parse_signal ("ill", SIGILL);
6179 #endif 6188 #endif
6180 #ifdef SIGABRT 6189 #ifdef SIGABRT
6181 handle_signal ("ABRT", SIGABRT); 6190 parse_signal ("abrt", SIGABRT);
6182 #endif 6191 #endif
6183 #ifdef SIGEMT 6192 #ifdef SIGEMT
6184 handle_signal ("EMT", SIGEMT); 6193 parse_signal ("emt", SIGEMT);
6185 #endif 6194 #endif
6186 #ifdef SIGKILL 6195 #ifdef SIGKILL
6187 handle_signal ("KILL", SIGKILL); 6196 parse_signal ("kill", SIGKILL);
6188 #endif 6197 #endif
6189 #ifdef SIGFPE 6198 #ifdef SIGFPE
6190 handle_signal ("FPE", SIGFPE); 6199 parse_signal ("fpe", SIGFPE);
6191 #endif 6200 #endif
6192 #ifdef SIGBUS 6201 #ifdef SIGBUS
6193 handle_signal ("BUS", SIGBUS); 6202 parse_signal ("bus", SIGBUS);
6194 #endif 6203 #endif
6195 #ifdef SIGSEGV 6204 #ifdef SIGSEGV
6196 handle_signal ("SEGV", SIGSEGV); 6205 parse_signal ("segv", SIGSEGV);
6197 #endif 6206 #endif
6198 #ifdef SIGSYS 6207 #ifdef SIGSYS
6199 handle_signal ("SYS", SIGSYS); 6208 parse_signal ("sys", SIGSYS);
6200 #endif 6209 #endif
6201 #ifdef SIGPIPE 6210 #ifdef SIGPIPE
6202 handle_signal ("PIPE", SIGPIPE); 6211 parse_signal ("pipe", SIGPIPE);
6203 #endif 6212 #endif
6204 #ifdef SIGALRM 6213 #ifdef SIGALRM
6205 handle_signal ("ALRM", SIGALRM); 6214 parse_signal ("alrm", SIGALRM);
6206 #endif
6207 #ifdef SIGTERM
6208 handle_signal ("TERM", SIGTERM);
6209 #endif 6215 #endif
6210 #ifdef SIGURG 6216 #ifdef SIGURG
6211 handle_signal ("URG", SIGURG); 6217 parse_signal ("urg", SIGURG);
6212 #endif 6218 #endif
6213 #ifdef SIGSTOP 6219 #ifdef SIGSTOP
6214 handle_signal ("STOP", SIGSTOP); 6220 parse_signal ("stop", SIGSTOP);
6215 #endif 6221 #endif
6216 #ifdef SIGTSTP 6222 #ifdef SIGTSTP
6217 handle_signal ("TSTP", SIGTSTP); 6223 parse_signal ("tstp", SIGTSTP);
6218 #endif 6224 #endif
6219 #ifdef SIGCONT 6225 #ifdef SIGCONT
6220 handle_signal ("CONT", SIGCONT); 6226 parse_signal ("cont", SIGCONT);
6221 #endif 6227 #endif
6222 #ifdef SIGCHLD 6228 #ifdef SIGCHLD
6223 handle_signal ("CHLD", SIGCHLD); 6229 parse_signal ("chld", SIGCHLD);
6224 #endif 6230 #endif
6225 #ifdef SIGTTIN 6231 #ifdef SIGTTIN
6226 handle_signal ("TTIN", SIGTTIN); 6232 parse_signal ("ttin", SIGTTIN);
6227 #endif 6233 #endif
6228 #ifdef SIGTTOU 6234 #ifdef SIGTTOU
6229 handle_signal ("TTOU", SIGTTOU); 6235 parse_signal ("ttou", SIGTTOU);
6230 #endif 6236 #endif
6231 #ifdef SIGIO 6237 #ifdef SIGIO
6232 handle_signal ("IO", SIGIO); 6238 parse_signal ("io", SIGIO);
6233 #endif 6239 #endif
6234 #ifdef SIGXCPU 6240 #ifdef SIGXCPU
6235 handle_signal ("XCPU", SIGXCPU); 6241 parse_signal ("xcpu", SIGXCPU);
6236 #endif 6242 #endif
6237 #ifdef SIGXFSZ 6243 #ifdef SIGXFSZ
6238 handle_signal ("XFSZ", SIGXFSZ); 6244 parse_signal ("xfsz", SIGXFSZ);
6239 #endif 6245 #endif
6240 #ifdef SIGVTALRM 6246 #ifdef SIGVTALRM
6241 handle_signal ("VTALRM", SIGVTALRM); 6247 parse_signal ("vtalrm", SIGVTALRM);
6242 #endif 6248 #endif
6243 #ifdef SIGPROF 6249 #ifdef SIGPROF
6244 handle_signal ("PROF", SIGPROF); 6250 parse_signal ("prof", SIGPROF);
6245 #endif 6251 #endif
6246 #ifdef SIGWINCH 6252 #ifdef SIGWINCH
6247 handle_signal ("WINCH", SIGWINCH); 6253 parse_signal ("winch", SIGWINCH);
6248 #endif 6254 #endif
6249 #ifdef SIGINFO 6255 #ifdef SIGINFO
6250 handle_signal ("INFO", SIGINFO); 6256 parse_signal ("info", SIGINFO);
6251 #endif
6252 #ifdef SIGUSR1
6253 handle_signal ("USR1", SIGUSR1);
6254 #endif
6255 #ifdef SIGUSR2
6256 handle_signal ("USR2", SIGUSR2);
6257 #endif 6257 #endif
6258 else 6258 else
6259 error ("Undefined signal name %s", name); 6259 error ("Undefined signal name %s", name);
6260 } 6260 }
6261 6261
6262 #undef handle_signal 6262 #undef parse_signal
6263 6263
6264 return make_number (kill (pid, XINT (sigcode))); 6264 return make_number (kill (pid, XINT (sigcode)));
6265 } 6265 }
6266 6266
6267 DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0, 6267 DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0,