diff options
author | jkar8572 <jkar8572> | 2002-11-21 18:37:57 +0000 |
---|---|---|
committer | jkar8572 <jkar8572> | 2002-11-21 18:37:57 +0000 |
commit | ad868a7b3e1c2cdaeddcf93b8ccf55434b0d1c21 (patch) | |
tree | e4df55fd3aa0496bee0fa3f9f1265eeae38cac2c /quotasys.c | |
parent | 9bdd6236879ea379758f82ad5cec7033f0a751ac (diff) |
Updated edquota(8) and setquota(8) to allow setting of individual grace time (Jan Kara)
Diffstat (limited to 'quotasys.c')
-rw-r--r-- | quotasys.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -285,6 +285,24 @@ void time2str(time_t seconds, char *buf, int flags) } /* + * Convert number with unit to time in seconds + */ +int str2timeunits(time_t num, char *unit, time_t *res) +{ + if (memcmp(unit, "second", 6) == 0) + *res = num; + else if (memcmp(unit, "minute", 6) == 0) + *res = num * 60; + else if (memcmp(unit, "hour", 4) == 0) + *res = num * 60 * 60; + else if (memcmp(unit, "day", 3) == 0) + *res = num * 24 * 60 * 60; + else + return -1; + return 0; +} + +/* * Convert number in quota blocks to some nice short form for printing */ void space2str(qsize_t space, char *buf, int format) |