Dump9660 (and mk9660). Until we either do something
intelligent with symlinks or put in a switch for things like dump9660, this is of rather limited utility under Unix.
This commit is contained in:
parent
e1dddc0532
commit
7285a491c1
20 changed files with 4375 additions and 0 deletions
41
src/cmd/9660/uid.c
Normal file
41
src/cmd/9660/uid.c
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include <u.h>
|
||||
#include <libc.h>
|
||||
|
||||
/*
|
||||
* /adm/users is
|
||||
* id:user/group:head member:other members
|
||||
*
|
||||
* /etc/{passwd,group}
|
||||
* name:x:nn:other stuff
|
||||
*/
|
||||
|
||||
static int isnumber(char *s);
|
||||
|
||||
sniff(Biobuf *b)
|
||||
{
|
||||
read first line of file into p;
|
||||
|
||||
nf = getfields(p, f, nelem(f), ":");
|
||||
if(nf < 4)
|
||||
return nil;
|
||||
|
||||
if(isnumber(f[0]) && !isnumber(f[2]))
|
||||
return _plan9;
|
||||
|
||||
if(!isnumber(f[0]) && isnumber(f[2]))
|
||||
return _unix;
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
isnumber(char *s)
|
||||
{
|
||||
char *q;
|
||||
|
||||
strtol(s, &q, 10);
|
||||
return *q == '\0';
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
Loading…
Add table
Add a link
Reference in a new issue