@@ -275,18 +275,15 @@ static int lpcap_open_dead(lua_State *L)
275275
276276
277277/*-
278- -- cap = pcap.open_offline([fname])
279-
280- fname defaults to "-", stdin.
278+ -- cap = pcap.open_offline(fname)
281279
282280Open a savefile to read packets from.
283281
284- Warning, fname defaulting to stdin causes unsuspecting users to
285- think this API is hanging, when they don't actually have a pcap on stdin.
282+ An fname of "-" is a synonym for stdin.
286283*/
287284static int lpcap_open_offline (lua_State * L )
288285{
289- const char * fname = luaL_optstring (L , 1 , "-" );
286+ const char * fname = luaL_checkstring (L , 1 );
290287 pcap_t * * cap = pushpcapopen (L );
291288 char errbuf [PCAP_ERRBUF_SIZE ];
292289 * cap = pcap_open_offline (fname , errbuf );
@@ -314,17 +311,20 @@ static int lpcap_close (lua_State *L)
314311
315312
316313/*-
317- -- dumper = cap:dump_open([fname])
314+ -- dumper = cap:dump_open(fname)
315+
316+ Open a dump file to write packets to.
318317
319- fname defaults to "-", stdout.
318+ An fname of "-" is a synonym for stdout.
320319
321320Note that the dumper object is independent of the cap object, once
322- it's created (the cap object can be closed).
321+ it's created (so the cap object can be closed if its not going to
322+ be used).
323323*/
324324static int lpcap_dump_open (lua_State * L )
325325{
326326 pcap_t * cap = checkpcap (L );
327- const char * fname = luaL_optstring (L , 2 , "-" );
327+ const char * fname = luaL_checkstring (L , 2 );
328328 pcap_dumper_t * * dumper = lua_newuserdata (L , sizeof (* dumper ));
329329
330330 * dumper = NULL ;
0 commit comments