vos: complain if no fields are passed
[openafs.git] / src / volser / vos.c
index 429fbce..4e1a743 100644 (file)
@@ -74,6 +74,7 @@ struct tqHead {
 
 #define COMMONPARMS     cmd_Seek(ts, 12);\
 cmd_AddParm(ts, "-cell", CMD_SINGLE, CMD_OPTIONAL, "cell name");\
+cmd_AddParmAlias(ts, 12, "-c");   /* original -cell option */ \
 cmd_AddParm(ts, "-noauth", CMD_FLAG, CMD_OPTIONAL, "don't authenticate");\
 cmd_AddParm(ts, "-localauth",CMD_FLAG,CMD_OPTIONAL,"use server tickets");\
 cmd_AddParm(ts, "-verbose", CMD_FLAG, CMD_OPTIONAL, "verbose");\
@@ -1713,6 +1714,7 @@ SetFields(struct cmd_syndesc *as, void *arock)
     afs_uint32 aserver;
     afs_int32 apart;
     int previdx = -1;
+    int have_field = 0;
 
     volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err);  /* -id */
     if (volid == 0) {
@@ -1746,6 +1748,7 @@ SetFields(struct cmd_syndesc *as, void *arock)
 
     if (as->parms[1].items) {
        /* -max <quota> */
+       have_field = 1;
        code = util_GetHumanInt32(as->parms[1].items->data, &info.maxquota);
        if (code) {
            fprintf(STDERR, "invalid quota value\n");
@@ -1754,12 +1757,18 @@ SetFields(struct cmd_syndesc *as, void *arock)
     }
     if (as->parms[2].items) {
        /* -clearuse */
+       have_field = 1;
        info.dayUse = 0;
     }
     if (as->parms[3].items) {
        /* -clearVolUpCounter */
+       have_field = 1;
        info.spare2 = 0;
     }
+    if (!have_field) {
+       fprintf(STDERR,"Nothing to set.\n");
+       return (1);
+    }
     code = UV_SetVolumeInfo(aserver, apart, volid, &info);
     if (code)
        fprintf(STDERR,
@@ -4476,7 +4485,6 @@ static int
 ListVLDB(struct cmd_syndesc *as, void *arock)
 {
     afs_int32 apart;
-    afs_uint32 aserver;
     afs_int32 code;
     afs_int32 vcode;
     struct VldbListByAttributes attributes;
@@ -4490,7 +4498,6 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
     int quiet, sort, lock;
     afs_int32 thisindex, nextindex;
 
-    aserver = 0;
     apart = 0;
 
     attributes.Mask = 0;
@@ -4517,6 +4524,8 @@ ListVLDB(struct cmd_syndesc *as, void *arock)
 
     /* Server specified */
     if (as->parms[1].items) {
+       afs_uint32 aserver;
+
        aserver = GetServer(as->parms[1].items->data);
        if (aserver == 0) {
            fprintf(STDERR, "vos: server '%s' not found in host table\n",
@@ -6168,6 +6177,7 @@ main(int argc, char **argv)
                "machine readable format");
     COMMONPARMS;
     cmd_CreateAlias(ts, "volinfo");
+    cmd_CreateAlias(ts, "e");
 
     ts = cmd_CreateSyntax("setfields", SetFields, NULL,
                          "change volume info fields");